[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250925-perf_build_android_ndk-v1-3-8b35aadde3dc@arm.com>
Date: Thu, 25 Sep 2025 11:26:27 +0100
From: Leo Yan <leo.yan@....com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>,
Namhyung Kim <namhyung@...nel.org>, Jiri Olsa <jolsa@...nel.org>,
Ian Rogers <irogers@...gle.com>, Adrian Hunter <adrian.hunter@...el.com>,
Quentin Monnet <qmo@...nel.org>, Andrii Nakryiko <andrii@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <nick.desaulniers+lkml@...il.com>,
Bill Wendling <morbo@...gle.com>, Justin Stitt <justinstitt@...gle.com>,
Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <martin.lau@...ux.dev>,
Eduard Zingerman <eddyz87@...il.com>, Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>,
John Fastabend <john.fastabend@...il.com>, KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>,
James Clark <james.clark@...aro.org>
Cc: linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
llvm@...ts.linux.dev, bpf@...r.kernel.org, Leo Yan <leo.yan@....com>
Subject: [PATCH 3/8] bpftool: Conditionally add -Wformat-signedness flag
clang-18.1.3 on Ubuntu 24.04.2 reports warning:
warning: unknown warning option '-Wformat-signedness' [-Wunknown-warning-option]
Conditionally add the option only when it is supported by compiler.
Signed-off-by: Leo Yan <leo.yan@....com>
---
tools/bpf/bpftool/Makefile | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
index 9e9a5f006cd2aabe1e89bd83e394455c0d4473e0..948a0cc98b39d3f9afa0de73643eab04e8798ff5 100644
--- a/tools/bpf/bpftool/Makefile
+++ b/tools/bpf/bpftool/Makefile
@@ -64,11 +64,21 @@ $(LIBBPF_BOOTSTRAP)-clean: FORCE | $(LIBBPF_BOOTSTRAP_OUTPUT)
prefix ?= /usr/local
bash_compdir ?= /usr/share/bash-completion/completions
+try-run = $(shell set -e; \
+ if ($(1)) >/dev/null 2>&1; \
+ then echo "$(2)"; \
+ else echo "$(3)"; \
+ fi)
+
+__cc-option = $(call try-run,\
+ $(1) -Werror $(2) -c -x c /dev/null -o /dev/null,$(2),)
+cc-option = $(call __cc-option, $(CC),$(1))
+
CFLAGS += -O2
CFLAGS += -W
CFLAGS += -Wall
CFLAGS += -Wextra
-CFLAGS += -Wformat-signedness
+CFLAGS += $(call cc-option,-Wformat-signedness)
CFLAGS += -Wno-unused-parameter
CFLAGS += -Wno-missing-field-initializers
CFLAGS += $(filter-out -Wswitch-enum -Wnested-externs,$(EXTRA_WARNINGS))
--
2.34.1
Powered by blists - more mailing lists