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