From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7815 invoked by alias); 18 Dec 2011 20:58:49 -0000 Received: (qmail 7806 invoked by uid 22791); 18 Dec 2011 20:58:47 -0000 X-SWARE-Spam-Status: No, hits=-5.3 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; Sun, 18 Dec 2011 20:58:32 +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 pBIKwVRc026717 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 18 Dec 2011 15:58:31 -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 pBIKwRYE004531 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Sun, 18 Dec 2011 15:58:29 -0500 Date: Sun, 18 Dec 2011 22:55:00 -0000 From: Jan Kratochvil To: Hui Zhu Cc: gdb-patches ml Subject: [obv] Fix unused-but-set-variable error [Re: [OB] Fix linux-low.c build error] Message-ID: <20111218205826.GA15385@host2.jankratochvil.net> References: <20111218192239.GA25401@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-2022-jp Content-Disposition: inline In-Reply-To: <20111218192239.GA25401@host2.jankratochvil.net> 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/msg00613.txt.bz2 On Sun, 18 Dec 2011 20:22:39 +0100, Jan Kratochvil wrote: > (c) With these GCCs > FSF: gcc (GCC) 4.6.3 20111218 (prerelease) > FSF: gcc (GCC) 4.7.0 20111218 (experimental) [...] > linux-low.c: In function ‘linux_create_inferior’: > linux-low.c:577:8: error: variable ‘ret’ set but not used [-Werror=unused-but-set-variable] Checked in this alternative fix to not break the next nightly builds. I believe it now should pass also on Ubuntu, tested it with artificial warn_unused_result attribute for `write'. Regards, Jan http://sourceware.org/ml/gdb-cvs/2011-12/msg00185.html --- src/gdb/gdbserver/ChangeLog 2011/12/18 15:49:04 1.529 +++ src/gdb/gdbserver/ChangeLog 2011/12/18 20:55:08 1.530 @@ -1,3 +1,11 @@ +2011-12-18 Jan Kratochvil + + * linux-low.c (linux_create_inferior): Put empty if clause for write. + + Revert: + 2011-12-18 Hui Zhu + * linux-low.c (linux_create_inferior): Save return value to ret. + 2011-12-18 Hui Zhu * linux-low.c (linux_create_inferior): Save return value to ret. --- src/gdb/gdbserver/linux-low.c 2011/12/18 15:49:04 1.186 +++ src/gdb/gdbserver/linux-low.c 2011/12/18 20:55:08 1.187 @@ -574,12 +574,12 @@ Also, redirect stdin to /dev/null. */ if (remote_connection_is_stdio ()) { - int ret; close (0); open ("/dev/null", O_RDONLY); dup2 (2, 1); - ret = write (2, "stdin/stdout redirected\n", - sizeof ("stdin/stdout redirected\n") - 1); + if (write (2, "stdin/stdout redirected\n", + sizeof ("stdin/stdout redirected\n") - 1) < 0) + /* Errors ignored. */; } execv (program, allargs);