This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix up definitions for older G++
- From: Andreas Jaeger <aj at suse dot com>
- To: libc-alpha at sourceware dot org
- Date: Tue, 04 Sep 2012 21:51:57 +0200
- Subject: Re: [PATCH] Fix up definitions for older G++
- References: <20120831120003.GB3556@redhat.com>
On 08/31/2012 02:00 PM, Marek Polacek wrote:
So this should fix both bugs #14530 and #13741. We weren't defining
__extern_always_inline macro for C++ when using G++ earlier than 4.3,
which caused failures. This still not addresses non-GCC compilers,
though
BTW, wonder whether in that macro shouldn't be __GNUC_GNU_INLINE__
in place of __GNUC_STDC_INLINE__. We have:
# if defined __GNUC_STDC_INLINE__ || defined __cplusplus
# define __extern_inline extern __inline __attribute__ ((__gnu_inline__))
# define __extern_always_inline \
extern __always_inline __attribute__ ((__gnu_inline__))
That way, when using -fgnu89-inline the __GNUC_GNU_INLINE__ would be
defined and we'd get the gnu_inline attribute.
Tried to compile <stdlib.h> with gcc 4[1234567]/trunk. Tested x86_64,
ok for trunk?
2012-08-31 Marek Polacek <polacek@redhat.com>
[BZ #14530]
[BZ #13741]
* misc/sys/cdefs.h: Define __extern_inline and __extern_always_inline
for C++ and GCC <4.3 as well.
--- libc/misc/sys/cdefs.h.mp2 2012-08-31 11:52:24.778971804 +0200
+++ libc/misc/sys/cdefs.h 2012-08-31 13:20:30.430284130 +0200
@@ -329,6 +329,10 @@
# define __extern_inline extern __inline
# define __extern_always_inline extern __always_inline
# endif
+#else /* C++ and GCC <4.3. */
The test is:
#if !defined __cplusplus || __GNUC_PREREQ (4,3)
So, the negation would be:
C++ and !(GCC >= 4.3) - which means also a non-gcc compiler.
What about
#elif defined __GNUC__
/* C++ and GCC < 4.3. */
+# define __extern_inline extern __inline
+# define __extern_always_inline \
+ extern __always_inline
#else
and then defining them as empty.
We use _extern_always_inline without any tests in the rest of GCC but
sometimes check whether it exists. This might need a further cleanup but
none that I consider urgent,
Andreas
#endif
/* GCC 4.3 and above allow passing all anonymous arguments of an
Marek
--
Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126