[SLOF] [PATCH] lib/libnet/ipv6: Silence compiler warning from Clang

Segher Boessenkool segher at kernel.crashing.org
Tue Jun 28 08:05:31 AEST 2022

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.

[ That it is "folded to a constant array" is a) completely untrue, and b)
that it is folded to a constant _size_ array is just a trivial and
obvious optimisation, that you can expect any good compiler to do. ]


More information about the SLOF mailing list