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 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