@@ -11,7 +11,7 @@ def configure(conf):
11
11
conf .start_msg ('Checking C++ compiler version' )
12
12
13
13
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 )
15
15
ccverstr = '.' .join (conf .env .CC_VERSION )
16
16
errmsg = ''
17
17
warnmsg = ''
@@ -60,6 +60,10 @@ def configure(conf):
60
60
conf .env .DEFINES += generalFlags ['DEFINES' ]
61
61
62
62
63
+ def get_compiler_ver (conf ):
64
+ return tuple (int (i ) for i in conf .env .CC_VERSION )
65
+
66
+
63
67
@Configure .conf
64
68
def check_compiler_flags (conf ):
65
69
# Debug or optimized CXXFLAGS and LINKFLAGS are applied only if the
@@ -124,9 +128,6 @@ def add_supported_linkflags(self, linkflags):
124
128
125
129
126
130
class CompilerFlags :
127
- def getCompilerVersion (self , conf ):
128
- return tuple (int (i ) for i in conf .env .CC_VERSION )
129
-
130
131
def getGeneralFlags (self , conf ):
131
132
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are always needed"""
132
133
return {'CXXFLAGS' : [], 'LINKFLAGS' : [], 'DEFINES' : []}
@@ -227,7 +228,7 @@ def getGeneralFlags(self, conf):
227
228
elif Utils .unversioned_sys_platform () == 'freebsd' :
228
229
# Bug #4790
229
230
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 ):
231
232
# Bug #5300
232
233
flags ['CXXFLAGS' ] += ['-Wno-enum-constexpr-conversion' ]
233
234
return flags
@@ -241,10 +242,10 @@ def getDebugFlags(self, conf):
241
242
flags = super ().getDebugFlags (conf )
242
243
flags ['CXXFLAGS' ] += self .__cxxFlags
243
244
# Enable assertions in libc++
244
- if self . getCompilerVersion (conf ) >= (18 , 0 , 0 ):
245
+ if get_compiler_ver (conf ) >= (18 , 0 , 0 ):
245
246
# https://libcxx.llvm.org/Hardening.html
246
247
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 ):
248
249
# https://releases.llvm.org/15.0.0/projects/libcxx/docs/UsingLibcxx.html#enabling-the-safe-libc-mode
249
250
flags ['DEFINES' ] += ['_LIBCPP_ENABLE_ASSERTIONS=1' ]
250
251
# Tell libc++ to avoid including transitive headers
0 commit comments