• [gentoo-dev] [PATCH] toolchain-funcs.eclass: avoid using tc-getCPP in c

    From Mike Gilbert@21:1/5 to All on Wed Feb 5 19:20:01 2025
    We usually want to invoke cc -E rather than cpp directly. We should not
    rely on the quirk of tc-getCPP defaulting to "cc -E" when CPP is unset.

    Resolves a warning when CPP is set to llvm-cpp, which does not accept
    the -E option.

    Closes: https://bugs.gentoo.org/949340
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>
    ---
    eclass/toolchain-funcs.eclass | 12 ++++++------
    1 file changed, 6 insertions(+), 6 deletions(-)

    diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass index 0abed5b8d75e..754d23f91c06 100644
    --- a/eclass/toolchain-funcs.eclass
    +++ b/eclass/toolchain-funcs.eclass
    @@ -1,4 +1,4 @@
    -# Copyright 2002-2024 Gentoo Authors
    +# Copyright 2002-2025 Gentoo Authors
    # Distributed under the terms of the GNU General Public License v2

    # @ECLASS: toolchain-funcs.eclass
    @@ -900,7 +900,7 @@ tc-get-compiler-type() {
    HAVE_GCC
    #endif
    '
    - local res=$($(tc-getCPP "$@") -E -P - <<<"${code}")
    + local res=$($(tc-getCC "$@") -E -P - <<<"${code}")

    case ${res} in
    *HAVE_PATHCC*) echo pathcc;;
    @@ -927,7 +927,7 @@ tc-is-clang() {
    # compilers rather than maintaining a --version flag matrix, bug #335943.
    _gcc_fullversion() {
    local ver="$1"; shift
    - set -- $($(tc-getCPP "$@") -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__")
    + set -- $($(tc-getCC "$@") -E -P - <<<"__