non-GNU C++ compilers

Submitted by Marc Glisse on Sept. 24, 2011, 7:58 p.m.

Details

Message ID alpine.DEB.2.02.1109242130000.9208@laptop-mg.saclay.inria.fr
State New
Headers show

Commit Message

Marc Glisse Sept. 24, 2011, 7:58 p.m.
On Sat, 17 Sep 2011, Joseph S. Myers wrote:

> These are OK (with ChangeLog entries properly omitting the "include/",
> since they go in include/ChangeLog) in the absence of libiberty maintainer
> objections within 72 hours.

Thanks. Is someone willing to commit them now they have been accepted? I 
am attaching them as a single patch and copying the changelog entries here 
for convenience (I wrote the date of Monday because it looks like a day 
where someone might have time to commit...).

include/ChangeLog:

2011-09-26  Ulrich Drepper  <drepper@gmail.com>

 	* obstack.h [!GNUC] (obstack_free): Avoid cast to int.

2011-09-26  Marc Glisse  <marc.glisse@inria.fr>

 	* ansidecl.h (ENUM_BITFIELD): Always use enum in C++

Patch hide | download patch | download mbox

Index: include/ansidecl.h
===================================================================
--- include/ansidecl.h	(revision 179146)
+++ include/ansidecl.h	(working copy)
@@ -416,10 +416,12 @@ 
 #define EXPORTED_CONST const
 #endif
 
-/* Be conservative and only use enum bitfields with GCC.
+/* Be conservative and only use enum bitfields with C++ or GCC.
    FIXME: provide a complete autoconf test for buggy enum bitfields.  */
 
-#if (GCC_VERSION > 2000)
+#ifdef __cplusplus
+#define ENUM_BITFIELD(TYPE) enum TYPE
+#elif (GCC_VERSION > 2000)
 #define ENUM_BITFIELD(TYPE) __extension__ enum TYPE
 #else
 #define ENUM_BITFIELD(TYPE) unsigned int
Index: include/obstack.h
===================================================================
--- include/obstack.h	(revision 179146)
+++ include/obstack.h	(working copy)
@@ -532,9 +532,9 @@ 
 # define obstack_free(h,obj)						\
 ( (h)->temp = (char *) (obj) - (char *) (h)->chunk,			\
   (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
-   ? (int) ((h)->next_free = (h)->object_base				\
-	    = (h)->temp + (char *) (h)->chunk)				\
-   : (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0)))
+   ? (((h)->next_free = (h)->object_base				\
+	    = (h)->temp + (char *) (h)->chunk), 0)			\
+   : ((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0)))
 
 #endif /* not __GNUC__ or not __STDC__ */