This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Fix compile time warning building aout targeted architectures.
- From: Nick Clifton <nickc at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 12 Jan 2018 13:13:06 -0000
- Subject: [binutils-gdb] Fix compile time warning building aout targeted architectures.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b5b62006522c6d8d42028754bb1be165f00fe210
commit b5b62006522c6d8d42028754bb1be165f00fe210
Author: Gunther Nikl <gnikl@users.sourceforge.net>
Date: Fri Jan 12 13:12:17 2018 +0000
Fix compile time warning building aout targeted architectures.
Occasionally I build an out-of-tree a.out target (m68k-amigaos). After
a system upgrade which included a newer compiler (clang 4) the build
produces warnings like this:
warning: macro expansion producing 'defined' has undefined behavior
[-Wexpansion-to-defined]
This is caused by the macro gas/config/aout_gnu.h:USE_EXTENDED_RELOC.
Since it is in a header file, the warning triggers for several files.
I am unsure what solution is preferable, thus I am suggesting two
patches:
a) keep the offending macro but define it explicitly to 0 and 1
b) replace the macro usage with its value where it is used.
Either patch removes the warning for clang. I did not check with a
recent GCC.
* gas/config/aout_gnu.h (USE_EXTENDED_RELOC): Explicitly
define to 0 and 1. Remove a dangling reference to "AMD 29000"
in a comment.
Diff:
---
gas/ChangeLog | 6 ++++++
gas/config/aout_gnu.h | 7 ++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 0b45805..5887b36 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2018-01-12 Gunther Nikl <gnikl@users.sourceforge.net>
+
+ * gas/config/aout_gnu.h (USE_EXTENDED_RELOC): Explicitly
+ define to 0 and 1. Remove a dangling reference to "AMD 29000"
+ in a comment.
+
2018-01-11 Igor Tsimbalist <igor.v.tsimbalist@intel.com>
* testsuite/i386/avx512_4fmaps_vl-warn.l: Likewise.
diff --git a/gas/config/aout_gnu.h b/gas/config/aout_gnu.h
index 6d80d5d..f404d1e 100644
--- a/gas/config/aout_gnu.h
+++ b/gas/config/aout_gnu.h
@@ -32,8 +32,6 @@
*/
-#define USE_EXTENDED_RELOC defined(TC_SPARC)
-
#if defined(TC_SPARC)
enum reloc_type
{
@@ -62,6 +60,9 @@ enum reloc_type
NO_RELOC
};
+#define USE_EXTENDED_RELOC 1
+#else
+#define USE_EXTENDED_RELOC 0
#endif /* TC_SPARC */
#define __GNU_EXEC_MACROS__
@@ -303,7 +304,7 @@ struct nlist
/* The following enum and struct were borrowed from SunOS's
/usr/include/sun4/a.out.h and extended to handle
- other machines. It is currently used on SPARC and AMD 29000.
+ other machines. It is currently used on SPARC.
reloc_ext_bytes is how it looks on disk. reloc_info_extended is
how we might process it on a native host. */