commit: 3ffccf8150c87234124ba1a72b11b829bb17dd15 Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Mon Jan 30 01:10:18 2023 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Mon Jan 30 17:37:04 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3ffccf81
toolchain-funcs.eclass: add tc-enables-cxx-assertions Bug: https://bugs.gentoo.org/884417 Bug: https://bugs.gentoo.org/876895 Signed-off-by: Sam James <sam <AT> gentoo.org> eclass/toolchain-funcs.eclass | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass index b9e956098b3e..d46104275f8e 100644 --- a/eclass/toolchain-funcs.eclass +++ b/eclass/toolchain-funcs.eclass @@ -996,6 +996,15 @@ gcc-specs-stack-check() { [[ "${directive/\{!fno-stack-check:}" != "${directive}" ]] } +# @FUNCTION: tc-enables-cxx-assertions +# @RETURN: Truth if the current compiler enables assertions in the C++ standard library +# @DESCRIPTION: +# Return truth if the current compiler enables assertions in the C++ standard +# library. For libstdc++, this is -D_GLIBCXX_ASSERTIONS, and for libcxx/libc++, +# this is -D_LIBCPP_ENABLE_ASSERTIONS. +tc-enables-cxx-assertions() { + tc-cpp-is-true "defined(_GLIBCXX_ASSERTIONS) || defined(_LIBCPP_ENABLE_ASSERTIONS)" ${CPPFLAGS} ${CXXFLAGS} +} # @FUNCTION: tc-enables-pie # @RETURN: Truth if the current compiler generates position-independent code (PIC) which can be linked into executables
