@@ -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' : []}
@@ -226,7 +227,7 @@ def getGeneralFlags(self, conf):
226227 elif Utils .unversioned_sys_platform () == 'freebsd' :
227228 # Bug #4790
228229 flags ['CXXFLAGS' ] += [['-isystem' , '/usr/local/include' ]]
229- if self . getCompilerVersion (conf ) >= (18 , 0 , 0 ):
230+ if get_compiler_ver (conf ) >= (18 , 0 , 0 ) and get_compiler_ver ( conf ) < ( 20 , 1 , 0 ):
230231 # Bug #5300
231232 flags ['CXXFLAGS' ] += ['-Wno-enum-constexpr-conversion' ]
232233 return flags
@@ -240,10 +241,10 @@ def getDebugFlags(self, conf):
240241 flags = super ().getDebugFlags (conf )
241242 flags ['CXXFLAGS' ] += self .__cxxFlags
242243 # Enable assertions in libc++
243- if self . getCompilerVersion (conf ) >= (18 , 0 , 0 ):
244+ if get_compiler_ver (conf ) >= (18 , 0 , 0 ):
244245 # https://libcxx.llvm.org/Hardening.html
245246 flags ['DEFINES' ] += ['_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE' ]
246- elif self . getCompilerVersion (conf ) >= (15 , 0 , 0 ):
247+ elif get_compiler_ver (conf ) >= (15 , 0 , 0 ):
247248 # https://releases.llvm.org/15.0.0/projects/libcxx/docs/UsingLibcxx.html#enabling-the-safe-libc-mode
248249 flags ['DEFINES' ] += ['_LIBCPP_ENABLE_ASSERTIONS=1' ]
249250 # Tell libc++ to avoid including transitive headers
0 commit comments