scons: Bump compiler requirement to gcc >= 4.7 and clang >= 3.1
This patch updates the compiler minimum requirement to gcc 4.7 and clang 3.1, thus allowing: 1. Explicit virtual overrides (no need for M5_ATTR_OVERRIDE) 2. Non-static data member initializers 3. Template aliases 4. Delegating constructors This patch also enables a transition from --std=c++0x to --std=c++11.
This commit is contained in:
parent
57971248f6
commit
c466d55a26
2 changed files with 14 additions and 26 deletions
22
SConstruct
22
SConstruct
|
@ -556,9 +556,8 @@ if main['GCC'] or main['CLANG']:
|
||||||
# Enable -Wall and then disable the few warnings that we
|
# Enable -Wall and then disable the few warnings that we
|
||||||
# consistently violate
|
# consistently violate
|
||||||
main.Append(CCFLAGS=['-Wall', '-Wno-sign-compare', '-Wundef'])
|
main.Append(CCFLAGS=['-Wall', '-Wno-sign-compare', '-Wundef'])
|
||||||
# We always compile using C++11, but only gcc >= 4.7 and clang 3.1
|
# We always compile using C++11
|
||||||
# actually use that name, so we stick with c++0x
|
main.Append(CXXFLAGS=['-std=c++11'])
|
||||||
main.Append(CXXFLAGS=['-std=c++0x'])
|
|
||||||
# Add selected sanity checks from -Wextra
|
# Add selected sanity checks from -Wextra
|
||||||
main.Append(CXXFLAGS=['-Wmissing-field-initializers',
|
main.Append(CXXFLAGS=['-Wmissing-field-initializers',
|
||||||
'-Woverloaded-virtual'])
|
'-Woverloaded-virtual'])
|
||||||
|
@ -582,13 +581,12 @@ else:
|
||||||
Exit(1)
|
Exit(1)
|
||||||
|
|
||||||
if main['GCC']:
|
if main['GCC']:
|
||||||
# Check for a supported version of gcc. >= 4.6 is chosen for its
|
# Check for a supported version of gcc. >= 4.7 is chosen for its
|
||||||
# level of c++11 support. See
|
# level of c++11 support. See
|
||||||
# http://gcc.gnu.org/projects/cxx0x.html for details. 4.6 is also
|
# http://gcc.gnu.org/projects/cxx0x.html for details.
|
||||||
# the first version with proper LTO support.
|
|
||||||
gcc_version = readCommand([main['CXX'], '-dumpversion'], exception=False)
|
gcc_version = readCommand([main['CXX'], '-dumpversion'], exception=False)
|
||||||
if compareVersions(gcc_version, "4.6") < 0:
|
if compareVersions(gcc_version, "4.7") < 0:
|
||||||
print 'Error: gcc version 4.6 or newer required.'
|
print 'Error: gcc version 4.7 or newer required.'
|
||||||
print ' Installed version:', gcc_version
|
print ' Installed version:', gcc_version
|
||||||
Exit(1)
|
Exit(1)
|
||||||
|
|
||||||
|
@ -642,15 +640,15 @@ if main['GCC']:
|
||||||
'-fno-builtin-realloc', '-fno-builtin-free'])
|
'-fno-builtin-realloc', '-fno-builtin-free'])
|
||||||
|
|
||||||
elif main['CLANG']:
|
elif main['CLANG']:
|
||||||
# Check for a supported version of clang, >= 3.0 is needed to
|
# Check for a supported version of clang, >= 3.1 is needed to
|
||||||
# support similar features as gcc 4.6. See
|
# support similar features as gcc 4.7. See
|
||||||
# http://clang.llvm.org/cxx_status.html for details
|
# http://clang.llvm.org/cxx_status.html for details
|
||||||
clang_version_re = re.compile(".* version (\d+\.\d+)")
|
clang_version_re = re.compile(".* version (\d+\.\d+)")
|
||||||
clang_version_match = clang_version_re.search(CXX_version)
|
clang_version_match = clang_version_re.search(CXX_version)
|
||||||
if (clang_version_match):
|
if (clang_version_match):
|
||||||
clang_version = clang_version_match.groups()[0]
|
clang_version = clang_version_match.groups()[0]
|
||||||
if compareVersions(clang_version, "3.0") < 0:
|
if compareVersions(clang_version, "3.1") < 0:
|
||||||
print 'Error: clang version 3.0 or newer required.'
|
print 'Error: clang version 3.1 or newer required.'
|
||||||
print ' Installed version:', clang_version
|
print ' Installed version:', clang_version
|
||||||
Exit(1)
|
Exit(1)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1015,7 +1015,8 @@ def makeEnv(env, label, objsfx, strip = False, **kwargs):
|
||||||
|
|
||||||
# Add additional warnings here that should not be applied to
|
# Add additional warnings here that should not be applied to
|
||||||
# the SWIG generated code
|
# the SWIG generated code
|
||||||
new_env.Append(CXXFLAGS='-Wmissing-declarations')
|
new_env.Append(CXXFLAGS=['-Wmissing-declarations',
|
||||||
|
'-Wdelete-non-virtual-dtor'])
|
||||||
|
|
||||||
if env['GCC']:
|
if env['GCC']:
|
||||||
# Depending on the SWIG version, we also need to supress
|
# Depending on the SWIG version, we also need to supress
|
||||||
|
@ -1023,15 +1024,8 @@ def makeEnv(env, label, objsfx, strip = False, **kwargs):
|
||||||
# initializers.
|
# initializers.
|
||||||
swig_env.Append(CCFLAGS=['-Wno-uninitialized',
|
swig_env.Append(CCFLAGS=['-Wno-uninitialized',
|
||||||
'-Wno-missing-field-initializers',
|
'-Wno-missing-field-initializers',
|
||||||
'-Wno-unused-but-set-variable'])
|
'-Wno-unused-but-set-variable',
|
||||||
|
'-Wno-maybe-uninitialized'])
|
||||||
# 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')
|
|
||||||
|
|
||||||
# Only gcc >= 4.9 supports UBSan, so check both the version
|
# Only gcc >= 4.9 supports UBSan, so check both the version
|
||||||
# and the command-line option before adding the compiler and
|
# and the command-line option before adding the compiler and
|
||||||
|
@ -1042,10 +1036,6 @@ def makeEnv(env, label, objsfx, strip = False, **kwargs):
|
||||||
new_env.Append(LINKFLAGS='-fsanitize=undefined')
|
new_env.Append(LINKFLAGS='-fsanitize=undefined')
|
||||||
|
|
||||||
if env['CLANG']:
|
if env['CLANG']:
|
||||||
# Always enable the warning for deletion of derived classes
|
|
||||||
# with non-virtual destructors
|
|
||||||
new_env.Append(CXXFLAGS=['-Wdelete-non-virtual-dtor'])
|
|
||||||
|
|
||||||
swig_env.Append(CCFLAGS=[
|
swig_env.Append(CCFLAGS=[
|
||||||
# Some versions of SWIG can return uninitialized values
|
# Some versions of SWIG can return uninitialized values
|
||||||
'-Wno-sometimes-uninitialized',
|
'-Wno-sometimes-uninitialized',
|
||||||
|
|
Loading…
Reference in a new issue