Messages in this thread | | | From | Vladimir Oltean <> | Subject | Re: [PATCH] net: ethernet: mscc: fix missing brace warning for old compilers | Date | Mon, 2 Nov 2020 23:19:20 +0000 |
| |
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.
| |