1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 %s -verify -ffreestanding -fsyntax-only -triple=i686-linux-gnu -std=c11
2f4a2713aSLionel Sambuc
3f4a2713aSLionel Sambuc // Basic parsing/Sema tests for __c11_atomic_*
4f4a2713aSLionel Sambuc
5*0a6a1f1dSLionel Sambuc #include <stdatomic.h>
6f4a2713aSLionel Sambuc
7f4a2713aSLionel Sambuc struct S { char c[3]; };
8f4a2713aSLionel Sambuc
9f4a2713aSLionel Sambuc _Static_assert(__GCC_ATOMIC_BOOL_LOCK_FREE == 2, "");
10f4a2713aSLionel Sambuc _Static_assert(__GCC_ATOMIC_CHAR_LOCK_FREE == 2, "");
11f4a2713aSLionel Sambuc _Static_assert(__GCC_ATOMIC_CHAR16_T_LOCK_FREE == 2, "");
12f4a2713aSLionel Sambuc _Static_assert(__GCC_ATOMIC_CHAR32_T_LOCK_FREE == 2, "");
13f4a2713aSLionel Sambuc _Static_assert(__GCC_ATOMIC_WCHAR_T_LOCK_FREE == 2, "");
14f4a2713aSLionel Sambuc _Static_assert(__GCC_ATOMIC_SHORT_LOCK_FREE == 2, "");
15f4a2713aSLionel Sambuc _Static_assert(__GCC_ATOMIC_INT_LOCK_FREE == 2, "");
16f4a2713aSLionel Sambuc _Static_assert(__GCC_ATOMIC_LONG_LOCK_FREE == 2, "");
17f4a2713aSLionel Sambuc #ifdef __i386__
18f4a2713aSLionel Sambuc _Static_assert(__GCC_ATOMIC_LLONG_LOCK_FREE == 1, "");
19f4a2713aSLionel Sambuc #else
20f4a2713aSLionel Sambuc _Static_assert(__GCC_ATOMIC_LLONG_LOCK_FREE == 2, "");
21f4a2713aSLionel Sambuc #endif
22f4a2713aSLionel Sambuc _Static_assert(__GCC_ATOMIC_POINTER_LOCK_FREE == 2, "");
23f4a2713aSLionel Sambuc
24f4a2713aSLionel Sambuc _Static_assert(__c11_atomic_is_lock_free(1), "");
25f4a2713aSLionel Sambuc _Static_assert(__c11_atomic_is_lock_free(2), "");
26f4a2713aSLionel Sambuc _Static_assert(__c11_atomic_is_lock_free(3), ""); // expected-error {{not an integral constant expression}}
27f4a2713aSLionel Sambuc _Static_assert(__c11_atomic_is_lock_free(4), "");
28f4a2713aSLionel Sambuc _Static_assert(__c11_atomic_is_lock_free(8), "");
29f4a2713aSLionel Sambuc _Static_assert(__c11_atomic_is_lock_free(16), ""); // expected-error {{not an integral constant expression}}
30f4a2713aSLionel Sambuc _Static_assert(__c11_atomic_is_lock_free(17), ""); // expected-error {{not an integral constant expression}}
31f4a2713aSLionel Sambuc
32f4a2713aSLionel Sambuc _Static_assert(__atomic_is_lock_free(1, 0), "");
33f4a2713aSLionel Sambuc _Static_assert(__atomic_is_lock_free(2, 0), "");
34f4a2713aSLionel Sambuc _Static_assert(__atomic_is_lock_free(3, 0), ""); // expected-error {{not an integral constant expression}}
35f4a2713aSLionel Sambuc _Static_assert(__atomic_is_lock_free(4, 0), "");
36f4a2713aSLionel Sambuc _Static_assert(__atomic_is_lock_free(8, 0), "");
37f4a2713aSLionel Sambuc _Static_assert(__atomic_is_lock_free(16, 0), ""); // expected-error {{not an integral constant expression}}
38f4a2713aSLionel Sambuc _Static_assert(__atomic_is_lock_free(17, 0), ""); // expected-error {{not an integral constant expression}}
39f4a2713aSLionel Sambuc
40*0a6a1f1dSLionel Sambuc _Static_assert(atomic_is_lock_free((atomic_char*)0), "");
41*0a6a1f1dSLionel Sambuc _Static_assert(atomic_is_lock_free((atomic_short*)0), "");
42*0a6a1f1dSLionel Sambuc _Static_assert(atomic_is_lock_free((atomic_int*)0), "");
43*0a6a1f1dSLionel Sambuc _Static_assert(atomic_is_lock_free((atomic_long*)0), "");
44*0a6a1f1dSLionel Sambuc // expected-error@+1 {{__int128 is not supported on this target}}
45*0a6a1f1dSLionel Sambuc _Static_assert(atomic_is_lock_free((_Atomic(__int128)*)0), ""); // expected-error {{not an integral constant expression}}
46*0a6a1f1dSLionel Sambuc _Static_assert(atomic_is_lock_free(0 + (atomic_char*)0), "");
47*0a6a1f1dSLionel Sambuc
48f4a2713aSLionel Sambuc char i8;
49f4a2713aSLionel Sambuc short i16;
50f4a2713aSLionel Sambuc int i32;
51f4a2713aSLionel Sambuc int __attribute__((vector_size(8))) i64;
52*0a6a1f1dSLionel Sambuc struct Incomplete *incomplete; // expected-note {{forward declaration of 'struct Incomplete'}}
53f4a2713aSLionel Sambuc
54f4a2713aSLionel Sambuc _Static_assert(__atomic_is_lock_free(1, &i8), "");
55f4a2713aSLionel Sambuc _Static_assert(__atomic_is_lock_free(1, &i64), "");
56f4a2713aSLionel Sambuc _Static_assert(__atomic_is_lock_free(2, &i8), ""); // expected-error {{not an integral constant expression}}
57f4a2713aSLionel Sambuc _Static_assert(__atomic_is_lock_free(2, &i16), "");
58f4a2713aSLionel Sambuc _Static_assert(__atomic_is_lock_free(2, &i64), "");
59f4a2713aSLionel Sambuc _Static_assert(__atomic_is_lock_free(4, &i16), ""); // expected-error {{not an integral constant expression}}
60f4a2713aSLionel Sambuc _Static_assert(__atomic_is_lock_free(4, &i32), "");
61f4a2713aSLionel Sambuc _Static_assert(__atomic_is_lock_free(4, &i64), "");
62f4a2713aSLionel Sambuc _Static_assert(__atomic_is_lock_free(8, &i32), ""); // expected-error {{not an integral constant expression}}
63f4a2713aSLionel Sambuc _Static_assert(__atomic_is_lock_free(8, &i64), "");
64f4a2713aSLionel Sambuc
65f4a2713aSLionel Sambuc _Static_assert(__atomic_always_lock_free(1, 0), "");
66f4a2713aSLionel Sambuc _Static_assert(__atomic_always_lock_free(2, 0), "");
67f4a2713aSLionel Sambuc _Static_assert(!__atomic_always_lock_free(3, 0), "");
68f4a2713aSLionel Sambuc _Static_assert(__atomic_always_lock_free(4, 0), "");
69f4a2713aSLionel Sambuc _Static_assert(__atomic_always_lock_free(8, 0), "");
70f4a2713aSLionel Sambuc _Static_assert(!__atomic_always_lock_free(16, 0), "");
71f4a2713aSLionel Sambuc _Static_assert(!__atomic_always_lock_free(17, 0), "");
72f4a2713aSLionel Sambuc
73f4a2713aSLionel Sambuc _Static_assert(__atomic_always_lock_free(1, incomplete), "");
74f4a2713aSLionel Sambuc _Static_assert(!__atomic_always_lock_free(2, incomplete), "");
75f4a2713aSLionel Sambuc _Static_assert(!__atomic_always_lock_free(4, incomplete), "");
76f4a2713aSLionel Sambuc
77f4a2713aSLionel Sambuc _Static_assert(__atomic_always_lock_free(1, &i8), "");
78f4a2713aSLionel Sambuc _Static_assert(__atomic_always_lock_free(1, &i64), "");
79f4a2713aSLionel Sambuc _Static_assert(!__atomic_always_lock_free(2, &i8), "");
80f4a2713aSLionel Sambuc _Static_assert(__atomic_always_lock_free(2, &i16), "");
81f4a2713aSLionel Sambuc _Static_assert(__atomic_always_lock_free(2, &i64), "");
82f4a2713aSLionel Sambuc _Static_assert(!__atomic_always_lock_free(4, &i16), "");
83f4a2713aSLionel Sambuc _Static_assert(__atomic_always_lock_free(4, &i32), "");
84f4a2713aSLionel Sambuc _Static_assert(__atomic_always_lock_free(4, &i64), "");
85f4a2713aSLionel Sambuc _Static_assert(!__atomic_always_lock_free(8, &i32), "");
86f4a2713aSLionel Sambuc _Static_assert(__atomic_always_lock_free(8, &i64), "");
87f4a2713aSLionel Sambuc
f(_Atomic (int)* i,_Atomic (int *)* p,_Atomic (float)* d,int * I,int ** P,float * D,struct S * s1,struct S * s2)88f4a2713aSLionel Sambuc void f(_Atomic(int) *i, _Atomic(int*) *p, _Atomic(float) *d,
89f4a2713aSLionel Sambuc int *I, int **P, float *D, struct S *s1, struct S *s2) {
90f4a2713aSLionel Sambuc __c11_atomic_init(I, 5); // expected-error {{pointer to _Atomic}}
91f4a2713aSLionel Sambuc __c11_atomic_load(0); // expected-error {{too few arguments to function}}
92f4a2713aSLionel Sambuc __c11_atomic_load(0,0,0); // expected-error {{too many arguments to function}}
93f4a2713aSLionel Sambuc __c11_atomic_store(0,0,0); // expected-error {{address argument to atomic builtin must be a pointer}}
94f4a2713aSLionel Sambuc __c11_atomic_store((int*)0,0,0); // expected-error {{address argument to atomic operation must be a pointer to _Atomic}}
95f4a2713aSLionel Sambuc
96f4a2713aSLionel Sambuc __c11_atomic_load(i, memory_order_seq_cst);
97f4a2713aSLionel Sambuc __c11_atomic_load(p, memory_order_seq_cst);
98f4a2713aSLionel Sambuc __c11_atomic_load(d, memory_order_seq_cst);
99f4a2713aSLionel Sambuc
100f4a2713aSLionel Sambuc int load_n_1 = __atomic_load_n(I, memory_order_relaxed);
101f4a2713aSLionel Sambuc int *load_n_2 = __atomic_load_n(P, memory_order_relaxed);
102f4a2713aSLionel Sambuc float load_n_3 = __atomic_load_n(D, memory_order_relaxed); // expected-error {{must be a pointer to integer or pointer}}
103f4a2713aSLionel Sambuc __atomic_load_n(s1, memory_order_relaxed); // expected-error {{must be a pointer to integer or pointer}}
104f4a2713aSLionel Sambuc
105f4a2713aSLionel Sambuc __atomic_load(i, I, memory_order_relaxed); // expected-error {{must be a pointer to a trivially-copyable type}}
106f4a2713aSLionel Sambuc __atomic_load(I, i, memory_order_relaxed); // expected-warning {{passing '_Atomic(int) *' to parameter of type 'int *'}}
107f4a2713aSLionel Sambuc __atomic_load(I, *P, memory_order_relaxed);
108f4a2713aSLionel Sambuc __atomic_load(I, *P, memory_order_relaxed, 42); // expected-error {{too many arguments}}
109f4a2713aSLionel Sambuc (int)__atomic_load(I, I, memory_order_seq_cst); // expected-error {{operand of type 'void'}}
110f4a2713aSLionel Sambuc __atomic_load(s1, s2, memory_order_acquire);
111f4a2713aSLionel Sambuc
112f4a2713aSLionel Sambuc __c11_atomic_store(i, 1, memory_order_seq_cst);
113f4a2713aSLionel Sambuc __c11_atomic_store(p, 1, memory_order_seq_cst); // expected-warning {{incompatible integer to pointer conversion}}
114f4a2713aSLionel Sambuc (int)__c11_atomic_store(d, 1, memory_order_seq_cst); // expected-error {{operand of type 'void'}}
115f4a2713aSLionel Sambuc
116f4a2713aSLionel Sambuc __atomic_store_n(I, 4, memory_order_release);
117f4a2713aSLionel Sambuc __atomic_store_n(I, 4.0, memory_order_release);
118f4a2713aSLionel Sambuc __atomic_store_n(I, P, memory_order_release); // expected-warning {{parameter of type 'int'}}
119f4a2713aSLionel Sambuc __atomic_store_n(i, 1, memory_order_release); // expected-error {{must be a pointer to integer or pointer}}
120f4a2713aSLionel Sambuc __atomic_store_n(s1, *s2, memory_order_release); // expected-error {{must be a pointer to integer or pointer}}
121f4a2713aSLionel Sambuc
122f4a2713aSLionel Sambuc __atomic_store(I, *P, memory_order_release);
123f4a2713aSLionel Sambuc __atomic_store(s1, s2, memory_order_release);
124f4a2713aSLionel Sambuc __atomic_store(i, I, memory_order_release); // expected-error {{trivially-copyable}}
125f4a2713aSLionel Sambuc
126f4a2713aSLionel Sambuc int exchange_1 = __c11_atomic_exchange(i, 1, memory_order_seq_cst);
127f4a2713aSLionel Sambuc int exchange_2 = __c11_atomic_exchange(I, 1, memory_order_seq_cst); // expected-error {{must be a pointer to _Atomic}}
128f4a2713aSLionel Sambuc int exchange_3 = __atomic_exchange_n(i, 1, memory_order_seq_cst); // expected-error {{must be a pointer to integer or pointer}}
129f4a2713aSLionel Sambuc int exchange_4 = __atomic_exchange_n(I, 1, memory_order_seq_cst);
130f4a2713aSLionel Sambuc
131f4a2713aSLionel Sambuc __atomic_exchange(s1, s2, s2, memory_order_seq_cst);
132f4a2713aSLionel Sambuc __atomic_exchange(s1, I, P, memory_order_seq_cst); // expected-warning 2{{parameter of type 'struct S *'}}
133f4a2713aSLionel Sambuc (int)__atomic_exchange(s1, s2, s2, memory_order_seq_cst); // expected-error {{operand of type 'void'}}
134f4a2713aSLionel Sambuc
135f4a2713aSLionel Sambuc __c11_atomic_fetch_add(i, 1, memory_order_seq_cst);
136f4a2713aSLionel Sambuc __c11_atomic_fetch_add(p, 1, memory_order_seq_cst);
137f4a2713aSLionel Sambuc __c11_atomic_fetch_add(d, 1, memory_order_seq_cst); // expected-error {{must be a pointer to atomic integer or pointer}}
138f4a2713aSLionel Sambuc
139f4a2713aSLionel Sambuc __atomic_fetch_add(i, 3, memory_order_seq_cst); // expected-error {{pointer to integer or pointer}}
140f4a2713aSLionel Sambuc __atomic_fetch_sub(I, 3, memory_order_seq_cst);
141f4a2713aSLionel Sambuc __atomic_fetch_sub(P, 3, memory_order_seq_cst);
142f4a2713aSLionel Sambuc __atomic_fetch_sub(D, 3, memory_order_seq_cst); // expected-error {{must be a pointer to integer or pointer}}
143f4a2713aSLionel Sambuc __atomic_fetch_sub(s1, 3, memory_order_seq_cst); // expected-error {{must be a pointer to integer or pointer}}
144f4a2713aSLionel Sambuc
145f4a2713aSLionel Sambuc __c11_atomic_fetch_and(i, 1, memory_order_seq_cst);
146f4a2713aSLionel Sambuc __c11_atomic_fetch_and(p, 1, memory_order_seq_cst); // expected-error {{must be a pointer to atomic integer}}
147f4a2713aSLionel Sambuc __c11_atomic_fetch_and(d, 1, memory_order_seq_cst); // expected-error {{must be a pointer to atomic integer}}
148f4a2713aSLionel Sambuc
149f4a2713aSLionel Sambuc __atomic_fetch_and(i, 3, memory_order_seq_cst); // expected-error {{pointer to integer}}
150f4a2713aSLionel Sambuc __atomic_fetch_or(I, 3, memory_order_seq_cst);
151f4a2713aSLionel Sambuc __atomic_fetch_xor(P, 3, memory_order_seq_cst); // expected-error {{must be a pointer to integer}}
152f4a2713aSLionel Sambuc __atomic_fetch_or(D, 3, memory_order_seq_cst); // expected-error {{must be a pointer to integer}}
153f4a2713aSLionel Sambuc __atomic_fetch_and(s1, 3, memory_order_seq_cst); // expected-error {{must be a pointer to integer}}
154f4a2713aSLionel Sambuc
155f4a2713aSLionel Sambuc _Bool cmpexch_1 = __c11_atomic_compare_exchange_strong(i, 0, 1, memory_order_seq_cst, memory_order_seq_cst);
156f4a2713aSLionel Sambuc _Bool cmpexch_2 = __c11_atomic_compare_exchange_strong(p, 0, (int*)1, memory_order_seq_cst, memory_order_seq_cst);
157f4a2713aSLionel Sambuc _Bool cmpexch_3 = __c11_atomic_compare_exchange_strong(d, (int*)0, 1, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{incompatible pointer types}}
158f4a2713aSLionel Sambuc
159f4a2713aSLionel Sambuc _Bool cmpexch_4 = __atomic_compare_exchange_n(I, I, 5, 1, memory_order_seq_cst, memory_order_seq_cst);
160f4a2713aSLionel Sambuc _Bool cmpexch_5 = __atomic_compare_exchange_n(I, P, 5, 0, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{; dereference with *}}
161f4a2713aSLionel Sambuc _Bool cmpexch_6 = __atomic_compare_exchange_n(I, I, P, 0, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{passing 'int **' to parameter of type 'int'}}
162f4a2713aSLionel Sambuc
163f4a2713aSLionel Sambuc _Bool cmpexch_7 = __atomic_compare_exchange(I, I, 5, 1, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{passing 'int' to parameter of type 'int *'}}
164f4a2713aSLionel Sambuc _Bool cmpexch_8 = __atomic_compare_exchange(I, P, I, 0, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{; dereference with *}}
165f4a2713aSLionel Sambuc _Bool cmpexch_9 = __atomic_compare_exchange(I, I, I, 0, memory_order_seq_cst, memory_order_seq_cst);
166f4a2713aSLionel Sambuc
167f4a2713aSLionel Sambuc const volatile int flag_k = 0;
168f4a2713aSLionel Sambuc volatile int flag = 0;
169f4a2713aSLionel Sambuc (void)(int)__atomic_test_and_set(&flag_k, memory_order_seq_cst); // expected-warning {{passing 'const volatile int *' to parameter of type 'volatile void *'}}
170f4a2713aSLionel Sambuc (void)(int)__atomic_test_and_set(&flag, memory_order_seq_cst);
171f4a2713aSLionel Sambuc __atomic_clear(&flag_k, memory_order_seq_cst); // expected-warning {{passing 'const volatile int *' to parameter of type 'volatile void *'}}
172f4a2713aSLionel Sambuc __atomic_clear(&flag, memory_order_seq_cst);
173f4a2713aSLionel Sambuc (int)__atomic_clear(&flag, memory_order_seq_cst); // expected-error {{operand of type 'void'}}
174f4a2713aSLionel Sambuc
175f4a2713aSLionel Sambuc const _Atomic(int) const_atomic;
176f4a2713aSLionel Sambuc __c11_atomic_init(&const_atomic, 0); // expected-error {{address argument to atomic operation must be a pointer to non-const _Atomic type ('const _Atomic(int) *' invalid)}}
177f4a2713aSLionel Sambuc __c11_atomic_store(&const_atomic, 0, memory_order_release); // expected-error {{address argument to atomic operation must be a pointer to non-const _Atomic type ('const _Atomic(int) *' invalid)}}
178f4a2713aSLionel Sambuc __c11_atomic_load(&const_atomic, memory_order_acquire); // expected-error {{address argument to atomic operation must be a pointer to non-const _Atomic type ('const _Atomic(int) *' invalid)}}
179*0a6a1f1dSLionel Sambuc
180*0a6a1f1dSLionel Sambuc // Ensure the <stdatomic.h> macros behave appropriately.
181*0a6a1f1dSLionel Sambuc atomic_int n = ATOMIC_VAR_INIT(123);
182*0a6a1f1dSLionel Sambuc atomic_init(&n, 456);
183*0a6a1f1dSLionel Sambuc atomic_init(&n, (void*)0); // expected-warning {{passing 'void *' to parameter of type 'int'}}
184*0a6a1f1dSLionel Sambuc
185*0a6a1f1dSLionel Sambuc const atomic_wchar_t cawt;
186*0a6a1f1dSLionel Sambuc atomic_init(&cawt, L'x'); // expected-error {{non-const}}
187*0a6a1f1dSLionel Sambuc atomic_wchar_t awt;
188*0a6a1f1dSLionel Sambuc atomic_init(&awt, L'x');
189*0a6a1f1dSLionel Sambuc
190*0a6a1f1dSLionel Sambuc int x = kill_dependency(12);
191*0a6a1f1dSLionel Sambuc
192*0a6a1f1dSLionel Sambuc atomic_thread_fence(); // expected-error {{too few arguments to function call}}
193*0a6a1f1dSLionel Sambuc atomic_thread_fence(memory_order_seq_cst);
194*0a6a1f1dSLionel Sambuc atomic_signal_fence(memory_order_seq_cst);
195*0a6a1f1dSLionel Sambuc void (*pfn)(memory_order) = &atomic_thread_fence;
196*0a6a1f1dSLionel Sambuc pfn = &atomic_signal_fence;
197*0a6a1f1dSLionel Sambuc
198*0a6a1f1dSLionel Sambuc int k = atomic_load_explicit(&n, memory_order_relaxed);
199*0a6a1f1dSLionel Sambuc atomic_store_explicit(&n, k, memory_order_relaxed);
200*0a6a1f1dSLionel Sambuc atomic_store(&n, atomic_load(&n));
201*0a6a1f1dSLionel Sambuc
202*0a6a1f1dSLionel Sambuc k = atomic_exchange(&n, 72);
203*0a6a1f1dSLionel Sambuc k = atomic_exchange_explicit(&n, k, memory_order_release);
204*0a6a1f1dSLionel Sambuc
205*0a6a1f1dSLionel Sambuc atomic_compare_exchange_strong(&n, k, k); // expected-warning {{take the address with &}}
206*0a6a1f1dSLionel Sambuc atomic_compare_exchange_weak(&n, &k, k);
207*0a6a1f1dSLionel Sambuc atomic_compare_exchange_strong_explicit(&n, &k, k, memory_order_seq_cst); // expected-error {{too few arguments}}
208*0a6a1f1dSLionel Sambuc atomic_compare_exchange_weak_explicit(&n, &k, k, memory_order_seq_cst, memory_order_acquire);
209*0a6a1f1dSLionel Sambuc
210*0a6a1f1dSLionel Sambuc atomic_fetch_add(&k, n); // expected-error {{must be a pointer to _Atomic}}
211*0a6a1f1dSLionel Sambuc k = atomic_fetch_add(&n, k);
212*0a6a1f1dSLionel Sambuc k = atomic_fetch_sub(&n, k);
213*0a6a1f1dSLionel Sambuc k = atomic_fetch_and(&n, k);
214*0a6a1f1dSLionel Sambuc k = atomic_fetch_or(&n, k);
215*0a6a1f1dSLionel Sambuc k = atomic_fetch_xor(&n, k);
216*0a6a1f1dSLionel Sambuc k = atomic_fetch_add_explicit(&n, k, memory_order_acquire);
217*0a6a1f1dSLionel Sambuc k = atomic_fetch_sub_explicit(&n, k, memory_order_release);
218*0a6a1f1dSLionel Sambuc k = atomic_fetch_and_explicit(&n, k, memory_order_acq_rel);
219*0a6a1f1dSLionel Sambuc k = atomic_fetch_or_explicit(&n, k, memory_order_consume);
220*0a6a1f1dSLionel Sambuc k = atomic_fetch_xor_explicit(&n, k, memory_order_relaxed);
221*0a6a1f1dSLionel Sambuc
222*0a6a1f1dSLionel Sambuc // C11 7.17.1/4: atomic_flag is a structure type.
223*0a6a1f1dSLionel Sambuc struct atomic_flag must_be_struct = ATOMIC_FLAG_INIT;
224*0a6a1f1dSLionel Sambuc // C11 7.17.8/5 implies that it is also a typedef type.
225*0a6a1f1dSLionel Sambuc atomic_flag guard = ATOMIC_FLAG_INIT;
226*0a6a1f1dSLionel Sambuc _Bool old_val = atomic_flag_test_and_set(&guard);
227*0a6a1f1dSLionel Sambuc if (old_val) atomic_flag_clear(&guard);
228*0a6a1f1dSLionel Sambuc
229*0a6a1f1dSLionel Sambuc old_val = (atomic_flag_test_and_set)(&guard);
230*0a6a1f1dSLionel Sambuc if (old_val) (atomic_flag_clear)(&guard);
231*0a6a1f1dSLionel Sambuc
232*0a6a1f1dSLionel Sambuc const atomic_flag const_guard;
233*0a6a1f1dSLionel Sambuc atomic_flag_test_and_set(&const_guard); // expected-error {{address argument to atomic operation must be a pointer to non-const _Atomic type ('const atomic_bool *' (aka 'const _Atomic(_Bool) *') invalid)}}
234*0a6a1f1dSLionel Sambuc atomic_flag_clear(&const_guard); // expected-error {{address argument to atomic operation must be a pointer to non-const _Atomic type ('const atomic_bool *' (aka 'const _Atomic(_Bool) *') invalid)}}
235f4a2713aSLionel Sambuc }
236f4a2713aSLionel Sambuc
237f4a2713aSLionel Sambuc _Atomic(int*) PR12527_a;
PR12527()238f4a2713aSLionel Sambuc void PR12527() { int *b = PR12527_a; }
239f4a2713aSLionel Sambuc
PR16931(int * x)240f4a2713aSLionel Sambuc void PR16931(int* x) { // expected-note {{passing argument to parameter 'x' here}}
241f4a2713aSLionel Sambuc typedef struct { _Atomic(_Bool) flag; } flag;
242f4a2713aSLionel Sambuc flag flagvar = { 0 };
243f4a2713aSLionel Sambuc PR16931(&flagvar); // expected-warning {{incompatible pointer types}}
244f4a2713aSLionel Sambuc }
245*0a6a1f1dSLionel Sambuc
memory_checks(_Atomic (int)* Ap,int * p,int val)246*0a6a1f1dSLionel Sambuc void memory_checks(_Atomic(int) *Ap, int *p, int val) {
247*0a6a1f1dSLionel Sambuc (void)__c11_atomic_load(Ap, memory_order_relaxed);
248*0a6a1f1dSLionel Sambuc (void)__c11_atomic_load(Ap, memory_order_acquire);
249*0a6a1f1dSLionel Sambuc (void)__c11_atomic_load(Ap, memory_order_consume);
250*0a6a1f1dSLionel Sambuc (void)__c11_atomic_load(Ap, memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
251*0a6a1f1dSLionel Sambuc (void)__c11_atomic_load(Ap, memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
252*0a6a1f1dSLionel Sambuc (void)__c11_atomic_load(Ap, memory_order_seq_cst);
253*0a6a1f1dSLionel Sambuc (void)__c11_atomic_load(Ap, val);
254*0a6a1f1dSLionel Sambuc (void)__c11_atomic_load(Ap, -1); // expected-warning {{memory order argument to atomic operation is invalid}}
255*0a6a1f1dSLionel Sambuc (void)__c11_atomic_load(Ap, 42); // expected-warning {{memory order argument to atomic operation is invalid}}
256*0a6a1f1dSLionel Sambuc
257*0a6a1f1dSLionel Sambuc (void)__c11_atomic_store(Ap, val, memory_order_relaxed);
258*0a6a1f1dSLionel Sambuc (void)__c11_atomic_store(Ap, val, memory_order_acquire); // expected-warning {{memory order argument to atomic operation is invalid}}
259*0a6a1f1dSLionel Sambuc (void)__c11_atomic_store(Ap, val, memory_order_consume); // expected-warning {{memory order argument to atomic operation is invalid}}
260*0a6a1f1dSLionel Sambuc (void)__c11_atomic_store(Ap, val, memory_order_release);
261*0a6a1f1dSLionel Sambuc (void)__c11_atomic_store(Ap, val, memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
262*0a6a1f1dSLionel Sambuc (void)__c11_atomic_store(Ap, val, memory_order_seq_cst);
263*0a6a1f1dSLionel Sambuc
264*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_add(Ap, 1, memory_order_relaxed);
265*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_add(Ap, 1, memory_order_acquire);
266*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_add(Ap, 1, memory_order_consume);
267*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_add(Ap, 1, memory_order_release);
268*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_add(Ap, 1, memory_order_acq_rel);
269*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_add(Ap, 1, memory_order_seq_cst);
270*0a6a1f1dSLionel Sambuc
271*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_add(
272*0a6a1f1dSLionel Sambuc (struct Incomplete * _Atomic *)0, // expected-error {{incomplete type 'struct Incomplete'}}
273*0a6a1f1dSLionel Sambuc 1, memory_order_seq_cst);
274*0a6a1f1dSLionel Sambuc
275*0a6a1f1dSLionel Sambuc (void)__c11_atomic_init(Ap, val);
276*0a6a1f1dSLionel Sambuc (void)__c11_atomic_init(Ap, val);
277*0a6a1f1dSLionel Sambuc (void)__c11_atomic_init(Ap, val);
278*0a6a1f1dSLionel Sambuc (void)__c11_atomic_init(Ap, val);
279*0a6a1f1dSLionel Sambuc (void)__c11_atomic_init(Ap, val);
280*0a6a1f1dSLionel Sambuc (void)__c11_atomic_init(Ap, val);
281*0a6a1f1dSLionel Sambuc
282*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_sub(Ap, val, memory_order_relaxed);
283*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_sub(Ap, val, memory_order_acquire);
284*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_sub(Ap, val, memory_order_consume);
285*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_sub(Ap, val, memory_order_release);
286*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_sub(Ap, val, memory_order_acq_rel);
287*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_sub(Ap, val, memory_order_seq_cst);
288*0a6a1f1dSLionel Sambuc
289*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_and(Ap, val, memory_order_relaxed);
290*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_and(Ap, val, memory_order_acquire);
291*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_and(Ap, val, memory_order_consume);
292*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_and(Ap, val, memory_order_release);
293*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_and(Ap, val, memory_order_acq_rel);
294*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_and(Ap, val, memory_order_seq_cst);
295*0a6a1f1dSLionel Sambuc
296*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_or(Ap, val, memory_order_relaxed);
297*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_or(Ap, val, memory_order_acquire);
298*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_or(Ap, val, memory_order_consume);
299*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_or(Ap, val, memory_order_release);
300*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_or(Ap, val, memory_order_acq_rel);
301*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_or(Ap, val, memory_order_seq_cst);
302*0a6a1f1dSLionel Sambuc
303*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_xor(Ap, val, memory_order_relaxed);
304*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_xor(Ap, val, memory_order_acquire);
305*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_xor(Ap, val, memory_order_consume);
306*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_xor(Ap, val, memory_order_release);
307*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_xor(Ap, val, memory_order_acq_rel);
308*0a6a1f1dSLionel Sambuc (void)__c11_atomic_fetch_xor(Ap, val, memory_order_seq_cst);
309*0a6a1f1dSLionel Sambuc
310*0a6a1f1dSLionel Sambuc (void)__c11_atomic_exchange(Ap, val, memory_order_relaxed);
311*0a6a1f1dSLionel Sambuc (void)__c11_atomic_exchange(Ap, val, memory_order_acquire);
312*0a6a1f1dSLionel Sambuc (void)__c11_atomic_exchange(Ap, val, memory_order_consume);
313*0a6a1f1dSLionel Sambuc (void)__c11_atomic_exchange(Ap, val, memory_order_release);
314*0a6a1f1dSLionel Sambuc (void)__c11_atomic_exchange(Ap, val, memory_order_acq_rel);
315*0a6a1f1dSLionel Sambuc (void)__c11_atomic_exchange(Ap, val, memory_order_seq_cst);
316*0a6a1f1dSLionel Sambuc
317*0a6a1f1dSLionel Sambuc (void)__c11_atomic_compare_exchange_strong(Ap, p, val, memory_order_relaxed, memory_order_relaxed);
318*0a6a1f1dSLionel Sambuc (void)__c11_atomic_compare_exchange_strong(Ap, p, val, memory_order_acquire, memory_order_relaxed);
319*0a6a1f1dSLionel Sambuc (void)__c11_atomic_compare_exchange_strong(Ap, p, val, memory_order_consume, memory_order_relaxed);
320*0a6a1f1dSLionel Sambuc (void)__c11_atomic_compare_exchange_strong(Ap, p, val, memory_order_release, memory_order_relaxed);
321*0a6a1f1dSLionel Sambuc (void)__c11_atomic_compare_exchange_strong(Ap, p, val, memory_order_acq_rel, memory_order_relaxed);
322*0a6a1f1dSLionel Sambuc (void)__c11_atomic_compare_exchange_strong(Ap, p, val, memory_order_seq_cst, memory_order_relaxed);
323*0a6a1f1dSLionel Sambuc
324*0a6a1f1dSLionel Sambuc (void)__c11_atomic_compare_exchange_weak(Ap, p, val, memory_order_relaxed, memory_order_relaxed);
325*0a6a1f1dSLionel Sambuc (void)__c11_atomic_compare_exchange_weak(Ap, p, val, memory_order_acquire, memory_order_relaxed);
326*0a6a1f1dSLionel Sambuc (void)__c11_atomic_compare_exchange_weak(Ap, p, val, memory_order_consume, memory_order_relaxed);
327*0a6a1f1dSLionel Sambuc (void)__c11_atomic_compare_exchange_weak(Ap, p, val, memory_order_release, memory_order_relaxed);
328*0a6a1f1dSLionel Sambuc (void)__c11_atomic_compare_exchange_weak(Ap, p, val, memory_order_acq_rel, memory_order_relaxed);
329*0a6a1f1dSLionel Sambuc (void)__c11_atomic_compare_exchange_weak(Ap, p, val, memory_order_seq_cst, memory_order_relaxed);
330*0a6a1f1dSLionel Sambuc
331*0a6a1f1dSLionel Sambuc (void)__atomic_load_n(p, memory_order_relaxed);
332*0a6a1f1dSLionel Sambuc (void)__atomic_load_n(p, memory_order_acquire);
333*0a6a1f1dSLionel Sambuc (void)__atomic_load_n(p, memory_order_consume);
334*0a6a1f1dSLionel Sambuc (void)__atomic_load_n(p, memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
335*0a6a1f1dSLionel Sambuc (void)__atomic_load_n(p, memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
336*0a6a1f1dSLionel Sambuc (void)__atomic_load_n(p, memory_order_seq_cst);
337*0a6a1f1dSLionel Sambuc
338*0a6a1f1dSLionel Sambuc (void)__atomic_load(p, p, memory_order_relaxed);
339*0a6a1f1dSLionel Sambuc (void)__atomic_load(p, p, memory_order_acquire);
340*0a6a1f1dSLionel Sambuc (void)__atomic_load(p, p, memory_order_consume);
341*0a6a1f1dSLionel Sambuc (void)__atomic_load(p, p, memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
342*0a6a1f1dSLionel Sambuc (void)__atomic_load(p, p, memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
343*0a6a1f1dSLionel Sambuc (void)__atomic_load(p, p, memory_order_seq_cst);
344*0a6a1f1dSLionel Sambuc
345*0a6a1f1dSLionel Sambuc (void)__atomic_store(p, p, memory_order_relaxed);
346*0a6a1f1dSLionel Sambuc (void)__atomic_store(p, p, memory_order_acquire); // expected-warning {{memory order argument to atomic operation is invalid}}
347*0a6a1f1dSLionel Sambuc (void)__atomic_store(p, p, memory_order_consume); // expected-warning {{memory order argument to atomic operation is invalid}}
348*0a6a1f1dSLionel Sambuc (void)__atomic_store(p, p, memory_order_release);
349*0a6a1f1dSLionel Sambuc (void)__atomic_store(p, p, memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
350*0a6a1f1dSLionel Sambuc (void)__atomic_store(p, p, memory_order_seq_cst);
351*0a6a1f1dSLionel Sambuc
352*0a6a1f1dSLionel Sambuc (void)__atomic_store_n(p, val, memory_order_relaxed);
353*0a6a1f1dSLionel Sambuc (void)__atomic_store_n(p, val, memory_order_acquire); // expected-warning {{memory order argument to atomic operation is invalid}}
354*0a6a1f1dSLionel Sambuc (void)__atomic_store_n(p, val, memory_order_consume); // expected-warning {{memory order argument to atomic operation is invalid}}
355*0a6a1f1dSLionel Sambuc (void)__atomic_store_n(p, val, memory_order_release);
356*0a6a1f1dSLionel Sambuc (void)__atomic_store_n(p, val, memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
357*0a6a1f1dSLionel Sambuc (void)__atomic_store_n(p, val, memory_order_seq_cst);
358*0a6a1f1dSLionel Sambuc
359*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_add(p, val, memory_order_relaxed);
360*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_add(p, val, memory_order_acquire);
361*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_add(p, val, memory_order_consume);
362*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_add(p, val, memory_order_release);
363*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_add(p, val, memory_order_acq_rel);
364*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_add(p, val, memory_order_seq_cst);
365*0a6a1f1dSLionel Sambuc
366*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_sub(p, val, memory_order_relaxed);
367*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_sub(p, val, memory_order_acquire);
368*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_sub(p, val, memory_order_consume);
369*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_sub(p, val, memory_order_release);
370*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_sub(p, val, memory_order_acq_rel);
371*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_sub(p, val, memory_order_seq_cst);
372*0a6a1f1dSLionel Sambuc
373*0a6a1f1dSLionel Sambuc (void)__atomic_add_fetch(p, val, memory_order_relaxed);
374*0a6a1f1dSLionel Sambuc (void)__atomic_add_fetch(p, val, memory_order_acquire);
375*0a6a1f1dSLionel Sambuc (void)__atomic_add_fetch(p, val, memory_order_consume);
376*0a6a1f1dSLionel Sambuc (void)__atomic_add_fetch(p, val, memory_order_release);
377*0a6a1f1dSLionel Sambuc (void)__atomic_add_fetch(p, val, memory_order_acq_rel);
378*0a6a1f1dSLionel Sambuc (void)__atomic_add_fetch(p, val, memory_order_seq_cst);
379*0a6a1f1dSLionel Sambuc
380*0a6a1f1dSLionel Sambuc (void)__atomic_sub_fetch(p, val, memory_order_relaxed);
381*0a6a1f1dSLionel Sambuc (void)__atomic_sub_fetch(p, val, memory_order_acquire);
382*0a6a1f1dSLionel Sambuc (void)__atomic_sub_fetch(p, val, memory_order_consume);
383*0a6a1f1dSLionel Sambuc (void)__atomic_sub_fetch(p, val, memory_order_release);
384*0a6a1f1dSLionel Sambuc (void)__atomic_sub_fetch(p, val, memory_order_acq_rel);
385*0a6a1f1dSLionel Sambuc (void)__atomic_sub_fetch(p, val, memory_order_seq_cst);
386*0a6a1f1dSLionel Sambuc
387*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_and(p, val, memory_order_relaxed);
388*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_and(p, val, memory_order_acquire);
389*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_and(p, val, memory_order_consume);
390*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_and(p, val, memory_order_release);
391*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_and(p, val, memory_order_acq_rel);
392*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_and(p, val, memory_order_seq_cst);
393*0a6a1f1dSLionel Sambuc
394*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_or(p, val, memory_order_relaxed);
395*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_or(p, val, memory_order_acquire);
396*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_or(p, val, memory_order_consume);
397*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_or(p, val, memory_order_release);
398*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_or(p, val, memory_order_acq_rel);
399*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_or(p, val, memory_order_seq_cst);
400*0a6a1f1dSLionel Sambuc
401*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_xor(p, val, memory_order_relaxed);
402*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_xor(p, val, memory_order_acquire);
403*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_xor(p, val, memory_order_consume);
404*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_xor(p, val, memory_order_release);
405*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_xor(p, val, memory_order_acq_rel);
406*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_xor(p, val, memory_order_seq_cst);
407*0a6a1f1dSLionel Sambuc
408*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_nand(p, val, memory_order_relaxed);
409*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_nand(p, val, memory_order_acquire);
410*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_nand(p, val, memory_order_consume);
411*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_nand(p, val, memory_order_release);
412*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_nand(p, val, memory_order_acq_rel);
413*0a6a1f1dSLionel Sambuc (void)__atomic_fetch_nand(p, val, memory_order_seq_cst);
414*0a6a1f1dSLionel Sambuc
415*0a6a1f1dSLionel Sambuc (void)__atomic_and_fetch(p, val, memory_order_relaxed);
416*0a6a1f1dSLionel Sambuc (void)__atomic_and_fetch(p, val, memory_order_acquire);
417*0a6a1f1dSLionel Sambuc (void)__atomic_and_fetch(p, val, memory_order_consume);
418*0a6a1f1dSLionel Sambuc (void)__atomic_and_fetch(p, val, memory_order_release);
419*0a6a1f1dSLionel Sambuc (void)__atomic_and_fetch(p, val, memory_order_acq_rel);
420*0a6a1f1dSLionel Sambuc (void)__atomic_and_fetch(p, val, memory_order_seq_cst);
421*0a6a1f1dSLionel Sambuc
422*0a6a1f1dSLionel Sambuc (void)__atomic_or_fetch(p, val, memory_order_relaxed);
423*0a6a1f1dSLionel Sambuc (void)__atomic_or_fetch(p, val, memory_order_acquire);
424*0a6a1f1dSLionel Sambuc (void)__atomic_or_fetch(p, val, memory_order_consume);
425*0a6a1f1dSLionel Sambuc (void)__atomic_or_fetch(p, val, memory_order_release);
426*0a6a1f1dSLionel Sambuc (void)__atomic_or_fetch(p, val, memory_order_acq_rel);
427*0a6a1f1dSLionel Sambuc (void)__atomic_or_fetch(p, val, memory_order_seq_cst);
428*0a6a1f1dSLionel Sambuc
429*0a6a1f1dSLionel Sambuc (void)__atomic_xor_fetch(p, val, memory_order_relaxed);
430*0a6a1f1dSLionel Sambuc (void)__atomic_xor_fetch(p, val, memory_order_acquire);
431*0a6a1f1dSLionel Sambuc (void)__atomic_xor_fetch(p, val, memory_order_consume);
432*0a6a1f1dSLionel Sambuc (void)__atomic_xor_fetch(p, val, memory_order_release);
433*0a6a1f1dSLionel Sambuc (void)__atomic_xor_fetch(p, val, memory_order_acq_rel);
434*0a6a1f1dSLionel Sambuc (void)__atomic_xor_fetch(p, val, memory_order_seq_cst);
435*0a6a1f1dSLionel Sambuc
436*0a6a1f1dSLionel Sambuc (void)__atomic_nand_fetch(p, val, memory_order_relaxed);
437*0a6a1f1dSLionel Sambuc (void)__atomic_nand_fetch(p, val, memory_order_acquire);
438*0a6a1f1dSLionel Sambuc (void)__atomic_nand_fetch(p, val, memory_order_consume);
439*0a6a1f1dSLionel Sambuc (void)__atomic_nand_fetch(p, val, memory_order_release);
440*0a6a1f1dSLionel Sambuc (void)__atomic_nand_fetch(p, val, memory_order_acq_rel);
441*0a6a1f1dSLionel Sambuc (void)__atomic_nand_fetch(p, val, memory_order_seq_cst);
442*0a6a1f1dSLionel Sambuc
443*0a6a1f1dSLionel Sambuc (void)__atomic_exchange_n(p, val, memory_order_relaxed);
444*0a6a1f1dSLionel Sambuc (void)__atomic_exchange_n(p, val, memory_order_acquire);
445*0a6a1f1dSLionel Sambuc (void)__atomic_exchange_n(p, val, memory_order_consume);
446*0a6a1f1dSLionel Sambuc (void)__atomic_exchange_n(p, val, memory_order_release);
447*0a6a1f1dSLionel Sambuc (void)__atomic_exchange_n(p, val, memory_order_acq_rel);
448*0a6a1f1dSLionel Sambuc (void)__atomic_exchange_n(p, val, memory_order_seq_cst);
449*0a6a1f1dSLionel Sambuc
450*0a6a1f1dSLionel Sambuc (void)__atomic_exchange(p, p, p, memory_order_relaxed);
451*0a6a1f1dSLionel Sambuc (void)__atomic_exchange(p, p, p, memory_order_acquire);
452*0a6a1f1dSLionel Sambuc (void)__atomic_exchange(p, p, p, memory_order_consume);
453*0a6a1f1dSLionel Sambuc (void)__atomic_exchange(p, p, p, memory_order_release);
454*0a6a1f1dSLionel Sambuc (void)__atomic_exchange(p, p, p, memory_order_acq_rel);
455*0a6a1f1dSLionel Sambuc (void)__atomic_exchange(p, p, p, memory_order_seq_cst);
456*0a6a1f1dSLionel Sambuc
457*0a6a1f1dSLionel Sambuc (void)__atomic_compare_exchange(p, p, p, 0, memory_order_relaxed, memory_order_relaxed);
458*0a6a1f1dSLionel Sambuc (void)__atomic_compare_exchange(p, p, p, 0, memory_order_acquire, memory_order_relaxed);
459*0a6a1f1dSLionel Sambuc (void)__atomic_compare_exchange(p, p, p, 0, memory_order_consume, memory_order_relaxed);
460*0a6a1f1dSLionel Sambuc (void)__atomic_compare_exchange(p, p, p, 0, memory_order_release, memory_order_relaxed);
461*0a6a1f1dSLionel Sambuc (void)__atomic_compare_exchange(p, p, p, 0, memory_order_acq_rel, memory_order_relaxed);
462*0a6a1f1dSLionel Sambuc (void)__atomic_compare_exchange(p, p, p, 0, memory_order_seq_cst, memory_order_relaxed);
463*0a6a1f1dSLionel Sambuc
464*0a6a1f1dSLionel Sambuc (void)__atomic_compare_exchange_n(p, p, val, 0, memory_order_relaxed, memory_order_relaxed);
465*0a6a1f1dSLionel Sambuc (void)__atomic_compare_exchange_n(p, p, val, 0, memory_order_acquire, memory_order_relaxed);
466*0a6a1f1dSLionel Sambuc (void)__atomic_compare_exchange_n(p, p, val, 0, memory_order_consume, memory_order_relaxed);
467*0a6a1f1dSLionel Sambuc (void)__atomic_compare_exchange_n(p, p, val, 0, memory_order_release, memory_order_relaxed);
468*0a6a1f1dSLionel Sambuc (void)__atomic_compare_exchange_n(p, p, val, 0, memory_order_acq_rel, memory_order_relaxed);
469*0a6a1f1dSLionel Sambuc (void)__atomic_compare_exchange_n(p, p, val, 0, memory_order_seq_cst, memory_order_relaxed);
470*0a6a1f1dSLionel Sambuc }
471*0a6a1f1dSLionel Sambuc
472*0a6a1f1dSLionel Sambuc
473