Re: [PATCH v3] bpf.2: Use standard types and attributes

Daniel Borkmann
2021-05-17T18:56:37Z

On 5/16/21 11:16 AM, Alejandro Colomar (man-pages) wrote:
> On 5/15/21 9:01 PM, Alejandro Colomar wrote:
>> Some manual pages are already using C99 syntax for integral
>> types 'uint32_t', but some aren't.  There are some using kernel
>> syntax '__u32'.  Fix those.
>>
>> Both the kernel and the standard types are 100% binary compatible,
>> and the source code differences between them are very small, and
>> not important in a manual page:
>>
>> - Some of them are implemented with different underlying types
>>    (e.g., s64 is always long long, while int64_t may be long long
>>    or long, depending on the arch).  This causes the following
>>    differences.
>>
>> - length modifiers required by printf are different, resulting in
>>    a warning ('-Wformat=').
>>
>> - pointer assignment causes a warning:
>>    ('-Wincompatible-pointer-types'), but there aren't any pointers
>>    in this page.
>>
>> But, AFAIK, all of those warnings can be safely ignored, due to
>> the binary compatibility between the types.
>>
>> ...
>>
>> Some pages also document attributes, using GNU syntax
>> '__attribute__((xxx))'.  Update those to use the shorter and more
>> portable C11 keywords such as 'alignas()' when possible, and C2x
>> syntax '[[gnu::xxx]]' elsewhere, which hasn't been standardized
>> yet, but is already implemented in GCC, and available through
>> either --std=c2x or any of the --std=gnu... options.
>>
>> The standard isn't very clear on how to use alignas() or
>> [[]]-style attributes, and the GNU documentation isn't better, so
>> the following link is a useful experiment about the different
>> alignment syntaxes:
>> __attribute__((aligned())), alignas(), and [[gnu::aligned()]]:
>> <https://stackoverflow.com/q/67271825/6872717>
>>
>> Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
> Discussion: <https://lore.kernel.org/linux-man/6740a229-842e-b368-86eb-defc786b3658@gmail.com/T/>
>> Nacked-by: Alexei Starovoitov <ast@kernel.org>
>> Nacked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

You forgot to retain my ...

Nacked-by: Daniel Borkmann <daniel@iogearbox.net>

>> Acked-by: Zack Weinberg <zackw@panix.com>
>> Cc: LKML <linux-kernel@vger.kernel.org>
>> Cc: glibc <libc-alpha@sourceware.org>
>> Cc: GCC <gcc-patches@gcc.gnu.org>
>> Cc: bpf <bpf@vger.kernel.org>
>> Cc: David Laight <David.Laight@ACULAB.COM>
>> Cc: Joseph Myers <joseph@codesourcery.com>
>> Cc: Florian Weimer <fweimer@redhat.com>
>> Cc: Daniel Borkmann <daniel@iogearbox.net>
>> ---
>>   man2/bpf.2 | 49 ++++++++++++++++++++++++-------------------------
>>   1 file changed, 24 insertions(+), 25 deletions(-)
>>