From 2d3083e746cf314c16048875e919305b1018bf8b Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 17 Oct 2019 19:35:17 -0400 Subject: move pthread types out of per-arch alltypes.h policy has long been that these definitions are purely a function of whether long/pointer is 32- or 64-bit, and that they are not allowed to vary per-arch. move the definition to the shared alltypes.h.in fragment, using integer constant expressions in terms of sizeof to vary the array dimensions appropriately. I'm not sure whether this is more or less ugly than using preprocessor conditionals and two sets of definitions here, but either way is a lot less ugly than repeating the same thing for every arch. --- include/alltypes.h.in | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/alltypes.h.in b/include/alltypes.h.in index 1ab40395..c47c8bf7 100644 --- a/include/alltypes.h.in +++ b/include/alltypes.h.in @@ -77,6 +77,14 @@ STRUCT iovec { void *iov_base; size_t iov_len; }; TYPEDEF unsigned socklen_t; TYPEDEF unsigned short sa_family_t; +TYPEDEF struct { union { int __i[sizeof(long)==8?14:9]; volatile int __vi[sizeof(long)==8?14:9]; unsigned long __s[sizeof(long)==8?7:9]; } __u; } pthread_attr_t; +TYPEDEF struct { union { int __i[sizeof(long)==8?10:6]; volatile int __vi[sizeof(long)==8?10:6]; volatile void *volatile __p[sizeof(long)==8?5:6]; } __u; } pthread_mutex_t; +TYPEDEF struct { union { int __i[sizeof(long)==8?10:6]; volatile int __vi[sizeof(long)==8?10:6]; volatile void *volatile __p[sizeof(long)==8?5:6]; } __u; } mtx_t; +TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } pthread_cond_t; +TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } cnd_t; +TYPEDEF struct { union { int __i[sizeof(long)==8?14:8]; volatile int __vi[sizeof(long)==8?14:8]; void *__p[sizeof(long)==8?7:8]; } __u; } pthread_rwlock_t; +TYPEDEF struct { union { int __i[sizeof(long)==8?8:5]; volatile int __vi[sizeof(long)==8?8:5]; void *__p[sizeof(long)==8?4:5]; } __u; } pthread_barrier_t; + #undef _Addr #undef _Int64 #undef _Reg -- cgit v1.2.1