diff options
author | 2025-03-11 19:28:08 +0800 | |
---|---|---|
committer | 2025-03-17 13:50:56 -0700 | |
commit | 8d86767be9c9b94f196e663e0ca88e2eb604a20e (patch) | |
tree | 7a1e483a41b5ad31d25a616185dd2dd8e274e6f9 /tools/bpf | |
parent | Merge branch 'support-freplace-prog-from-user-namespace' (diff) | |
download | wireguard-linux-8d86767be9c9b94f196e663e0ca88e2eb604a20e.tar.xz wireguard-linux-8d86767be9c9b94f196e663e0ca88e2eb604a20e.zip |
bpftool: Add -Wformat-signedness flag to detect format errors
This commit adds the -Wformat-signedness compiler flag to detect and
prevent printf format errors, where signed or unsigned types are
mismatched with format specifiers. This helps to catch potential issues at
compile-time, ensuring that our code is more robust and reliable. With
this flag, the compiler will now warn about incorrect format strings, such
as using %d with unsigned types or %u with signed types.
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20250311112809.81901-2-jiayuan.chen@linux.dev
Diffstat (limited to 'tools/bpf')
-rw-r--r-- | tools/bpf/bpftool/Makefile | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile index dd9f3ec84201..efe867dd2821 100644 --- a/tools/bpf/bpftool/Makefile +++ b/tools/bpf/bpftool/Makefile @@ -71,7 +71,12 @@ prefix ?= /usr/local bash_compdir ?= /usr/share/bash-completion/completions CFLAGS += -O2 -CFLAGS += -W -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers +CFLAGS += -W +CFLAGS += -Wall +CFLAGS += -Wextra +CFLAGS += -Wformat-signedness +CFLAGS += -Wno-unused-parameter +CFLAGS += -Wno-missing-field-initializers CFLAGS += $(filter-out -Wswitch-enum -Wnested-externs,$(EXTRA_WARNINGS)) CFLAGS += -DPACKAGE='"bpftool"' -D__EXPORTED_HEADERS__ \ -I$(or $(OUTPUT),.) \ |