public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Mike Gilbert <floppym@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: toolchain@gentoo.org, Mike Gilbert <floppym@gentoo.org>
Subject: [gentoo-dev] [PATCH] toolchain-funcs.eclass: avoid using tc-getCPP in compiler checks
Date: Wed,  5 Feb 2025 13:10:10 -0500	[thread overview]
Message-ID: <20250205181010.1968506-1-floppym@gentoo.org> (raw)

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 - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__")
 	eval echo "${ver}"
 }
 
@@ -960,7 +960,7 @@ gcc-micro-version() {
 # Internal func. Based on _gcc_fullversion() above.
 _clang_fullversion() {
 	local ver="$1"; shift
-	set -- $($(tc-getCPP "$@") -E -P - <<<"__clang_major__ __clang_minor__ __clang_patchlevel__")
+	set -- $($(tc-getCC "$@") -E -P - <<<"__clang_major__ __clang_minor__ __clang_patchlevel__")
 	eval echo "${ver}"
 }
 
@@ -1347,14 +1347,14 @@ tc-get-c-rtlib() {
 # @FUNCTION: tc-get-ptr-size
 # @RETURN: Size of a pointer in bytes for CHOST (e.g. 4 or 8).
 tc-get-ptr-size() {
-	$(tc-getCPP) -P - <<< __SIZEOF_POINTER__ ||
+	$(tc-getCC) -E -P - <<< __SIZEOF_POINTER__ ||
 		die "Could not determine CHOST pointer size"
 }
 
 # @FUNCTION: tc-get-build-ptr-size
 # @RETURN: Size of a pointer in bytes for CBUILD (e.g. 4 or 8).
 tc-get-build-ptr-size() {
-	$(tc-getBUILD_CPP) -P - <<< __SIZEOF_POINTER__ ||
+	$(tc-getBUILD_CC) -E -P - <<< __SIZEOF_POINTER__ ||
 		die "Could not determine CBUILD pointer size"
 }
 
-- 
2.48.1



             reply	other threads:[~2025-02-05 18:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-05 18:10 Mike Gilbert [this message]
2025-02-05 18:39 ` [gentoo-dev] [PATCH] toolchain-funcs.eclass: avoid using tc-getCPP in compiler checks James Le Cuirot
2025-02-05 19:06 ` Ionen Wolkens
2025-02-05 19:41   ` Mike Gilbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250205181010.1968506-1-floppym@gentoo.org \
    --to=floppym@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    --cc=toolchain@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox