* [PATCH] [GAS] Remove build warnings for a.out targets
@ 2018-01-11 19:29 gnikl
2018-01-12 13:14 ` Nick Clifton
0 siblings, 1 reply; 2+ messages in thread
From: gnikl @ 2018-01-11 19:29 UTC (permalink / raw)
To: binutils
Hello,
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.
Regards,
Gunther Nikl
---
a)
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.
--- 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
{
@@ -61,7 +59,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 +303,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. */
---
b)
2018-01-12 Gunther Nikl <gnikl@users.sourceforge.net>
* gas/config/aout_gnu.h (USE_EXTENDED_RELOC): Replace macro
usage with its value. Remove a dangling reference to "AMD
29000" in a comment.
--- 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
{
@@ -303,11 +301,11 @@ 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. */
-#if USE_EXTENDED_RELOC
+#if defined(TC_SPARC)
struct reloc_ext_bytes
{
@@ -406,7 +404,7 @@ struct reloc_std_bytes
#define RELOC_STD_SIZE 8 /* Bytes per relocation
entry */
-#endif /* USE_EXTENDED_RELOC */
+#endif /* TC_SPARC */
#ifndef CUSTOM_RELOC_FORMAT
struct relocation_info
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] [GAS] Remove build warnings for a.out targets
2018-01-11 19:29 [PATCH] [GAS] Remove build warnings for a.out targets gnikl
@ 2018-01-12 13:14 ` Nick Clifton
0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2018-01-12 13:14 UTC (permalink / raw)
To: gnikl, binutils
Hi Gunther,
> 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.
I like a).
> 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.
Approved and applied.
Cheers
Nick
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-01-12 13:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-11 19:29 [PATCH] [GAS] Remove build warnings for a.out targets gnikl
2018-01-12 13:14 ` Nick Clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).