Fix name clash for ! __STDC__

Alan Modra alan@linuxcare.com.au
Tue Jun 6 01:41:00 GMT 2000


On Mon, 5 Jun 2000, Nick Clifton wrote:

> : Ah well, this is what I should really do:  Get rid of END_RELOC_NUMBERS,
> : and make up a LAST_RELOC_NUMBER macro so that we could tack commas on the
> : end of the RELOC_NUMBER definition.  This would allow removal of the dummy
> : -1 valued enum (the one that needs the token pasting), and probably allow
> : gcc to optimise a little more.
> 
> Do you want to do this now ?

Yes.  Or at least a variation on what I said above.  See below.  If this
is OK with you I'll make a ChangeLog entry too, and check it in.  I've
checked (or at least told egrep to check) that nothing uses the enum value
generated by the old START_RELOC_NUMBERS, and I'll do the same for new
R_XXX_max enum values.

> If not, then please go ahead and check your patch in.

The quick fix is already in.  You gave the OK on Fri, 2 Jun 2000 10:47:14

Regards, Alan Modra
-- 
Linuxcare.  Support for the Revolution.

Index: reloc-macros.h
===================================================================
RCS file: /cvs/src/src/include/elf/reloc-macros.h,v
retrieving revision 1.3
diff -u -p -r1.3 reloc-macros.h
--- reloc-macros.h	2000/06/03 01:57:29	1.3
+++ reloc-macros.h	2000/06/06 08:38:35
@@ -27,20 +27,20 @@
    	START_RELOC_NUMBERS (foo)
    	    RELOC_NUMBER (R_foo_NONE,    0)
    	    RELOC_NUMBER (R_foo_32,      1)
-   	    FAKE_RELOC   (R_foo_illegal, 2)
-   	    EMPTY_RELOC  (R_foo_max)
-   	END_RELOC_NUMBERS
+   	    EMPTY_RELOC  (R_foo_good)
+   	    FAKE_RELOC   (R_foo_illegal, 9)
+   	END_RELOC_NUMBERS (R_foo_count)
 
    Then the following will be produced by default (ie if
    RELOC_MACROS_GEN_FUNC is *not* defined).
 
    	enum foo
 	{
-	  foo = -1,
    	  R_foo_NONE = 0,
    	  R_foo_32 = 1,
-   	  R_foo_illegal = 2,
-   	  R_foo_max
+	  R_foo_good,
+   	  R_foo_illegal = 9,
+   	  R_foo_count
    	};
 
    If RELOC_MACROS_GEN_FUNC *is* defined, then instead the
@@ -95,21 +95,11 @@ name (rtype)							\
 
 #else /* Default to generating enum.  */
 
-/* Some compilers cannot cope with an enum that ends with a trailing
-   comma, so START_RELOC_NUMBERS creates a fake reloc entry, (initialised
-   to -1 so that the first real entry will still default to 0).  Further
-   entries then prepend a comma to their definitions, creating a list
-   of enumerator entries that will satisfy these compilers.  */
-#if defined (__STDC__) || defined (ALMOST_STDC)
-#define START_RELOC_NUMBERS(name)   enum name { _##name = -1
-#else
-#define START_RELOC_NUMBERS(name)   enum name { _/**/name = -1
-#endif
-
-#define RELOC_NUMBER(name, number)  , name = number
-#define FAKE_RELOC(name, number)    , name = number
-#define EMPTY_RELOC(name)           , name
-#define END_RELOC_NUMBERS           };
+#define START_RELOC_NUMBERS(name)   enum name {
+#define RELOC_NUMBER(name, number)  name = number,
+#define FAKE_RELOC(name, number)    name = number,
+#define EMPTY_RELOC(name)           name,
+#define END_RELOC_NUMBERS(name)     name };
 
 #endif
 
