Skip to content

Commit 6b2a466

Browse files
committed
[C11] Claim conformance to WG14 N1482
This paper added a pile of macros for atomic initialization which we started supporting in Clang 4.0.
1 parent 7f2a41b commit 6b2a466

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed

clang/test/C/C11/n1482.c

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// RUN: %clang_cc1 -verify -ffreestanding -std=c11 %s
2+
// expected-no-diagnostics
3+
4+
/* WG14 N1482: Clang 4
5+
* Explicit initializers for atomics
6+
*
7+
* NB: We can only test the compile time behavior from the paper, not the
8+
* runtime behavior.
9+
*/
10+
11+
#include <stdatomic.h>
12+
13+
#ifndef ATOMIC_BOOL_LOCK_FREE
14+
#error "Missing ATOMIC_BOOL_LOCK_FREE"
15+
#endif
16+
17+
#ifndef ATOMIC_CHAR_LOCK_FREE
18+
#error "Missing ATOMIC_CHAR_LOCK_FREE"
19+
#endif
20+
21+
#ifndef ATOMIC_CHAR16_T_LOCK_FREE
22+
#error "Missing ATOMIC_CHAR16_T_LOCK_FREE"
23+
#endif
24+
25+
#ifndef ATOMIC_CHAR32_T_LOCK_FREE
26+
#error "Missing ATOMIC_CHAR32_T_LOCK_FREE"
27+
#endif
28+
29+
#ifndef ATOMIC_WCHAR_T_LOCK_FREE
30+
#error "Missing ATOMIC_WCHAR_T_LOCK_FREE"
31+
#endif
32+
33+
#ifndef ATOMIC_SHORT_LOCK_FREE
34+
#error "Missing ATOMIC_SHORT_LOCK_FREE"
35+
#endif
36+
37+
#ifndef ATOMIC_INT_LOCK_FREE
38+
#error "Missing ATOMIC_INT_LOCK_FREE"
39+
#endif
40+
41+
#ifndef ATOMIC_LONG_LOCK_FREE
42+
#error "Missing ATOMIC_LONG_LOCK_FREE"
43+
#endif
44+
45+
#ifndef ATOMIC_LLONG_LOCK_FREE
46+
#error "Missing ATOMIC_LLONG_LOCK_FREE"
47+
#endif
48+
49+
#ifndef ATOMIC_POINTER_LOCK_FREE
50+
#error "Missing ATOMIC_POINTER_LOCK_FREE"
51+
#endif
52+
53+
#ifndef ATOMIC_VAR_INIT
54+
#error "Missing ATOMIC_VAR_INIT"
55+
#endif
56+
57+
#ifndef atomic_init
58+
#error "Missing atomic_init"
59+
#endif

clang/www/c_status.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ <h2 id="c11">C11 implementation status</h2>
548548
<tr>
549549
<td>Explicit initializers for atomics</td>
550550
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1482.htm">N1482</a></td>
551-
<td class="unknown" align="center">Unknown</td>
551+
<td class="full" align="center">Clang 4</td>
552552
</tr>
553553
<tr>
554554
<td>Atomics proposal (minus ternary op)</td>

0 commit comments

Comments
 (0)