Skip to content

Commit d1bd1c7

Browse files
committed
[C2y] Claim conformance to WG14 N3496
This was a clarification for C23's N2412, primarily about the BOOL_WIDTH macro. It should expand to the number of bits in the value representation, not the object representation. Clang 20 implements the correct value.
1 parent 1c1140c commit d1bd1c7

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

clang/test/C/C2y/n3496.c

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// RUN: %clang_cc1 -verify -std=c2y -ffreestanding %s
2+
// RUN: %clang_cc1 -verify -std=c23 -ffreestanding %s
3+
4+
/* WG14 N3496: Clang 20
5+
* Clarify the specification of the width macros
6+
*
7+
* C23 N2412 mandated a two's complement sign representation for integers, and
8+
* added *_WIDTH macros for all of the various integer types. There was
9+
* confusion as to whether BOOL_WIDTH specified the minimum number of bits or
10+
* an exact number of bits. N3496 clarified that it's an exact number of bits.
11+
*/
12+
// expected-no-diagnostics
13+
14+
#include <limits.h>
15+
16+
static_assert(BOOL_WIDTH == 1);
17+

clang/www/c_status.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ <h2 id="c2y">C2y implementation status</h2>
319319
<tr>
320320
<td>Clarify the specification of the width macros</td>
321321
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3496.htm">N3496</a></td>
322-
<td class="unknown" align="center">Unknown</td>
322+
<td class="full" align="center">Clang 20</td>
323323
</tr>
324324
<tr>
325325
<td>Complex operators</td>

0 commit comments

Comments
 (0)