@@ -11,7 +11,7 @@ def configure(conf):
1111 conf .start_msg ('Checking C++ compiler version' )
1212
1313 cxx = conf .env .CXX_NAME # generic name of the compiler
14- ccver = tuple ( int ( i ) for i in conf . env . CC_VERSION )
14+ ccver = get_compiler_ver ( conf )
1515 ccverstr = '.' .join (conf .env .CC_VERSION )
1616 errmsg = ''
1717 warnmsg = ''
@@ -60,6 +60,10 @@ def configure(conf):
6060 conf .env .DEFINES += generalFlags ['DEFINES' ]
6161
6262
63+ def get_compiler_ver (conf ):
64+ return tuple (int (i ) for i in conf .env .CC_VERSION )
65+
66+
6367@Configure .conf
6468def check_compiler_flags (conf ):
6569 # Debug or optimized CXXFLAGS and LINKFLAGS are applied only if the
@@ -124,9 +128,6 @@ def add_supported_linkflags(self, linkflags):
124128
125129
126130class CompilerFlags :
127- def getCompilerVersion (self , conf ):
128- return tuple (int (i ) for i in conf .env .CC_VERSION )
129-
130131 def getGeneralFlags (self , conf ):
131132 """Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are always needed"""
132133 return {'CXXFLAGS' : [], 'LINKFLAGS' : [], 'DEFINES' : []}
@@ -227,7 +228,7 @@ def getGeneralFlags(self, conf):
227228 elif Utils .unversioned_sys_platform () == 'freebsd' :
228229 # Bug #4790
229230 flags ['CXXFLAGS' ] += [['-isystem' , '/usr/local/include' ]]
230- if self . getCompilerVersion (conf ) >= (18 , 0 , 0 ):
231+ if get_compiler_ver (conf ) >= (18 , 0 , 0 ) and get_compiler_ver ( conf ) < ( 20 , 1 , 0 ):
231232 # Bug #5300
232233 flags ['CXXFLAGS' ] += ['-Wno-enum-constexpr-conversion' ]
233234 return flags
@@ -241,10 +242,10 @@ def getDebugFlags(self, conf):
241242 flags = super ().getDebugFlags (conf )
242243 flags ['CXXFLAGS' ] += self .__cxxFlags
243244 # Enable assertions in libc++
244- if self . getCompilerVersion (conf ) >= (18 , 0 , 0 ):
245+ if get_compiler_ver (conf ) >= (18 , 0 , 0 ):
245246 # https://libcxx.llvm.org/Hardening.html
246247 flags ['DEFINES' ] += ['_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE' ]
247- elif self . getCompilerVersion (conf ) >= (15 , 0 , 0 ):
248+ elif get_compiler_ver (conf ) >= (15 , 0 , 0 ):
248249 # https://releases.llvm.org/15.0.0/projects/libcxx/docs/UsingLibcxx.html#enabling-the-safe-libc-mode
249250 flags ['DEFINES' ] += ['_LIBCPP_ENABLE_ASSERTIONS=1' ]
250251 # Tell libc++ to avoid including transitive headers
0 commit comments