diff options
author | Joel Brobecker <brobecker@gnat.com> | 2013-05-09 06:58:16 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2013-05-09 06:58:16 +0000 |
commit | 95615b4a2932c1cbb5e8314afa4f43b1c38a9ee8 (patch) | |
tree | 7d39c7b1b49da495d4cb52c635d4570398979e2f | |
parent | 485edc33433aae5742e8cc4fbefdeea586dd7623 (diff) | |
download | gdb-95615b4a2932c1cbb5e8314afa4f43b1c38a9ee8.tar.gz |
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.
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/bfd.c | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index da19766a430..e680c3ac41e 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2013-05-09 Joel Brobecker <brobecker@adacore.com> + + * bfd.c (_bfd_default_error_handler): Replace use of putc + by fputc. Add comment explaining why. + 2013-05-09 Alan Modra <amodra@gmail.com> * elflink.c (elf_link_add_object_symbols): Don't omit reading diff --git a/bfd/bfd.c b/bfd/bfd.c index 10bc319bdaa..8d0580c20f0 100644 --- a/bfd/bfd.c +++ b/bfd/bfd.c @@ -733,7 +733,9 @@ _bfd_default_error_handler (const char *fmt, ...) vfprintf (stderr, new_fmt, ap); va_end (ap); - putc ('\n', stderr); + /* On AIX, putc is implemented as a macro that triggers a -Wunused-value + warning, so use the fputc function to avoid it. */ + fputc ('\n', stderr); fflush (stderr); } |