SWIG: Make gem5 compile and link with swig 2.0.4
authorAndreas Hansson <andreas.hansson@arm.com>
Tue, 10 Jan 2012 00:08:20 +0000 (18:08 -0600)
committerAndreas Hansson <andreas.hansson@arm.com>
Tue, 10 Jan 2012 00:08:20 +0000 (18:08 -0600)
To make gem5 compile and run with swig 2.0.4 a few minor fixes are
necessary, the fail label issues by swig must not be treated as an
error by gcc (tested with gcc 4.2.1), and the vector wrappers must
have SWIGPY_SLICE_ARG defined which happens in pycontainer.swg,
included through std_container.i. By adding the aforementioned include
to the vector wrappers everything seems to work.

src/SConscript
src/python/m5/params.py

index 0a4bb57f499303867e9937b55a7795538fc5c6d8..7fb03e821c5158f0c6ad06f75695750c279ab2a6 100755 (executable)
@@ -851,8 +851,8 @@ def makeEnv(label, objsfx, strip = False, **kwargs):
         swig_env.Append(CCFLAGS='-Wno-uninitialized')
         swig_env.Append(CCFLAGS='-Wno-sign-compare')
         swig_env.Append(CCFLAGS='-Wno-parentheses')
+        swig_env.Append(CCFLAGS='-Wno-unused-label')
         if compareVersions(env['GCC_VERSION'], '4.6.0') != -1:
-            swig_env.Append(CCFLAGS='-Wno-unused-label')
             swig_env.Append(CCFLAGS='-Wno-unused-but-set-variable')
 
     werror_env = new_env.Clone()
index ee3678dc9b7c8b31b0a38ab529941c162fb3f6f9..03917d08525072102cb9286e81ed57f1de4568e8 100644 (file)
@@ -256,6 +256,9 @@ class VectorParamDesc(ParamDesc):
         self.ptype.cxx_predecls(code)
         code('%}')
         code()
+        # Make sure the SWIGPY_SLICE_ARG is defined through this inclusion
+        code('%include "std_container.i"')
+        code()
         self.ptype.swig_predecls(code)
         code()
         code('%include "std_vector.i"')