[v2] Move shared pthread definitions to common headers

Message ID mvm379mxhcx.fsf@suse.de
State Committed
Commit 55703fcace89b53d7f41f7d85ede50571da2bcc8
Headers

Commit Message

Andreas Schwab July 24, 2017, 10:24 a.m. UTC
  On Apr 18 2017, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:

> diff --git a/sysdeps/nptl/bits/thread-shared-types.h b/sysdeps/nptl/bits/thread-shared-types.h
> new file mode 100644
> index 0000000..a829cee
> --- /dev/null
> +++ b/sysdeps/nptl/bits/thread-shared-types.h

This has extra semicolons that will be flagged by -Wpedantic.

In file included from /usr/include/bits/pthreadtypes.h:23:0,
                 from /usr/include/pthread.h:26,
                 from pthread.c:1:
/usr/include/bits/thread-shared-types.h:110:31: warning: extra semicolon in struct or union specified [-Wpedantic]
   __PTHREAD_COMPAT_PADDING_MID;
                               ^
/usr/include/bits/thread-shared-types.h:112:23: warning: extra semicolon in struct or union specified [-Wpedantic]
   __PTHREAD_SPINS_DATA;
                       ^
/usr/include/bits/thread-shared-types.h:123:31: warning: extra semicolon in struct or union specified [-Wpedantic]
   __PTHREAD_COMPAT_PADDING_END;
                               ^

Andreas.

	[BZ #21804]
	* sysdeps/nptl/bits/thread-shared-types.h (__PTHREAD_SPINS_DATA)
	[__PTHREAD_MUTEX_LOCK_ELISION && __WORDSIZE == 64]: Remove
	trailing semicolon.
	(struct __pthread_mutex_s): Remove semicolon after
	__PTHREAD_COMPAT_PADDING_MID and __PTHREAD_COMPAT_PADDING_END.
	* sysdeps/hppa/nptl/bits/pthreadtypes-arch.h
	(__PTHREAD_COMPAT_PADDING_MID, __PTHREAD_COMPAT_PADDING_END): Add
	semicolon.
  

Comments

Siddhesh Poyarekar July 24, 2017, 1:13 p.m. UTC | #1
On Monday 24 July 2017 03:54 PM, Andreas Schwab wrote:
> On Apr 18 2017, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
> 
>> diff --git a/sysdeps/nptl/bits/thread-shared-types.h b/sysdeps/nptl/bits/thread-shared-types.h
>> new file mode 100644
>> index 0000000..a829cee
>> --- /dev/null
>> +++ b/sysdeps/nptl/bits/thread-shared-types.h
> 
> This has extra semicolons that will be flagged by -Wpedantic.
> 
> In file included from /usr/include/bits/pthreadtypes.h:23:0,
>                  from /usr/include/pthread.h:26,
>                  from pthread.c:1:
> /usr/include/bits/thread-shared-types.h:110:31: warning: extra semicolon in struct or union specified [-Wpedantic]
>    __PTHREAD_COMPAT_PADDING_MID;
>                                ^
> /usr/include/bits/thread-shared-types.h:112:23: warning: extra semicolon in struct or union specified [-Wpedantic]
>    __PTHREAD_SPINS_DATA;
>                        ^
> /usr/include/bits/thread-shared-types.h:123:31: warning: extra semicolon in struct or union specified [-Wpedantic]
>    __PTHREAD_COMPAT_PADDING_END;
>                                ^
> 
> Andreas.
> 
> 	[BZ #21804]
> 	* sysdeps/nptl/bits/thread-shared-types.h (__PTHREAD_SPINS_DATA)
> 	[__PTHREAD_MUTEX_LOCK_ELISION && __WORDSIZE == 64]: Remove
> 	trailing semicolon.
> 	(struct __pthread_mutex_s): Remove semicolon after
> 	__PTHREAD_COMPAT_PADDING_MID and __PTHREAD_COMPAT_PADDING_END.
> 	* sysdeps/hppa/nptl/bits/pthreadtypes-arch.h
> 	(__PTHREAD_COMPAT_PADDING_MID, __PTHREAD_COMPAT_PADDING_END): Add
> 	semicolon.

This is fine.

Siddhesh

> 
> diff --git a/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h b/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h
> index 7befe5de6d..c1585625d1 100644
> --- a/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h
> +++ b/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h
> @@ -43,10 +43,10 @@
>  /* The old 4-word 16-byte aligned lock. This is initalized
>     to all ones by the Linuxthreads PTHREAD_MUTEX_INITIALIZER.
>     Unused in NPTL.  */
> -#define __PTHREAD_COMPAT_PADDING_MID  int __compat_padding[4]
> +#define __PTHREAD_COMPAT_PADDING_MID  int __compat_padding[4];
>  /* Two more words are left before the NPTL
>     pthread_mutex_t is larger than Linuxthreads.  */
> -#define __PTHREAD_COMPAT_PADDING_END  int __reserved[2]
> +#define __PTHREAD_COMPAT_PADDING_END  int __reserved[2];
>  #define __PTHREAD_MUTEX_LOCK_ELISION    0
>  
>  #define __LOCK_ALIGNMENT __attribute__ ((__aligned__(16)))
> diff --git a/sysdeps/nptl/bits/thread-shared-types.h b/sysdeps/nptl/bits/thread-shared-types.h
> index 1e45f2d8ce..68b82b6bd6 100644
> --- a/sysdeps/nptl/bits/thread-shared-types.h
> +++ b/sysdeps/nptl/bits/thread-shared-types.h
> @@ -77,7 +77,7 @@ typedef struct __pthread_internal_slist
>  # if __WORDSIZE == 64
>  #  define __PTHREAD_SPINS_DATA	\
>    short __spins;		\
> -  short __elision;
> +  short __elision
>  #  define __PTHREAD_SPINS             0, 0
>  # else
>  #  define __PTHREAD_SPINS_DATA	\
> @@ -107,7 +107,7 @@ struct __pthread_mutex_s
>    /* KIND must stay at this position in the structure to maintain
>       binary compatibility with static initializers.  */
>    int __kind;
> -  __PTHREAD_COMPAT_PADDING_MID;
> +  __PTHREAD_COMPAT_PADDING_MID
>  #if __WORDSIZE == 64
>    __PTHREAD_SPINS_DATA;
>    __pthread_list_t __list;
> @@ -120,7 +120,7 @@ struct __pthread_mutex_s
>      __pthread_slist_t __list;
>    };
>  #endif
> -  __PTHREAD_COMPAT_PADDING_END;
> +  __PTHREAD_COMPAT_PADDING_END
>  };
>  
>  
>
  

