Move ENUM_BITFIELD to ansidecl.h
diff mbox

Message ID 20110425060214.GA1786@host1.jankratochvil.net
State New
Headers show

Commit Message

Jan Kratochvil April 25, 2011, 6:02 a.m. UTC
Hi,

[patch] ENUM_BITFIELD broke GDB
http://sourceware.org/ml/binutils/2011-04/msg00333.html

ENUM_BITFIELD has been now defined in bfdlink.h which is included only in some
GDB sources.  There would be needed some
	#ifndef ENUM_BITFIELD
	#define ENUM_BITFIELD
but I find it fragile.

Is approved its unification into ansidecl.h across gcc/binutils/gdb?

GCC still builds with the patch.


Thanks,
Jan


include/
2011-04-25  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* ansidecl.h (ENUM_BITFIELD): New, from gcc/system.h.

contrib/
2011-04-25  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* paranoia.cc (ENUM_BITFIELD): Remove.

gcc/
2011-04-25  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* system.h (ENUM_BITFIELD): Remove.

libcpp/
2011-04-25  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* system.h (ENUM_BITFIELD): Remove.

^^^ gcc approval
------------------------------------------------------------------------------

for binutils part:
include/
2011-04-25  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* bfdlink.h (ENUM_BITFIELD): Remove.

gdb/
2011-04-25  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* defs.h (ENUM_BITFIELD): Remove.

Comments

Ian Taylor April 25, 2011, 5:05 p.m. UTC | #1
On Sun, Apr 24, 2011 at 11:02 PM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:

> include/
> 2011-04-25  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
>        * ansidecl.h (ENUM_BITFIELD): New, from gcc/system.h.
>
> contrib/
> 2011-04-25  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
>        * paranoia.cc (ENUM_BITFIELD): Remove.
>
> gcc/
> 2011-04-25  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
>        * system.h (ENUM_BITFIELD): Remove.
>
> libcpp/
> 2011-04-25  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
>        * system.h (ENUM_BITFIELD): Remove.
>
> ^^^ gcc approval
> ------------------------------------------------------------------------------
>
> for binutils part:
> include/
> 2011-04-25  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
>        * bfdlink.h (ENUM_BITFIELD): Remove.
>
> gdb/
> 2011-04-25  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
>        * defs.h (ENUM_BITFIELD): Remove.

This is OK.

Note that binutils/gdb include directory is copied from gcc directory,
so no separate approval is required there.  But I technically can't
approve the change to gdb/defs.h, although I think it counts as
obvious given the other changes.

Thanks.

Ian
Jan Kratochvil April 25, 2011, 6:15 p.m. UTC | #2
On Mon, 25 Apr 2011 19:05:22 +0200, Ian Lance Taylor wrote:
> On Sun, Apr 24, 2011 at 11:02 PM, Jan Kratochvil
> <jan.kratochvil@redhat.com> wrote:
> 
> > include/
> > 2011-04-25  Jan Kratochvil  <jan.kratochvil@redhat.com>
> >
> >        * ansidecl.h (ENUM_BITFIELD): New, from gcc/system.h.
> >
> > contrib/
> > 2011-04-25  Jan Kratochvil  <jan.kratochvil@redhat.com>
> >
> >        * paranoia.cc (ENUM_BITFIELD): Remove.
> >
> > gcc/
> > 2011-04-25  Jan Kratochvil  <jan.kratochvil@redhat.com>
> >
> >        * system.h (ENUM_BITFIELD): Remove.
> >
> > libcpp/
> > 2011-04-25  Jan Kratochvil  <jan.kratochvil@redhat.com>
> >
> >        * system.h (ENUM_BITFIELD): Remove.
> >
> > ^^^ gcc approval
> > ------------------------------------------------------------------------------
> 
> This is OK.

Checked in:
	http://gcc.gnu.org/ml/gcc-cvs/2011-04/msg01129.html
	http://gcc.gnu.org/viewcvs?view=revision&revision=172933


