qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 3/3] Avoid Wunsed-but-set warnings (or errors in


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 3/3] Avoid Wunsed-but-set warnings (or errors in case of Werror)
Date: Tue, 5 Jul 2011 08:02:36 +0100

On 5 July 2011 07:15, Markus Armbruster <address@hidden> wrote:
>> +    int fd, __attribute__((unused)) ret;
>>
>>      snprintf(reset_file, sizeof(reset_file),
>>               "/sys/bus/pci/devices/%04x:%02x:%02x.%01x/reset",
>
> What about (void)write() and do away with ret?

If 'ret' has been used to silence compiler warnings about functions
which have been declared with attribute __warn_unused_result__
(eg write() and various other libc functions) then "(void)write()"
is insufficient -- gcc requires the variable.

-- PMM



reply via email to

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