Index: alpha.h
===================================================================
RCS file: /cvs/src/src/include/elf/alpha.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 alpha.h
--- alpha.h	1999/05/03 07:29:03	1.1.1.1
+++ alpha.h	2000/06/06 08:17:19
@@ -102,7 +102,6 @@ START_RELOC_NUMBERS (elf_alpha_reloc_typ
   RELOC_NUMBER (R_ALPHA_JMP_SLOT, 26)	/* Create PLT entry */
   RELOC_NUMBER (R_ALPHA_RELATIVE, 27)	/* Adjust by program base */
 
-  EMPTY_RELOC  (R_ALPHA_max)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_ALPHA_max)
 
 #endif /* _ELF_ALPHA_H */
Index: arc.h
===================================================================
RCS file: /cvs/src/src/include/elf/arc.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 arc.h
--- arc.h	1999/05/03 07:29:03	1.1.1.1
+++ arc.h	2000/06/06 08:17:19
@@ -31,8 +31,7 @@ START_RELOC_NUMBERS (elf_arc_reloc_type)
   RELOC_NUMBER (R_ARC_32, 1)
   RELOC_NUMBER (R_ARC_B26, 2)
   RELOC_NUMBER (R_ARC_B22_PCREL, 3)
-  EMPTY_RELOC  (R_ARC_max)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_ARC_max)
 
 /* Processor specific flags for the ELF header e_flags field.  */
 
Index: arm.h
===================================================================
RCS file: /cvs/src/src/include/elf/arm.h,v
retrieving revision 1.5
diff -u -p -r1.5 arm.h
--- arm.h	2000/04/08 00:09:26	1.5
+++ arm.h	2000/06/06 08:17:19
@@ -124,6 +124,6 @@ START_RELOC_NUMBERS (elf_arm_reloc_type)
   RELOC_NUMBER (R_ARM_RABS32,         253)
   RELOC_NUMBER (R_ARM_RPC24,          254)
   RELOC_NUMBER (R_ARM_RBASE,          255)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_ARM_max)
 
 #endif /* _ELF_ARM_H */
Index: avr.h
===================================================================
RCS file: /cvs/src/src/include/elf/avr.h,v
retrieving revision 1.1
diff -u -p -r1.1 avr.h
--- avr.h	2000/03/27 08:39:13	1.1
+++ avr.h	2000/06/06 08:17:19
@@ -52,7 +52,6 @@ START_RELOC_NUMBERS (elf_avr_reloc_type)
      RELOC_NUMBER (R_AVR_HI8_LDI_PM_NEG,       16)
      RELOC_NUMBER (R_AVR_HH8_LDI_PM_NEG,       17)
      RELOC_NUMBER (R_AVR_CALL,		       18)
-     EMPTY_RELOC  (R_AVR_max)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_AVR_max)
 
 #endif /* _ELF_AVR_H */
Index: d10v.h
===================================================================
RCS file: /cvs/src/src/include/elf/d10v.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 d10v.h
--- d10v.h	1999/05/03 07:29:03	1.1.1.1
+++ d10v.h	2000/06/06 08:17:19
@@ -33,6 +33,6 @@ START_RELOC_NUMBERS (elf_d10v_reloc_type
   RELOC_NUMBER (R_D10V_32, 6)
   RELOC_NUMBER (R_D10V_GNU_VTINHERIT, 7)
   RELOC_NUMBER (R_D10V_GNU_VTENTRY, 8)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_D10V_max)
 
 #endif
Index: d30v.h
===================================================================
RCS file: /cvs/src/src/include/elf/d30v.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 d30v.h
--- d30v.h	1999/05/03 07:29:03	1.1.1.1
+++ d30v.h	2000/06/06 08:17:19
@@ -37,6 +37,6 @@ START_RELOC_NUMBERS (elf_d30v_reloc_type
   RELOC_NUMBER (R_D30V_32, 10)
   RELOC_NUMBER (R_D30V_32_PCREL, 11)
   RELOC_NUMBER (R_D30V_32_NORMAL, 12)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_D30V_max)
 
 #endif
