From 3b613351e514faed72ecf9edad9eaad3db8efa58 Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Thu, 9 May 2013 06:58:16 +0000 Subject: 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/bfd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'bfd/bfd.c') diff --git a/bfd/bfd.c b/bfd/bfd.c index 10bc319bda..8d0580c20f 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); } -- cgit v1.2.1