[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 10/14] Zero json struct with memset() instea of
From: |
Jes Sorensen |
Subject: |
[Qemu-devel] Re: [PATCH 10/14] Zero json struct with memset() instea of = {} to keep compiler happy. |
Date: |
Mon, 30 Aug 2010 17:53:41 +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 17:48, Anthony Liguori wrote:
> On 08/30/2010 10:43 AM, Jes Sorensen wrote:
>> Yes it's technically legal. However it's painful when you try to apply
>> more aggressive warning flags looking for real bugs.
>
> No, this is GCC being stupid.
>
>> I would suggest we modify the coding style to ask people to not init a
>> struct like this.
>>
>
> 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
I believe the comma after the last case takes care of terminating the list.
I agree that it would be nice to get gcc to not moan about this specific
case, however I will argue that my change is worth it to be able to use
the error flags, even if it is gcc being stupid.
Cheers,
Jes
- [Qemu-devel] [PATCH 00/14] gcc extra warning fixes, Jes . Sorensen, 2010/08/30
- [Qemu-devel] [PATCH 01/14] Remove unused argument for nbd_client(), Jes . Sorensen, 2010/08/30
- [Qemu-devel] [PATCH 06/14] Remove unused argument for encrypt_sectors(), Jes . Sorensen, 2010/08/30
- [Qemu-devel] [PATCH 05/14] Remove unused argument for check_for_block_signature(), Jes . Sorensen, 2010/08/30
- [Qemu-devel] [PATCH 08/14] Remove unused argument for qcow2_encrypt_sectors(), Jes . Sorensen, 2010/08/30
- [Qemu-devel] [PATCH 09/14] Remove unused arguments for add_aio_request() and free_aio_req(), Jes . Sorensen, 2010/08/30
- [Qemu-devel] [PATCH 10/14] Zero json struct with memset() instea of = {} to keep compiler happy., Jes . Sorensen, 2010/08/30
- Re: [Qemu-devel] Re: [PATCH 10/14] Zero json struct with memset() instea of = {} to keep compiler happy., malc, 2010/08/30
- Re: [Qemu-devel] Re: [PATCH 10/14] Zero json struct with memset() instea of = {} to keep compiler happy., Richard Henderson, 2010/08/30
[Qemu-devel] Re: [PATCH 10/14] Zero json struct with memset() instea of = {} to keep compiler happy., Paolo Bonzini, 2010/08/30