]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
tools: bpftool: move "__printf()" attributes to header file
authorQuentin Monnet <quentin.monnet@netronome.com>
Thu, 15 Aug 2019 14:32:20 +0000 (15:32 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 16 Aug 2019 05:06:46 +0000 (22:06 -0700)
commit8918dc42dc85ba6981028f65a989c478eb80bc02
treefb4d3e3897a5731d4d7bf7a856eb8dc197157c62
parentb0ead6d75a5b335287337e602e6b815e1115481c
tools: bpftool: move "__printf()" attributes to header file

Some functions in bpftool have a "__printf()" format attributes to tell
the compiler they should expect printf()-like arguments. But because
these attributes are not used for the function prototypes in the header
files, the compiler does not run the checks everywhere the functions are
used, and some mistakes on format string and corresponding arguments
slipped in over time.

Let's move the __printf() attributes to the correct places.

Note: We add guards around the definition of GCC_VERSION in
tools/include/linux/compiler-gcc.h to prevent a conflict in jit_disasm.c
on GCC_VERSION from headers pulled via libbfd.

Fixes: c101189bc968 ("tools: bpftool: fix -Wmissing declaration warnings")
Reported-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/bpf/bpftool/common.c
tools/bpf/bpftool/json_writer.c
tools/bpf/bpftool/json_writer.h
tools/bpf/bpftool/main.h
tools/include/linux/compiler-gcc.h