> Note that binutils/gdb include directory is copied from gcc directory,

Yes, going to merge it now, I was already told by Alan Modra:
	http://sourceware.org/ml/binutils/2011-04/msg00339.html


Thanks,
Jan

Patch
diff mbox

--- include/ansidecl.h	(revision 172929)
+++ include/ansidecl.h	(working copy)
@@ -416,6 +416,15 @@  So instead we use the macro below and te
 #define EXPORTED_CONST const
 #endif
 
+/* Be conservative and only use enum bitfields with GCC.
+   FIXME: provide a complete autoconf test for buggy enum bitfields.  */
+
+#if (GCC_VERSION > 2000)
+#define ENUM_BITFIELD(TYPE) __extension__ enum TYPE
+#else
+#define ENUM_BITFIELD(TYPE) unsigned int
+#endif
+
 #ifdef __cplusplus
 }
 #endif
--- contrib/paranoia.cc	(revision 172929)
+++ contrib/paranoia.cc	(working copy)
@@ -169,7 +169,6 @@  lines
     };
 #undef DEFTREECODE
 
-#define ENUM_BITFIELD(X) enum X
 #define class klass
 
 #include "real.h"
--- gcc/system.h	(revision 172929)
+++ gcc/system.h	(working copy)
@@ -598,15 +598,6 @@  extern int vsnprintf(char *, size_t, con
 #define HOST_BIT_BUCKET "/dev/null"
 #endif
 
-/* Be conservative and only use enum bitfields with GCC.
-   FIXME: provide a complete autoconf test for buggy enum bitfields.  */
-
-#if (GCC_VERSION > 2000)
-#define ENUM_BITFIELD(TYPE) __extension__ enum TYPE
-#else
-#define ENUM_BITFIELD(TYPE) unsigned int
-#endif
-
 #ifndef offsetof
 #define offsetof(TYPE, MEMBER)	((size_t) &((TYPE *) 0)->MEMBER)
 #endif
--- libcpp/system.h	(revision 172929)
+++ libcpp/system.h	(working copy)
@@ -357,15 +357,6 @@  extern void abort (void);
    || (__STDC_VERSION__ >= 199901L))
 #endif
 
-/* Be conservative and only use enum bitfields with GCC.
-   FIXME: provide a complete autoconf test for buggy enum bitfields.  */
-
-#if (GCC_VERSION > 2000)
-#define ENUM_BITFIELD(TYPE) __extension__ enum TYPE
-#else
-#define ENUM_BITFIELD(TYPE) unsigned int
-#endif
-
 #ifndef offsetof
 #define offsetof(TYPE, MEMBER)	((size_t) &((TYPE *) 0)->MEMBER)
 #endif
--- include/bfdlink.h
+++ include/bfdlink.h
@@ -24,12 +24,6 @@ 
 #ifndef BFDLINK_H
 #define BFDLINK_H
 
-#if (__GNUC__ * 1000 + __GNUC_MINOR__ > 2000)
-#define ENUM_BITFIELD(TYPE) __extension__ enum TYPE
-#else
-#define ENUM_BITFIELD(TYPE) unsigned int
-#endif
-
 /* Which symbols to strip during a link.  */
 enum bfd_link_strip
 {
--- gdb/defs.h
+++ gdb/defs.h
@@ -271,15 +271,6 @@  struct cleanup
     void *arg;
   };
 
-/* Be conservative and use enum bitfields only with GCC.
-   This is copied from gcc 3.3.1, system.h.  */
-
-#if defined(__GNUC__) && (__GNUC__ >= 2)
-#define ENUM_BITFIELD(TYPE) enum TYPE
-#else
-#define ENUM_BITFIELD(TYPE) unsigned int
-#endif
-
 /* vec.h-style vectors of strings want a typedef for char * .  */
 
 typedef char * char_ptr;