mirror of
https://github.com/mesonbuild/meson.git
synced 2026-08-07 08:10:51 +00:00
compilers: cpp: stop trying to handle old libc++ for assertions
This has two problems: 1) it keeps breaking with Apple Clang (bug #14440, bug #14856) 2) it gets confused when using GCC with libc++ (a rare configuration) because compiler version != libc++ version There's no reason to keep catering for old libc++ here. The feature was somewhat immature in older libc++ anyway. Just rip it out and then we can go back and restore it for the niche case later. Bug: https://github.com/mesonbuild/meson/issues/14440 Bug: https://github.com/mesonbuild/meson/issues/14856 Closes: https://github.com/mesonbuild/meson/issues/13978
This commit is contained in:
@@ -312,9 +312,6 @@ class ClangCPPCompiler(_StdCPPLibMixin, ClangCPPStds, ClangCompiler, CPPCompiler
|
||||
return libs
|
||||
return []
|
||||
|
||||
def is_libcpp_enable_assertions_deprecated(self) -> bool:
|
||||
return version_compare(self.version, ">=18")
|
||||
|
||||
def get_assert_args(self, disable: bool, env: 'Environment') -> T.List[str]:
|
||||
if disable:
|
||||
return ['-DNDEBUG']
|
||||
@@ -326,13 +323,8 @@ class ClangCPPCompiler(_StdCPPLibMixin, ClangCPPStds, ClangCompiler, CPPCompiler
|
||||
|
||||
if self.language_stdlib_provider(env) == 'stdc++':
|
||||
return ['-D_GLIBCXX_ASSERTIONS=1']
|
||||
else:
|
||||
if self.is_libcpp_enable_assertions_deprecated():
|
||||
return ['-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST']
|
||||
elif version_compare(self.version, '>=15'):
|
||||
return ['-D_LIBCPP_ENABLE_ASSERTIONS=1']
|
||||
|
||||
return []
|
||||
return ['-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST']
|
||||
|
||||
def get_pch_use_args(self, pch_dir: str, header: str) -> T.List[str]:
|
||||
args = super().get_pch_use_args(pch_dir, header)
|
||||
@@ -347,13 +339,7 @@ class ArmLtdClangCPPCompiler(ClangCPPCompiler):
|
||||
|
||||
|
||||
class AppleClangCPPCompiler(AppleCompilerMixin, AppleCPPStdsMixin, ClangCPPCompiler):
|
||||
def is_libcpp_enable_assertions_deprecated(self) -> bool:
|
||||
# Upstream libc++ deprecated _LIBCPP_ENABLE_ASSERTIONS
|
||||
# in favor of _LIBCPP_HARDENING_MODE from version 18 onwards,
|
||||
# but Apple Clang 16's libc++ has back-ported that change.
|
||||
# See: https://github.com/mesonbuild/meson/issues/14440 and
|
||||
# https://github.com/mesonbuild/meson/issues/14856
|
||||
return version_compare(self.version, ">=16")
|
||||
pass
|
||||
|
||||
|
||||
class EmscriptenCPPCompiler(EmscriptenMixin, ClangCPPCompiler):
|
||||
@@ -547,8 +533,6 @@ class GnuCPPCompiler(_StdCPPLibMixin, GnuCPPStds, GnuCompiler, CPPCompiler):
|
||||
# an experimental configure arg to expose that.
|
||||
if version_compare(self.version, '>=18'):
|
||||
return ['-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST']
|
||||
elif version_compare(self.version, '>=15'):
|
||||
return ['-D_LIBCPP_ENABLE_ASSERTIONS=1']
|
||||
|
||||
return []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user