c11_atomic.c revision 1.3
1/* $NetBSD: c11_atomic.c,v 1.3 2023/01/21 13:48:40 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 */ 12 13/* lint1-extra-flags: -Ac11 */ 14 15/* C11 6.7.3 "Type qualifiers" */ 16typedef _Atomic int atomic_int; 17 18typedef _Atomic struct { 19 int field; 20} atomic_struct; 21 22/* C11 6.7.2.4 "Atomic type specifiers" */ 23double * 24atomic_ptr_cmpexch(_Atomic(double *)*ptr_var, _Atomic(double *) new_value) 25{ 26 double *old = *ptr_var; 27 *ptr_var = new_value; 28 return old; 29} 30