Stefan Weil | 23 May 2012 17:29
Picon
Favicon

Re: [PATCH 1.1] virtio: Fix compiler warning for non Linux hosts

Am 23.05.2012 10:09, schrieb Stefan Hajnoczi:
> On Tue, May 22, 2012 at 10:23 PM, Stefan Weil<sw <at> weilnetz.de>  wrote:
>> The local variables ret, i are only used if __linux__ is defined.
>>
>> Signed-off-by: Stefan Weil<sw <at> weilnetz.de>
>> ---
>>   hw/virtio-blk.c |    4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
> The #ifdef __linux__ further down in the function declares the local
> hdr variable.  We could move ret and i down into the #ifdef instead of
> adding a new one.

I noticed that, but declaring variables anywhere is C++, not C code.

hdr violates the QEMU coding rules (other patches which did not
declare local variables at the beginning of a block were already
rejected). That's why I wrote the patch as it is.

Regards,
Stefan W.


Gmane