Skip to content

Commit 83d4cc1

Browse files
committed
Deduplicate arch/emscripten/bits/alltypes.h{,in} with include/libc/alltypes.h.in
1 parent bc10c37 commit 83d4cc1

File tree

2 files changed

+6
-50
lines changed

2 files changed

+6
-50
lines changed

system/lib/libc/musl/arch/emscripten/bits/alltypes.h

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* The .h version of this file is generated from the .h.in.
33
* See update_alltypes.sh.
44
*/
5+
// XXX Emscripten keep in sync with musl/arch/i386/bits/alltypes.h.in
56
#define _Addr __PTRDIFF_TYPE__
67
#define _Int64 __INT64_TYPE__
78
#define _Reg __PTRDIFF_TYPE__
@@ -13,17 +14,6 @@
1314
#define LONG_MAX 0x7fffffffL
1415
#endif
1516

16-
#if defined(__NEED_va_list) && !defined(__DEFINED_va_list)
17-
typedef __builtin_va_list va_list;
18-
#define __DEFINED_va_list
19-
#endif
20-
21-
#if defined(__NEED___isoc_va_list) && !defined(__DEFINED___isoc_va_list)
22-
typedef __builtin_va_list __isoc_va_list;
23-
#define __DEFINED___isoc_va_list
24-
#endif
25-
26-
2717
#ifndef __cplusplus
2818
#ifdef __WCHAR_TYPE__
2919
#if defined(__NEED_wchar_t) && !defined(__DEFINED_wchar_t)
@@ -89,6 +79,7 @@ typedef struct { alignas(8) long long __ll; long double __ld; } max_align_t;
8979

9080
#endif
9181

82+
// XXX Emscripten use 32-bit time (reverts musl commit d6dcfe4d0c58856690ecbad4cf191d7c9ee1a4a8)
9283
#if defined(__NEED_time_t) && !defined(__DEFINED_time_t)
9384
typedef long time_t;
9485
#define __DEFINED_time_t
@@ -100,6 +91,7 @@ typedef long suseconds_t;
10091
#endif
10192

10293

94+
// XXX Emscripten avoid endian-specific padding (reverts musl commit 9b2921bea1d5017832e1b45d1fd64220047a9802)
10395
#if defined(__NEED_struct_timespec) && !defined(__DEFINED_struct_timespec)
10496
struct timespec { time_t tv_sec; long tv_nsec; };
10597
#define __DEFINED_struct_timespec
@@ -113,36 +105,6 @@ typedef struct { union { int __i[10]; volatile int __vi[10]; unsigned __s[10]; }
113105
#define __DEFINED_pthread_attr_t
114106
#endif
115107

116-
#if defined(__NEED_pthread_mutex_t) && !defined(__DEFINED_pthread_mutex_t)
117-
typedef struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } pthread_mutex_t;
118-
#define __DEFINED_pthread_mutex_t
119-
#endif
120-
121-
#if defined(__NEED_mtx_t) && !defined(__DEFINED_mtx_t)
122-
typedef struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } mtx_t;
123-
#define __DEFINED_mtx_t
124-
#endif
125-
126-
#if defined(__NEED_pthread_cond_t) && !defined(__DEFINED_pthread_cond_t)
127-
typedef struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } pthread_cond_t;
128-
#define __DEFINED_pthread_cond_t
129-
#endif
130-
131-
#if defined(__NEED_cnd_t) && !defined(__DEFINED_cnd_t)
132-
typedef struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } cnd_t;
133-
#define __DEFINED_cnd_t
134-
#endif
135-
136-
#if defined(__NEED_pthread_rwlock_t) && !defined(__DEFINED_pthread_rwlock_t)
137-
typedef struct { union { int __i[8]; volatile int __vi[8]; void *__p[8]; } __u; } pthread_rwlock_t;
138-
#define __DEFINED_pthread_rwlock_t
139-
#endif
140-
141-
#if defined(__NEED_pthread_barrier_t) && !defined(__DEFINED_pthread_barrier_t)
142-
typedef struct { union { int __i[5]; volatile int __vi[5]; void *__p[5]; } __u; } pthread_barrier_t;
143-
#define __DEFINED_pthread_barrier_t
144-
#endif
145-
146108
#define __LITTLE_ENDIAN 1234
147109
#define __BIG_ENDIAN 4321
148110
#define __USE_TIME_BITS64 1

system/lib/libc/musl/arch/emscripten/bits/alltypes.h.in

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* The .h version of this file is generated from the .h.in.
33
* See update_alltypes.sh.
44
*/
5+
// XXX Emscripten keep in sync with musl/arch/i386/bits/alltypes.h.in
56
#define _Addr __PTRDIFF_TYPE__
67
#define _Int64 __INT64_TYPE__
78
#define _Reg __PTRDIFF_TYPE__
@@ -13,9 +14,6 @@
1314
#define LONG_MAX 0x7fffffffL
1415
#endif
1516

16-
TYPEDEF __builtin_va_list va_list;
17-
TYPEDEF __builtin_va_list __isoc_va_list;
18-
1917
#ifndef __cplusplus
2018
#ifdef __WCHAR_TYPE__
2119
TYPEDEF __WCHAR_TYPE__ wchar_t;
@@ -41,17 +39,13 @@ TYPEDEF struct { __attribute__((__aligned__(8))) long long __ll; long double __l
4139
TYPEDEF struct { alignas(8) long long __ll; long double __ld; } max_align_t;
4240
#endif
4341

42+
// XXX Emscripten use 32-bit time (reverts musl commit d6dcfe4d0c58856690ecbad4cf191d7c9ee1a4a8)
4443
TYPEDEF long time_t;
4544
TYPEDEF long suseconds_t;
4645

46+
// XXX Emscripten avoid endian-specific padding (reverts musl commit 9b2921bea1d5017832e1b45d1fd64220047a9802)
4747
STRUCT timespec { time_t tv_sec; long tv_nsec; };
4848

4949
// For canvas transfer implementation in Emscripten, use an extra control field
5050
// to pass a pointer to a string denoting the WebGL canvases to transfer.
5151
TYPEDEF struct { union { int __i[10]; volatile int __vi[10]; unsigned __s[10]; } __u; const char *_a_transferredcanvases; } pthread_attr_t;
52-
TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } pthread_mutex_t;
53-
TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } mtx_t;
54-
TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } pthread_cond_t;
55-
TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } cnd_t;
56-
TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; void *__p[8]; } __u; } pthread_rwlock_t;
57-
TYPEDEF struct { union { int __i[5]; volatile int __vi[5]; void *__p[5]; } __u; } pthread_barrier_t;

0 commit comments

Comments
 (0)