This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 0/2] Fix attributes for fortify functions


On Wednesday, August 29, 2012 13:51:15 Marek Polacek wrote:
> 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)

That defines it for any compiler, even non-gcc ones.

Let's check and try to fix all cases if possible:
* We miss the !__cplusplus && GCC && GCC < 4.3 (the one you make above)
* We also miss the !__cplusplus && any other compiler

Note: I would prefer a patch that handles non-GCC compilers but this is 
not a requirement. If you make it as above, add a comment so that it's 
clear what you do...

Btw. I suggest to file a bugreport for this and fix this for 2.16 as well.

Thanks,
Andreas
-- 
 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]