Re: [iptables PATCH] libiptc: Avoid gcc-10 zero-length array warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 08, 2020 at 05:31:03PM +0200, Jan Engelhardt wrote:
> 
> On Thursday 2020-10-08 16:58, Phil Sutter wrote:
> >
> >While the question of whether kernel UAPI headers should adhere to
> >strict ISO C or not may be debatable, my motivation for working around
> >the situation in user space comes from Gustavo's complaints when I tried
> >to convert the relevant struct members into flexible arrays. He
> >apparently is a burnt child looking at commit 1e6e9d0f4859e ("uapi:
> >revert flexible-array conversions").
> 
> Ugh... RDMA.
> 
> iptables does not rely or even do such embedding nonsense. When we
> have a flexible array member T x[0] or T x[] somewhere, we really do
> mean that Ts follow, not some Us like in the RDMA case.

In fact, struct ipt_replace has a zero-length array as last field of
type struct ipt_entry which in turn has a zero-length array as last
field. :)

Embedding is allowed as a gcc-extension. So while my initial approach at
getting rid of the warning in iptables compile-output worked, it didn't
make the header ISO C compatible.

> It's probably fair to restore [] for our headers.

Since gcc in pedantic mode neither accepts zero length arrays nor
embedded structs with flexible member arrays, doing so won't break ISO C
compatibility at least. ;)

Cheers, Phil



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux