GCC: Guard some gcc flags so they're used when available and needed.
authorGabe Black <gblack@eecs.umich.edu>
Thu, 10 Nov 2011 05:48:28 +0000 (21:48 -0800)
committerGabe Black <gblack@eecs.umich.edu>
Thu, 10 Nov 2011 05:48:28 +0000 (21:48 -0800)
SConstruct
src/SConscript

index 06e1c3f16392598617dd4c87b7ab622c800e9ff8..89761a4f19bc1f2da608172655a78ec02bc07170 100755 (executable)
@@ -487,6 +487,7 @@ if main['GCC']:
     # Note CCVERSION doesn't work here because it is run with the CC
     # before we override it from the command line
     gcc_version = readCommand([main['CXX'], '-dumpversion'], exception=False)
+    main['GCC_VERSION'] = gcc_version
     if not compareVersions(gcc_version, '4.4.1') or \
        not compareVersions(gcc_version, '4.4.2'):
         print 'Info: Tree vectorizer in GCC 4.4.1 & 4.4.2 is buggy, disabling.'
index 391a832bab3798d5fa5cc4871ca6d6b2ad73a827..0a4bb57f499303867e9937b55a7795538fc5c6d8 100755 (executable)
@@ -51,7 +51,7 @@ Export('env')
 
 build_env = [(opt, env[opt]) for opt in export_vars]
 
-from m5.util import code_formatter
+from m5.util import code_formatter, compareVersions
 
 ########################################################################
 # Code for adding source files of various types
@@ -851,8 +851,9 @@ 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')
-        swig_env.Append(CCFLAGS='-Wno-unused-but-set-variable')
+        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()
     werror_env.Append(CCFLAGS='-Werror')