forked from OSchip/llvm-project
Update the status & add tests for some more C99 DRs
This commit is contained in:
parent
e0b5208650
commit
548f3f9061
|
@ -0,0 +1,27 @@
|
||||||
|
/* RUN: %clang_cc1 -std=c89 -ast-dump -o - %s | FileCheck %s
|
||||||
|
RUN: %clang_cc1 -std=c99 -ast-dump -o - %s | FileCheck %s
|
||||||
|
RUN: %clang_cc1 -std=c11 -ast-dump -o - %s | FileCheck %s
|
||||||
|
RUN: %clang_cc1 -std=c17 -ast-dump -o - %s | FileCheck %s
|
||||||
|
RUN: %clang_cc1 -std=c2x -ast-dump -o - %s | FileCheck %s
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* WG14 DR253: yes
|
||||||
|
* "overriding" in designated initializers
|
||||||
|
*/
|
||||||
|
struct fred {
|
||||||
|
char s [6];
|
||||||
|
int n;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct fred y [] = { { { "abc" }, 1 }, [0] = { .s[0] = 'q' } };
|
||||||
|
|
||||||
|
/* Ensure that y[0] is initialized as if by the initializer { 'q' }. */
|
||||||
|
|
||||||
|
// CHECK: VarDecl 0x{{.*}} <line:16:1, col:62> col:13 y 'struct fred[1]' cinit
|
||||||
|
// CHECK-NEXT: InitListExpr 0x{{.*}} <col:20, col:62> 'struct fred[1]'
|
||||||
|
// CHECK-NEXT: InitListExpr 0x{{.*}} <col:46, col:60> 'struct fred':'struct fred'
|
||||||
|
// CHECK-NEXT: InitListExpr 0x{{.*}} <col:50, col:56> 'char[6]'
|
||||||
|
// CHECK-NEXT: array_filler
|
||||||
|
// CHECK-NEXT: ImplicitCastExpr
|
||||||
|
// CHECK-NEXT: CharacterLiteral 0x{{.*}} <col:56> 'int' 113
|
||||||
|
// CHECK-NEXT: ImplicitValueInitExpr 0x{{.*}} <<invalid sloc>> 'int'
|
|
@ -32,6 +32,18 @@
|
||||||
*
|
*
|
||||||
* WG14 DR234: yes
|
* WG14 DR234: yes
|
||||||
* Miscellaneous Typos
|
* Miscellaneous Typos
|
||||||
|
*
|
||||||
|
* WG14 DR245: yes
|
||||||
|
* Missing paragraph numbers
|
||||||
|
*
|
||||||
|
* WG14 DR247: yes
|
||||||
|
* Are values a form of behaviour?
|
||||||
|
*
|
||||||
|
* WG14 DR248: yes
|
||||||
|
* Limits are required for optional types
|
||||||
|
*
|
||||||
|
* WG14 DR255: yes
|
||||||
|
* Non-prototyped function calls and argument mismatches
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -144,3 +156,99 @@ void dr230(void) {
|
||||||
/* expected-error@-1 {{invalid preprocessing directive}} \
|
/* expected-error@-1 {{invalid preprocessing directive}} \
|
||||||
expected-warning@-1 {{missing terminating ' character}}
|
expected-warning@-1 {{missing terminating ' character}}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* WG14 DR237: no
|
||||||
|
* Declarations using [static]
|
||||||
|
*/
|
||||||
|
void dr237_f(int array[static 10]); /* c89only-warning {{static array size is a C99 feature}}
|
||||||
|
expected-note {{callee declares array parameter as static here}}
|
||||||
|
*/
|
||||||
|
void dr237_1(void) {
|
||||||
|
int array[4];
|
||||||
|
dr237_f(array); /* expected-warning {{array argument is too small; contains 4 elements, callee requires at least 10}} */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FIXME: the composite type for this declaration should retain the static
|
||||||
|
* array extent instead of losing it.
|
||||||
|
*/
|
||||||
|
void dr237_f(int array[]);
|
||||||
|
|
||||||
|
void dr237_2(void) {
|
||||||
|
int array[4];
|
||||||
|
/* FIXME: this should diagnose the same as above. */
|
||||||
|
dr237_f(array);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* WG14 DR246: yes
|
||||||
|
* Completion of declarators
|
||||||
|
*/
|
||||||
|
void dr246(void) {
|
||||||
|
int i[i]; /* expected-error {{use of undeclared identifier 'i'}} */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* WG14 DR250: yes
|
||||||
|
* Non-directives within macro arguments
|
||||||
|
*/
|
||||||
|
void dr250(void) {
|
||||||
|
#define dr250_nothing(x)
|
||||||
|
|
||||||
|
/* FIXME: See DR231 regarding the error about an invalid preprocessing
|
||||||
|
* directive.
|
||||||
|
*/
|
||||||
|
|
||||||
|
dr250_nothing(
|
||||||
|
#nondirective /* expected-error {{invalid preprocessing directive}}
|
||||||
|
expected-warning {{embedding a directive within macro arguments has undefined behavior}}
|
||||||
|
*/
|
||||||
|
)
|
||||||
|
|
||||||
|
#undef dr250_nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
/* WG14 DR251: yes
|
||||||
|
* Are struct fred and union fred the same type?
|
||||||
|
*/
|
||||||
|
union dr251_fred { int a; }; /* expected-note {{previous use is here}} */
|
||||||
|
void dr251(void) {
|
||||||
|
struct dr251_fred *ptr; /* expected-error {{use of 'dr251_fred' with tag type that does not match previous declaration}} */
|
||||||
|
}
|
||||||
|
|
||||||
|
#if __STDC_VERSION__ < 202000L
|
||||||
|
/* WG14 DR252: yes
|
||||||
|
* Incomplete argument types when calling non-prototyped functions
|
||||||
|
*/
|
||||||
|
void dr252_no_proto(); /* expected-warning {{a function declaration without a prototype is deprecated in all versions of C}} */
|
||||||
|
void dr252_proto(void); /* expected-note {{'dr252_proto' declared here}} */
|
||||||
|
void dr252(void) {
|
||||||
|
/* It's a constraint violation to pass an argument to a function with a
|
||||||
|
* prototype that specifies a void parameter.
|
||||||
|
*/
|
||||||
|
dr252_proto(dr252_no_proto()); /* expected-error {{too many arguments to function call, expected 0, have 1}} */
|
||||||
|
|
||||||
|
/* It's technically UB to pass an incomplete type to a function without a
|
||||||
|
* prototype, but Clang treats it as an error.
|
||||||
|
*/
|
||||||
|
dr252_no_proto(dr252_proto()); /* expected-error {{argument type 'void' is incomplete}}
|
||||||
|
expected-warning {{passing arguments to 'dr252_no_proto' without a prototype is deprecated in all versions of C and is not supported in C2x}}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
#endif /* __STDC_VERSION__ < 202000L */
|
||||||
|
|
||||||
|
/* WG14 DR258: yes
|
||||||
|
* Ordering of "defined" and macro replacement
|
||||||
|
*/
|
||||||
|
void dr258(void) {
|
||||||
|
/* We get the diagnostic twice because the argument is used twice in the
|
||||||
|
* expansion. */
|
||||||
|
#define repeat(x) x && x
|
||||||
|
#if repeat(defined fred) /* expected-warning 2 {{macro expansion producing 'defined' has undefined behavior}} */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* We get no diagnostic because the argument is unused. */
|
||||||
|
#define forget(x) 0
|
||||||
|
#if forget(defined fred)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef repeat
|
||||||
|
#undef forget
|
||||||
|
}
|
||||||
|
|
|
@ -1356,7 +1356,7 @@ conformance.</p>
|
||||||
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_237.htm">237</a></td>
|
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_237.htm">237</a></td>
|
||||||
<td>NAD</td>
|
<td>NAD</td>
|
||||||
<td>Declarations using [static]</td>
|
<td>Declarations using [static]</td>
|
||||||
<td class="unknown" align="center">Unknown</td>
|
<td class="none" align="center">No</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="238">
|
<tr id="238">
|
||||||
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_238.htm">238</a></td>
|
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_238.htm">238</a></td>
|
||||||
|
@ -1385,7 +1385,7 @@ conformance.</p>
|
||||||
<tr id="242">
|
<tr id="242">
|
||||||
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_242.htm">242</a></td>
|
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_242.htm">242</a></td>
|
||||||
<td>C99</td>
|
<td>C99</td>
|
||||||
<td></td>
|
<td>Make the base standard and Annex F consistent for logb(0)</td>
|
||||||
<td class="na" align="center">N/A</td>
|
<td class="na" align="center">N/A</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="243">
|
<tr id="243">
|
||||||
|
@ -1410,49 +1410,49 @@ conformance.</p>
|
||||||
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_246.htm">246</a></td>
|
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_246.htm">246</a></td>
|
||||||
<td>NAD</td>
|
<td>NAD</td>
|
||||||
<td>Completion of declarators</td>
|
<td>Completion of declarators</td>
|
||||||
<td class="unknown" align="center">Unknown</td>
|
<td class="full" align="center">Yes</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="247">
|
<tr id="247">
|
||||||
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_247.htm">247</a></td>
|
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_247.htm">247</a></td>
|
||||||
<td>C99</td>
|
<td>C99</td>
|
||||||
<td>Are values a form of behaviour?</td>
|
<td>Are values a form of behaviour?</td>
|
||||||
<td class="unknown" align="center">Unknown</td>
|
<td class="full" align="center">Yes</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="248">
|
<tr id="248">
|
||||||
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_248.htm">248</a></td>
|
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_248.htm">248</a></td>
|
||||||
<td>C99</td>
|
<td>C99</td>
|
||||||
<td>limits are required for optional types</td>
|
<td>Limits are required for optional types</td>
|
||||||
<td class="unknown" align="center">Unknown</td>
|
<td class="full" align="center">Yes</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="249">
|
<tr id="249">
|
||||||
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_249.htm">249</a></td>
|
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_249.htm">249</a></td>
|
||||||
<td>C99</td>
|
<td>Dup</td>
|
||||||
<td>Lacuna applying C89:TC1 to C99</td>
|
<td>Lacuna applying C89:TC1 to C99</td>
|
||||||
<td class="unknown" align="center">Unknown</td>
|
<td class="none" align="center">Duplicate of <a href="#9">9</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="250">
|
<tr id="250">
|
||||||
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_250.htm">250</a></td>
|
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_250.htm">250</a></td>
|
||||||
<td>C99</td>
|
<td>C99</td>
|
||||||
<td>Non-directives within macro arguments</td>
|
<td>Non-directives within macro arguments</td>
|
||||||
<td class="unknown" align="center">Unknown</td>
|
<td class="full" align="center">Yes</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="251">
|
<tr id="251">
|
||||||
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_251.htm">251</a></td>
|
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_251.htm">251</a></td>
|
||||||
<td>C99</td>
|
<td>C99</td>
|
||||||
<td>Are struct fred and union fred the same type?</td>
|
<td>Are struct fred and union fred the same type?</td>
|
||||||
<td class="unknown" align="center">Unknown</td>
|
<td class="full" align="center">Yes</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="252">
|
<tr id="252">
|
||||||
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_252.htm">252</a></td>
|
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_252.htm">252</a></td>
|
||||||
<td>NAD</td>
|
<td>NAD</td>
|
||||||
<td>Incomplete argument types when calling non-prototyped functions</td>
|
<td>Incomplete argument types when calling non-prototyped functions</td>
|
||||||
<td class="unknown" align="center">Unknown</td>
|
<td class="full" align="center">Yes</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="253">
|
<tr id="253">
|
||||||
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_253.htm">253</a></td>
|
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_253.htm">253</a></td>
|
||||||
<td>NAD</td>
|
<td>NAD</td>
|
||||||
<td>"overriding" in designated initializers</td>
|
<td>"overriding" in designated initializers</td>
|
||||||
<td class="unknown" align="center">Unknown</td>
|
<td class="full" align="center">Yes</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="254">
|
<tr id="254">
|
||||||
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_254.htm">254</a></td>
|
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_254.htm">254</a></td>
|
||||||
|
@ -1464,7 +1464,7 @@ conformance.</p>
|
||||||
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_255.htm">255</a></td>
|
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_255.htm">255</a></td>
|
||||||
<td>NAD</td>
|
<td>NAD</td>
|
||||||
<td>Non-prototyped function calls and argument mismatches</td>
|
<td>Non-prototyped function calls and argument mismatches</td>
|
||||||
<td class="unknown" align="center">Unknown</td>
|
<td class="full" align="center">Yes</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="256">
|
<tr id="256">
|
||||||
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_256.htm">256</a></td>
|
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_256.htm">256</a></td>
|
||||||
|
@ -1482,7 +1482,7 @@ conformance.</p>
|
||||||
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_258.htm">258</a></td>
|
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_258.htm">258</a></td>
|
||||||
<td>NAD</td>
|
<td>NAD</td>
|
||||||
<td>Ordering of "defined" and macro replacement</td>
|
<td>Ordering of "defined" and macro replacement</td>
|
||||||
<td class="unknown" align="center">Unknown</td>
|
<td class="full" align="center">Yes</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="259">
|
<tr id="259">
|
||||||
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_259.htm">259</a></td>
|
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_259.htm">259</a></td>
|
||||||
|
|
Loading…
Reference in New Issue