]> www.infradead.org Git - users/hch/misc.git/commit
bpftool: Add -Wformat-signedness flag to detect format errors
authorJiayuan Chen <jiayuan.chen@linux.dev>
Tue, 11 Mar 2025 11:28:08 +0000 (19:28 +0800)
committerAndrii Nakryiko <andrii@kernel.org>
Mon, 17 Mar 2025 20:50:56 +0000 (13:50 -0700)
commit8d86767be9c9b94f196e663e0ca88e2eb604a20e
tree7a1e483a41b5ad31d25a616185dd2dd8e274e6f9
parentb02f072a36560a89155a1ebcb2ca6bd881333a8b
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
tools/bpf/bpftool/Makefile