From: Aaron Ballman
Date: Wed, 21 Sep 2022 19:31:53 +0000 (-0400)
Subject: Add tests & update the C99 DR statuses for dr315 and dr316
X-Git-Tag: upstream/17.0.6~32844
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b63b4d89663c240a77675d233652dcc854a85bb7;p=platform%2Fupstream%2Fllvm.git
Add tests & update the C99 DR statuses for dr315 and dr316
---
diff --git a/clang/test/C/drs/dr3xx.c b/clang/test/C/drs/dr3xx.c
index de25c4d..795bc59 100644
--- a/clang/test/C/drs/dr3xx.c
+++ b/clang/test/C/drs/dr3xx.c
@@ -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 */
diff --git a/clang/www/c_dr_status.html b/clang/www/c_dr_status.html
index 3d0a64b..4ef2937 100644
--- a/clang/www/c_dr_status.html
+++ b/clang/www/c_dr_status.html
@@ -1843,13 +1843,13 @@ conformance.
315 |
C99 |
Implementation-defined bit-field types |
- Unknown |
+ Yes |
316 |
NAD |
Unprototyped function types |
- Unknown |
+ Yes |
317 |