Skip to content

Commit 4746877

Browse files
committed
[C99] Claim conformance to WG14 N570
1 parent 2be7225 commit 4746877

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

clang/test/C/C99/n570.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// RUN: %clang_cc1 -verify -std=c99 %s
2+
// RUN: %clang_cc1 -E -std=c99 %s | FileCheck %s
3+
// expected-no-diagnostics
4+
5+
/* WG14 N570: Yes
6+
* Empty macro arguments
7+
*
8+
* NB: the original paper is not available online anywhere, so the test
9+
* coverage is coming from what could be gleaned from the C99 rationale
10+
* document. In C89, it was UB to pass no arguments to a function-like macro,
11+
* and that's now supported in C99.
12+
*/
13+
14+
#define TEN 10
15+
#define U u
16+
#define I // expands into no preprocessing tokens
17+
#define L L
18+
#define glue(a, b) a ## b
19+
#define xglue(a, b) glue(a, b)
20+
21+
const unsigned u = xglue(TEN, U);
22+
const int i = xglue(TEN, I);
23+
const long l = xglue(TEN, L);
24+
25+
// CHECK: const unsigned u = 10u;
26+
// CHECK-NEXT: const int i = 10;
27+
// CHECK-NEXT: const long l = 10L;
28+
29+
_Static_assert(u == 10U, "");
30+
_Static_assert(i == 10, "");
31+
_Static_assert(l == 10L, "");

clang/www/c_status.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ <h2 id="c99">C99 implementation status</h2>
300300
<tr>
301301
<td>empty macro arguments</td>
302302
<td>N570</td>
303-
<td class="unknown" align="center">Unknown</td>
303+
<td class="full" align="center">Yes</td>
304304
</tr>
305305
<tr>
306306
<td>new structure type compatibility (tag compatibility)</td>

0 commit comments

Comments
 (0)