diff mbox series

[bpf-next,1/7] tools: bpftool: silence 'missing initializer' warnings

Message ID cdaa014f73cc5ca41829579ecce8c364a03ee07a.1520545951.git.jbenc@redhat.com
State Accepted, archived
Delegated to: BPF Maintainers
Headers show
Series tools: bpf: standardize make | expand

Commit Message

Jiri Benc March 8, 2018, 10 p.m. UTC
When building bpf tool, gcc emits piles of warnings:

prog.c: In function ‘prog_fd_by_tag’:
prog.c:101:9: warning: missing initializer for field ‘type’ of ‘struct bpf_prog_info’ [-Wmissing-field-initializers]
  struct bpf_prog_info info = {};
         ^
In file included from /home/storage/jbenc/git/net-next/tools/lib/bpf/bpf.h:26:0,
                 from prog.c:47:
/home/storage/jbenc/git/net-next/tools/include/uapi/linux/bpf.h:925:8: note: ‘type’ declared here
  __u32 type;
        ^

As these warnings are not useful, switch them off.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
---
 tools/bpf/bpftool/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jakub Kicinski March 9, 2018, 7:38 a.m. UTC | #1
On Thu,  8 Mar 2018 23:00:35 +0100, Jiri Benc wrote:
> When building bpf tool, gcc emits piles of warnings:
> 
> prog.c: In function ‘prog_fd_by_tag’:
> prog.c:101:9: warning: missing initializer for field ‘type’ of ‘struct bpf_prog_info’ [-Wmissing-field-initializers]
>   struct bpf_prog_info info = {};
>          ^
> In file included from /home/storage/jbenc/git/net-next/tools/lib/bpf/bpf.h:26:0,
>                  from prog.c:47:
> /home/storage/jbenc/git/net-next/tools/include/uapi/linux/bpf.h:925:8: note: ‘type’ declared here
>   __u32 type;
>         ^
> 
> As these warnings are not useful, switch them off.
> 
> Signed-off-by: Jiri Benc <jbenc@redhat.com>

FWIW I couldn't reproduce this one.  Out of curiosity what GCC did you
use?
Jiri Benc March 9, 2018, 8:42 a.m. UTC | #2
On Thu, 8 Mar 2018 23:38:12 -0800, Jakub Kicinski wrote:
> FWIW I couldn't reproduce this one.  Out of curiosity what GCC did you
> use?

gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16)

 Jiri
diff mbox series

Patch

diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
index 26901ec87361..4c2867481f5c 100644
--- a/tools/bpf/bpftool/Makefile
+++ b/tools/bpf/bpftool/Makefile
@@ -38,7 +38,7 @@  bash_compdir ?= /usr/share/bash-completion/completions
 CC = gcc
 
 CFLAGS += -O2
-CFLAGS += -W -Wall -Wextra -Wno-unused-parameter -Wshadow
+CFLAGS += -W -Wall -Wextra -Wno-unused-parameter -Wshadow -Wno-missing-field-initializers
 CFLAGS += -DPACKAGE='"bpftool"' -D__EXPORTED_HEADERS__ -I$(srctree)/tools/include/uapi -I$(srctree)/tools/include -I$(srctree)/tools/lib/bpf -I$(srctree)/kernel/bpf/
 CFLAGS += -DBPFTOOL_VERSION='"$(BPFTOOL_VERSION)"'
 LIBS = -lelf -lbfd -lopcodes $(LIBBPF)