[gcc patch] Move ENUM_BITFIELD to ansidecl.h

Jan Kratochvil
2011-04-25T06:02:52Z

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.

--- 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;