Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Yonghong Song <yhs@fb.com>
Cc: Andrii Nakryiko <andriin@fb.com>, bpf <bpf@vger.kernel.org>,
	Networking <netdev@vger.kernel.org>,
	Alexei Starovoitov <ast@fb.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH bpf-next 1/7] libbpf: disable -Wswitch-enum compiler warning
Date: Tue, 18 Aug 2020 18:39:14 -0700	[thread overview]
Message-ID: <CAEf4BzaTWVhymaGuSHHHL8+TCbP=qRFc+YvG+ZMYMNTEg-vA-A@mail.gmail.com> (raw)
In-Reply-To: <b26b5c66-f335-2e47-bf6c-f557853ce2d7@fb.com>

On Tue, Aug 18, 2020 at 6:23 PM Yonghong Song <yhs@fb.com> wrote:
>
>
>
> On 8/18/20 2:33 PM, Andrii Nakryiko wrote:
> > That compilation warning is more annoying, than helpful.
>
> Curious which compiler and which version caused this issue?
> I did not hit with gcc 8.2 or latest clang in my environment.
>

Strange, I just tried on bpf-next, removed -Wno-switch-enum and got
tons of errors:

libbpf.c: In function ‘bpf_object__sanitize_prog’:
libbpf.c:5560:3: error: enumeration value ‘BPF_FUNC_unspec’ not
handled in switch [-Werror=switch-enum]
   switch (func_id) {
   ^~~~~~
libbpf.c:5560:3: error: enumeration value ‘BPF_FUNC_map_lookup_elem’
not handled in switch [-Werror=switch-enum]
libbpf.c:5560:3: error: enumeration value ‘BPF_FUNC_map_update_elem’
not handled in switch [-Werror=switch-enum]
... and many more ...

My compiler:

$ cc --version
cc (GCC) 8.2.1 20180801 (Red Hat 8.2.1-2)


> >
> > Signed-off-by: Andrii Nakryiko <andriin@fb.com>
> > ---
> >   tools/lib/bpf/Makefile | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> > index bf8ed134cb8a..95c946e94ca5 100644
> > --- a/tools/lib/bpf/Makefile
> > +++ b/tools/lib/bpf/Makefile
> > @@ -107,7 +107,7 @@ ifeq ($(feature-reallocarray), 0)
> >   endif
> >
> >   # Append required CFLAGS
> > -override CFLAGS += $(EXTRA_WARNINGS)
> > +override CFLAGS += $(EXTRA_WARNINGS) -Wno-switch-enum
> >   override CFLAGS += -Werror -Wall
> >   override CFLAGS += -fPIC
> >   override CFLAGS += $(INCLUDES)
> >

  reply	other threads:[~2020-08-19  1:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-18 21:33 [PATCH bpf-next 0/7] libbpf feature probing and sanitization improvements Andrii Nakryiko
2020-08-18 21:33 ` [PATCH bpf-next 1/7] libbpf: disable -Wswitch-enum compiler warning Andrii Nakryiko
2020-08-19  1:23   ` Yonghong Song
2020-08-19  1:39     ` Andrii Nakryiko [this message]
2020-08-19  5:44       ` Yonghong Song
2020-08-18 21:33 ` [PATCH bpf-next 2/7] libbpf: make kernel feature probing lazy Andrii Nakryiko
2020-08-18 21:33 ` [PATCH bpf-next 3/7] libbpf: factor out common logic of testing and closing FD Andrii Nakryiko
2020-08-18 21:33 ` [PATCH bpf-next 4/7] libbpf: sanitize BPF program code for bpf_probe_read_{kernel,user}[_str] Andrii Nakryiko
2020-08-19  1:42   ` Yonghong Song
2020-08-19 20:11     ` Andrii Nakryiko
2020-08-19 20:15       ` Alexei Starovoitov
2020-08-19 20:23         ` Andrii Nakryiko
2020-08-18 21:33 ` [PATCH bpf-next 5/7] selftests/bpf: fix test_vmlinux test to use bpf_probe_read_user() Andrii Nakryiko
2020-08-18 21:33 ` [PATCH bpf-next 6/7] libbpf: switch tracing and CO-RE helper macros to bpf_probe_read_kernel() Andrii Nakryiko
2020-08-18 21:33 ` [PATCH bpf-next 7/7] libbpf: detect minimal BTF support and skip BTF loading, if missing Andrii Nakryiko
2020-08-19  0:24 ` [PATCH bpf-next 0/7] libbpf feature probing and sanitization improvements Alexei Starovoitov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAEf4BzaTWVhymaGuSHHHL8+TCbP=qRFc+YvG+ZMYMNTEg-vA-A@mail.gmail.com' \
    --to=andrii.nakryiko@gmail.com \
    --cc=andriin@fb.com \
    --cc=ast@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=yhs@fb.com \
    --subject='Re: [PATCH bpf-next 1/7] libbpf: disable -Wswitch-enum compiler warning' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).