Index: fr30.h
===================================================================
RCS file: /cvs/src/src/include/elf/fr30.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 fr30.h
--- fr30.h	1999/05/03 07:29:03	1.1.1.1
+++ fr30.h	2000/06/06 08:17:19
@@ -37,7 +37,6 @@ START_RELOC_NUMBERS (elf_fr30_reloc_type
   RELOC_NUMBER (R_FR30_12_PCREL, 10)
   RELOC_NUMBER (R_FR30_GNU_VTINHERIT, 11)
   RELOC_NUMBER (R_FR30_GNU_VTENTRY, 12)
-  EMPTY_RELOC  (R_FR30_max)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_FR30_max)
 
 #endif /* _ELF_FR30_H */
Index: hppa.h
===================================================================
RCS file: /cvs/src/src/include/elf/hppa.h,v
retrieving revision 1.8
diff -u -p -r1.8 hppa.h
--- hppa.h	1999/12/09 18:23:45	1.8
+++ hppa.h	2000/06/06 08:17:23
@@ -267,8 +267,7 @@ START_RELOC_NUMBERS (elf_hppa_reloc_type
     RELOC_NUMBER (R_PARISC_LTOFF_TP16F, 229)
     RELOC_NUMBER (R_PARISC_LTOFF_TP16WF, 230)
     RELOC_NUMBER (R_PARISC_LTOFF_TP16DF, 231)
-    EMPTY_RELOC (R_PARISC_UNIMPLEMENTED)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_PARISC_UNIMPLEMENTED)
 
 #ifndef RELOC_MACROS_GEN_FUNC
 typedef enum elf_hppa_reloc_type elf_hppa_reloc_type;
Index: i386.h
===================================================================
RCS file: /cvs/src/src/include/elf/i386.h,v
retrieving revision 1.2
diff -u -p -r1.2 i386.h
--- i386.h	1999/12/09 18:23:45	1.2
+++ i386.h	2000/06/06 08:17:23
@@ -44,6 +44,6 @@ START_RELOC_NUMBERS (elf_i386_reloc_type
      /* These are GNU extensions to enable C++ vtable garbage collection.  */
      RELOC_NUMBER (R_386_GNU_VTINHERIT, 250)
      RELOC_NUMBER (R_386_GNU_VTENTRY, 251)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_386_max)
 
 #endif
Index: i960.h
===================================================================
RCS file: /cvs/src/src/include/elf/i960.h,v
retrieving revision 1.2
diff -u -p -r1.2 i960.h
--- i960.h	1999/12/09 18:23:45	1.2
+++ i960.h	2000/06/06 08:17:23
@@ -32,7 +32,6 @@ START_RELOC_NUMBERS (elf_i960_reloc_type
      RELOC_NUMBER (R_960_OPTCALL,   5)
      RELOC_NUMBER (R_960_OPTCALLX,  6)
      RELOC_NUMBER (R_960_OPTCALLXA, 7)
-     EMPTY_RELOC (R_960_max)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_960_max)
 
 #endif /* _ELF_I960_H */
Index: ia64.h
===================================================================
RCS file: /cvs/src/src/include/elf/ia64.h,v
retrieving revision 1.2
diff -u -p -r1.2 ia64.h
--- ia64.h	2000/05/23 01:30:56	1.2
+++ ia64.h	2000/06/06 08:17:28
@@ -167,6 +167,6 @@ START_RELOC_NUMBERS (elf_ia64_reloc_type
   RELOC_NUMBER (R_IA64_LTOFF_TP22, 0x9a) /* @ltoff(sym-TP+add), add imm22 ## */
 
   FAKE_RELOC (R_IA64_MAX_RELOC_CODE, 0x9a)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_IA64_max)
 
 #endif /* _ELF_IA64_H */
