1 /* Test stdatomic.h header contents. */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c11 -pedantic-errors" } */
7 #ifndef ATOMIC_BOOL_LOCK_FREE
8 # error ATOMIC_BOOL_LOCK_FREE not defined
11 #ifndef ATOMIC_CHAR_LOCK_FREE
12 # error ATOMIC_CHAR_LOCK_FREE not defined
15 #ifndef ATOMIC_CHAR16_T_LOCK_FREE
16 # error ATOMIC_CHAR16_T_LOCK_FREE not defined
19 #ifndef ATOMIC_CHAR32_T_LOCK_FREE
20 # error ATOMIC_CHAR32_T_LOCK_FREE not defined
23 #ifndef ATOMIC_WCHAR_T_LOCK_FREE
24 # error ATOMIC_WCHAR_T_LOCK_FREE not defined
27 #ifndef ATOMIC_SHORT_LOCK_FREE
28 # error ATOMIC_SHORT_LOCK_FREE not defined
31 #ifndef ATOMIC_INT_LOCK_FREE
32 # error ATOMIC_INT_LOCK_FREE not defined
35 #ifndef ATOMIC_LONG_LOCK_FREE
36 # error ATOMIC_LONG_LOCK_FREE not defined
39 #ifndef ATOMIC_LLONG_LOCK_FREE
40 # error ATOMIC_LLONG_LOCK_FREE not defined
43 #ifndef ATOMIC_POINTER_LOCK_FREE
44 # error ATOMIC_POINTER_LOCK_FREE not defined
47 memory_order m0
= memory_order_relaxed
;
48 memory_order m1
= memory_order_consume
;
49 memory_order m2
= memory_order_acquire
;
50 memory_order m3
= memory_order_release
;
51 memory_order m4
= memory_order_acq_rel
;
52 memory_order m5
= memory_order_seq_cst
;
54 atomic_flag af
= ATOMIC_FLAG_INIT
;
56 struct s
{ int i
[100]; } sv
;
60 _Atomic
struct s sva
= ATOMIC_VAR_INIT (sv
);
63 #ifndef kill_dependency
64 # error kill_dependency not defined
67 #define CHECK_ATOMIC_TYPEDEF(A, B) \
71 char array1[sizeof (A) == sizeof (B) ? 1 : -1]; \
72 char array2[_Alignof (A) == _Alignof (B) ? 1 : -1]; \
82 CHECK_ATOMIC_TYPEDEF (atomic_bool
, _Atomic _Bool
);
83 CHECK_ATOMIC_TYPEDEF (atomic_char
, _Atomic
char);
84 CHECK_ATOMIC_TYPEDEF (atomic_schar
, _Atomic
signed char);
85 CHECK_ATOMIC_TYPEDEF (atomic_uchar
, _Atomic
unsigned char);
86 CHECK_ATOMIC_TYPEDEF (atomic_short
, _Atomic
short);
87 CHECK_ATOMIC_TYPEDEF (atomic_ushort
, _Atomic
unsigned short);
88 CHECK_ATOMIC_TYPEDEF (atomic_int
, _Atomic
int);
89 CHECK_ATOMIC_TYPEDEF (atomic_uint
, _Atomic
unsigned int);
90 CHECK_ATOMIC_TYPEDEF (atomic_long
, _Atomic
long);
91 CHECK_ATOMIC_TYPEDEF (atomic_ulong
, _Atomic
unsigned long);
92 CHECK_ATOMIC_TYPEDEF (atomic_llong
, _Atomic
long long);
93 CHECK_ATOMIC_TYPEDEF (atomic_ullong
, _Atomic
unsigned long long);
94 CHECK_ATOMIC_TYPEDEF (atomic_char16_t
, _Atomic __CHAR16_TYPE__
);
95 CHECK_ATOMIC_TYPEDEF (atomic_char32_t
, _Atomic __CHAR32_TYPE__
);
96 CHECK_ATOMIC_TYPEDEF (atomic_wchar_t
, _Atomic
wchar_t);
97 CHECK_ATOMIC_TYPEDEF (atomic_int_least8_t
, _Atomic
int_least8_t);
98 CHECK_ATOMIC_TYPEDEF (atomic_uint_least8_t
, _Atomic
uint_least8_t);
99 CHECK_ATOMIC_TYPEDEF (atomic_int_least16_t
, _Atomic
int_least16_t);
100 CHECK_ATOMIC_TYPEDEF (atomic_uint_least16_t
, _Atomic
uint_least16_t);
101 CHECK_ATOMIC_TYPEDEF (atomic_int_least32_t
, _Atomic
int_least32_t);
102 CHECK_ATOMIC_TYPEDEF (atomic_uint_least32_t
, _Atomic
uint_least32_t);
103 CHECK_ATOMIC_TYPEDEF (atomic_int_least64_t
, _Atomic
int_least64_t);
104 CHECK_ATOMIC_TYPEDEF (atomic_uint_least64_t
, _Atomic
uint_least64_t);
105 CHECK_ATOMIC_TYPEDEF (atomic_int_fast8_t
, _Atomic
int_fast8_t);
106 CHECK_ATOMIC_TYPEDEF (atomic_uint_fast8_t
, _Atomic
uint_fast8_t);
107 CHECK_ATOMIC_TYPEDEF (atomic_int_fast16_t
, _Atomic
int_fast16_t);
108 CHECK_ATOMIC_TYPEDEF (atomic_uint_fast16_t
, _Atomic
uint_fast16_t);
109 CHECK_ATOMIC_TYPEDEF (atomic_int_fast32_t
, _Atomic
int_fast32_t);
110 CHECK_ATOMIC_TYPEDEF (atomic_uint_fast32_t
, _Atomic
uint_fast32_t);
111 CHECK_ATOMIC_TYPEDEF (atomic_int_fast64_t
, _Atomic
int_fast64_t);
112 CHECK_ATOMIC_TYPEDEF (atomic_uint_fast64_t
, _Atomic
uint_fast64_t);
113 CHECK_ATOMIC_TYPEDEF (atomic_intptr_t
, _Atomic
intptr_t);
114 CHECK_ATOMIC_TYPEDEF (atomic_uintptr_t
, _Atomic
uintptr_t);
115 CHECK_ATOMIC_TYPEDEF (atomic_size_t
, _Atomic
size_t);
116 CHECK_ATOMIC_TYPEDEF (atomic_ptrdiff_t
, _Atomic
ptrdiff_t);
117 CHECK_ATOMIC_TYPEDEF (atomic_intmax_t
, _Atomic
intmax_t);
118 CHECK_ATOMIC_TYPEDEF (atomic_uintmax_t
, _Atomic
uintmax_t);