[SLOF] [PATCH] lib/libnet/ipv6: Silence compiler warning from Clang
Segher Boessenkool
segher at kernel.crashing.org
Wed Jun 29 01:19:27 AEST 2022
Hi!
On Tue, Jun 28, 2022 at 06:40:23PM +1000, Alexey Kardashevskiy wrote:
> On 6/28/22 16:34, Thomas Huth wrote:
> >On 28/06/2022 00.05, Segher Boessenkool wrote:
> >>On Mon, Jun 27, 2022 at 10:26:32AM +0200, Thomas Huth wrote:
> >>>When compiling the libnet code with Clang (e.g. for the s390-ccw bios),
> >>>it complains with the following warning:
> >>>
> >>> ipv6.c:447:18: warning: variable length array folded to constant array
> >>> as an extension [-Wgnu-folding-constant]
> >>> unsigned short raw[ip6size];
> >>> ^
> >>>The warning is completely harmless, of course. Anyway let's rewrite the
> >>>code a little bit to make the compiler silent again.
> >>
> >>This makes the code worse though :-(
> >>
> >>You could shut off the silly warning instead? Clang claims to be
> >>compatible to GCC, and GCC explicitly allows variable-length auto
> >>arrays even in C90 mode. This is documented, too.
> >
> >Ok, can do, SLOF itself cannot be compiled with Clang anyway, so it
> >likely makes more sense indeed to disable this warning in the s390-ccw
> >bios that uses SLOF's libnet.
>
> I rather like the initial idea of getting rid of ip6size, I tend to
> (incorrectly) read "ip6size" as "size of the ipv6 header in bytes" (as
> sizes are almost always bytes) which it is not here.
It could use a better name no matter what, it doesn't even say "header" :-)
Using ARRAY_SIZE this will probably look a lot better, with or without
the change?
Segher
More information about the SLOF
mailing list