[clang] d231e3b - [C11] Add test & update status of N1282 and DR087
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 22 07:18:01 PDT 2024
Author: Aaron Ballman
Date: 2024-03-22T10:17:50-04:00
New Revision: d231e3b10ead90e4360f7ceb88e4bca9d42d7d04
URL: https://github.com/llvm/llvm-project/commit/d231e3b10ead90e4360f7ceb88e4bca9d42d7d04
DIFF: https://github.com/llvm/llvm-project/commit/d231e3b10ead90e4360f7ceb88e4bca9d42d7d04.diff
LOG: [C11] Add test & update status of N1282 and DR087
Our existing diagnostics for catching unsequenced modifications handles
test coverage for N1282, which is correcting the standard based on the
resolution of DR087.
Added:
clang/test/C/C11/n1282.c
Modified:
clang/test/C/drs/dr0xx.c
clang/www/c_dr_status.html
clang/www/c_status.html
Removed:
################################################################################
diff --git a/clang/test/C/C11/n1282.c b/clang/test/C/C11/n1282.c
new file mode 100644
index 00000000000000..ed952790c88333
--- /dev/null
+++ b/clang/test/C/C11/n1282.c
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -verify -Wunsequenced -Wno-unused-value %s
+
+/* WG14 N1282: Yes
+ * Clarification of Expressions
+ */
+
+int g;
+
+int f(int i) {
+ g = i;
+ return 0;
+}
+
+int main(void) {
+ int x;
+ x = (10, g = 1, 20) + (30, g = 2, 40); /* Line A */ // expected-warning {{multiple unsequenced modifications to 'g'}}
+ x = (10, f(1), 20) + (30, f(2), 40); /* Line B */
+ x = (g = 1) + (g = 2); /* Line C */ // expected-warning {{multiple unsequenced modifications to 'g'}}
+ return 0;
+}
diff --git a/clang/test/C/drs/dr0xx.c b/clang/test/C/drs/dr0xx.c
index c93cfb63d604cf..36de32a93da95d 100644
--- a/clang/test/C/drs/dr0xx.c
+++ b/clang/test/C/drs/dr0xx.c
@@ -73,6 +73,10 @@
* WG14 DR085: yes
* Returning from main
*
+ * WG14 DR087: yes
+ * Order of evaluation
+ * Note: this DR is covered by C/C11/n1282.c
+ *
* WG14 DR086: yes
* Object-like macros in system headers
*
diff --git a/clang/www/c_dr_status.html b/clang/www/c_dr_status.html
index fa2ceb1be58bdc..ed45123ffd0ecb 100644
--- a/clang/www/c_dr_status.html
+++ b/clang/www/c_dr_status.html
@@ -577,7 +577,7 @@ <h2 id="cdr">C defect report implementation status</h2>
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_087.html">87</a></td>
<td>NAD</td>
<td>Order of evaluation</td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr id="88">
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_088.html">88</a></td>
diff --git a/clang/www/c_status.html b/clang/www/c_status.html
index b1f5ab4cbc4f07..0069da74cbd56c 100644
--- a/clang/www/c_status.html
+++ b/clang/www/c_status.html
@@ -401,7 +401,7 @@ <h2 id="c11">C11 implementation status</h2>
<tr>
<td>Clarification of expressions</td>
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1282.pdf">N1282</a></td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr>
<td>Extending the lifetime of temporary objects (factored approach)</td>
More information about the cfe-commits
mailing list