diff mbox

[04/10] htl: Make __PTHREAD_ONCE_INIT more flexible

Message ID 20200114185255.25813-6-samuel.thibault@ens-lyon.org
State Committed, archived
Headers show

Commit Message

Samuel Thibault Jan. 14, 2020, 6:52 p.m. UTC
by moving its (struct __pthread_once) cast into PTHREAD_ONCE_INIT.
---
 sysdeps/htl/bits/types/struct___pthread_once.h | 2 +-
 sysdeps/htl/pthread.h                          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Adhemerval Zanella Jan. 20, 2020, 6:01 p.m. UTC | #1
On 14/01/2020 15:52, Samuel Thibault wrote:
> by moving its (struct __pthread_once) cast into PTHREAD_ONCE_INIT.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/htl/bits/types/struct___pthread_once.h | 2 +-
>  sysdeps/htl/pthread.h                          | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sysdeps/htl/bits/types/struct___pthread_once.h b/sysdeps/htl/bits/types/struct___pthread_once.h
> index 31a0c0817b..a6b6db708c 100644
> --- a/sysdeps/htl/bits/types/struct___pthread_once.h
> +++ b/sysdeps/htl/bits/types/struct___pthread_once.h
> @@ -28,6 +28,6 @@ struct __pthread_once
>  };
>  
>  #define __PTHREAD_ONCE_INIT \
> -	(struct __pthread_once) { 0, __PTHREAD_SPIN_LOCK_INITIALIZER }
> +	0, __PTHREAD_SPIN_LOCK_INITIALIZER
>  
>  #endif /* bits/types/struct___pthread_once.h */

Ok.

> diff --git a/sysdeps/htl/pthread.h b/sysdeps/htl/pthread.h
> index 3216860493..38c61e8da3 100644
> --- a/sysdeps/htl/pthread.h
> +++ b/sysdeps/htl/pthread.h
> @@ -802,7 +802,7 @@ extern int pthread_setspecific (pthread_key_t __key, const void *__value)
>  
>  #include <bits/types/struct___pthread_once.h>
>  
> -#define PTHREAD_ONCE_INIT __PTHREAD_ONCE_INIT
> +#define PTHREAD_ONCE_INIT (struct __pthread_once) { __PTHREAD_ONCE_INIT }
>  
>  /* Call INIT_ROUTINE if this function has never been called with
>     *ONCE_CONTROL, otherwise do nothing.  */
> 

Ok, although I think the cast is superfluous.
Samuel Thibault Jan. 20, 2020, 6:29 p.m. UTC | #2
Adhemerval Zanella, le lun. 20 janv. 2020 15:01:13 -0300, a ecrit:
> > -	(struct __pthread_once) { 0, __PTHREAD_SPIN_LOCK_INITIALIZER }
> > +	0, __PTHREAD_SPIN_LOCK_INITIALIZER

> > -#define PTHREAD_ONCE_INIT __PTHREAD_ONCE_INIT
> > +#define PTHREAD_ONCE_INIT (struct __pthread_once) { __PTHREAD_ONCE_INIT }
> 
> Ok, although I think the cast is superfluous.

I think so as well, but preferred to keep it for now, so that this
series is a no-op in that regard :)

Samuel
diff mbox

Patch

diff --git a/sysdeps/htl/bits/types/struct___pthread_once.h b/sysdeps/htl/bits/types/struct___pthread_once.h
index 31a0c0817b..a6b6db708c 100644
--- a/sysdeps/htl/bits/types/struct___pthread_once.h
+++ b/sysdeps/htl/bits/types/struct___pthread_once.h
@@ -28,6 +28,6 @@  struct __pthread_once
 };
 
 #define __PTHREAD_ONCE_INIT \
-	(struct __pthread_once) { 0, __PTHREAD_SPIN_LOCK_INITIALIZER }
+	0, __PTHREAD_SPIN_LOCK_INITIALIZER
 
 #endif /* bits/types/struct___pthread_once.h */
diff --git a/sysdeps/htl/pthread.h b/sysdeps/htl/pthread.h
index 3216860493..38c61e8da3 100644
--- a/sysdeps/htl/pthread.h
+++ b/sysdeps/htl/pthread.h
@@ -802,7 +802,7 @@  extern int pthread_setspecific (pthread_key_t __key, const void *__value)
 
 #include <bits/types/struct___pthread_once.h>
 
-#define PTHREAD_ONCE_INIT __PTHREAD_ONCE_INIT
+#define PTHREAD_ONCE_INIT (struct __pthread_once) { __PTHREAD_ONCE_INIT }
 
 /* Call INIT_ROUTINE if this function has never been called with
    *ONCE_CONTROL, otherwise do nothing.  */