@@ -136,7 +136,7 @@ def getGeneralFlags(self, conf):
136
136
137
137
def getDebugFlags (self , conf ):
138
138
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in debug mode"""
139
- return {'CXXFLAGS' : [], 'LINKFLAGS' : [], 'DEFINES' : ['_DEBUG' ]}
139
+ return {'CXXFLAGS' : [], 'LINKFLAGS' : [], 'DEFINES' : []}
140
140
141
141
def getOptimizedFlags (self , conf ):
142
142
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in optimized mode"""
@@ -175,6 +175,9 @@ def getDebugFlags(self, conf):
175
175
'-Wno-error=maybe-uninitialized' , # Bug #1615
176
176
]
177
177
flags ['LINKFLAGS' ] += self .__linkFlags
178
+ # Enable assertions in libstdc++
179
+ # https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_macros.html
180
+ flags ['DEFINES' ] += ['_GLIBCXX_ASSERTIONS=1' ]
178
181
return flags
179
182
180
183
def getOptimizedFlags (self , conf ):
@@ -223,6 +226,9 @@ def getGeneralFlags(self, conf):
223
226
elif Utils .unversioned_sys_platform () == 'freebsd' :
224
227
# Bug #4790
225
228
flags ['CXXFLAGS' ] += [['-isystem' , '/usr/local/include' ]]
229
+ if self .getCompilerVersion (conf ) >= (18 , 0 , 0 ):
230
+ # Bug #5300
231
+ flags ['CXXFLAGS' ] += ['-Wno-enum-constexpr-conversion' ]
226
232
return flags
227
233
228
234
__cxxFlags = [
@@ -233,6 +239,13 @@ def getGeneralFlags(self, conf):
233
239
def getDebugFlags (self , conf ):
234
240
flags = super ().getDebugFlags (conf )
235
241
flags ['CXXFLAGS' ] += self .__cxxFlags
242
+ # Enable assertions in libc++
243
+ if self .getCompilerVersion (conf ) >= (18 , 0 , 0 ):
244
+ # https://libcxx.llvm.org/Hardening.html
245
+ flags ['DEFINES' ] += ['_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE' ]
246
+ elif self .getCompilerVersion (conf ) >= (15 , 0 , 0 ):
247
+ # https://releases.llvm.org/15.0.0/projects/libcxx/docs/UsingLibcxx.html#enabling-the-safe-libc-mode
248
+ flags ['DEFINES' ] += ['_LIBCPP_ENABLE_ASSERTIONS=1' ]
236
249
return flags
237
250
238
251
def getOptimizedFlags (self , conf ):
0 commit comments