From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=59793 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oq8eq-00010H-SM for qemu-devel@nongnu.org; Mon, 30 Aug 2010 14:00:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oq8ep-0003rh-GR for qemu-devel@nongnu.org; Mon, 30 Aug 2010 14:00:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49371) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oq8ep-0003ra-8o for qemu-devel@nongnu.org; Mon, 30 Aug 2010 14:00:35 -0400 Message-ID: <4C7BF1B6.2050603@redhat.com> Date: Mon, 30 Aug 2010 20:00:22 +0200 From: Jes Sorensen MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [PATCH 10/14] Zero json struct with memset() instea of = {} to keep compiler happy. References: <1283182547-26116-1-git-send-email-Jes.Sorensen@redhat.com> <1283182547-26116-11-git-send-email-Jes.Sorensen@redhat.com> <4C7BD0CE.6020505@codemonkey.ws> <4C7BD19C.9080308@redhat.com> <4C7BD2E7.2010201@codemonkey.ws> <20100830165513.GG16898@codesourcery.com> In-Reply-To: <20100830165513.GG16898@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nathan Froyd Cc: kwolf@redhat.com, qemu-devel@nongnu.org On 08/30/10 18:55, Nathan Froyd wrote: > On Mon, Aug 30, 2010 at 10:48:55AM -0500, Anthony Liguori wrote: >> No, this is GCC being stupid. >> >> How else do you terminate a list? IOW: >> >> MyDeviceInfo device_infos[] = { >> {"foo", 0, 2}, >> {"bar", 0, 1}, >> {} /* or { 0 } */ >> }; >> >> This is such a pervasive idiom that there's simply no way that GCC can >> possibly try to warn against this. Plus, it's entirely reasonable. >> >> I think this is just a false positive in GCC. Otherwise, there's a ton >> of code that it should be throwing warnings against. > > Well, it sounds like Jes was compiling QEMU was extra warning flags, and > I doubt people do much beyond -Wall and maybe one or two others. I was! I am not arguing that we should always compile QEMU with such aggressive flags, but I my search did turn up several genuine bugs. What I do argue in favor of is when it makes sense to make small IMHO harmless changes to the code, that makes it easier to build QEMU with aggressive C flags in order to catch real bugs. Cheers, Jes