Index: m32r.h
===================================================================
RCS file: /cvs/src/src/include/elf/m32r.h,v
retrieving revision 1.2
diff -u -p -r1.2 m32r.h
--- m32r.h	1999/10/05 00:43:14	1.2
+++ m32r.h	2000/06/06 08:17:28
@@ -37,8 +37,7 @@ START_RELOC_NUMBERS (elf_m32r_reloc_type
   RELOC_NUMBER (R_M32R_SDA16, 10)
   RELOC_NUMBER (R_M32R_GNU_VTINHERIT, 11)
   RELOC_NUMBER (R_M32R_GNU_VTENTRY, 12)
-  EMPTY_RELOC  (R_M32R_max)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_M32R_max)
 
 /* Processor specific section indices.  These sections do not actually
    exist.  Symbols with a st_shndx field corresponding to one of these
Index: m68k.h
===================================================================
RCS file: /cvs/src/src/include/elf/m68k.h,v
retrieving revision 1.3
diff -u -p -r1.3 m68k.h
--- m68k.h	1999/07/13 00:50:47	1.3
+++ m68k.h	2000/06/06 08:17:28
@@ -50,8 +50,7 @@ START_RELOC_NUMBERS (elf_m68k_reloc_type
   /* These are GNU extensions to enable C++ vtable garbage collection.  */
   RELOC_NUMBER (R_68K_GNU_VTINHERIT, 23)
   RELOC_NUMBER (R_68K_GNU_VTENTRY, 24)
-  EMPTY_RELOC  (R_68K_max)   
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_68K_max)
 
 #define EF_CPU32    0x00810000
 
Index: mcore.h
===================================================================
RCS file: /cvs/src/src/include/elf/mcore.h,v
retrieving revision 1.4
diff -u -p -r1.4 mcore.h
--- mcore.h	2000/01/20 19:08:43	1.4
+++ mcore.h	2000/06/06 08:17:28
@@ -38,8 +38,7 @@ START_RELOC_NUMBERS (elf_mcore_reloc_typ
   RELOC_NUMBER (R_MCORE_COPY, 10)
   RELOC_NUMBER (R_MCORE_GLOB_DAT, 11)
   RELOC_NUMBER (R_MCORE_JUMP_SLOT, 12)
-  EMPTY_RELOC  (R_MCORE_max)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_MCORE_max)
 
 /* Section Attributes.  */
 #define SHF_MCORE_NOREAD	0x80000000
Index: mips.h
===================================================================
RCS file: /cvs/src/src/include/elf/mips.h,v
retrieving revision 1.5
diff -u -p -r1.5 mips.h
--- mips.h	2000/05/28 19:24:21	1.5
+++ mips.h	2000/06/06 08:17:35
@@ -84,7 +84,7 @@ START_RELOC_NUMBERS (elf_mips_reloc_type
   /* These are GNU extensions to enable C++ vtable garbage collection.  */
   RELOC_NUMBER (R_MIPS_GNU_VTINHERIT, 253)
   RELOC_NUMBER (R_MIPS_GNU_VTENTRY, 254)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_MIPS_max)
 
 /* Processor specific flags for the ELF header e_flags field.  */
 
Index: mn10200.h
===================================================================
RCS file: /cvs/src/src/include/elf/mn10200.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 mn10200.h
--- mn10200.h	1999/05/03 07:29:03	1.1.1.1
+++ mn10200.h	2000/06/06 08:17:35
@@ -34,6 +34,6 @@ START_RELOC_NUMBERS (elf_mn10200_reloc_t
   RELOC_NUMBER (R_MN10200_PCREL8, 5)
   RELOC_NUMBER (R_MN10200_PCREL16, 6)
   RELOC_NUMBER (R_MN10200_PCREL24, 7)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_MN10200_max)
 
 #endif /* _ELF_MN10200_H */
