summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2025-10-28 10:41:04 +0000
committerEli Schwartz <eschwartz93@gmail.com>2025-10-31 01:24:46 -0400
commit8b74f795e89a9ac6454428745a75a56e7361f91c (patch)
tree8163332e5f5f83586a934c0c45a801a54f03dce4 /mesonbuild/compilers
parent6ad2c919087c75254c8fe19b2a76102883358f1b (diff)
downloadmeson-8b74f795e89a9ac6454428745a75a56e7361f91c.tar.gz
compilers: cpp: unset LIBCPP_HARDENING_MODE first for debugstl
libc++ uses the same macro name, just with different values, for debugstl. If the distro or similar predefines a hardening mode lower than the mode debugstl wants (or in any other way not equal), we get an annoying redefinition warning. Closes: https://github.com/mesonbuild/meson/issues/13812
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r--mesonbuild/compilers/cpp.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py
index 47087b694..91a1f04ab 100644
--- a/mesonbuild/compilers/cpp.py
+++ b/mesonbuild/compilers/cpp.py
@@ -286,6 +286,7 @@ class ClangCPPCompiler(_StdCPPLibMixin, ClangCPPStds, ClangCompiler, CPPCompiler
# https://discourse.llvm.org/t/building-a-program-with-d-libcpp-debug-1-against-a-libc-that-is-not-itself-built-with-that-define/59176/3
# Note that unlike _GLIBCXX_DEBUG, _MODE_DEBUG doesn't break ABI. It's just slow.
if version_compare(self.version, '>=18'):
+ args.append('-U_LIBCPP_HARDENING_MODE')
args.append('-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG')
if not rtti:
@@ -494,6 +495,7 @@ class GnuCPPCompiler(_StdCPPLibMixin, GnuCPPStds, GnuCompiler, CPPCompiler):
if not rtti:
args.append('-fno-rtti')
+ # We may want to handle libc++'s debugstl mode here too
if debugstl:
args.append('-D_GLIBCXX_DEBUG=1')
return args