This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Make __extern_always_inline usable on clang++ again
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Siddhesh Poyarekar <siddhesh at redhat dot com>
- Cc: libc-alpha at sourceware dot org, David Sommerseth <davids at redhat dot com>, carlos at redhat dot com, allan at archlinux dot org
- Date: Tue, 16 Sep 2014 12:41:46 +0200
- Subject: Re: [PATCH] Make __extern_always_inline usable on clang++ again
- Authentication-results: sourceware.org; auth=none
- References: <20140916102016 dot GM6586 at spoyarek dot pnq dot redhat dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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