scons: Use conf to determine if some flags are supported.

Use conf rather than checking for particular combinations of OS and/or
compiler versions. This *should* be just as correct, and not require
keeping track of what versions of the tools particular flags were added.

Change-Id: Icaa4c273fe89801e2808e6a814ce476700fd6956
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40861
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
This commit is contained in:
Gabe Black
2021-02-07 01:48:20 -08:00
parent 1828a6e7e3
commit 79d53c83e6

View File

@@ -323,10 +323,7 @@ if main['GCC'] or main['CLANG']:
main.Append(CCFLAGS=['-I/usr/local/include'])
main.Append(CXXFLAGS=['-I/usr/local/include'])
# On Mac OS X/Darwin the default linker doesn't support the
# option --as-needed
if sys.platform != "darwin":
main.Append(LINKFLAGS='-Wl,--as-needed')
conf.CheckLinkFlag('-Wl,--as-needed')
if GetOption('gold_linker'):
main.Append(LINKFLAGS='-fuse-ld=gold')
@@ -397,12 +394,8 @@ elif main['CLANG']:
# interchangeably.
'-Wno-mismatched-tags',
])
if sys.platform != "darwin" and \
compareVersions(clang_version, "10.0") >= 0:
main.Append(CCFLAGS=['-Wno-c99-designator'])
if compareVersions(clang_version, "8.0") >= 0:
main.Append(CCFLAGS=['-Wno-defaulted-function-deleted'])
conf.CheckCxxFlag('-Wno-c99-designator')
conf.CheckCxxFlag('-Wno-defaulted-function-deleted')
main.Append(TCMALLOC_CCFLAGS=['-fno-builtin'])