[PATCH 7/9] perf build: Check the version of the compiler that is used
From: Ian Rogers
Date: Wed Sep 16 2026 - 02:16:25 EST
The flex and bison flags are adjusted for clang older than 13.0.0, which
doesn't grok -Wno-unused-but-set-variable. The test is reached because
CC_NO_CLANG says CC is clang, but the version comes from $(CLANG), which
defaults to plain "clang" and needn't be the compiler in use:
$ make CC=clang-19 CLANG=clang-12
version from $(CLANG) -> 12.0.0, flag stripped
version from $(CC) -> 19.1.7, flag kept
Dropping the flag lets the warnings it suppresses in the generated flex
and bison code through, and those are errors under -Werror.
Ask $(CC) instead, as that is what compiles the code.
Fixes: 878460e8d0ff ("perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0")
Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
Assisted-by: Antigravity:gemini-3.1-pro
---
tools/perf/util/Build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index d08f2af7d970..a4618e4e4848 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -339,7 +339,7 @@ bison_flags := -DYYENABLE_NLS=0 -Wno-unused-but-set-variable
# Old clangs don't grok -Wno-unused-but-set-variable, remove it
ifeq ($(CC_NO_CLANG), 0)
- CLANG_VERSION := $(shell $(CLANG) --version | head -1 | sed 's/.*clang version \([[:digit:]]\+.[[:digit:]]\+.[[:digit:]]\+\).*/\1/g')
+ CLANG_VERSION := $(shell $(CC) --version | head -1 | sed 's/.*clang version \([[:digit:]]\+.[[:digit:]]\+.[[:digit:]]\+\).*/\1/g')
ifeq ($(call version-lt3,$(CLANG_VERSION),13.0.0),1)
bison_flags := $(subst -Wno-unused-but-set-variable,,$(bison_flags))
flex_flags := $(subst -Wno-unused-but-set-variable,,$(flex_flags))
--
2.55.0.1032.g73a4cd73de-goog