Re: [PATCH] non-GNU C++ compilers

2011-08-08 Thread Joseph S. Myers
On Mon, 8 Aug 2011, Marc Glisse wrote:

>   * include/obstack.h (obstack_free): Cast to char* instead of int

This header comes from glibc/gnulib.  Although some local changes have 
been made to it in the past, sending any fixes to upstream glibc is still 
a good idea.

(ansidecl.h *claims* to come from glibc but the glibc copy was removed in 
1997.  obstack.h really does still come from glibc.)

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: [PATCH] non-GNU C++ compilers

2011-08-08 Thread Marc Glisse

On Mon, 8 Aug 2011, Joseph S. Myers wrote:


On Mon, 8 Aug 2011, Marc Glisse wrote:


* include/obstack.h (obstack_free): Cast to char* instead of int


This header comes from glibc/gnulib.  Although some local changes have
been made to it in the past, sending any fixes to upstream glibc is still
a good idea.

(ansidecl.h *claims* to come from glibc but the glibc copy was removed in
1997.  obstack.h really does still come from glibc.)


Ah, ok, thanks, that's confusing indeed.

/me takes a look at malloc/obstack.h in glibc.

Er, the 2 seem to have diverged quite a bit. I will send a similar patch 
to glibc (not quite the same as obstack_free already looks different), but 
it looks like gcc still needs patching independently.


--
Marc Glisse


Re: [PATCH] non-GNU C++ compilers

2011-08-20 Thread Marc Glisse

On Mon, 8 Aug 2011, Joseph S. Myers wrote:


On Mon, 8 Aug 2011, Marc Glisse wrote:


* include/obstack.h (obstack_free): Cast to char* instead of int


This header comes from glibc/gnulib.  Although some local changes have
been made to it in the past, sending any fixes to upstream glibc is still
a good idea.


http://sourceware.org/bugzilla/show_bug.cgi?id=13067

(doesn't help gcc much, but it is in glibc's bugzilla now)

--
Marc Glisse


Re: [PATCH] non-GNU C++ compilers

2011-09-17 Thread Marc Glisse

(the original discussion started here:
http://gcc.gnu.org/ml/gcc-patches/2011-08/msg00758.html
)

On Mon, 8 Aug 2011, Joseph S. Myers wrote:


On Mon, 8 Aug 2011, Marc Glisse wrote:


* include/obstack.h (obstack_free): Cast to char* instead of int


This header comes from glibc/gnulib.  Although some local changes have
been made to it in the past, sending any fixes to upstream glibc is still
a good idea.


It was fixed in glibc. The equivalent patch (not identical because the 
files are already different) for gcc would be the one attached.



(ansidecl.h *claims* to come from glibc but the glibc copy was removed in
1997.  obstack.h really does still come from glibc.)


Is someone willing to review (and possibly commit) these 2 patches?

Changelog for include/obstack.h in glibc (guess it should be copied almost 
as is?):


2011-09-11  Ulrich Drepper  
* obstack.h [!GNUC] (obstack_free): Avoid cast to int.

Changelog for the ansidecl.h part:

2011-08-08 Marc Glisse 
* include/ansidecl.h (ENUM_BITFIELD): Always use enum in C++

--
Marc GlisseIndex: obstack.h
===
--- obstack.h   (revision 178906)
+++ 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__ */
 


Re: [PATCH] non-GNU C++ compilers

2011-09-17 Thread Joseph S. Myers
On Sat, 17 Sep 2011, Marc Glisse wrote:

> Is someone willing to review (and possibly commit) these 2 patches?
> 
> Changelog for include/obstack.h in glibc (guess it should be copied almost as
> is?):
> 
> 2011-09-11  Ulrich Drepper  
>   * obstack.h [!GNUC] (obstack_free): Avoid cast to int.
> 
> Changelog for the ansidecl.h part:
> 
> 2011-08-08 Marc Glisse 
>   * include/ansidecl.h (ENUM_BITFIELD): Always use enum in C++

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.

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: [PATCH] non-GNU C++ compilers

2011-09-24 Thread Marc Glisse

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  

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

2011-09-26  Marc Glisse  

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

--
Marc GlisseIndex: 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__ */