From owner-svn-src-all@freebsd.org Mon Feb 22 22:58:01 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EACE4AB1D9C; Mon, 22 Feb 2016 22:58:01 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AE4081295; Mon, 22 Feb 2016 22:58:01 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:7b8:3a7::8dd7:5393:bc62:ce77] (unknown [IPv6:2001:7b8:3a7:0:8dd7:5393:bc62:ce77]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id B8C6420F62; Mon, 22 Feb 2016 23:57:56 +0100 (CET) Subject: Re: svn commit: r295768 - head/usr.sbin/iostat Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) Content-Type: multipart/signed; boundary="Apple-Mail=_D1F9D041-9575-40FF-B2B4-EE6F1905BBE9"; protocol="application/pgp-signature"; micalg=pgp-sha1 X-Pgp-Agent: GPGMail 2.6b2 (ebbf3ef) From: Dimitry Andric In-Reply-To: <156A6796-D62B-4977-893B-E4E727578412@FreeBSD.org> Date: Mon, 22 Feb 2016 23:57:43 +0100 Cc: Alan Somers , Sergey Kandaurov , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Message-Id: References: <201602182008.u1IK81vg092127@repo.freebsd.org> <83BB8467-4C40-4CF1-B394-1376C9D97FCF@FreeBSD.org> <156A6796-D62B-4977-893B-E4E727578412@FreeBSD.org> To: David Chisnall X-Mailer: Apple Mail (2.3112) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2016 22:58:02 -0000 --Apple-Mail=_D1F9D041-9575-40FF-B2B4-EE6F1905BBE9 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 On 22 Feb 2016, at 10:56, David Chisnall wrote: >=20 > On 19 Feb 2016, at 23:23, Dimitry Andric wrote: >>=20 >> This warning is only produced when you use -Wall -W, and then = initialize >> structs partially, i.e. you initialize some fields but not others. I >> think this is a quite reasonable warning for a high warning level. >=20 > The warning is annoying in many ways. You ought to be able to zero = initialise any struct with {0}, but clang objects if you do this and = requires every field to be filled in. This warning really shouldn=E2=80=99= t be enabled with -Wall, because it has too hight a false positive rate. It isn't, it is in -W (a.k.a -Wextra). But gcc also warns in this case. = E.g. if I use this example: struct foo { int i; int j; } bar[] =3D { { 42 }, { 43 } }; I get the following warnings from gcc -Wextra: $ gcc -Wextra -c initializers.c initializers.c:5:2: warning: missing initializer for field 'j' of = 'struct foo' [-Wmissing-field-initializers] { 42 }, ^ initializers.c:3:6: note: 'j' declared here int j; ^ initializers.c:6:2: warning: missing initializer for field 'j' of = 'struct foo' [-Wmissing-field-initializers] { 43 } ^ initializers.c:3:6: note: 'j' declared here int j; ^ Note that the warnings disappear if C99 initializers are used. -Dimitry --Apple-Mail=_D1F9D041-9575-40FF-B2B4-EE6F1905BBE9 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.29 iEYEARECAAYFAlbLknQACgkQsF6jCi4glqM5bQCghdAFmccwUc2pODSEp86SEgSw miUAoKK7lNvPr4ojr/PKxizoVorQy112 =+hXe -----END PGP SIGNATURE----- --Apple-Mail=_D1F9D041-9575-40FF-B2B4-EE6F1905BBE9--