xref: /llvm-project/clang/test/C/C23/n2886.c (revision 50c81128de8616117118564eff22cf508cba7848)
1 // RUN: %clang_cc1 -verify=okay -std=c11 -ffreestanding %s
2 // RUN: %clang_cc1 -verify -std=c17 -ffreestanding %s
3 // RUN: %clang_cc1 -verify -std=c2x -ffreestanding %s
4 
5 /* WG14 N2886: yes
6  * Remove ATOMIC_VAR_INIT v2
7  */
8 
9 /* okay-no-diagnostics */
10 #include <stdatomic.h>
11 
12 _Atomic int a = ATOMIC_VAR_INIT(0); /* #diag */
13 #if __STDC_VERSION__ <= 201710L
14 /* expected-warning@#diag {{macro 'ATOMIC_VAR_INIT' has been marked as deprecated}}
15    expected-note@stdatomic.h:* {{macro marked 'deprecated' here}}
16 */
17 #else
18 /* expected-error@#diag {{use of undeclared identifier 'ATOMIC_VAR_INIT'}} */
19 #endif
20 
21