Patch

diff --git a/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h b/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h
index 7befe5de6d..c1585625d1 100644
--- a/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h
@@ -43,10 +43,10 @@ 
 /* The old 4-word 16-byte aligned lock. This is initalized
    to all ones by the Linuxthreads PTHREAD_MUTEX_INITIALIZER.
    Unused in NPTL.  */
-#define __PTHREAD_COMPAT_PADDING_MID  int __compat_padding[4]
+#define __PTHREAD_COMPAT_PADDING_MID  int __compat_padding[4];
 /* Two more words are left before the NPTL
    pthread_mutex_t is larger than Linuxthreads.  */
-#define __PTHREAD_COMPAT_PADDING_END  int __reserved[2]
+#define __PTHREAD_COMPAT_PADDING_END  int __reserved[2];
 #define __PTHREAD_MUTEX_LOCK_ELISION    0
 
 #define __LOCK_ALIGNMENT __attribute__ ((__aligned__(16)))
diff --git a/sysdeps/nptl/bits/thread-shared-types.h b/sysdeps/nptl/bits/thread-shared-types.h
index 1e45f2d8ce..68b82b6bd6 100644
--- a/sysdeps/nptl/bits/thread-shared-types.h
+++ b/sysdeps/nptl/bits/thread-shared-types.h
@@ -77,7 +77,7 @@  typedef struct __pthread_internal_slist
 # if __WORDSIZE == 64
 #  define __PTHREAD_SPINS_DATA	\
   short __spins;		\
-  short __elision;
+  short __elision
 #  define __PTHREAD_SPINS             0, 0
 # else
 #  define __PTHREAD_SPINS_DATA	\
@@ -107,7 +107,7 @@  struct __pthread_mutex_s
   /* KIND must stay at this position in the structure to maintain
      binary compatibility with static initializers.  */
   int __kind;
-  __PTHREAD_COMPAT_PADDING_MID;
+  __PTHREAD_COMPAT_PADDING_MID
 #if __WORDSIZE == 64
   __PTHREAD_SPINS_DATA;
   __pthread_list_t __list;
@@ -120,7 +120,7 @@  struct __pthread_mutex_s
     __pthread_slist_t __list;
   };
 #endif
-  __PTHREAD_COMPAT_PADDING_END;
+  __PTHREAD_COMPAT_PADDING_END
 };