Use fputc in place of putc to avoid -Wunused-value warning (AIX).
authorJoel Brobecker <brobecker@gnat.com>
Thu, 9 May 2013 06:58:16 +0000 (06:58 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Thu, 9 May 2013 06:58:16 +0000 (06:58 +0000)
commitceae87f3fed88525f5f4ade1173ecb5368366edf
tree00936f536f1059ff4142d28a61fafa7fb72cf366
parent40aea4772114f8c0b62595560e67b5e229b47ee6
Use fputc in place of putc to avoid -Wunused-value warning (AIX).

Currently, bfd does not compile with -Wunused-value because
the following code:

        val = putc ('\n', f);

gets expanded into some code that triggers a warning:

        warning: value computed is not used [-Wunused-value]

This is because putc is implemented as a macro...

>#define putc(__x, __p)  (((!((__p)->_flag & 0xC000)) && \
>                        ((__p)->_flag = ((__p)->_flag  & 0x3FFF) | 0x8000)),\
>                        (--(__p)->_cnt < 0 ? \
>                        __flsbuf((unsigned char) (__x), (__p)) : \
>                        (int) (*(__p)->_ptr++ = (unsigned char) (__x))))

It's the first part, before the coma operator, which triggers
the unused-value warning.

This patch fixes the issue by simply avoiding the macro and using
fputc instead.

bfd/ChangeLog:

        * bfd.c (_bfd_default_error_handler): Replace use of putc
        by fputc.  Add comment explaining why.
bfd/ChangeLog
bfd/bfd.c