[clang] d1bd1c7 - [C2y] Claim conformance to WG14 N3496
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 7 06:51:41 PST 2025
Author: Aaron Ballman
Date: 2025-03-07T09:51:33-05:00
New Revision: d1bd1c7e825d190fc47cd06956c381cc0f70fba8
URL: https://github.com/llvm/llvm-project/commit/d1bd1c7e825d190fc47cd06956c381cc0f70fba8
DIFF: https://github.com/llvm/llvm-project/commit/d1bd1c7e825d190fc47cd06956c381cc0f70fba8.diff
LOG: [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.
Added:
clang/test/C/C2y/n3496.c
Modified:
clang/www/c_status.html
Removed:
################################################################################
diff --git a/clang/test/C/C2y/n3496.c b/clang/test/C/C2y/n3496.c
new file mode 100644
index 0000000000000..74b8880b8ca19
--- /dev/null
+++ b/clang/test/C/C2y/n3496.c
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -verify -std=c2y -ffreestanding %s
+// RUN: %clang_cc1 -verify -std=c23 -ffreestanding %s
+
+/* WG14 N3496: Clang 20
+ * Clarify the specification of the width macros
+ *
+ * C23 N2412 mandated a two's complement sign representation for integers, and
+ * added *_WIDTH macros for all of the various integer types. There was
+ * confusion as to whether BOOL_WIDTH specified the minimum number of bits or
+ * an exact number of bits. N3496 clarified that it's an exact number of bits.
+ */
+// expected-no-diagnostics
+
+#include <limits.h>
+
+static_assert(BOOL_WIDTH == 1);
+
diff --git a/clang/www/c_status.html b/clang/www/c_status.html
index b72b96dd598b5..f9dc3a48654c7 100644
--- a/clang/www/c_status.html
+++ b/clang/www/c_status.html
@@ -319,7 +319,7 @@ <h2 id="c2y">C2y implementation status</h2>
<tr>
<td>Clarify the specification of the width macros</td>
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3496.htm">N3496</a></td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="full" align="center">Clang 20</td>
</tr>
<tr>
<td>Complex operators</td>
More information about the cfe-commits
mailing list