From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:59729) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qe0d5-0003dg-Px for qemu-devel@nongnu.org; Tue, 05 Jul 2011 04:05:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qe0d2-0001nY-HK for qemu-devel@nongnu.org; Tue, 05 Jul 2011 04:05:10 -0400 Received: from mail-wy0-f173.google.com ([74.125.82.173]:59998) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qe0d2-0001mD-2E for qemu-devel@nongnu.org; Tue, 05 Jul 2011 04:05:08 -0400 Received: by wyf28 with SMTP id 28so4406429wyf.4 for ; Tue, 05 Jul 2011 01:05:07 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4E12C5B0.3040704@redhat.com> Date: Tue, 05 Jul 2011 10:05:04 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <2cb2082c25eadc24d1e22ebbd4293e3e6b53c832.1309816302.git.rprabhu@wnohang.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/3] Avoid Wunsed-but-set warnings (or errors in case of Werror) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Peter Maydell , Raghavendra D Prabhu , qemu-devel@nongnu.org, Raghavendra D Prabhu , kvm@vger.kernel.org On 07/05/2011 09:49 AM, Markus Armbruster wrote: > > 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. > > gcc being silly. Oh well. In this particular case I think that the return value should be checked. It's good if something is printed in the log saying that the reset wasn't done for some reason---even if it is just defensive. The really silly thing is in glibc, not gcc. __warn_unused_result__ was added to fwrite, where you have no certainty that the write has been done, but not to either fclose or fflush. Oh well... Paolo