From: Gabe Black Date: Sun, 7 Feb 2021 09:48:20 +0000 (-0800) Subject: scons: Use conf to determine if some flags are supported. X-Git-Tag: develop-gem5-snapshot~88 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=79d53c83e6022dc1f1bb67d237165e26f91f52bb;p=gem5.git 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 Maintainer: Gabe Black Reviewed-by: Andreas Sandberg --- diff --git a/SConstruct b/SConstruct index d64842425..214aa4834 100755 --- a/SConstruct +++ b/SConstruct @@ -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'])