changeset ccd525e43682 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=ccd525e43682
description:
        SWIG: Ensure ptrdiff_t is a known type in gcc >= 4.6.1

        This patch fixes a compilation error that occurs with gcc >= 4.6.1,
        caused by swig not including cstddef and not using the std:: namespace
        prefix for ptrdiff_t. There is an old patch,
        http://reviews.m5sim.org/r/913/ that no longer applies cleanly and
        this might be re-iterating the same issue.

        We work around the problem by always enforcing the inclusion of
        cstddef in all swig interface declarations, and also by explicitly
        using std::ptrdiff_t.

diffstat:

 src/python/m5/SimObject.py |  13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diffs (23 lines):

diff -r c69a4493a430 -r ccd525e43682 src/python/m5/SimObject.py
--- a/src/python/m5/SimObject.py        Wed Feb 29 01:51:39 2012 -0500
+++ b/src/python/m5/SimObject.py        Wed Feb 29 04:26:58 2012 -0500
@@ -408,6 +408,19 @@
         for param in params:
             param.cxx_predecls(code)
         cls.export_method_cxx_predecls(code)
+        code('''\
+/**
+  * This is a workaround for bug in swig. Prior to gcc 4.6.1 the STL
+  * headers like vector, string, etc. used to automatically pull in
+  * the cstddef header but starting with gcc 4.6.1 they no longer do.
+  * This leads to swig generated a file that does not compile so we
+  * explicitly include cstddef. Additionally, including version 2.0.4,
+  * swig uses ptrdiff_t without the std:: namespace prefix which is
+  * required with gcc 4.6.1. We explicitly provide access to it.
+  */
+#include <cstddef>
+using std::ptrdiff_t;
+''')
         code('%}')
         code()
 
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to