Subject: Re: [iproute PATCH v3 0/6] Big C99 style initializer rework

From: Stephen Hemminger <[email-masked]>
Date: Mon, 27 Jun 2016 14:10:49 -0700

On Mon, 27 Jun 2016 20:23:02 +0200
Phil Sutter <[email-masked]> wrote:

> Hi,
> 
> On Mon, Jun 27, 2016 at 10:59:12AM -0700, Stephen Hemminger wrote:
> > On Thu, 23 Jun 2016 17:34:08 +0000
> > Phil Sutter <[email-masked]> wrote:
> > 
> > > This is v3 of my C99-style initializer related patch series. The changes
> > > since v2 are:
> [...]
> > 
> > I like the idea and it makes code cleaner. But doing this introduces lots of warnings
> > and that is not acceptable.
> > ip
> >     CC       ip.o
> >     CC       ipaddress.o
> > ipaddress.c: In function ‘print_queuelen’:
> > ipaddress.c:175:10: warning: missing braces around initializer [-Wmissing-braces]
> >    struct ifreq ifr = { 0 };
> >           ^
> 
> I saw these too with gcc-3.4.6 but not with 5.3.0. It appears to be a
> gcc bug[1]. One possible workaround is to match the brace level of the
> first field, but it's quite ugly: [2]. Another way might be to
> initialize one of the fields to zero, like so:
> 
> | struct ifreq ifr = { .ifr_qlen = 0 };
> 
> What do you think?
> 
> Thanks, Phil
> 
> [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119
> [2] http://nwl.cc/cgi-bin/git/gitweb.cgi?p=iproute2.git;a=commitdiff;h=a1cbf2b63c995b2f633c5b4699248ab308b201d2;hp=3809cfec65b03716d1d0360338126df4b4f3fbf6

I am using gcc on Debian stable which is 5.3.1.