netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Stephen Hemminger <shemming@brocade.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>,
	David Ahern <dsa@cumulusnetworks.com>,
	Nicolas Dichtel <nicolas.dichtel@6wind.com>,
	Julien Floret <julien.floret@6wind.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [iproute PATCH v3 0/6] Big C99 style initializer rework
Date: Tue, 28 Jun 2016 19:37:23 +0200	[thread overview]
Message-ID: <20160628173723.GA6733@orbyte.nwl.cc> (raw)
In-Reply-To: <20160627141049.356c1eff@xeon-e3>

On Mon, Jun 27, 2016 at 02:10:49PM -0700, Stephen Hemminger wrote:
> On Mon, 27 Jun 2016 20:23:02 +0200
> Phil Sutter <phil@nwl.cc> 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 <phil@nwl.cc> 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.

Hmm. In a fresh install of Debian 8.5 I see the warnings as well, but it
has gcc-4.9.2-10 as most recent version.

Another thing I noticed: Using empty braces ('{}') instead of the
universal zero initializer seems to work without causing warnings (at
least unless '-pedantic' is used).

Cheers, Phil

  reply	other threads:[~2016-06-28 17:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <d6784d8bb2d84ceab6c1719e32e8fa8e@HQ1WP-EXMB11.corp.brocade.com>
2016-06-27 17:59 ` [iproute PATCH v3 0/6] Big C99 style initializer rework Stephen Hemminger
2016-06-27 18:23   ` Phil Sutter
2016-06-27 21:10     ` Stephen Hemminger
2016-06-28 17:37       ` Phil Sutter [this message]
2016-06-28 17:37         ` David Ahern
2016-06-28 17:58           ` Phil Sutter
2016-06-28 17:59             ` David Ahern
2016-06-28 18:07               ` Phil Sutter
2016-06-23 17:34 Phil Sutter
2016-06-24  9:17 ` David Laight
2016-06-24 11:47   ` Phil Sutter
2016-06-24 13:12 ` Nicolas Dichtel

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=20160628173723.GA6733@orbyte.nwl.cc \
    --to=phil@nwl.cc \
    --cc=daniel@iogearbox.net \
    --cc=dsa@cumulusnetworks.com \
    --cc=julien.floret@6wind.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    --cc=shemming@brocade.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;
as well as URLs for NNTP newsgroup(s).