mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: David Laight <David.Laight@ACULAB.COM>
Cc: 'Arnd Bergmann' <arnd@kernel.org>,
	Sam Ravnborg <sam@ravnborg.org>,
	"David S . Miller" <davem@davemloft.net>,
	"sparclinux@vger.kernel.org" <sparclinux@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] sparc: mdesc: Fix compile error seen with gcc 11.x
Date: Tue, 14 Sep 2021 08:17:47 -0700	[thread overview]
Message-ID: <20210914151747.GC3457579@roeck-us.net> (raw)
In-Reply-To: <549b61046b134234bd4bffd85315f29a@AcuMS.aculab.com>

On Tue, Sep 14, 2021 at 03:03:51PM +0000, David Laight wrote:
> From: Arnd Bergmann
> > Sent: 14 September 2021 15:54
> > 
> > On Tue, Sep 14, 2021 at 4:24 PM Guenter Roeck <linux@roeck-us.net> wrote:
> > > On 9/14/21 7:17 AM, David Laight wrote:
> > > >> Sorry, I didn't realize that a field of size 0 increases the structure size
> > > >> on sparc. I had checked the size of the old and the new structure with gcc
> > > >> on x86_64 and didn't see a field size increase.
> > > >
> > > > clang output doesn't change:
> > > >
> > > > https://godbolt.org/z/bTeeq19j1
> > > >
> > > > gcc ought to generate the same size.
> > > >
> > > > It ought to be 'char data[];' though.
> > > >
> > >
> > > I am never sure if [] or [0] is "correct". Anyway, is there agreement that this
> > > is an acceptable solution ? I'll be happy to resend if that is the case.
> > 
> > Yes, looks good to me, in the [] version. I think the [0] version can be
> > interpreted as a zero-length array that may not be accessed, while the
> > [] flexible array syntax clearly means that extra data follows, and it's
> > part of the C standard now, while [0] is a gcc extension.
> 
> More problematic is where is the correct place for the 'char data[]'.
> It follows the header rather than being part of it.

I personally always prefer the simple solution, and I don't really care
about such nuances. I take it as granted that a header is followed by data,
and I think that a zero-length field at the end of a header is a perfectly
valid means to express that, but that is just my personal opinion.

Anyway, I take that as non-agreement and won't resend at this time.

Thanks,
Guenter

      reply	other threads:[~2021-09-14 15:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13 16:37 Guenter Roeck
     [not found] ` <YT+SPIAl0IdWOAn/@ravnborg.org>
2021-09-13 18:52   ` Guenter Roeck
2021-09-14 12:02     ` Anatoly Pugachev
2021-09-14 14:17     ` David Laight
2021-09-14 14:24       ` Guenter Roeck
2021-09-14 14:53         ` Arnd Bergmann
2021-09-14 15:03           ` David Laight
2021-09-14 15:17             ` Guenter Roeck [this message]

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=20210914151747.GC3457579@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=David.Laight@ACULAB.COM \
    --cc=arnd@kernel.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    --cc=sparclinux@vger.kernel.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

all inboxes | Powered by JetHome®