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