• [gentoo-dev] [PATCH 2/5] toolchain-funcs.eclass: add tc-enables-cxx-ass

    From Sam James@21:1/5 to All on Mon Jan 30 02:50:01 2023
    Bug: https://bugs.gentoo.org/884417
    Bug: https://bugs.gentoo.org/876895
    Signed-off-by: Sam James <sam@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 b9e956098b3e2..d46104275f8e6 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