build: sync default CXXFLAGS and DEFINES with NFD
Change-Id: Ie4d78d89c921230eb3460e9a6092fc9c66b9f819
diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py
index 4aa9e9b..7784d9f 100644
--- a/.waf-tools/default-compiler-flags.py
+++ b/.waf-tools/default-compiler-flags.py
@@ -128,11 +128,15 @@
def getGeneralFlags(self, conf):
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are always needed"""
- return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': []}
+ return {
+ 'CXXFLAGS': [],
+ 'LINKFLAGS': [],
+ 'DEFINES': ['BOOST_FILESYSTEM_NO_DEPRECATED'],
+ }
def getDebugFlags(self, conf):
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in debug mode"""
- return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': ['_DEBUG']}
+ return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': []}
def getOptimizedFlags(self, conf):
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in optimized mode"""
@@ -158,7 +162,6 @@
'-Wpedantic',
'-Wenum-conversion',
'-Wextra-semi',
- '-Wnon-virtual-dtor',
'-Wno-unused-parameter',
]
__linkFlags = ['-Wl,-O1']
@@ -171,6 +174,9 @@
'-Wno-error=maybe-uninitialized', # Bug #1615
]
flags['LINKFLAGS'] += self.__linkFlags
+ # Enable assertions in libstdc++
+ # https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_macros.html
+ flags['DEFINES'] += ['_GLIBCXX_ASSERTIONS=1']
return flags
def getOptimizedFlags(self, conf):
@@ -219,6 +225,9 @@
elif Utils.unversioned_sys_platform() == 'freebsd':
# Bug #4790
flags['CXXFLAGS'] += [['-isystem', '/usr/local/include']]
+ if self.getCompilerVersion(conf) >= (18, 0, 0):
+ # Bug #5300
+ flags['CXXFLAGS'] += ['-Wno-enum-constexpr-conversion']
return flags
__cxxFlags = [
@@ -229,6 +238,13 @@
def getDebugFlags(self, conf):
flags = super().getDebugFlags(conf)
flags['CXXFLAGS'] += self.__cxxFlags
+ # Enable assertions in libc++
+ if self.getCompilerVersion(conf) >= (18, 0, 0):
+ # https://libcxx.llvm.org/Hardening.html
+ flags['DEFINES'] += ['_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE']
+ elif self.getCompilerVersion(conf) >= (15, 0, 0):
+ # https://releases.llvm.org/15.0.0/projects/libcxx/docs/UsingLibcxx.html#enabling-the-safe-libc-mode
+ flags['DEFINES'] += ['_LIBCPP_ENABLE_ASSERTIONS=1']
return flags
def getOptimizedFlags(self, conf):