Skip to content

Commit

Permalink
[C11] Add test & update status of N1282 and DR087
Browse files Browse the repository at this point in the history
Our existing diagnostics for catching unsequenced modifications handles
test coverage for N1282, which is correcting the standard based on the
resolution of DR087.
  • Loading branch information
AaronBallman committed Mar 22, 2024
1 parent 46b853a commit d231e3b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
20 changes: 20 additions & 0 deletions clang/test/C/C11/n1282.c
Original file line number Diff line number Diff line change
@@ -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;
}
4 changes: 4 additions & 0 deletions clang/test/C/drs/dr0xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
2 changes: 1 addition & 1 deletion clang/www/c_dr_status.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion clang/www/c_status.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit d231e3b

Please sign in to comment.