[clang] 91babd3 - Update the status of a few more C99 DRs

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 26 05:21:23 PDT 2022


Author: Aaron Ballman
Date: 2022-09-26T08:20:56-04:00
New Revision: 91babd351665e867c9cc4be22bc3daee8f639942

URL: https://github.com/llvm/llvm-project/commit/91babd351665e867c9cc4be22bc3daee8f639942
DIFF: https://github.com/llvm/llvm-project/commit/91babd351665e867c9cc4be22bc3daee8f639942.diff

LOG: Update the status of a few more C99 DRs

Added: 
    

Modified: 
    clang/test/C/drs/dr3xx.c
    clang/www/c_dr_status.html

Removed: 
    


################################################################################
diff  --git a/clang/test/C/drs/dr3xx.c b/clang/test/C/drs/dr3xx.c
index 795bc590f5351..0f06118ca6e57 100644
--- a/clang/test/C/drs/dr3xx.c
+++ b/clang/test/C/drs/dr3xx.c
@@ -1,8 +1,8 @@
 /* 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
-   RUN: %clang_cc1 -std=c2x -fsyntax-only -Wvla -verify -pedantic %s
+   RUN: %clang_cc1 -std=c99 -fsyntax-only -Wvla -verify=expected,c99andup -pedantic -Wno-c11-extensions %s
+   RUN: %clang_cc1 -std=c11 -fsyntax-only -Wvla -verify=expected,c99andup -pedantic %s
+   RUN: %clang_cc1 -std=c17 -fsyntax-only -Wvla -verify=expected,c99andup -pedantic %s
+   RUN: %clang_cc1 -std=c2x -fsyntax-only -Wvla -verify=expected,c99andup -pedantic %s
  */
 
 /* The following are DRs which do not require tests to demonstrate
@@ -108,10 +108,91 @@ _Static_assert(sizeof(dr315.a + dr315.b) == sizeof(unsigned long long), ""); /*
  */
 _Static_assert(sizeof(dr315.c + dr315.d) == sizeof(int), "");
 
+#if __STDC_VERSION__ < 202000L
 /* 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;
+
+/* WG14 DR317: yes
+ * Function definitions with empty parentheses
+ *
+ * Despite the function with empty parens being a definition, this does not
+ * provide a prototype for the function. However, calling the function with
+ * arguments is undefined behavior, so it is defensible for us to warn the user
+ * about it. They key point to this DR is that we give the "without a
+ * prototype" warnings to demonstrate we don't give this function a prototype.
+ */
+void dr317_1() {}  /* expected-warning {{a function declaration without a prototype is deprecated in all versions of C}} */
+void dr317_2(void) {
+  if (0)
+    dr317_1(1); /* expected-warning {{too many arguments in call to 'dr317_1'}}
+                   expected-warning {{passing arguments to 'dr317_1' without a prototype is deprecated in all versions of C and is not supported in C2x}}
+                 */
+}
 #endif /* __STDC_VERSION__ < 202000L */
