[clang] d99cfa0 - [C99] Claim conformance to WG14 N631 and WG14 N696
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 25 09:55:54 PDT 2024
Author: Aaron Ballman
Date: 2024-03-25T12:55:43-04:00
New Revision: d99cfa053998483e7283e91ff204fbe117345685
URL: https://github.com/llvm/llvm-project/commit/d99cfa053998483e7283e91ff204fbe117345685
DIFF: https://github.com/llvm/llvm-project/commit/d99cfa053998483e7283e91ff204fbe117345685.diff
LOG: [C99] Claim conformance to WG14 N631 and WG14 N696
Both of these relate to handling of standard pragmas. N631 is about
various STDC pragmas being included in the standard at all, and N696
is about whether macros are expanded in standard pragmas (they're not).
Added:
clang/test/C/C99/n696.c
Modified:
clang/www/c_status.html
Removed:
################################################################################
diff --git a/clang/test/C/C99/n696.c b/clang/test/C/C99/n696.c
new file mode 100644
index 00000000000000..c84ef2c7159e09
--- /dev/null
+++ b/clang/test/C/C99/n696.c
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -verify %s
+
+/* WG14 N696: yes
+ * Standard pragmas - improved wording
+ *
+ * NB: this also covers N631 which changed these features into pragmas rather
+ * than macros.
+ */
+
+// Verify that we do not expand macros in STDC pragmas. If we expanded them,
+// this code would issue diagnostics.
+#define ON 12
+#pragma STDC FENV_ACCESS ON
+#pragma STDC CX_LIMITED_RANGE ON
+#pragma STDC FP_CONTRACT ON
+
+// If we expanded macros, this code would not issue diagnostics.
+#define BLERP OFF
+#pragma STDC FENV_ACCESS BLERP // expected-warning {{expected 'ON' or 'OFF' or 'DEFAULT' in pragma}}
+#pragma STDC CX_LIMITED_RANGE BLERP // expected-warning {{expected 'ON' or 'OFF' or 'DEFAULT' in pragma}}
+#pragma STDC FP_CONTRACT BLERP // expected-warning {{expected 'ON' or 'OFF' or 'DEFAULT' in pragma}}
+
diff --git a/clang/www/c_status.html b/clang/www/c_status.html
index e97275e02033ff..ddfdc2f21c8796 100644
--- a/clang/www/c_status.html
+++ b/clang/www/c_status.html
@@ -330,11 +330,11 @@ <h2 id="c99">C99 implementation status</h2>
</tr>
<tr>
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n631.htm">N631</a></td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr>
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n696.ps">N696</a></td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr>
<td>__func__ predefined identifier</td>
More information about the cfe-commits
mailing list