From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Hui Zhu <teawater@gmail.com>
Cc: gdb-patches ml <gdb-patches@sourceware.org>
Subject: [obv] Fix unused-but-set-variable error [Re: [OB] Fix linux-low.c build error]
Date: Sun, 18 Dec 2011 22:55:00 -0000 [thread overview]
Message-ID: <20111218205826.GA15385@host2.jankratochvil.net> (raw)
In-Reply-To: <20111218192239.GA25401@host2.jankratochvil.net>
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 <jan.kratochvil@redhat.com>
+
+ * linux-low.c (linux_create_inferior): Put empty if clause for write.
+
+ Revert:
+ 2011-12-18 Hui Zhu <teawater@gmail.com>
+ * linux-low.c (linux_create_inferior): Save return value to ret.
+
2011-12-18 Hui Zhu <teawater@gmail.com>
* 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);
next prev parent reply other threads:[~2011-12-18 20:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-18 16:05 [OB] Fix linux-low.c build error Hui Zhu
2011-12-18 20:58 ` Jan Kratochvil
2011-12-18 22:55 ` Jan Kratochvil [this message]
2011-12-19 3:22 ` [obv] Fix unused-but-set-variable error [Re: [OB] Fix linux-low.c build error] Hui Zhu
2011-12-19 3:34 ` Joel Brobecker
2011-12-19 6:50 ` Yao Qi
2011-12-19 6:53 ` Joel Brobecker
2011-12-19 8:13 ` Yao Qi
2011-12-19 9:32 ` Joel Brobecker
2011-12-19 10:23 ` Jan Kratochvil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111218205826.GA15385@host2.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=teawater@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox