This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 1/7] Fix __PTHREAD_MUTEX_HAVE_ELISION -Wundef warning
- From: Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>
- To: libc-alpha at sourceware dot org
- Date: Mon, 17 Mar 2014 09:29:24 -0300
- Subject: Re: [PATCH 1/7] Fix __PTHREAD_MUTEX_HAVE_ELISION -Wundef warning
- Authentication-results: sourceware.org; auth=none
- References: <1395059004-20960-1-git-send-email-will dot newton at linaro dot org>
On 17-03-2014 09:23, Will Newton wrote:
> ChangeLog:
>
> 2014-03-17 Will Newton <will.newton@linaro.org>
>
> * nptl/sysdeps/pthread/pthread.h: Check
> __PTHREAD_MUTEX_HAVE_ELISION is defined before testing
> its value.
> ---
> nptl/sysdeps/pthread/pthread.h | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/nptl/sysdeps/pthread/pthread.h b/nptl/sysdeps/pthread/pthread.h
> index 1e0c5dc..142da63 100644
> --- a/nptl/sysdeps/pthread/pthread.h
> +++ b/nptl/sysdeps/pthread/pthread.h
> @@ -83,12 +83,16 @@ enum
>
>
> /* Mutex initializers. */
> -#if __PTHREAD_MUTEX_HAVE_ELISION == 1 /* 64bit layout. */
> -#define __PTHREAD_SPINS 0, 0
> -#elif __PTHREAD_MUTEX_HAVE_ELISION == 2 /* 32bit layout. */
> -#define __PTHREAD_SPINS { 0, 0 }
> +#ifdef __PTHREAD_MUTEX_HAVE_ELISION
> +# if __PTHREAD_MUTEX_HAVE_ELISION == 1 /* 64bit layout. */
> +# define __PTHREAD_SPINS 0, 0
> +# elif __PTHREAD_MUTEX_HAVE_ELISION == 2 /* 32bit layout. */
> +# define __PTHREAD_SPINS { 0, 0 }
> +# else
> +# error "Unknown value of __PTHREAD_MUTEX_HAVE_ELISION"
> +# endif
> #else
> -#define __PTHREAD_SPINS 0
> +# define __PTHREAD_SPINS 0
> #endif
>
> #ifdef __PTHREAD_MUTEX_HAVE_PREV
Hi Will, I'm ok with this patch (I did the same on ppc builds).