diff options
author | Andreas Hansson <andreas.hansson@arm.com> | 2013-02-19 05:56:07 -0500 |
---|---|---|
committer | Andreas Hansson <andreas.hansson@arm.com> | 2013-02-19 05:56:07 -0500 |
commit | 08a5fd328b25d2ff431dc8f593c2d1bf3816b36e (patch) | |
tree | 085f00bcddb25887b90c68ed41fcd87dc01f91a6 /src | |
parent | 5eddb6387765240730bfb1c57f481133d3a3c737 (diff) | |
download | gem5-08a5fd328b25d2ff431dc8f593c2d1bf3816b36e.tar.xz |
scons: Unify the flags shared by gcc and clang
This patch restructures and unifies the flags used by gcc and clang as
they are largely the same. The common parts are now dealt with in a
shared block of code, and the few bits and pieces that are
specifically affecting either gcc or clang are done separately.
Diffstat (limited to 'src')
-rwxr-xr-x | src/SConscript | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/src/SConscript b/src/SConscript index 465bae70e..8dccd0900 100755 --- a/src/SConscript +++ b/src/SConscript @@ -893,25 +893,34 @@ def makeEnv(label, objsfx, strip = False, **kwargs): swig_env = new_env.Clone() swig_env.Append(CCFLAGS='-Werror') + + # Both gcc and clang have issues with unused labels and values in + # the SWIG generated code + swig_env.Append(CCFLAGS=['-Wno-unused-label', '-Wno-unused-value']) + + # Add additional warnings here that should not be applied to + # the SWIG generated code + new_env.Append(CXXFLAGS='-Wmissing-declarations') + if env['GCC']: - swig_env.Append(CCFLAGS=['-Wno-uninitialized', '-Wno-sign-compare', - '-Wno-parentheses', '-Wno-unused-label', - '-Wno-unused-value']) + # Depending on the SWIG version, we also need to supress + # warnings about missing field initializers. + swig_env.Append(CCFLAGS='-Wno-missing-field-initializers') + if compareVersions(env['GCC_VERSION'], '4.6') >= 0: swig_env.Append(CCFLAGS='-Wno-unused-but-set-variable') - # Add additional warnings here that should not be applied to - # the SWIG generated code - new_env.Append(CXXFLAGS='-Wmissing-declarations') + # If gcc supports it, also warn for deletion of derived + # classes with non-virtual desctructors. For gcc >= 4.7 we + # also have to disable warnings about the SWIG code having + # potentially uninitialized variables. if compareVersions(env['GCC_VERSION'], '4.7') >= 0: new_env.Append(CXXFLAGS='-Wdelete-non-virtual-dtor') + swig_env.Append(CCFLAGS='-Wno-maybe-uninitialized') if env['CLANG']: - swig_env.Append(CCFLAGS=['-Wno-unused-label', '-Wno-unused-value']) - - # Add additional warnings here that should not be applied to - # the SWIG generated code - new_env.Append(CXXFLAGS=['-Wmissing-declarations', - '-Wdelete-non-virtual-dtor']) + # Always enable the warning for deletion of derived classes + # with non-virtual destructors + new_env.Append(CXXFLAGS=['-Wdelete-non-virtual-dtor']) werror_env = new_env.Clone() werror_env.Append(CCFLAGS='-Werror') |