* [PATCH] non-GNU C++ compilers
@ 2011-08-08 12:51 Marc Glisse
2011-08-08 21:50 ` Joseph S. Myers
0 siblings, 1 reply; 9+ messages in thread
From: Marc Glisse @ 2011-08-08 12:51 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: TEXT/PLAIN, Size: 622 bytes --]
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.glisse@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
[-- Attachment #2: Type: TEXT/PLAIN, Size: 1381 bytes --]
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__ */
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] non-GNU C++ compilers
2011-08-08 12:51 [PATCH] non-GNU C++ compilers Marc Glisse
@ 2011-08-08 21:50 ` Joseph S. Myers
2011-08-08 23:20 ` Marc Glisse
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Joseph S. Myers @ 2011-08-08 21:50 UTC (permalink / raw)
To: Marc Glisse; +Cc: gcc-patches
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
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] non-GNU C++ compilers
2011-08-08 21:50 ` Joseph S. Myers
@ 2011-08-08 23:20 ` Marc Glisse
2011-08-20 20:28 ` Marc Glisse
2011-09-17 9:27 ` Marc Glisse
2 siblings, 0 replies; 9+ messages in thread
From: Marc Glisse @ 2011-08-08 23:20 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: gcc-patches
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] non-GNU C++ compilers
2011-08-08 21:50 ` Joseph S. Myers
2011-08-08 23:20 ` Marc Glisse
@ 2011-08-20 20:28 ` Marc Glisse
2011-09-17 9:27 ` Marc Glisse
2 siblings, 0 replies; 9+ messages in thread
From: Marc Glisse @ 2011-08-20 20:28 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: gcc-patches
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] non-GNU C++ compilers
2011-08-08 21:50 ` Joseph S. Myers
2011-08-08 23:20 ` Marc Glisse
2011-08-20 20:28 ` Marc Glisse
@ 2011-09-17 9:27 ` Marc Glisse
2011-09-17 13:44 ` Joseph S. Myers
2 siblings, 1 reply; 9+ messages in thread
From: Marc Glisse @ 2011-09-17 9:27 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: gcc-patches
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1112 bytes --]
(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 <drepper@gmail.com>
* obstack.h [!GNUC] (obstack_free): Avoid cast to int.
Changelog for the ansidecl.h part:
2011-08-08 Marc Glisse <marc.glisse@inria.fr>
* include/ansidecl.h (ENUM_BITFIELD): Always use enum in C++
--
Marc Glisse
[-- Attachment #2: Type: TEXT/PLAIN, Size: 732 bytes --]
Index: 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__ */
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] non-GNU C++ compilers
2011-09-17 9:27 ` Marc Glisse
@ 2011-09-17 13:44 ` Joseph S. Myers
2011-09-24 22:38 ` Marc Glisse
0 siblings, 1 reply; 9+ messages in thread
From: Joseph S. Myers @ 2011-09-17 13:44 UTC (permalink / raw)
To: gcc-patches
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 <drepper@gmail.com>
> * obstack.h [!GNUC] (obstack_free): Avoid cast to int.
>
> Changelog for the ansidecl.h part:
>
> 2011-08-08 Marc Glisse <marc.glisse@inria.fr>
> * 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
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] non-GNU C++ compilers
2011-09-17 13:44 ` Joseph S. Myers
@ 2011-09-24 22:38 ` Marc Glisse
2011-10-21 19:11 ` Ping: " Marc Glisse
0 siblings, 1 reply; 9+ messages in thread
From: Marc Glisse @ 2011-09-24 22:38 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: gcc-patches
[-- Attachment #1: Type: TEXT/PLAIN, Size: 742 bytes --]
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++
--
Marc Glisse
[-- Attachment #2: Type: TEXT/PLAIN, Size: 1424 bytes --]
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__ */
^ permalink raw reply [flat|nested] 9+ messages in thread
* Ping: [PATCH] non-GNU C++ compilers
2011-09-24 22:38 ` Marc Glisse
@ 2011-10-21 19:11 ` Marc Glisse
2011-10-22 5:54 ` DJ Delorie
0 siblings, 1 reply; 9+ messages in thread
From: Marc Glisse @ 2011-10-21 19:11 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: TEXT/PLAIN, Size: 852 bytes --]
Hello,
anyone willing to commit this?
On Sat, 24 Sep 2011, Marc Glisse wrote:
> 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++
--
Marc Glisse
[-- Attachment #2: Type: TEXT/PLAIN, Size: 1424 bytes --]
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__ */
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Ping: [PATCH] non-GNU C++ compilers
2011-10-21 19:11 ` Ping: " Marc Glisse
@ 2011-10-22 5:54 ` DJ Delorie
0 siblings, 0 replies; 9+ messages in thread
From: DJ Delorie @ 2011-10-22 5:54 UTC (permalink / raw)
To: Marc Glisse; +Cc: gcc-patches
Committed. Thanks!
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-10-22 1:36 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-08 12:51 [PATCH] non-GNU C++ compilers Marc Glisse
2011-08-08 21:50 ` Joseph S. Myers
2011-08-08 23:20 ` Marc Glisse
2011-08-20 20:28 ` Marc Glisse
2011-09-17 9:27 ` Marc Glisse
2011-09-17 13:44 ` Joseph S. Myers
2011-09-24 22:38 ` Marc Glisse
2011-10-21 19:11 ` Ping: " Marc Glisse
2011-10-22 5:54 ` DJ Delorie
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).