[clang] 3472b6e - Updating more entries in the C DR Status page

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 3 05:29:13 PDT 2022


Author: Aaron Ballman
Date: 2022-06-03T08:29:06-04:00
New Revision: 3472b6eb0a70f6b3ae45078d79d1c5b350da9c24

URL: https://github.com/llvm/llvm-project/commit/3472b6eb0a70f6b3ae45078d79d1c5b350da9c24
DIFF: https://github.com/llvm/llvm-project/commit/3472b6eb0a70f6b3ae45078d79d1c5b350da9c24.diff

LOG: Updating more entries in the C DR Status page

Adds test coverage or information for ~25 more C DRs.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/test/C/drs/dr1xx.c b/clang/test/C/drs/dr1xx.c
index 58c4386b3fe3b..10497f90c2db9 100644
--- a/clang/test/C/drs/dr1xx.c
+++ b/clang/test/C/drs/dr1xx.c
@@ -13,6 +13,24 @@
  *
  * WG14 DR104: dup 084
  * Incomplete tag types in a parameter list
+ *
+ * WG14 DR109: yes
+ * Are undefined values and undefined behavior the same?
+ *
+ * WG14 DR110: dup 047
+ * Formal parameters having array-of-non-object types
+ *
+ * WG14 DR117: yes
+ * Abstract semantics, sequence points, and expression evaluation
+ *
+ * WG14 DR121: yes
+ * Conversions of pointer values to integral types
+ *
+ * WG14 DR122: dup 015
+ * Conversion/widening of bit-fields
+ *
+ * WG14 DR125: yes
+ * Using things declared as 'extern (qualified) void'
  */
 
 
@@ -71,3 +89,137 @@ void dr105(void) {
   extern int i;   /* expected-note {{previous declaration is here}} */
   extern float i; /* expected-error {{redeclaration of 'i' with a 
diff erent type: 'float' vs 'int'}} */
 }
+
+/* WG14 DR106: yes
+ * When can you dereference a void pointer?
+ *
+ * NB: This is a partial duplicate of DR012.
+ */
+void dr106(void *p, int i) {
+  /* The behavior changed between C89 and C99. */
+  (void)&*p; /* c89only-warning {{ISO C forbids taking the address of an expression of type 'void'}} */
+  /* The behavior of all three of these is undefined. */
+  (void)*p;
+  (void)(i ? *p : *p);
+  (void)(*p, *p); /* expected-warning {{left operand of comma operator has no effect}} */
+}
+
+/* WG14 DR108: yes
+ * Can a macro identifier hide a keyword?
+ */
+void dr108(void) {
+#define const
+  const int i = 12;
+#undef const
+  const int j = 12; /* expected-note {{variable 'j' declared const here}} */
+
+  i = 100; /* Okay, the keyword was hidden by the macro. */
+  j = 100; /* expected-error {{cannot assign to variable 'j' with const-qualified type 'const int'}} */
+}
+
+/* WG14 DR111: yes
+ * Conversion of pointer-to-qualified type values to type (void*) values
+ */
+void dr111(const char *ccp, void *vp) {
+  vp = ccp; /* expected-warning {{assigning to 'void *' from 'const char *' discards qualifiers}} */
+}
+
+/* WG14 DR112: yes
+ * Null pointer constants and relational comparisons
+ */
+void dr112(void *vp) {
+  /* The behavior of this expression is pedantically undefined.
+   * FIXME: should we diagnose under -pedantic?
+   */
+  (void)(vp > (void*)0);
+}
+
+/* WG14 DR113: yes
+ * Return expressions in functions declared to return qualified void
+ */
+volatile void dr113_v(volatile void *vvp) { /* expected-warning {{function cannot return qualified void type 'volatile void'}} */
+  return *vvp; /* expected-warning {{void function 'dr113_v' should not return void expression}} */
+}
+const void dr113_c(const void *cvp) { /* expected-warning {{function cannot return qualified void type 'const void'}} */
+  return *cvp; /* expected-warning {{void function 'dr113_c' should not return void expression}} */
+}
+
+/* WG14 DR114: yes
+ * Initialization of multi-dimensional char array objects
+ */
+void dr114(void) {
+  char array[2][5] = { "defghi" }; /* expected-warning {{initializer-string for char array is too long}} */
+}
+
+/* WG14 DR115: yes
+ * Member declarators as declarators
+ */
+void dr115(void) {
+  struct { int mbr; }; /* expected-warning {{declaration does not declare anything}} */
+  union { int mbr; };  /* expected-warning {{declaration does not declare anything}} */
+}
+
+/* WG14 DR116: yes
+ * Implicit unary & applied to register arrays
+ */
+void dr116(void) {
+  register int array[5] = { 0, 1, 2, 3, 4 };
+  (void)array;       /* expected-error {{address of register variable requested}} */
+  (void)array[3];    /* expected-error {{address of register variable requested}} */
+  (void)(array + 3); /* expected-error {{address of register variable requested}} */
+}
+
+/* WG14 DR118: yes
+ * Completion point for enumerated types
+ */
+void dr118(void) {
+  enum E {
+	/* The enum isn't a complete type until the closing }, but an
+	 * implementation may complete the type earlier if it has sufficient type
+	 * information to calculate size or alignment, etc.
+	 */
+    Val = sizeof(enum E)
+  };
+}
+
+/* WG14 DR119: yes
+ * Initialization of multi-dimensional array objects
+ */
+void dr119(void) {
+  static int array[][] = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }; /* expected-error {{array has incomplete element type 'int[]'}} */
+}
+
+/* WG14 DR120: yes
+ * Semantics of assignment to (and initialization of) bit-fields
+ */
+void dr120(void) {
+  /* We could verify this one with a codegen test to ensure that the proper
+   * value is stored into bit, but the diagnostic tells us what the value is
+   * after conversion, so we can lean on that for verification.
+   */
+  struct S { unsigned bit:1; };
+  struct S object1 = { 3 }; /* expected-warning {{implicit truncation from 'int' to bit-field changes value from 3 to 1}} */
+  struct S object2;
+  object2.bit = 3; /* expected-warning {{implicit truncation from 'int' to bit-field changes value from 3 to 1}} */
+}
+
+/* WG14 DR123: yes
+ * 'Type categories' and qualified types
+ */
+void dr123(void) {
+  /* Both of these examples are strictly conforming. */
+  enum E1 {
+    enumerator1 = (const int) 9
+  };
+  enum E2 {
+    enumerator2 = (volatile int) 9
+  };
+}
+
+/* WG14 DR124: yes
+ * Casts to 'a void type' versus casts to 'the void type'
+ */
+void dr124(void) {
+  /* A cast can cast to void or any qualified version of void. */
+  (const volatile void)0;
+}

