1 /* $NetBSD: c11_atomic.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */ 2 # 3 "c11_atomic.c" 3 4 /* 5 * The keyword '_Atomic' was added in C11. This test ensures that in C11 6 * mode, '_Atomic' can be used as both type qualifier and type specifier. 7 * 8 * See also: 9 * C11 6.7.3 Type qualifiers 10 * C11 6.7.2.4 Atomic type specifiers 11 * msg_350.c 12 */ 13 14 /* lint1-extra-flags: -Ac11 -X 351 */ 15 16 /* C11 6.7.3 "Type qualifiers" */ 17 typedef _Atomic int atomic_int; 18 19 typedef _Atomic struct { 20 int field; 21 } atomic_struct; 22 23 /* C11 6.7.2.4 "Atomic type specifiers" */ 24 double * atomic_ptr_cmpexch(_Atomic (double *)* ptr_var,_Atomic (double *)new_value)25atomic_ptr_cmpexch(_Atomic(double *)*ptr_var, _Atomic(double *) new_value) 26 { 27 double *old = *ptr_var; 28 *ptr_var = new_value; 29 return old; 30 } 31