This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [obv] Fix unused-but-set-variable error [Re: [OB] Fix linux-low.c build error]
On 12/19/2011 04:58 AM, Jan Kratochvil wrote:
> 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.
> +
This reminds me that I committed a similar patch some days ago. Here is a
patch to revert.
--
Yao (éå)
* tracepoint.c (gdb_ust_thread): Put an empty if clause for write.
Revert:
2011-12-14 Yao Qi <yao@codesourcery.com>
* tracepoint.c (gdb_ust_thread): Don't ignore return value
of write.
Index: gdb/gdbserver/tracepoint.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/tracepoint.c,v
retrieving revision 1.38
diff -u -r1.38 tracepoint.c
--- gdb/gdbserver/tracepoint.c 15 Dec 2011 12:40:03 -0000 1.38
+++ gdb/gdbserver/tracepoint.c 19 Dec 2011 06:17:49 -0000
@@ -8122,8 +8122,8 @@
strcpy (cmd_buf, "");
}
- /* Fix compiler's warning: ignoring return value of 'write'. */
- ret = write (fd, buf, 1);
+ if (write (fd, buf, 1) < 0)
+ /* Errors ignored. */;
close (fd);
}
}