perf build fixes
Subsystems (3)
v2 cover perf build fixes
This patch series contains "perf" build fixes specific to 6.1. We have seen occasional build failures in our CI looking like these:
util/parse-events-bison.c: In function 'yy_symbol_print':util/parse-events-bison.c:901: error: unterminated #if
901 | #if YYDEBUG
|
util/parse-events-bison.c:1020:62: error: '_p' undeclared (first use in this function)
1020 | yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp, _parse_state, scanner);
| ^~util/parse-events-bison.c:1020:62: note: each undeclared identifier is reported only once for each function it appears in util/parse-events-bison.c:1020:64: error: expected ')' at end of input
1020 | yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp, _parse_state, scanner);
| ~ ^
| )
1021 | YYFPRINTF (yyo, ")");
|
util/parse-events-bison.c:1020:3: error: too few arguments to function 'yy_symbol_value_print'
1020 | yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp, _parse_state, scanner);
| ^~~~~~~~~~~~~~~~~~~~~
util/parse-events-bison.c:991:1: note: declared here
991 | yy_symbol_value_print (FILE *yyo,
| ^~~~~~~~~~~~~~~~~~~~~which are resolved by these patches.
Changes in v2:
- backport change adding version-lt3 macro
- added fix for "perf build: Disable fewer bison warnings" per Sasha's review
Arnaldo Carvalho de Melo (2):
tools build: Add 3-component logical version comparators perf build: Remove -Wno-unused-but-set-variable from the flex flags
when building with clang < 13.0.0
Ian Rogers (3):
perf build: Conditionally define NDEBUG
perf parse-events: Make YYDEBUG dependent on doing a debug build perf build: Disable fewer bison warnings
tools/perf/Makefile.config | 1 + tools/perf/util/Build | 32 +++++++++++++++++++++++++------- tools/perf/util/expr.y | 4 +++- tools/perf/util/parse-events.y | 3 +++ tools/perf/util/pmu.y | 3 +++ tools/scripts/utilities.mak | 20 ++++++++++++++++++++ 6 files changed, 55 insertions(+), 8 deletions(-)
Signature · 1 line
2.34.1
PATCH v2 1/5 perf build: Conditionally define NDEBUG
From: Ian Rogers <[email protected]>
commit 616b14b47a86d880ba21a363440f20f82152d8f2 upstream
When a build is done without DEBUG=1 then define NDEBUG. This will compile out asserts and other debug code.
--- tools/perf/Makefile.config | 1 + 1 file changed, 1 insertion(+)
tools/perf/Makefile.config +1 -0
@@ -228,6 +228,7 @@ ifndef DEBUG endif ifeq ($(DEBUG),0) +CORE_CFLAGS += -DNDEBUG=1 ifeq ($(CC_NO_CLANG), 0) CORE_CFLAGS += -O3 else
Signature · 1 line
2.34.1
Patch "perf build: Conditionally define NDEBUG" has been added to the 6.1-stable tree
This is a note to let you know that I've just added the patch titled
perf build: Conditionally define NDEBUG
to the 6.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
perf-build-conditionally-define-ndebug.patch
and it can be found in the queue-6.1 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
From [email protected] Wed May 20 22:29:26 2026
From: Florian Fainelli <[email protected]>
Date: Wed, 20 May 2026 09:33:16 -0700
Subject: perf build: Conditionally define NDEBUG
To: [email protected]
Cc: Ian Rogers <[email protected]>, Adrian Hunter <[email protected]>, Alexander Shishkin <[email protected]>, Ingo Molnar <[email protected]>, Jiri Olsa <[email protected]>, Mark Rutland <[email protected]>, Namhyung Kim <[email protected]>, Paolo Bonzini <[email protected]>, Peter Zijlstra <[email protected]>, Sean Christopherson <[email protected]>, Arnaldo Carvalho de Melo <[email protected]>, Florian Fainelli <[email protected]>, Arnaldo Carvalho de Melo <[email protected]>, Nathan Chancellor <[email protected]>, Nick Desaulniers <[email protected]>, Tom Rix <[email protected]>, [email protected] (open list:PERFORMANCE EVENTS SUBSYSTEM), [email protected] (open list:PERFORMANCE EVENTS SUBSYSTEM), [email protected] (open list:BPF [MISC]), [email protected] (open list:CLANG/LLVM BUILD SUPPORT), [email protected]
Message-ID: <[email protected]>
From: Ian Rogers <[email protected]>
commit 616b14b47a86d880ba21a363440f20f82152d8f2 upstream
When a build is done without DEBUG=1 then define NDEBUG. This will compile out asserts and other debug code.
--- tools/perf/Makefile.config | 1 + 1 file changed, 1 insertion(+)
tools/perf/Makefile.config +1 -0
@@ -228,6 +228,7 @@ ifndef DEBUG endif ifeq ($(DEBUG),0) +CORE_CFLAGS += -DNDEBUG=1 ifeq ($(CC_NO_CLANG), 0) CORE_CFLAGS += -O3 else
Patches currently in stable-queue which might be from [email protected] are
queue-6.1/perf-build-remove-wno-unused-but-set-variable-from-the-flex-flags-when-building-with-clang-13.0.0.patch queue-6.1/perf-build-conditionally-define-ndebug.patch queue-6.1/perf-parse-events-make-yydebug-dependent-on-doing-a-debug-build.patch queue-6.1/perf-build-disable-fewer-bison-warnings.patch queue-6.1/tools-build-add-3-component-logical-version-comparators.patch
PATCH v2 2/5 perf parse-events: Make YYDEBUG dependent on doing a debug build
In reply to Florian FainelliFrom: Ian Rogers <[email protected]>
commit d4ce60190e08d84f88937019defa5e3d23409ac1 upstream
YYDEBUG enables line numbers and other error helpers in the generated parse-events-bison.c. These shouldn't be generated when debugging isn't enabled.
--- tools/perf/util/parse-events.y | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/parse-events.y +2 -0
@@ -6,7 +6,9 @@ %{ +#ifndef NDEBUG #define YYDEBUG 1 +#endif #include <fnmatch.h> #include <stdio.h>
Signature · 1 line
2.34.1
Patch "perf parse-events: Make YYDEBUG dependent on doing a debug build" has been added to the 6.1-stable tree
This is a note to let you know that I've just added the patch titled
perf parse-events: Make YYDEBUG dependent on doing a debug build
to the 6.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
perf-parse-events-make-yydebug-dependent-on-doing-a-debug-build.patch
and it can be found in the queue-6.1 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
From [email protected] Wed May 20 22:58:26 2026
From: Florian Fainelli <[email protected]>
Date: Wed, 20 May 2026 09:33:17 -0700
Subject: perf parse-events: Make YYDEBUG dependent on doing a debug build
To: [email protected]
Cc: Ian Rogers <[email protected]>, Namhyung Kim <[email protected]>, Adrian Hunter <[email protected]>, Alexander Shishkin <[email protected]>, Gaosheng Cui <[email protected]>, Ingo Molnar <[email protected]>, James Clark <[email protected]>, Jiri Olsa <[email protected]>, Kan Liang <[email protected]>, Mark Rutland <[email protected]>, Peter Zijlstra <[email protected]>, Rob Herring <[email protected]>, [email protected], Arnaldo Carvalho de Melo <[email protected]>, Florian Fainelli <[email protected]>, Arnaldo Carvalho de Melo <[email protected]>, Nathan Chancellor <[email protected]>, Nick Desaulniers <[email protected]>, Tom Rix <[email protected]>, [email protected] (open list:PERFORMANCE EVENTS SUBSYSTEM), [email protected] (open list:PERFORMANCE EVENTS SUBSYSTEM), [email protected] (open list:CLANG/LLVM BUILD SUPPORT), [email protected]
Message-ID: <[email protected]>
From: Ian Rogers <[email protected]>
commit d4ce60190e08d84f88937019defa5e3d23409ac1 upstream
YYDEBUG enables line numbers and other error helpers in the generated parse-events-bison.c. These shouldn't be generated when debugging isn't enabled.
--- tools/perf/util/parse-events.y | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/parse-events.y +2 -0
@@ -6,7 +6,9 @@ %{ +#ifndef NDEBUG #define YYDEBUG 1 +#endif #include <fnmatch.h> #include <stdio.h>
Patches currently in stable-queue which might be from [email protected] are
queue-6.1/perf-build-remove-wno-unused-but-set-variable-from-the-flex-flags-when-building-with-clang-13.0.0.patch queue-6.1/perf-build-conditionally-define-ndebug.patch queue-6.1/perf-parse-events-make-yydebug-dependent-on-doing-a-debug-build.patch queue-6.1/perf-build-disable-fewer-bison-warnings.patch queue-6.1/tools-build-add-3-component-logical-version-comparators.patch
PATCH v2 3/5 perf build: Disable fewer bison warnings
In reply to Florian FainelliFrom: Ian Rogers <[email protected]>
commit ddc8e4c966923ad1137790817157c8a5f0301aec upstream
If bison is version 3.8.2, reduce the number of bison C warnings disabled. Earlier bison versions have all C warnings disabled. Avoid implicit declarations of yylex by adding the declaration in the C file. A header can't be included as a circular dependency would occur due to the lexer using the bison defined tokens.
Committer notes:
Some recent versions of gcc and clang (noticed on Alpine Linux 3.17, edge, clearlinux, fedora 37, etc.
--- tools/perf/util/Build | 12 ++++++++---- tools/perf/util/expr.y | 4 +++- tools/perf/util/parse-events.y | 1 + tools/perf/util/pmu.y | 3 +++ 4 files changed, 15 insertions(+), 5 deletions(-)
tools/perf/util/Build +8 -4
@@ -269,10 +269,14 @@ CFLAGS_parse-events-flex.o += $(flex_flags) CFLAGS_pmu-flex.o += $(flex_flags) CFLAGS_expr-flex.o += $(flex_flags) -bison_flags := -DYYENABLE_NLS=0 -BISON_GE_35 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\)/\1\2/g') \>\= 35) -ifeq ($(BISON_GE_35),1) - bison_flags += -Wno-unused-parameter -Wno-nested-externs -Wno-implicit-function-declaration -Wno-switch-enum -Wno-unused-but-set-variable -Wno-unknown-warning-option +# Some newer clang and gcc version complain about this +# util/parse-events-bison.c:1317:9: error: variable 'parse_events_nerrs' set but not used [-Werror,-Wunused-but-set-variable] +# int yynerrs = 0; + +bison_flags := -DYYENABLE_NLS=0 -Wno-unused-but-set-variable +BISON_GE_382 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \>\= 382) +ifeq ($(BISON_GE_382),1) + bison_flags += -Wno-switch-enum else bison_flags += -w endif
tools/perf/util/expr.y +3 -1
@@ -7,6 +7,8 @@ #include "util/debug.h" #define IN_EXPR_Y 1 #include "expr.h" +#include "expr-bison.h" +int expr_lex(YYSTYPE * yylval_param , void *yyscanner); %} %define api.pure full
@@ -56,7 +58,7 @@ static void expr_error(double *final_val __maybe_unused, struct expr_parse_ctx *ctx __maybe_unused, bool compute_ids __maybe_unused, - void *scanner, + void *scanner __maybe_unused, const char *s) { pr_debug("%s\n", s);
tools/perf/util/parse-events.y +1 -0
@@ -20,6 +20,7 @@ #include "parse-events.h" #include "parse-events-bison.h" +int parse_events_lex(YYSTYPE * yylval_param, YYLTYPE * yylloc_param , void *yyscanner); void parse_events_error(YYLTYPE *loc, void *parse_state, void *scanner, char const *msg); #define ABORT_ON(val) \
tools/perf/util/pmu.y +3 -0
@@ -9,6 +9,9 @@ #include <linux/bitmap.h> #include <string.h> #include "pmu.h" +#include "pmu-bison.h" + +int perf_pmu_lex(void); #define ABORT_ON(val) \ do { \
Signature · 1 line
2.34.1
Patch "perf build: Disable fewer bison warnings" has been added to the 6.1-stable tree
This is a note to let you know that I've just added the patch titled
perf build: Disable fewer bison warnings
to the 6.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
perf-build-disable-fewer-bison-warnings.patch
and it can be found in the queue-6.1 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
From [email protected] Wed May 20 22:58:58 2026
From: Florian Fainelli <[email protected]>
Date: Wed, 20 May 2026 09:33:18 -0700
Subject: perf build: Disable fewer bison warnings
To: [email protected]
Cc: Ian Rogers <[email protected]>, Adrian Hunter <[email protected]>, Alexander Shishkin <[email protected]>, Andrii Nakryiko <[email protected]>, Eduard Zingerman <[email protected]>, Gaosheng Cui <[email protected]>, Ingo Molnar <[email protected]>, Jiri Olsa <[email protected]>, Kan Liang <[email protected]>, Mark Rutland <[email protected]>, Namhyung Kim <[email protected]>, Nathan Chancellor <[email protected]>, Nick Desaulniers <[email protected]>, Peter Zijlstra <[email protected]>, Rob Herring <[email protected]>, Tom Rix <[email protected]>, [email protected], [email protected], Arnaldo Carvalho de Melo <[email protected]>, Florian Fainelli <[email protected]>, Arnaldo Carvalho de Melo <[email protected]>, [email protected] (open list:PERFORMANCE EVENTS SUBSYSTEM), [email protected] (open list:PERFORMANCE EVENTS SUBSYSTEM), [email protected]
Message-ID: <[email protected]>
From: Ian Rogers <[email protected]>
commit ddc8e4c966923ad1137790817157c8a5f0301aec upstream
If bison is version 3.8.2, reduce the number of bison C warnings disabled. Earlier bison versions have all C warnings disabled. Avoid implicit declarations of yylex by adding the declaration in the C file. A header can't be included as a circular dependency would occur due to the lexer using the bison defined tokens.
Committer notes:
Some recent versions of gcc and clang (noticed on Alpine Linux 3.17, edge, clearlinux, fedora 37, etc.
--- tools/perf/util/Build | 12 ++++++++---- tools/perf/util/expr.y | 4 +++- tools/perf/util/parse-events.y | 1 + tools/perf/util/pmu.y | 3 +++ 4 files changed, 15 insertions(+), 5 deletions(-)
tools/perf/util/Build +8 -4
@@ -269,10 +269,14 @@ CFLAGS_parse-events-flex.o += $(flex_fl CFLAGS_pmu-flex.o += $(flex_flags) CFLAGS_expr-flex.o += $(flex_flags) -bison_flags := -DYYENABLE_NLS=0 -BISON_GE_35 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\)/\1\2/g') \>\= 35) -ifeq ($(BISON_GE_35),1) - bison_flags += -Wno-unused-parameter -Wno-nested-externs -Wno-implicit-function-declaration -Wno-switch-enum -Wno-unused-but-set-variable -Wno-unknown-warning-option +# Some newer clang and gcc version complain about this +# util/parse-events-bison.c:1317:9: error: variable 'parse_events_nerrs' set but not used [-Werror,-Wunused-but-set-variable] +# int yynerrs = 0; + +bison_flags := -DYYENABLE_NLS=0 -Wno-unused-but-set-variable +BISON_GE_382 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \>\= 382) +ifeq ($(BISON_GE_382),1) + bison_flags += -Wno-switch-enum else bison_flags += -w endif
tools/perf/util/expr.y +3 -1
@@ -7,6 +7,8 @@ #include "util/debug.h" #define IN_EXPR_Y 1 #include "expr.h" +#include "expr-bison.h" +int expr_lex(YYSTYPE * yylval_param , void *yyscanner); %} %define api.pure full
@@ -56,7 +58,7 @@ static void expr_error(double *final_val __maybe_unused, struct expr_parse_ctx *ctx __maybe_unused, bool compute_ids __maybe_unused, - void *scanner, + void *scanner __maybe_unused, const char *s) { pr_debug("%s\n", s);
tools/perf/util/parse-events.y +1 -0
@@ -20,6 +20,7 @@ #include "parse-events.h" #include "parse-events-bison.h" +int parse_events_lex(YYSTYPE * yylval_param, YYLTYPE * yylloc_param , void *yyscanner); void parse_events_error(YYLTYPE *loc, void *parse_state, void *scanner, char const *msg); #define ABORT_ON(val) \
tools/perf/util/pmu.y +3 -0
@@ -9,6 +9,9 @@ #include <linux/bitmap.h> #include <string.h> #include "pmu.h" +#include "pmu-bison.h" + +int perf_pmu_lex(void); #define ABORT_ON(val) \ do { \
Patches currently in stable-queue which might be from [email protected] are
queue-6.1/perf-build-remove-wno-unused-but-set-variable-from-the-flex-flags-when-building-with-clang-13.0.0.patch queue-6.1/perf-build-conditionally-define-ndebug.patch queue-6.1/perf-parse-events-make-yydebug-dependent-on-doing-a-debug-build.patch queue-6.1/perf-build-disable-fewer-bison-warnings.patch queue-6.1/tools-build-add-3-component-logical-version-comparators.patch
PATCH v2 4/5 tools build: Add 3-component logical version comparators
In reply to Florian FainelliFrom: Arnaldo Carvalho de Melo <[email protected]>
commit a9b451509565d40a5ca3b41c39a2b758cdbc5355 upstream
The next cset needs to compare if a flex version is greater or equal/less than another, but since there is no canonical, generally available way to compare versions in the command line (sort -V, yeah, but...), just use awk to canonicalize the versions like is also done in scripts/rust_is_available.sh.
There was a problem spotted in linux-next where a bashism, here documents, aka the '<<<' stdin redirector, for strings to be used as the stdin for awk. Use $(shell echo | awk ...) instead.
--- tools/scripts/utilities.mak | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
tools/scripts/utilities.mak +20 -0
@@ -177,3 +177,23 @@ $(if $($(1)),$(call _ge_attempt,$($(1)),$(1)),$(call _ge_attempt,$(2))) endef _ge_attempt = $(or $(get-executable),$(call _gea_err,$(2))) _gea_err = $(if $(1),$(error Please set '$(1)' appropriately)) + +# version-ge3 +# +# Usage $(call version-ge3,2.6.4,$(FLEX_VERSION)) +# +# To compare if a 3 component version is greater or equal to another, first use +# was to check the flex version to see if we can use compiler warnings as +# errors for one of the cases flex generates code C compilers complains about. + +version-ge3 = $(shell echo "$(1).$(2)" | awk -F'.' '{ printf("%d\n", (10000000 * $$1 + 10000 * $$2 + $$3) >= (10000000 * $$4 + 10000 * $$5 + $$6)) }') + +# version-lt3 +# +# Usage $(call version-lt3,2.6.2,$(FLEX_VERSION)) +# +# To compare if a 3 component version is less thjan another, first use was to +# check the flex version to see if we can use compiler warnings as errors for +# one of the cases flex generates code C compilers complains about. + +version-lt3 = $(shell echo "$(1).$(2)" | awk -F'.' '{ printf("%d\n", (10000000 * $$1 + 10000 * $$2 + $$3) < (10000000 * $$4 + 10000 * $$5 + $$6)) }')
Signature · 1 line
2.34.1
Patch "tools build: Add 3-component logical version comparators" has been added to the 6.1-stable tree
This is a note to let you know that I've just added the patch titled
tools build: Add 3-component logical version comparators
to the 6.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
tools-build-add-3-component-logical-version-comparators.patch
and it can be found in the queue-6.1 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
From [email protected] Thu May 21 01:09:09 2026
From: Florian Fainelli <[email protected]>
Date: Wed, 20 May 2026 09:33:19 -0700
Subject: tools build: Add 3-component logical version comparators
To: [email protected]
Cc: Arnaldo Carvalho de Melo <[email protected]>, Adrian Hunter <[email protected]>, Ian Rogers <[email protected]>, Jiri Olsa <[email protected]>, Namhyung Kim <[email protected]>, Florian Fainelli <[email protected]>, Peter Zijlstra <[email protected]>, Ingo Molnar <[email protected]>, Arnaldo Carvalho de Melo <[email protected]>, Mark Rutland <[email protected]>, Alexander Shishkin <[email protected]>, Nathan Chancellor <[email protected]>, Nick Desaulniers <[email protected]>, Tom Rix <[email protected]>, [email protected] (open list:PERFORMANCE EVENTS SUBSYSTEM), [email protected] (open list:PERFORMANCE EVENTS SUBSYSTEM), [email protected] (open list:BPF [MISC]), [email protected] (open list:CLANG/LLVM BUILD SUPPORT), [email protected]
Message-ID: <[email protected]>
From: Arnaldo Carvalho de Melo <[email protected]>
commit a9b451509565d40a5ca3b41c39a2b758cdbc5355 upstream
The next cset needs to compare if a flex version is greater or equal/less than another, but since there is no canonical, generally available way to compare versions in the command line (sort -V, yeah, but...), just use awk to canonicalize the versions like is also done in scripts/rust_is_available.sh.
There was a problem spotted in linux-next where a bashism, here documents, aka the '<<<' stdin redirector, for strings to be used as the stdin for awk. Use $(shell echo | awk ...) instead.
--- tools/scripts/utilities.mak | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
tools/scripts/utilities.mak +20 -0
@@ -177,3 +177,23 @@ $(if $($(1)),$(call _ge_attempt,$($(1)), endef _ge_attempt = $(or $(get-executable),$(call _gea_err,$(2))) _gea_err = $(if $(1),$(error Please set '$(1)' appropriately)) + +# version-ge3 +# +# Usage $(call version-ge3,2.6.4,$(FLEX_VERSION)) +# +# To compare if a 3 component version is greater or equal to another, first use +# was to check the flex version to see if we can use compiler warnings as +# errors for one of the cases flex generates code C compilers complains about. + +version-ge3 = $(shell echo "$(1).$(2)" | awk -F'.' '{ printf("%d\n", (10000000 * $$1 + 10000 * $$2 + $$3) >= (10000000 * $$4 + 10000 * $$5 + $$6)) }') + +# version-lt3 +# +# Usage $(call version-lt3,2.6.2,$(FLEX_VERSION)) +# +# To compare if a 3 component version is less thjan another, first use was to +# check the flex version to see if we can use compiler warnings as errors for +# one of the cases flex generates code C compilers complains about. + +version-lt3 = $(shell echo "$(1).$(2)" | awk -F'.' '{ printf("%d\n", (10000000 * $$1 + 10000 * $$2 + $$3) < (10000000 * $$4 + 10000 * $$5 + $$6)) }')
Patches currently in stable-queue which might be from [email protected] are
queue-6.1/perf-build-remove-wno-unused-but-set-variable-from-the-flex-flags-when-building-with-clang-13.0.0.patch queue-6.1/perf-build-conditionally-define-ndebug.patch queue-6.1/perf-parse-events-make-yydebug-dependent-on-doing-a-debug-build.patch queue-6.1/perf-build-disable-fewer-bison-warnings.patch queue-6.1/tools-build-add-3-component-logical-version-comparators.patch
PATCH v2 5/5 perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0
In reply to Florian FainelliFrom: Arnaldo Carvalho de Melo <[email protected]>
clang < 13.0.0 doesn't grok -Wno-unused-but-set-variable, so just remove it to avoid:
error: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option] make[4]: *** [/git/perf-6.5.0-rc4/tools/build/Makefile.build:128: /tmp/build/perf/util/pmu-flex.o] Error 1
make[4]: *** Waiting for unfinished jobs....
--- tools/perf/util/Build | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
tools/perf/util/Build +17 -3
@@ -1,3 +1,6 @@ +include $(srctree)/tools/scripts/Makefile.include +include $(srctree)/tools/scripts/utilities.mak + perf-y += arm64-frame-pointer-unwind-support.o perf-y += annotate.o perf-y += block-info.o
@@ -265,15 +268,22 @@ ifeq ($(FLEX_GE_26),1) else flex_flags := -w endif -CFLAGS_parse-events-flex.o += $(flex_flags) -CFLAGS_pmu-flex.o += $(flex_flags) -CFLAGS_expr-flex.o += $(flex_flags) # Some newer clang and gcc version complain about this # util/parse-events-bison.c:1317:9: error: variable 'parse_events_nerrs' set but not used [-Werror,-Wunused-but-set-variable] # int yynerrs = 0; 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') + 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)) + endif +endif + BISON_GE_382 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \>\= 382) ifeq ($(BISON_GE_382),1) bison_flags += -Wno-switch-enum
@@ -286,6 +296,10 @@ ifeq ($(BISON_LT_381),1) bison_flags += -DYYNOMEM=YYABORT endif +CFLAGS_parse-events-flex.o += $(flex_flags) +CFLAGS_pmu-flex.o += $(flex_flags) +CFLAGS_expr-flex.o += $(flex_flags) + CFLAGS_parse-events-bison.o += $(bison_flags) CFLAGS_pmu-bison.o += -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags) CFLAGS_expr-bison.o += -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)
Signature · 1 line
2.34.1
Re: [PATCH stable 6.1 v2 5/5] perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0
Quoted 9 lines · Florian Fainelli
From: Arnaldo Carvalho de Melo <[email protected]>
clang < 13.0.0 doesn't grok -Wno-unused-but-set-variable, so just remove it to avoid:
error: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option] make[4]: *** [/git/perf-6.5.0-rc4/tools/build/Makefile.build:128:
/tmp/build/perf/util/pmu-flex.o] Error 1
make[4]: *** Waiting for unfinished jobs....
Quoted 9 lines
Fixes ddc8e4c966923ad1 ("perf build: Disable fewer bison warnings")Cc Adrian Hunter <[email protected]>Cc Ian Rogers <[email protected]>Cc Jiri Olsa <[email protected]>Cc Namhyung Kim <[email protected]>Signed-off-by Arnaldo Carvalho de Melo <[email protected]>Signed-off-by Florian Fainelli <[email protected]>Change-Id I8db8a372d1e83d26fbe8beda2bcf4d1a871a2b80
Argh, sorry the Change-Id snuck in there, let me know if you need me to resubmit.
Signature · 1 line
Florian
Re: [PATCH stable 6.1 v2 5/5] perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0
Quoted 20 lines · Florian Fainelli
Quoted 9 lines · Florian Fainelli
From: Arnaldo Carvalho de Melo <[email protected]>
clang < 13.0.0 doesn't grok -Wno-unused-but-set-variable, so just remove it to avoid:
error: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option] make[4]: *** [/git/perf-6.5.0-rc4/tools/build/Makefile.build:128:
/tmp/build/perf/util/pmu-flex.o] Error 1
make[4]: *** Waiting for unfinished jobs....Quoted 9 lines
Fixes ddc8e4c966923ad1 ("perf build: Disable fewer bison warnings")Cc Adrian Hunter <[email protected]>Cc Ian Rogers <[email protected]>Cc Jiri Olsa <[email protected]>Cc Namhyung Kim <[email protected]>Signed-off-by Arnaldo Carvalho de Melo <[email protected]>Signed-off-by Florian Fainelli <[email protected]>Change-Id I8db8a372d1e83d26fbe8beda2bcf4d1a871a2b80
Quoted 2 lines
Argh, sorry the Change-Id snuck in there, let me know if you need me to resubmit.
I got it, no worries.
Patch "perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0" has been added to the 6.1-stable tree
In reply to Florian FainelliThis is a note to let you know that I've just added the patch titled
perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0
to the 6.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
perf-build-remove-wno-unused-but-set-variable-from-the-flex-flags-when-building-with-clang-13.0.0.patch
and it can be found in the queue-6.1 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
From [email protected] Wed May 20 22:59:29 2026
From: Florian Fainelli <[email protected]>
Date: Wed, 20 May 2026 09:33:20 -0700
Subject: perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0
To: [email protected]
Cc: Arnaldo Carvalho de Melo <[email protected]>, Adrian Hunter <[email protected]>, Ian Rogers <[email protected]>, Jiri Olsa <[email protected]>, Namhyung Kim <[email protected]>, Florian Fainelli <[email protected]>, Peter Zijlstra <[email protected]>, Ingo Molnar <[email protected]>, Arnaldo Carvalho de Melo <[email protected]>, Mark Rutland <[email protected]>, Alexander Shishkin <[email protected]>, Nathan Chancellor <[email protected]>, Nick Desaulniers <[email protected]>, Tom Rix <[email protected]>, [email protected] (open list:PERFORMANCE EVENTS SUBSYSTEM), [email protected] (open list:PERFORMANCE EVENTS SUBSYSTEM), [email protected] (open list:BPF [MISC]), [email protected] (open list:CLANG/LLVM BUILD SUPPORT), [email protected]
Message-ID: <[email protected]>
From: Arnaldo Carvalho de Melo <[email protected]>
clang < 13.0.0 doesn't grok -Wno-unused-but-set-variable, so just remove it to avoid:
error: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option] make[4]: *** [/git/perf-6.5.0-rc4/tools/build/Makefile.build:128: /tmp/build/perf/util/pmu-flex.o] Error 1
make[4]: *** Waiting for unfinished jobs....
--- tools/perf/util/Build | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
tools/perf/util/Build +17 -3
@@ -1,3 +1,6 @@ +include $(srctree)/tools/scripts/Makefile.include +include $(srctree)/tools/scripts/utilities.mak + perf-y += arm64-frame-pointer-unwind-support.o perf-y += annotate.o perf-y += block-info.o
@@ -265,15 +268,22 @@ ifeq ($(FLEX_GE_26),1) else flex_flags := -w endif -CFLAGS_parse-events-flex.o += $(flex_flags) -CFLAGS_pmu-flex.o += $(flex_flags) -CFLAGS_expr-flex.o += $(flex_flags) # Some newer clang and gcc version complain about this # util/parse-events-bison.c:1317:9: error: variable 'parse_events_nerrs' set but not used [-Werror,-Wunused-but-set-variable] # int yynerrs = 0; 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') + 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)) + endif +endif + BISON_GE_382 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \>\= 382) ifeq ($(BISON_GE_382),1) bison_flags += -Wno-switch-enum
@@ -286,6 +296,10 @@ ifeq ($(BISON_LT_381),1) bison_flags += -DYYNOMEM=YYABORT endif +CFLAGS_parse-events-flex.o += $(flex_flags) +CFLAGS_pmu-flex.o += $(flex_flags) +CFLAGS_expr-flex.o += $(flex_flags) + CFLAGS_parse-events-bison.o += $(bison_flags) CFLAGS_pmu-bison.o += -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags) CFLAGS_expr-bison.o += -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)
Patches currently in stable-queue which might be from [email protected] are
queue-6.1/perf-build-remove-wno-unused-but-set-variable-from-the-flex-flags-when-building-with-clang-13.0.0.patch queue-6.1/perf-build-conditionally-define-ndebug.patch queue-6.1/perf-parse-events-make-yydebug-dependent-on-doing-a-debug-build.patch queue-6.1/perf-build-disable-fewer-bison-warnings.patch queue-6.1/tools-build-add-3-component-logical-version-comparators.patch
Greg KH
maintainerRe: [PATCH stable 6.1 v2 5/5] perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0
In reply to Florian FainelliQuoted 17 lines · Florian Fainelli
From: Arnaldo Carvalho de Melo <[email protected]>
clang < 13.0.0 doesn't grok -Wno-unused-but-set-variable, so just remove it to avoid:
error: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option] make[4]: *** [/git/perf-6.5.0-rc4/tools/build/Makefile.build:128:
/tmp/build/perf/util/pmu-flex.o] Error 1
make[4]: *** Waiting for unfinished jobs....Fixes ddc8e4c966923ad1 ("perf build: Disable fewer bison warnings")Cc Adrian Hunter <[email protected]>Cc Ian Rogers <[email protected]>Cc Jiri Olsa <[email protected]>Cc Namhyung Kim <[email protected]>Signed-off-by Arnaldo Carvalho de Melo <[email protected]>Signed-off-by Florian Fainelli <[email protected]>
Quoted 4 lines
--- tools/perf/util/Build | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
Oops, no upstream git id? What is it?
thanks,
greg k-h