lkml.org 
[lkml]   [2020]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] net: ethernet: mscc: fix missing brace warning for old compilers
Date
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.
\
 
 \ /
  Last update: 2020-11-03 00:20    [W:0.054 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site