From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3977 invoked by alias); 19 Dec 2011 10:13:45 -0000 Received: (qmail 3967 invoked by uid 22791); 19 Dec 2011 10:13:44 -0000 X-SWARE-Spam-Status: No, hits=-5.4 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 19 Dec 2011 10:13:26 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pBJADMZv014261 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 19 Dec 2011 05:13:22 -0500 Received: from host2.jankratochvil.net (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id pBJADHwM032619 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Mon, 19 Dec 2011 05:13:20 -0500 Date: Mon, 19 Dec 2011 10:23:00 -0000 From: Jan Kratochvil To: Yao Qi Cc: Hui Zhu , gdb-patches ml Subject: Re: [obv] Fix unused-but-set-variable error [Re: [OB] Fix linux-low.c build error] Message-ID: <20111219101316.GA5027@host2.jankratochvil.net> References: <20111218192239.GA25401@host2.jankratochvil.net> <20111218205826.GA15385@host2.jankratochvil.net> <4EEED8FB.4040103@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4EEED8FB.4040103@codesourcery.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-12/txt/msg00629.txt.bz2 On Mon, 19 Dec 2011 07:26:03 +0100, Yao Qi wrote: > This reminds me that I committed a similar patch some days ago. Here is a > patch to revert. [...] > - /* Fix compiler's warning: ignoring return value of 'write'. */ > - ret = write (fd, buf, 1); > + if (write (fd, buf, 1) < 0) > + /* Errors ignored. */; > close (fd); > } > } I would add a comment that the variable "ret" is already used elsewhere incl. reading it in that function. This is the reason it did not trigger the unused-but-set-variable error. Still sure I agree such patch is useful (+Joel suggests more comments for it), this is unwised code dependency. . Thanks, Jan