Add tests & update the C99 DR statuses for dr315 and dr316
authorAaron Ballman <aaron@aaronballman.com>
Wed, 21 Sep 2022 19:31:53 +0000 (15:31 -0400)
committerAaron Ballman <aaron@aaronballman.com>
Wed, 21 Sep 2022 19:33:03 +0000 (15:33 -0400)
clang/test/C/drs/dr3xx.c
clang/www/c_dr_status.html

index de25c4d..795bc59 100644 (file)
@@ -1,4 +1,4 @@
-/* RUN: %clang_cc1 -std=c89 -fsyntax-only -Wvla -verify -pedantic -Wno-c11-extensions %s
+/* RUN: %clang_cc1 -std=c89 -fsyntax-only -Wvla -verify=expected,c89only -pedantic -Wno-c11-extensions %s
    RUN: %clang_cc1 -std=c99 -fsyntax-only -Wvla -verify -pedantic -Wno-c11-extensions %s
    RUN: %clang_cc1 -std=c11 -fsyntax-only -Wvla -verify -pedantic %s
    RUN: %clang_cc1 -std=c17 -fsyntax-only -Wvla -verify -pedantic %s
@@ -83,7 +83,7 @@ void dr311(int x) {
   vla y[3]; /* expected-warning {{variable length array}} */
 }
 
-/* WG14 DR313:
+/* WG14 DR313: yes
  * Incomplete arrays of VLAs
  */
 void dr313(int i) {
@@ -91,3 +91,27 @@ void dr313(int i) {
                          expected-warning {{variable length array}}
                        */
 }
+
+/* WG14 DR315: yes
+ * Implementation-defined bit-field types
+ */
+struct dr315_t {
+  unsigned long long a : 37; /* c89only-warning {{'long long' is an extension when C99 mode is not enabled}} */
+  unsigned long long b : 37; /* c89only-warning {{'long long' is an extension when C99 mode is not enabled}} */
+
+  short c : 8;
+  short d : 8;
+} dr315;
+_Static_assert(sizeof(dr315.a + dr315.b) == sizeof(unsigned long long), ""); /* c89only-warning {{'long long' is an extension when C99 mode is not enabled}} */
+/* Demonstrate that integer promotions still happen when less than the width of
+ * an int.
+ */
+_Static_assert(sizeof(dr315.c + dr315.d) == sizeof(int), "");
+
+/* WG14 DR316: yes
+ * Unprototyped function types
+ */
+#if __STDC_VERSION__ < 202000L
+void dr316_1(a) int a; {}  /* expected-warning {{a function definition without a prototype is deprecated in all versions of C and is not supported in C2x}} */
+void (*dr316_1_ptr)(int, int, int) = dr316_1;
+#endif /* __STDC_VERSION__ < 202000L */
index 3d0a64b..4ef2937 100644 (file)
@@ -1843,13 +1843,13 @@ conformance.</p>
     <td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_315.htm">315</a></td>
     <td>C99</td>
     <td>Implementation-defined bit-field types</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="316">
     <td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_316.htm">316</a></td>
     <td>NAD</td>
     <td>Unprototyped function types</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="317">
     <td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_317.htm">317</a></td>