Skip to contentSkip to conversation

tools: bpftool: add missing bpf_prog_linfo forward declaration

PATCH In review Stanislav Fomichev 1 participant 2 messages Dec 19, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: bpftool: add missing bpf_prog_linfo forward declaration

When building bpftool without HAVE_LIBBFD_SUPPORT I see the following warnings:
main.h:164:23: warning: ‘struct bpf_prog_linfo’ declared inside parameter list will not be visible outside of this definition or declaration
const struct bpf_prog_linfo *prog_linfo,
^~~~~~~~~~~~~~

Move bpf_prog_linfo around so both HAVE_LIBBFD_SUPPORT and !HAVE_LIBBFD_SUPPORT see it.

Fixes b053b439b72ad152 ("bpf: libbpf: bpftool: Print bpf_line_info

during prog dump")

---
 tools/bpf/bpftool/main.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bpf/bpftool/main.h +1 -1
index d2beb88f0e2e..9487345b04a7 100644
@@ -147,8 +147,8 @@ int prog_parse_fd(int *argc, char ***argv);
 int map_parse_fd(int *argc, char ***argv);
 int map_parse_fd_and_info(int *argc, char ***argv, void *info, __u32 *info_len);
 
-#ifdef HAVE_LIBBFD_SUPPORT
 struct bpf_prog_linfo;
+#ifdef HAVE_LIBBFD_SUPPORT
 void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
 		       const char *arch, const char *disassembler_options,
 		       const struct btf *btf,
Signature · 1 line
2.20.0.405.gbc1bbc6f85-goog
#1 lore raw
Quoted 35 lines · Stanislav Fomichev

When building bpftool without HAVE_LIBBFD_SUPPORT I see the following warnings:
main.h:164:23: warning: ‘struct bpf_prog_linfo’ declared inside parameter list will not be visible outside of this definition or declaration
const struct bpf_prog_linfo *prog_linfo,
^~~~~~~~~~~~~~

Move bpf_prog_linfo around so both HAVE_LIBBFD_SUPPORT and !HAVE_LIBBFD_SUPPORT see it.

Fixes b053b439b72ad152 ("bpf: libbpf: bpftool: Print bpf_line_info

during prog dump")

---
 tools/bpf/bpftool/main.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bpf/bpftool/main.h +1 -2
index d2beb88f0e2e..9487345b04a7 100644
@@ -147,8 +147,8 @@ int prog_parse_fd(int *argc, char ***argv);
 int map_parse_fd(int *argc, char ***argv);
 int map_parse_fd_and_info(int *argc, char ***argv, void *info, __u32 *info_len);
 
-#ifdef HAVE_LIBBFD_SUPPORT
 struct bpf_prog_linfo;
+#ifdef HAVE_LIBBFD_SUPPORT
 void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
                       const char *arch, const char *disassembler_options,
                       const struct btf *btf,
--
Quoted 2 lines

2.20.0.405.gbc1bbc6f85-goog

Looks like its fixed already, please ignore!