Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 949340 - toolchain-funcs.eclass: tc-get-compiler-type warning on unused-command-line-argument when use llvm profile
Summary: toolchain-funcs.eclass: tc-get-compiler-type warning on unused-command-line-a...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-02-05 15:16 UTC by Zhixu Liu
Modified: 2025-02-16 18:41 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zhixu Liu 2025-02-05 15:16:46 UTC
# default/linux/amd64/23.0/llvm
# emerge -Ov1e llvm-core/clang-runtime

These are the packages that would be merged, in order:

[ebuild   R    ] llvm-core/clang-runtime-19.1.4:19::gentoo  USE="compiler-rt libcxx openmp -sanitize" ABI_X86="(32) (64) (-x32)" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB

>>> Verifying ebuild manifests
>>> Running pre-merge checks for llvm-core/clang-runtime-19.1.4
clang-cpp: warning: argument unused during compilation: '-E' [-Wunused-command-line-argument]
 * You seem to be using clang as a system compiler.  As of clang-16,
...

The warning message:

> clang-cpp: warning: argument unused during compilation: '-E' [-Wunused-command-line-argument]

is unexpected, shoule be hidden or silented?

Reproducible: Always
Comment 1 Mike Gilbert gentoo-dev 2025-02-05 16:52:37 UTC
The profile sets CPP=clang-cpp, which apparently does not accept a -E flag.

Should probably change tc-get-compiler-type from this:

local res=$($(tc-getCPP "$@") -E -P - <<<"${code}")

to this:

local res=$($(tc-getCC "$@") -E -P - <<<"${code}")
Comment 2 Alfred Wingate 2025-02-05 18:15:56 UTC
(In reply to Mike Gilbert from comment #1)
> The profile sets CPP=clang-cpp, which apparently does not accept a -E flag.
> 
> Should probably change tc-get-compiler-type from this:
> 
> local res=$($(tc-getCPP "$@") -E -P - <<<"${code}")
> 
> to this:
> 
> local res=$($(tc-getCC "$@") -E -P - <<<"${code}")

And normally an unset CPP would be gcc -E either way? So its double wrong with gcc -E -E. 

So another valid solution is to remove -E from this.

local res=$($(tc-getCPP "$@") -E -P - <<<"${code}")
Comment 3 Mike Gilbert gentoo-dev 2025-02-05 18:37:02 UTC
Sent a patch for review.

https://archives.gentoo.org/gentoo-dev/20250205181010.1968506-1-floppym@gentoo.org/T/#u
Comment 4 Mike Gilbert gentoo-dev 2025-02-05 18:38:26 UTC
(In reply to Alfred Wingate from comment #2)

The function is meant to test the compiler, not the preprocessor, so I think tc-getCC makes more sense.
Comment 5 Larry the Git Cow gentoo-dev 2025-02-16 18:41:35 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a1e7d1e7a213a08d6acc94d6b10628259ba49517

commit a1e7d1e7a213a08d6acc94d6b10628259ba49517
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2025-02-05 17:09:11 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2025-02-16 18:37:15 +0000

    toolchain-funcs.eclass: avoid using tc-getCPP in compiler checks
    
    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(-)