summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-01-30 01:10:18 +0000
committerSam James <sam@gentoo.org>2023-01-30 17:37:04 +0000
commit3ffccf8150c87234124ba1a72b11b829bb17dd15 (patch)
treeefd821edec407e1f5bcd83db31f687f32b8d3130 /eclass
parenttoolchain-funcs.eclass: add tc-enables-fortify-source for FORTIFY_SOURCE (diff)
downloadgentoo-3ffccf8150c87234124ba1a72b11b829bb17dd15.tar.gz
gentoo-3ffccf8150c87234124ba1a72b11b829bb17dd15.tar.bz2
gentoo-3ffccf8150c87234124ba1a72b11b829bb17dd15.zip
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@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/toolchain-funcs.eclass9
1 files changed, 9 insertions, 0 deletions
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