[PATCH 0/2] Fix attributes for fortify functions

Marek Polacek polacek@redhat.com
Wed Aug 29 11:51:00 GMT 2012


On Wed, Aug 29, 2012 at 03:53:29AM +0400, Dmitry V. Levin wrote:
> This commit glibc-2.15-685-g5ac3ea1 introduced a regression:
> 
> $ echo '#include <stdlib.h>' |gcc-4.1 -O2 -D_FORTIFY_SOURCE=2 -S -xc++ - -o /dev/null
> /usr/include/bits/stdlib.h:36: error: expected constructor, destructor, or type conversion before 'char'
> /usr/include/stdlib.h:972: error: expected `}' at end of input

Ouch.  That's because when __cplusplus and !__GNUC_PREREQ (4,3), we
never define __extern_always_inline.  This quick hack ought to "fix"
it.  Sorry.

--- libc/misc/sys/cdefs.h.mp2	2012-08-29 13:45:23.975696658 +0200
+++ libc/misc/sys/cdefs.h	2012-08-29 13:47:49.643063131 +0200
@@ -331,6 +331,12 @@
 # endif
 #endif
 
+#if defined __cplusplus && !__GNUC_PREREQ (4,3)
+# define __extern_inline extern __inline __attribute__ ((__gnu_inline__))
+# define __extern_always_inline \
+  extern __always_inline __attribute__ ((__gnu_inline__))
+#endif
+
 /* GCC 4.3 and above allow passing all anonymous arguments of an
    __extern_always_inline function to some other vararg function.  */
 #if __GNUC_PREREQ (4,3)

	Marek



More information about the Libc-alpha mailing list