diff  --git a/clang/www/c_dr_status.html b/clang/www/c_dr_status.html
index aa2b21d7f604e..ff3387b7caf7e 100644
--- a/clang/www/c_dr_status.html
+++ b/clang/www/c_dr_status.html
@@ -690,122 +690,122 @@ <h2 id="cdr">C defect report implementation status</h2>
   <tr id="106">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_106.html">106</a></td>
     <td>NAD</td>
-    <td>ANSI/ISO C Defect report #rfg13</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td>When can you dereference a void pointer?</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="107">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_107.html">107</a></td>
     <td>NAD</td>
-    <td>ANSI/ISO C Defect report #rfg14</td>
+    <td>Type requirements of the assert macro parameter</td>
     <td class="na" align="center">N/A</td>
   </tr>
   <tr id="108">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_108.html">108</a></td>
     <td>NAD</td>
-    <td>ANSI/ISO C Defect report #rfg15</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td>Can a macro identifier hide a keyword?</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="109">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_109.html">109</a></td>
     <td>NAD</td>
-    <td>ANSI/ISO C Defect report #rfg16</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td>Are undefined values and undefined behavior the same?</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="110">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_110.html">110</a></td>
     <td>Dup</td>
     <td>Formal parameters having array-of-non-object types</td>
-    <td class="unknown" align="center">Duplicate of <a href="#47">47</a></td>
+    <td class="full" align="center">Duplicate of <a href="#47">47</a></td>
   </tr>
   <tr id="111">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_111.html">111</a></td>
     <td>NAD</td>
     <td>Conversion of pointer-to-qualified type values to type (void*) values</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="112">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_112.html">112</a></td>
     <td>NAD</td>
     <td>Null pointer constants and relational comparisons</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="113">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_113.html">113</a></td>
     <td>NAD</td>
     <td>Return expressions in functions declared to return qualified void</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="114">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_114.html">114</a></td>
     <td>NAD</td>
     <td>Initialization of multi-dimensional char array objects</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="115">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_115.html">115</a></td>
     <td>NAD</td>
     <td>Member declarators as declarators</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="116">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_116.html">116</a></td>
     <td>NAD</td>
     <td>Implicit unary & applied to register arrays</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="117">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_117.html">117</a></td>
     <td>NAD</td>
     <td>Abstract semantics, sequence points, and expression evaluation</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="118">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_118.html">118</a></td>
     <td>C89</td>
     <td>Completion point for enumerated types</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="119">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_119.html">119</a></td>
     <td>NAD</td>
     <td>Initialization of multi-dimensional array objects</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="120">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_120.html">120</a></td>
     <td>NAD</td>
     <td>Semantics of assignment to (and initialization of) bit-fields</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="121">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_121.html">121</a></td>
     <td>NAD</td>
     <td>Conversions of pointer values to integral types</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="122">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_122.html">122</a></td>
     <td>Dup</td>
     <td>Conversion/widening of bit-fields</td>
-    <td class="unknown" align="center">Duplicate of <a href="#15">15</a></td>
+    <td class="full" align="center">Duplicate of <a href="#15">15</a></td>
   </tr>
   <tr id="123">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_123.html">123</a></td>
     <td>NAD</td>
     <td>'Type categories' and qualified types</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="124">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_124.html">124</a></td>
     <td>C89</td>
     <td>Casts to 'a void type' versus casts to 'the void type'</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="125">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_125.html">125</a></td>
     <td>NAD</td>
     <td>Using things declared as 'extern (qualified) void'</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="126">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_126.html">126</a></td>


        


More information about the cfe-commits mailing list