public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Pujin Shi <shipujin.t@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>,
	Claudiu Manoil <claudiu.manoil@nxp.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Xiaoliang Yang <xiaoliang.yang_1@nxp.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net: ethernet: mscc: fix missing brace warning for old compilers
Date: Mon, 2 Nov 2020 23:19:20 +0000	[thread overview]
Message-ID: <20201102231919.n2isaam3xefujycs@skbuf> (raw)
In-Reply-To: <20201102140808.54c156fa@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net>

On Mon, Nov 02, 2020 at 02:08:08PM -0800, Jakub Kicinski wrote:
> Old GCC does not like the 0, if the members of struct are not scalars.
>
> struct ocelot_vcap_u16 {
>         u8 value[2];
>         u8 mask[2];
> };
>
> In this case the first member is an array.
>
> It wants us to add another curly brace:
>
> struct ocelot_vcap_u16 etype = {{0}};
>
> ... or we can just skip the 0.

I am reading that the empty set initializer is a GNU extension. I would
not like to see yet another patch from clang folks coming as a follow-up
to this one.

> That's just FWIW. I don't remember which versions of GCC behave like
> that, I just know we get a constant stream of this sort of fixes.
> I think clang may generate a similar warning.
>
> Pujin, please specify the version of GCC you're using and repost.

If the initializer really has to be changed, I would prefer to see a memset.

      reply	other threads:[~2020-11-02 23:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-02 13:41 [PATCH] net: ethernet: mscc: fix missing brace warning for old compilers Pujin Shi
2020-11-02 13:56 ` Vladimir Oltean
2020-11-02 17:32   ` David Sterba
2020-11-02 22:08   ` Jakub Kicinski
2020-11-02 23:19     ` Vladimir Oltean [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=20201102231919.n2isaam3xefujycs@skbuf \
    --to=vladimir.oltean@nxp.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shipujin.t@gmail.com \
    --cc=xiaoliang.yang_1@nxp.com \
    /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