netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Jan Engelhardt <jengelh@inai.de>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>, netfilter-devel@vger.kernel.org
Subject: Re: [iptables PATCH] libiptc: Avoid gcc-10 zero-length array warning
Date: Thu, 8 Oct 2020 18:07:14 +0200	[thread overview]
Message-ID: <20201008160714.GB13016@orbyte.nwl.cc> (raw)
In-Reply-To: <q9379q5-3n1-p1r-1ro4-n5q2r086574q@vanv.qr>

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

  reply	other threads:[~2020-10-08 16:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-08 13:01 [iptables PATCH] libiptc: Avoid gcc-10 zero-length array warning Phil Sutter
2020-10-08 14:33 ` Jan Engelhardt
2020-10-08 14:58   ` Phil Sutter
2020-10-08 15:31     ` Jan Engelhardt
2020-10-08 16:07       ` Phil Sutter [this message]
2020-10-08 16:46         ` Jan Engelhardt
2020-10-09 15:16           ` Phil Sutter
2020-10-09 16:43             ` Jan Engelhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201008160714.GB13016@orbyte.nwl.cc \
    --to=phil@nwl.cc \
    --cc=jengelh@inai.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).