From: Michael Forney <mforney@mforney.org>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: "Daniel Borkmann" <daniel@iogearbox.net>,
"Toke Høiland-Jørgensen" <toke@redhat.com>,
"Andrii Nakryiko" <andrii.nakryiko@gmail.com>,
"Andrii Nakryiko" <andriin@fb.com>, bpf <bpf@vger.kernel.org>,
Networking <netdev@vger.kernel.org>,
"Alexei Starovoitov" <ast@fb.com>,
"Kernel Team" <kernel-team@fb.com>, "Yonghong Song" <yhs@fb.com>
Subject: Re: [PATCH v3 bpf-next 1/3] bpf: switch BPF UAPI #define constants used from BPF program side to enums
Date: Tue, 2 Jun 2020 16:21:00 -0700 [thread overview]
Message-ID: <CAGw6cBuF8Dj-22bH=ryL+17N48pwMD5hN49sH4AHYYyMm2xgtg@mail.gmail.com> (raw)
In-Reply-To: <20200602230720.hf2ysnlssg67cpmw@ast-mbp.dhcp.thefacebook.com>
On 2020-06-02, Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote:
> the enum definition of BPF_F_CTXLEN_MASK is certainly within standard.
> I don't think kernel should adjust its headers because some compiler
> is failing to understand C standard.
This is not true. See C11 6.7.2.2p2: "The expression that defines the
value of an enumeration constant shall be an integer constant
expression that has a value representable as an int."
You can also see this with gcc if you turn on -Wpedantic and include
it in a way such that warnings are not silenced:
$ gcc -Wpedantic -x c -c -o /dev/null /usr/include/linux/bpf.h
/usr/include/linux/bpf.h:76:7: warning: ISO C forbids zero-size array
'data' [-Wpedantic]
76 | __u8 data[0]; /* Arbitrary size */
| ^~~~
/usr/include/linux/bpf.h:3220:22: warning: ISO C restricts enumerator
values to range of 'int' [-Wpedantic]
3220 | BPF_F_INDEX_MASK = 0xffffffffULL,
| ^~~~~~~~~~~~~
/usr/include/linux/bpf.h:3221:23: warning: ISO C restricts enumerator
values to range of 'int' [-Wpedantic]
3221 | BPF_F_CURRENT_CPU = BPF_F_INDEX_MASK,
| ^~~~~~~~~~~~~~~~
/usr/include/linux/bpf.h:3223:23: warning: ISO C restricts enumerator
values to range of 'int' [-Wpedantic]
3223 | BPF_F_CTXLEN_MASK = (0xfffffULL << 32),
| ^
/usr/include/linux/bpf.h:3797:8: warning: ISO C forbids zero-size
array 'args' [-Wpedantic]
3797 | __u64 args[0];
| ^~~~
$
-Michael
next prev parent reply other threads:[~2020-06-02 23:21 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-03 0:32 [PATCH v3 bpf-next 0/3] Convert BPF UAPI constants into enum values Andrii Nakryiko
2020-03-03 0:32 ` [PATCH v3 bpf-next 1/3] bpf: switch BPF UAPI #define constants used from BPF program side to enums Andrii Nakryiko
2020-03-03 23:01 ` Daniel Borkmann
2020-03-03 23:24 ` Andrii Nakryiko
2020-03-04 9:37 ` Toke Høiland-Jørgensen
2020-03-04 15:38 ` Daniel Borkmann
2020-03-04 15:50 ` Alexei Starovoitov
2020-03-04 16:03 ` Daniel Borkmann
2020-03-04 15:57 ` Daniel Borkmann
2020-03-04 16:02 ` Andrii Nakryiko
2020-03-04 16:07 ` Alexei Starovoitov
2020-03-05 10:50 ` Toke Høiland-Jørgensen
2020-06-02 5:31 ` Michael Forney
2020-06-02 19:17 ` Alexei Starovoitov
2020-06-02 21:40 ` Michael Forney
2020-06-02 23:07 ` Alexei Starovoitov
2020-06-02 23:21 ` Michael Forney [this message]
2020-06-02 23:36 ` Alexei Starovoitov
2020-06-03 21:22 ` Michael Forney
2020-03-03 0:32 ` [PATCH v3 bpf-next 2/3] libbpf: assume unsigned values for BTF_KIND_ENUM Andrii Nakryiko
2020-03-03 0:32 ` [PATCH v3 bpf-next 3/3] tools/runqslower: drop copy/pasted BPF_F_CURRENT_CPU definiton Andrii Nakryiko
2020-03-04 15:21 ` [PATCH v3 bpf-next 0/3] Convert BPF UAPI constants into enum values Daniel Borkmann
2020-03-04 15:34 ` Andrii Nakryiko
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='CAGw6cBuF8Dj-22bH=ryL+17N48pwMD5hN49sH4AHYYyMm2xgtg@mail.gmail.com' \
--to=mforney@mforney.org \
--cc=alexei.starovoitov@gmail.com \
--cc=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=toke@redhat.com \
--cc=yhs@fb.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).