Index: mn10300.h
===================================================================
RCS file: /cvs/src/src/include/elf/mn10300.h,v
retrieving revision 1.3
diff -u -p -r1.3 mn10300.h
--- mn10300.h	2000/05/28 19:25:07	1.3
+++ mn10300.h	2000/06/06 08:17:35
@@ -36,8 +36,7 @@ START_RELOC_NUMBERS (elf_mn10300_reloc_t
   RELOC_NUMBER (R_MN10300_GNU_VTINHERIT, 7)
   RELOC_NUMBER (R_MN10300_GNU_VTENTRY, 8)
   RELOC_NUMBER (R_MN10300_24, 9)
-  EMPTY_RELOC  (R_MN10300_MAX)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_MN10300_MAX)
 
 /* Machine variant if we know it.  This field was invented at Cygnus,
    but it is hoped that other vendors will adopt it.  If some standard
Index: pj.h
===================================================================
RCS file: /cvs/src/src/include/elf/pj.h,v
retrieving revision 1.1
diff -u -p -r1.1 pj.h
--- pj.h	1999/09/04 17:15:44	1.1
+++ pj.h	2000/06/06 08:17:35
@@ -35,8 +35,7 @@ START_RELOC_NUMBERS (elf_pj_reloc_type)
   RELOC_NUMBER (R_PJ_CODE_HI16, 14)
   RELOC_NUMBER (R_PJ_GNU_VTINHERIT, 15)
   RELOC_NUMBER (R_PJ_GNU_VTENTRY, 16)
-  EMPTY_RELOC (R_PJ_max)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_PJ_max)
 
 #define EF_PICOJAVA_ARCH     0x0000000f
 #define EF_PICOJAVA_NEWCALLS 0x00000010
Index: ppc.h
===================================================================
RCS file: /cvs/src/src/include/elf/ppc.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 ppc.h
--- ppc.h	1999/05/03 07:29:03	1.1.1.1
+++ ppc.h	2000/06/06 08:17:42
@@ -96,8 +96,7 @@ START_RELOC_NUMBERS (elf_ppc_reloc_type)
    that may still be in object files.  */
   RELOC_NUMBER (R_PPC_TOC16, 255)
 
-  EMPTY_RELOC (R_PPC_max)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_PPC_max)
 
 
 /* Processor specific flags for the ELF header e_flags field.  */
Index: sh.h
===================================================================
RCS file: /cvs/src/src/include/elf/sh.h,v
retrieving revision 1.3
diff -u -p -r1.3 sh.h
--- sh.h	2000/04/05 21:23:03	1.3
+++ sh.h	2000/06/06 08:17:42
@@ -78,7 +78,6 @@ START_RELOC_NUMBERS (elf_sh_reloc_type)
   RELOC_NUMBER (R_SH_GNU_VTENTRY, 35)
   RELOC_NUMBER (R_SH_LOOP_START, 36)
   RELOC_NUMBER (R_SH_LOOP_END, 37)
-  EMPTY_RELOC (R_SH_max)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_SH_max)
 
 #endif
Index: sparc.h
===================================================================
RCS file: /cvs/src/src/include/elf/sparc.h,v
retrieving revision 1.5
diff -u -p -r1.5 sparc.h
--- sparc.h	1999/07/16 21:36:38	1.5
+++ sparc.h	2000/06/06 08:17:42
@@ -134,8 +134,7 @@ START_RELOC_NUMBERS (elf_sparc_reloc_typ
   RELOC_NUMBER (R_SPARC_GNU_VTINHERIT, 250)
   RELOC_NUMBER (R_SPARC_GNU_VTENTRY, 251)
 
-  EMPTY_RELOC  (R_SPARC_max)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_SPARC_max)
 
 /* Relocation macros.  */
 
Index: v850.h
===================================================================
RCS file: /cvs/src/src/include/elf/v850.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 v850.h
--- v850.h	1999/05/03 07:29:03	1.1.1.1
+++ v850.h	2000/06/06 08:17:42
@@ -77,9 +77,7 @@ START_RELOC_NUMBERS (v850_reloc_type)
 /* END CYGNUS LOCAL */
      RELOC_NUMBER (R_V850_GNU_VTINHERIT, 23)
      RELOC_NUMBER (R_V850_GNU_VTENTRY, 24)
-
-     EMPTY_RELOC (R_V850_max)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_V850_max)
 
 
 /* Processor specific section indices.  These sections do not actually



More information about the Binutils mailing list