Skip to content

Commit 5a0fd08

Browse files
olsajiriNobody
authored andcommitted
bpftool: Fix generated code in codegen_asserts
Arnaldo reported perf compilation fail with: $ make -k BUILD_BPF_SKEL=1 CORESIGHT=1 PYTHON=python3 ... In file included from util/bpf_counter.c:28: /tmp/build/perf//util/bpf_skel/bperf_leader.skel.h: In function ‘bperf_leader_bpf__assert’: /tmp/build/perf//util/bpf_skel/bperf_leader.skel.h:351:51: error: unused parameter ‘s’ [-Werror=unused-parameter] 351 | bperf_leader_bpf__assert(struct bperf_leader_bpf *s) | ~~~~~~~~~~~~~~~~~~~~~~~~~^ cc1: all warnings being treated as errors If there's nothing to generate in the new assert function, we will get unused 's' warn/error, adding 'unused' attribute to it. Cc: Delyan Kratunov <delyank@fb.com> Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com> Fixes: 08d4dba ("bpftool: Bpf skeletons assert type sizes") Signed-off-by: Jiri Olsa <jolsa@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent bb05f84 commit 5a0fd08

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/bpf/bpftool/gen.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ static void codegen_asserts(struct bpf_object *obj, const char *obj_name)
477477
codegen("\
478478
\n\
479479
__attribute__((unused)) static void \n\
480-
%1$s__assert(struct %1$s *s) \n\
480+
%1$s__assert(struct %1$s *s __attribute__((unused))) \n\
481481
{ \n\
482482
#ifdef __cplusplus \n\
483483
#define _Static_assert static_assert \n\

0 commit comments

Comments
 (0)