public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [gcc patch] Move ENUM_BITFIELD to ansidecl.h
@ 2011-04-25  6:02 Jan Kratochvil
  2011-04-25 17:05 ` Ian Lance Taylor
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kratochvil @ 2011-04-25  6:02 UTC (permalink / raw)
  To: gcc-patches; +Cc: binutils, gdb-patches

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;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gcc patch] Move ENUM_BITFIELD to ansidecl.h
  2011-04-25  6:02 [gcc patch] Move ENUM_BITFIELD to ansidecl.h Jan Kratochvil
@ 2011-04-25 17:05 ` Ian Lance Taylor
  2011-04-25 18:15   ` Jan Kratochvil
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Lance Taylor @ 2011-04-25 17:05 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gcc-patches, binutils, gdb-patches

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gcc patch] Move ENUM_BITFIELD to ansidecl.h
  2011-04-25 17:05 ` Ian Lance Taylor
@ 2011-04-25 18:15   ` Jan Kratochvil
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kratochvil @ 2011-04-25 18:15 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-patches, binutils, gdb-patches

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-04-25 18:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-25  6:02 [gcc patch] Move ENUM_BITFIELD to ansidecl.h Jan Kratochvil
2011-04-25 17:05 ` Ian Lance Taylor
2011-04-25 18:15   ` Jan Kratochvil

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).