scons: Bump the compiler version to gcc 4.6 and clang 3.0

This patch bumps the supported version of gcc from 4.4 to 4.6, and
clang from 2.9 to 3.0. This enables, amongst other things, range-based
for loops, lambda expressions, etc. The STL implementation shipping
with 4.6 also has a full functional implementation of unique_ptr and
shared_ptr.
This commit is contained in:
Andreas Hansson 2014-06-10 17:44:39 -04:00
parent 4a98b0cd59
commit fdb965f5c1
2 changed files with 25 additions and 33 deletions

View file

@ -568,24 +568,18 @@ else:
Exit(1)
if main['GCC']:
# Check for a supported version of gcc, >= 4.4 is needed for c++0x
# support. See http://gcc.gnu.org/projects/cxx0x.html for details
# Check for a supported version of gcc. >= 4.6 is chosen for its
# level of c++11 support. See
# http://gcc.gnu.org/projects/cxx0x.html for details. 4.6 is also
# the first version with proper LTO support.
gcc_version = readCommand([main['CXX'], '-dumpversion'], exception=False)
if compareVersions(gcc_version, "4.4") < 0:
print 'Error: gcc version 4.4 or newer required.'
if compareVersions(gcc_version, "4.6") < 0:
print 'Error: gcc version 4.6 or newer required.'
print ' Installed version:', gcc_version
Exit(1)
main['GCC_VERSION'] = gcc_version
# Check for versions with bugs
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.'
main.Append(CCFLAGS=['-fno-tree-vectorize'])
# LTO support is only really working properly from 4.6 and beyond
if compareVersions(gcc_version, '4.6') >= 0:
# Add the appropriate Link-Time Optimization (LTO) flags
# unless LTO is explicitly turned off. Note that these flags
# are only used by the fast target.
@ -605,15 +599,15 @@ if main['GCC']:
'-fno-builtin-realloc', '-fno-builtin-free'])
elif main['CLANG']:
# Check for a supported version of clang, >= 2.9 is needed to
# support similar features as gcc 4.4. See
# Check for a supported version of clang, >= 3.0 is needed to
# support similar features as gcc 4.6. See
# http://clang.llvm.org/cxx_status.html for details
clang_version_re = re.compile(".* version (\d+\.\d+)")
clang_version_match = clang_version_re.search(CXX_version)
if (clang_version_match):
clang_version = clang_version_match.groups()[0]
if compareVersions(clang_version, "2.9") < 0:
print 'Error: clang version 2.9 or newer required.'
if compareVersions(clang_version, "3.0") < 0:
print 'Error: clang version 3.0 or newer required.'
print ' Installed version:', clang_version
Exit(1)
else:

View file

@ -925,10 +925,8 @@ def makeEnv(env, label, objsfx, strip = False, **kwargs):
# warnings about uninitialized variables and missing field
# initializers.
swig_env.Append(CCFLAGS=['-Wno-uninitialized',
'-Wno-missing-field-initializers'])
if compareVersions(env['GCC_VERSION'], '4.6') >= 0:
swig_env.Append(CCFLAGS='-Wno-unused-but-set-variable')
'-Wno-missing-field-initializers',
'-Wno-unused-but-set-variable'])
# If gcc supports it, also warn for deletion of derived
# classes with non-virtual desctructors. For gcc >= 4.7 we