This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: silence warning in libiberty/pex-unix.c
Ben Elliston <bje@au1.ibm.com> writes:
> > > -#define writeerr(s) write (STDERR_FILE_NO, s, strlen (s))
> > > +#define writeerr(s) if (write (STDERR_FILE_NO, s, 0) < 0) _exit (-1)
> >
> > Just cast the result to (void). I'll preapprove that patch if that
> > works.
>
> Casting function results to (void) is insufficient to eliminate the
> warning. Whether or not that is a bug is debatable, but I certainly
> expected it to work when I first tried it.
Let's fix that problem, then. I like the idea of __attribute__
((__warn_unused_result__)) but I don't like the idea of adding
extraneous and useless tests merely to avoid a warning. I would be OK
with it if the code compiled to nothing, but that won't be the case in
this example.
Ian