From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Ahern Subject: Re: [iproute PATCH v3 0/6] Big C99 style initializer rework Date: Tue, 28 Jun 2016 11:37:43 -0600 Message-ID: <0a003d6f-ae2f-57cb-f3f1-1975011c7b78@cumulusnetworks.com> References: <20160627105912.7961c3f4@xeon-e3> <20160627182302.GB13664@orbyte.nwl.cc> <20160627141049.356c1eff@xeon-e3> <20160628173723.GA6733@orbyte.nwl.cc> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit To: Phil Sutter , Stephen Hemminger , Daniel Borkmann , Nicolas Dichtel , Julien Floret , "netdev@vger.kernel.org" Return-path: Received: from mail-pa0-f49.google.com ([209.85.220.49]:34795 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750710AbcF1Riy (ORCPT ); Tue, 28 Jun 2016 13:38:54 -0400 Received: by mail-pa0-f49.google.com with SMTP id bz2so8433987pad.1 for ; Tue, 28 Jun 2016 10:37:44 -0700 (PDT) In-Reply-To: <20160628173723.GA6733@orbyte.nwl.cc> Sender: netdev-owner@vger.kernel.org List-ID: On 6/28/16 11:37 AM, Phil Sutter wrote: >>> 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). since .ifr_qlen is already referenced in that function seems like your suggestion above (struct ifreq ifr = { .ifr_qlen = 0 };) should be acceptable.