qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Re: [PATCH 10/14] Zero json struct with memset() instea


From: Jes Sorensen
Subject: Re: [Qemu-devel] Re: [PATCH 10/14] Zero json struct with memset() instea of = {} to keep compiler happy.
Date: Mon, 30 Aug 2010 20:00:22 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100806 Fedora/3.1.2-1.fc13 Lightning/1.0b2pre Thunderbird/3.1.2

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]