From 41d0914d861e82b4eeec16dd0f6109c311cf4c7e Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Wed, 20 Jul 2022 14:59:22 -0300 Subject: [PATCH] perf python: Ignore unused command line arguments when building with clang Noticed after switching to python3 by default on some older fedora releases: 35 38.20 fedora:27 : FAIL clang version 5.0.2 (tags/RELEASE_502/final) clang-5.0: error: argument unused during compilation: '-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1' [-Werror,-Wunused-command-line-argument] clang-5.0: error: argument unused during compilation: '-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1' [-Werror,-Wunused-command-line-argument] error: command 'clang' failed with exit status 1 Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/scripts/perl/Perf-Trace-Util/Build | 4 ++++ tools/perf/util/setup.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/Build b/tools/perf/scripts/perl/Perf-Trace-Util/Build index 79b43b98dbf6e..cc76be005d5eb 100644 --- a/tools/perf/scripts/perl/Perf-Trace-Util/Build +++ b/tools/perf/scripts/perl/Perf-Trace-Util/Build @@ -3,3 +3,7 @@ perf-y += Context.o CFLAGS_Context.o += $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-bad-function-cast -Wno-declaration-after-statement -Wno-switch-enum CFLAGS_Context.o += -Wno-unused-parameter -Wno-nested-externs -Wno-undef CFLAGS_Context.o += -Wno-switch-default -Wno-shadow + +ifeq ($(CC_NO_CLANG), 1) + CFLAGS_Context.o += -Wno-unused-command-line-argument +endif diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py index 5a3c74bce8369..5b1e6468d5e8b 100644 --- a/tools/perf/util/setup.py +++ b/tools/perf/util/setup.py @@ -48,7 +48,9 @@ class install_lib(_install_lib): cflags = getenv('CFLAGS', '').split() # switch off several checks (need to be at the end of cflags list) cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter', '-Wno-redundant-decls', '-DPYTHON_PERF' ] -if not cc_is_clang: +if cc_is_clang: + cflags += ["-Wno-unused-command-line-argument" ] +else: cflags += ['-Wno-cast-function-type' ] src_perf = getenv('srctree') + '/tools/perf' -- 2.30.2