+
+/* WG14 DR320: yes
+ * Scope of variably modified type
+ */
+int dr320_v;
+typedef int dr320_t[dr320_v]; /* c89only-warning {{variable length arrays are a C99 feature}}
+                                 expected-error {{variable length array declaration not allowed at file scope}}
+                                 c99andup-warning {{variable length array used}}
+                               */
+void dr320(int okay[dr320_v]) { /* c89only-warning {{variable length arrays are a C99 feature}}
+                                   c99andup-warning {{variable length array used}}
+                                 */
+  typedef int type[dr320_v]; /* c89only-warning {{variable length arrays are a C99 feature}}
+                                c99andup-warning {{variable length array used}}
+                              */
+  extern type bad;  /* expected-error {{variable length array declaration cannot have 'extern' linkage}} */
+
+  /* C99 6.7.5.2p2, second sentence. */
+  static type fine; /* expected-error {{variable length array declaration cannot have 'static' storage duration}} */
+}
+
+/* WG14 DR321: yes
+ * Wide character code values for members of the basic character set
+ */
+#define DR321 (\
+    ' ' == L' ' && '\t' == L'\t' && '\v' == L'\v' && '\r' == L'\r' &&           \
+    '\n' == L'\n' &&                                                            \
+    'a' == L'a' && 'b' == L'b' && 'c' == L'c' && 'd' == L'd' && 'e' == L'e' &&  \
+    'f' == L'f' && 'g' == L'g' && 'h' == L'h' && 'i' == L'i' && 'j' == L'j' &&  \
+    'k' == L'k' && 'l' == L'l' && 'm' == L'm' && 'n' == L'n' && 'o' == L'o' &&  \
+    'p' == L'p' && 'q' == L'q' && 'r' == L'r' && 's' == L's' && 't' == L't' &&  \
+    'u' == L'u' && 'v' == L'v' && 'w' == L'w' && 'x' == L'x' && 'y' == L'y' &&  \
+    'z' == L'z' &&                                                              \
+    'A' == L'A' && 'B' == L'B' && 'C' == L'C' && 'D' == L'D' && 'E' == L'E' &&  \
+    'F' == L'F' && 'G' == L'G' && 'H' == L'H' && 'I' == L'I' && 'J' == L'J' &&  \
+    'K' == L'K' && 'L' == L'L' && 'M' == L'M' && 'N' == L'N' && 'O' == L'O' &&  \
+    'P' == L'P' && 'Q' == L'Q' && 'R' == L'R' && 'S' == L'S' && 'T' == L'T' &&  \
+    'U' == L'U' && 'V' == L'V' && 'W' == L'W' && 'X' == L'X' && 'Y' == L'Y' &&  \
+    'Z' == L'Z' &&                                                              \
+    '0' == L'0' && '1' == L'1' && '2' == L'2' && '3' == L'3' && '4' == L'4' &&  \
+    '5' == L'5' && '6' == L'6' && '7' == L'7' && '8' == L'8' &&                 \
+    '9' == L'9' &&                                                              \
+    '_' == L'_' && '{' == L'{' && '}' == L'}' && '[' == L'[' && ']' == L']' &&  \
+    '#' == L'#' && '(' == L'(' && ')' == L')' && '<' == L'<' && '>' == L'>' &&  \
+    '%' == L'%' && ':' == L':' && ';' == L';' && '.' == L'.' && '?' == L'?' &&  \
+    '*' == L'*' && '+' == L'+' && '-' == L'-' && '/' == L'/' && '^' == L'^' &&  \
+    '&' == L'&' && '|' == L'|' && '~' == L'~' && '!' == L'!' && '=' == L'=' &&  \
+    ',' == L',' && '\\' == L'\\' && '"' == L'"' && '\'' == L'\''                \
+  )
+#if __STDC_MB_MIGHT_NEQ_WC__
+#ifndef __FreeBSD__ // PR22208, FreeBSD expects us to give a bad (but conforming) answer here.
+_Static_assert(!DR321, "__STDC_MB_MIGHT_NEQ_WC__ but all basic source characters have same representation");
+#endif
+#else
+_Static_assert(DR321, "!__STDC_MB_MIGHT_NEQ_WC__ but some character 
diff ers");
+#endif
+
+/* WG14 DR328: yes
+ * String literals in compound literal initialization
+ */
+const char *dr328_v = (const char *){"this is a string literal"}; /* c89only-warning {{compound literals are a C99-specific feature}} */
+void dr328(void) {
+  const char *val = (const char *){"also a string literal"}; /* c89only-warning {{compound literals are a C99-specific feature}} */
+}

diff  --git a/clang/www/c_dr_status.html b/clang/www/c_dr_status.html
index 4ef2937e7fe0f..52966d705e765 100644
--- a/clang/www/c_dr_status.html
+++ b/clang/www/c_dr_status.html
@@ -1855,7 +1855,7 @@ <h2 id="cdr">C defect report implementation status</h2>
     <td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_317.htm">317</a></td>
     <td>NAD</td>
     <td>Function definitions with empty parentheses</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="318">
     <td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_318.htm">318</a></td>
@@ -1873,13 +1873,13 @@ <h2 id="cdr">C defect report implementation status</h2>
     <td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_320.htm">320</a></td>
     <td>C99</td>
     <td>Scope of variably modified type</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="321">
     <td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_321.htm">321</a></td>
     <td>C99</td>
     <td>Wide character code values for members of the basic character set</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="322">
     <td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_322.htm">322</a></td>
@@ -1921,7 +1921,7 @@ <h2 id="cdr">C defect report implementation status</h2>
     <td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_328.htm">328</a></td>
     <td>C99</td>
     <td>String literals in compound literal initialization</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="329">
     <td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_329.htm">329</a></td>


        


More information about the cfe-commits mailing list