From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21441 invoked by alias); 18 Dec 2011 22:55:15 -0000 Received: (qmail 21432 invoked by uid 22791); 18 Dec 2011 22:55:14 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM X-Spam-Check-By: sourceware.org Received: from mail-ww0-f43.google.com (HELO mail-ww0-f43.google.com) (74.125.82.43) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 18 Dec 2011 22:55:00 +0000 Received: by wgbds11 with SMTP id ds11so8078218wgb.12 for ; Sun, 18 Dec 2011 14:54:59 -0800 (PST) Received: by 10.180.99.66 with SMTP id eo2mr7029965wib.36.1324248897344; Sun, 18 Dec 2011 14:54:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.151.11 with HTTP; Sun, 18 Dec 2011 14:54:16 -0800 (PST) In-Reply-To: <20111218205826.GA15385@host2.jankratochvil.net> References: <20111218192239.GA25401@host2.jankratochvil.net> <20111218205826.GA15385@host2.jankratochvil.net> From: Hui Zhu Date: Mon, 19 Dec 2011 03:22:00 -0000 Message-ID: Subject: Re: [obv] Fix unused-but-set-variable error [Re: [OB] Fix linux-low.c build error] To: Jan Kratochvil Cc: gdb-patches ml Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable 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/msg00614.txt.bz2 Thanks Jan. Best, Hui 2011/12/19 Jan Kratochvil : > On Sun, 18 Dec 2011 20:22:39 +0100, Jan Kratochvil wrote: >> (c) With these GCCs >> =A0 =A0 =A0 FSF: gcc (GCC) 4.6.3 20111218 (prerelease) >> =A0 =A0 =A0 FSF: gcc (GCC) 4.7.0 20111218 (experimental) > [...] >> =A0 =A0 =A0 linux-low.c: In function =91linux_create_inferior=92: >> =A0 =A0 =A0 linux-low.c:577:8: error: variable =91ret=92 set but not use= d [-Werror=3Dunused-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 =A0 =A0 1.529 > +++ src/gdb/gdbserver/ChangeLog 2011/12/18 20:55:08 =A0 =A0 1.530 > @@ -1,3 +1,11 @@ > +2011-12-18 =A0Jan Kratochvil =A0 > + > + =A0 =A0 =A0 * linux-low.c (linux_create_inferior): Put empty if clause = for write. > + > + =A0 =A0 =A0 Revert: > + =A0 =A0 =A0 2011-12-18 =A0Hui Zhu =A0 > + =A0 =A0 =A0 * linux-low.c (linux_create_inferior): Save return value to= ret. > + > =A02011-12-18 =A0Hui Zhu =A0 > > =A0 =A0 =A0 =A0* linux-low.c (linux_create_inferior): Save return value t= o ret. > --- src/gdb/gdbserver/linux-low.c =A0 =A0 =A0 2011/12/18 15:49:04 =A0 =A0= 1.186 > +++ src/gdb/gdbserver/linux-low.c =A0 =A0 =A0 2011/12/18 20:55:08 =A0 =A0= 1.187 > @@ -574,12 +574,12 @@ > =A0 =A0 =A0 =A0 Also, redirect stdin to /dev/null. =A0*/ > =A0 =A0 =A0 if (remote_connection_is_stdio ()) > =A0 =A0 =A0 =A0{ > - =A0 =A0 =A0 =A0 int ret; > =A0 =A0 =A0 =A0 =A0close (0); > =A0 =A0 =A0 =A0 =A0open ("/dev/null", O_RDONLY); > =A0 =A0 =A0 =A0 =A0dup2 (2, 1); > - =A0 =A0 =A0 =A0 ret =3D write (2, "stdin/stdout redirected\n", > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0sizeof ("stdin/stdout redire= cted\n") - 1); > + =A0 =A0 =A0 =A0 if (write (2, "stdin/stdout redirected\n", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0sizeof ("stdin/stdout redirected= \n") - 1) < 0) > + =A0 =A0 =A0 =A0 =A0 /* Errors ignored. =A0*/; > =A0 =A0 =A0 =A0} > > =A0 =A0 =A0 execv (program, allargs);