summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuentin Monnet <quentin.monnet@netronome.com>2019-08-14 07:37:24 -0400
committerDaniel Borkmann <daniel@iogearbox.net>2019-08-14 16:57:36 -0400
commita9436dca115d121d98e0b30f078f3294ce13fa18 (patch)
tree0d9cbcb6238cc5c3c359ff39209eb616b122612f
parentc162610c7db2e9611a7b3ec806f9c97fcfec0b0b (diff)
tools: bpftool: compile with $(EXTRA_WARNINGS)
Compile bpftool with $(EXTRA_WARNINGS), as defined in scripts/Makefile.include, and fix the new warnings produced. Simply leave -Wswitch-enum out of the warning list, as we have several switch-case structures where it is not desirable to process all values of an enum. Remove -Wshadow from the warnings we manually add to CFLAGS, as it is handled in $(EXTRA_WARNINGS). Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com> Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-rw-r--r--tools/bpf/bpftool/Makefile3
-rw-r--r--tools/bpf/bpftool/cgroup.c2
-rw-r--r--tools/bpf/bpftool/perf.c4
3 files changed, 7 insertions, 2 deletions
diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
index 4c9d1ffc3fc7..f284c207765a 100644
--- a/tools/bpf/bpftool/Makefile
+++ b/tools/bpf/bpftool/Makefile
@@ -37,7 +37,8 @@ prefix ?= /usr/local
37bash_compdir ?= /usr/share/bash-completion/completions 37bash_compdir ?= /usr/share/bash-completion/completions
38 38
39CFLAGS += -O2 39CFLAGS += -O2
40CFLAGS += -W -Wall -Wextra -Wno-unused-parameter -Wshadow -Wno-missing-field-initializers 40CFLAGS += -W -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers
41CFLAGS += $(filter-out -Wswitch-enum,$(EXTRA_WARNINGS))
41CFLAGS += -DPACKAGE='"bpftool"' -D__EXPORTED_HEADERS__ \ 42CFLAGS += -DPACKAGE='"bpftool"' -D__EXPORTED_HEADERS__ \
42 -I$(srctree)/kernel/bpf/ \ 43 -I$(srctree)/kernel/bpf/ \
43 -I$(srctree)/tools/include \ 44 -I$(srctree)/tools/include \
diff --git a/tools/bpf/bpftool/cgroup.c b/tools/bpf/bpftool/cgroup.c
index 44352b5aca85..1ef45e55039e 100644
--- a/tools/bpf/bpftool/cgroup.c
+++ b/tools/bpf/bpftool/cgroup.c
@@ -120,8 +120,8 @@ static int count_attached_bpf_progs(int cgroup_fd, enum bpf_attach_type type)
120static int show_attached_bpf_progs(int cgroup_fd, enum bpf_attach_type type, 120static int show_attached_bpf_progs(int cgroup_fd, enum bpf_attach_type type,
121 int level) 121 int level)
122{ 122{
123 const char *attach_flags_str;
123 __u32 prog_ids[1024] = {0}; 124 __u32 prog_ids[1024] = {0};
124 char *attach_flags_str;
125 __u32 prog_cnt, iter; 125 __u32 prog_cnt, iter;
126 __u32 attach_flags; 126 __u32 attach_flags;
127 char buf[32]; 127 char buf[32];
diff --git a/tools/bpf/bpftool/perf.c b/tools/bpf/bpftool/perf.c
index f2a545e667c4..b2046f33e23f 100644
--- a/tools/bpf/bpftool/perf.c
+++ b/tools/bpf/bpftool/perf.c
@@ -104,6 +104,8 @@ static void print_perf_json(int pid, int fd, __u32 prog_id, __u32 fd_type,
104 jsonw_string_field(json_wtr, "filename", buf); 104 jsonw_string_field(json_wtr, "filename", buf);
105 jsonw_lluint_field(json_wtr, "offset", probe_offset); 105 jsonw_lluint_field(json_wtr, "offset", probe_offset);
106 break; 106 break;
107 default:
108 break;
107 } 109 }
108 jsonw_end_object(json_wtr); 110 jsonw_end_object(json_wtr);
109} 111}
@@ -140,6 +142,8 @@ static void print_perf_plain(int pid, int fd, __u32 prog_id, __u32 fd_type,
140 printf("uretprobe filename %s offset %llu\n", buf, 142 printf("uretprobe filename %s offset %llu\n", buf,
141 probe_offset); 143 probe_offset);
142 break; 144 break;
145 default:
146 break;
143 } 147 }
144} 148}
145 149