summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/python/m5/SimObject.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py
index a2de7a086..9c6a32f41 100644
--- a/src/python/m5/SimObject.py
+++ b/src/python/m5/SimObject.py
@@ -408,6 +408,19 @@ class MetaSimObject(type):
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()