Hello,

this helps C++ compilers that do not define __GNUC__ compile gcc.

Bootstrapped:
1) CC=gcc with --disable-build-poststage1-with-cxx
2) CC=suncc

The second one required a fix for PR49907. I didn't build with sunCC simply because it requires several more patches.

Issues were discussed there:
http://gcc.gnu.org/ml/gcc/2011-07/msg00523.html
http://gcc.gnu.org/ml/gcc/2011-08/msg00006.html

Note that I can't commit.

2011-08-08  Marc Glisse  <marc.gli...@inria.fr>

        * include/ansidecl.h (ENUM_BITFIELD): Always use enum in C++
        * include/obstack.h (obstack_free): Cast to char* instead of int


--
Marc Glisse
Index: include/ansidecl.h
===================================================================
--- include/ansidecl.h  (revision 177557)
+++ 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 177557)
+++ 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)->next_free = (h)->object_base                                        
\
            = (h)->temp + (char *) (h)->chunk)                          \
-   : (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0)))
+   : ((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), (char*)0)))
 
 #endif /* not __GNUC__ or not __STDC__ */
 

Reply via email to