Gentoo Archives: gentoo-dev

From: Sam James <sam@g.o>
To: gentoo-dev@l.g.o
Cc: toolchain@g.o, Sam James <sam@g.o>
Subject: [gentoo-dev] [PATCH 2/5] toolchain-funcs.eclass: add tc-enables-cxx-assertions
Date: Mon, 30 Jan 2023 01:47:34
Message-Id: 20230130014708.2898311-2-sam@gentoo.org
In Reply to: [gentoo-dev] [PATCH 1/5] toolchain-funcs.eclass: add tc-enables-fortify-source for FORTIFY_SOURCE by Sam James
1 Bug: https://bugs.gentoo.org/884417
2 Bug: https://bugs.gentoo.org/876895
3 Signed-off-by: Sam James <sam@g.o>
4 ---
5 eclass/toolchain-funcs.eclass | 9 +++++++++
6 1 file changed, 9 insertions(+)
7
8 diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
9 index b9e956098b3e2..d46104275f8e6 100644
10 --- a/eclass/toolchain-funcs.eclass
11 +++ b/eclass/toolchain-funcs.eclass
12 @@ -996,6 +996,15 @@ gcc-specs-stack-check() {
13 [[ "${directive/\{!fno-stack-check:}" != "${directive}" ]]
14 }
15
16 +# @FUNCTION: tc-enables-cxx-assertions
17 +# @RETURN: Truth if the current compiler enables assertions in the C++ standard library
18 +# @DESCRIPTION:
19 +# Return truth if the current compiler enables assertions in the C++ standard
20 +# library. For libstdc++, this is -D_GLIBCXX_ASSERTIONS, and for libcxx/libc++,
21 +# this is -D_LIBCPP_ENABLE_ASSERTIONS.
22 +tc-enables-cxx-assertions() {
23 + tc-cpp-is-true "defined(_GLIBCXX_ASSERTIONS) || defined(_LIBCPP_ENABLE_ASSERTIONS)" ${CPPFLAGS} ${CXXFLAGS}
24 +}
25
26 # @FUNCTION: tc-enables-pie
27 # @RETURN: Truth if the current compiler generates position-independent code (PIC) which can be linked into executables
28 --
29 2.39.1