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] Make __extern_always_inline usable on clang++ again


On Tue, Sep 16, 2014 at 03:50:16PM +0530, Siddhesh Poyarekar wrote:
> [1] https://sourceware.org/ml/libc-alpha/2012-12/msg00306.html
> 
> 	[BZ #17266]
> 	* misc/sys/cdefs.h [!defined __extern_always_inline && defined
> 	__clang__]: Define __extern_always_inline and __extern_inline
> 	for clang++.
> 
> diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
> index d8ee73c..20b2483 100644
> --- a/misc/sys/cdefs.h
> +++ b/misc/sys/cdefs.h
> @@ -330,6 +330,20 @@
>  # endif
>  #endif
>  
> +/* clang++ identifies itself as gcc-4.2, but has support for GNU inlining
> +   semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and
> +   __GNUC_GNU_INLINE__ macro definitions.  */

s/fot/for/; why are you using a separate hunk for clang instead of using the
earlier one?

> +#if !defined __extern_always_inline && defined __clang__
> +# if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
> +#  define __extern_inline extern __inline __attribute__ ((__gnu_inline__))
> +#  define __extern_always_inline \
> +  extern __always_inline __attribute__ ((__gnu_inline__))
> +# else
> +#  define __extern_inline extern __inline
> +#  define __extern_always_inline extern __always_inline

This doesn't look right.  If you have clang that doesn't have gnu_inline
support, in C++ extern __inline definitely is not the right semantics.
You don't want to define the macros then.

I'd say you want to change:
#if !defined __cplusplus || __GNUC_PREREQ (4,3)
to:
#if !defined __cplusplus || __GNUC_PREREQ (4,3) \
    || (defined __clang__ && (defined __GNUC_STDC_INLINE__ \
			      || defined __GNUC_GNU_INLINE__))

	Jakub


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