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

Alexey Kardashevskiy aik at ozlabs.ru
Tue Jun 28 18:40:23 AEST 2022



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.



-- 
Alexey


More information about the SLOF mailing list