This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH, libiberty: eliminate build warning
On Fri, 2009-11-20 at 00:43 +0800, Doug Kwan (éæå) wrote:
> Oh, I did not realize the original warning. May be it is better to do
> something like:
>
> #define writerr(s) \
> do \
> { \
> const char *p = (s); \
> if (write(STDERR_FILE_NO, p, strlen(p))) \
> {} \
> } while (0)
>
> This should eliminate the unused result warning and is safe even if s
> has side-effects or the macro is used before an "else".
I don't think the extra complexity is warranted. This is just a simple
convenience macro and (now with my #undef added) is only defined within
the body of that function. It is not intended to be a general purpose
macro used by people that can't see the definition right in front of
them.
Ben