[clang] 0b46121 - Update more DR status information for C.
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 2 06:32:52 PDT 2022
Author: Aaron Ballman
Date: 2022-06-02T09:32:44-04:00
New Revision: 0b46121c4130eec702066bca65802c21a9517539
URL: https://github.com/llvm/llvm-project/commit/0b46121c4130eec702066bca65802c21a9517539
DIFF: https://github.com/llvm/llvm-project/commit/0b46121c4130eec702066bca65802c21a9517539.diff
LOG: Update more DR status information for C.
This adds new files to track DRs 100-199 and 400-499, but the file
contents are still a work in progress. It also updates the associated
status in the DR tracking page.
Added:
clang/test/C/drs/dr1xx.c
clang/test/C/drs/dr4xx.c
Modified:
clang/test/C/drs/dr0xx.c
clang/www/c_dr_status.html
Removed:
################################################################################
diff --git a/clang/test/C/drs/dr0xx.c b/clang/test/C/drs/dr0xx.c
index 5cc0823eeb0b7..522f36c7141f3 100644
--- a/clang/test/C/drs/dr0xx.c
+++ b/clang/test/C/drs/dr0xx.c
@@ -9,6 +9,9 @@
/* The following are DRs which do not require tests to demonstrate
* conformance or nonconformance.
*
+ * WG14 DR001: yes
+ * Do functions return values by copying?
+ *
* WG14 DR005: yes
* May a conforming implementation define and recognize a pragma which would
* change the semantics of the language?
diff --git a/clang/test/C/drs/dr1xx.c b/clang/test/C/drs/dr1xx.c
new file mode 100644
index 0000000000000..58c4386b3fe3b
--- /dev/null
+++ b/clang/test/C/drs/dr1xx.c
@@ -0,0 +1,73 @@
+/* RUN: %clang_cc1 -std=c89 -verify=expected,c89only -pedantic -Wno-c11-extensions %s
+ RUN: %clang_cc1 -std=c99 -verify=expected,c99untilc2x -pedantic -Wno-c11-extensions %s
+ RUN: %clang_cc1 -std=c11 -verify=expected,c99untilc2x -pedantic %s
+ RUN: %clang_cc1 -std=c17 -verify=expected,c99untilc2x -pedantic %s
+ RUN: %clang_cc1 -std=c2x -verify=expected,c2xandup -pedantic %s
+ */
+
+/* The following are DRs which do not require tests to demonstrate
+ * conformance or nonconformance.
+ *
+ * WG14 DR100: dup 001
+ * Defect with the return statement
+ *
+ * WG14 DR104: dup 084
+ * Incomplete tag types in a parameter list
+ */
+
+
+/* WG14 DR101: yes
+ * Type qualifiers and "as if by assignment"
+ */
+void dr101_callee(const int val);
+void dr101_caller(void) {
+ int val = 1;
+ dr101_callee(val); /* ok; const qualifier on the parameter doesn't prevent as-if assignment. */
+}
+
+/* WG14 DR102: yes
+ * Tag redeclaration constraints
+ */
+void dr102(void) {
+ struct S { int member; }; /* expected-note {{previous definition is here}} */
+ struct S { int member; }; /* expected-error {{redefinition of 'S'}} */
+
+ union U { int member; }; /* expected-note {{previous definition is here}} */
+ union U { int member; }; /* expected-error {{redefinition of 'U'}} */
+
+ enum E { member }; /* expected-note 2{{previous definition is here}} */
+ enum E { member }; /* expected-error {{redefinition of 'E'}}
+ expected-error {{redefinition of enumerator 'member'}} */
+}
+
+/* WG14 DR103: yes
+ * Formal parameters of incomplete type
+ */
+void dr103_1(int arg[]); /* ok, not an incomplete type due to rewrite */
+void dr103_2(struct S s) {} /* expected-warning {{declaration of 'struct S' will not be visible outside of this function}}
+ expected-error {{variable has incomplete type 'struct S'}}
+ expected-note {{forward declaration of 'struct S'}} */
+void dr103_3(struct S s); /* expected-warning {{declaration of 'struct S' will not be visible outside of this function}}
+ expected-note {{previous declaration is here}} */
+void dr103_3(struct S { int a; } s) { } /* expected-warning {{declaration of 'struct S' will not be visible outside of this function}}
+ expected-error {{conflicting types for 'dr103_3'}} */
+void dr103_4(struct S s1, struct S { int a; } s2); /* expected-warning {{declaration of 'struct S' will not be visible outside of this function}} */
+
+/* WG14 DR105: dup 017
+ * Precedence of requirements on compatible types
+ *
+ * NB: This is also Question 3 from DR017.
+ */
+void dr105(void) {
+ /* According to C2x 6.7.6.3p14 the return type and parameter types to be
+ * compatible types, but qualifiers are dropped from the parameter type.
+ */
+ extern void func(int);
+ extern void func(const int); /* FIXME: this should be pedantically diagnosed. */
+
+ extern void other_func(int); /* expected-note {{previous declaration is here}} */
+ extern void other_func(int *); /* expected-error {{conflicting types for 'other_func'}} */
+
+ 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'}} */
+}
diff --git a/clang/test/C/drs/dr4xx.c b/clang/test/C/drs/dr4xx.c
new file mode 100644
index 0000000000000..ab3407520f592
--- /dev/null
+++ b/clang/test/C/drs/dr4xx.c
@@ -0,0 +1,32 @@
+/* RUN: %clang_cc1 -std=c89 -verify=expected,c89only -pedantic -Wno-c11-extensions %s
+ RUN: %clang_cc1 -std=c99 -verify=expected,c99untilc2x -pedantic -Wno-c11-extensions %s
+ RUN: %clang_cc1 -std=c11 -verify=expected,c99untilc2x -pedantic %s
+ RUN: %clang_cc1 -std=c17 -verify=expected,c99untilc2x -pedantic %s
+ RUN: %clang_cc1 -std=c2x -verify=expected,c2xandup -pedantic %s
+ */
+
+/* The following are DRs which do not require tests to demonstrate
+ * conformance or nonconformance.
+ */
+
+
+/* WG14 DR423: partial
+ * Defect Report relative to n1570: underspecification for qualified rvalues
+ */
+
+/* FIXME: this should pass because the qualifier on the return type should be
+ * dropped when forming the function type.
+ */
+const int dr423_const(void);
+int dr423_nonconst(void);
+_Static_assert(__builtin_types_compatible_p(__typeof__(dr423_const), __typeof__(dr423_nonconst)), "fail"); /* expected-error {{fail}} */
+
+void dr423_func(void) {
+ const int i = 12;
+ __typeof__(i) v1 = 12; /* expected-note {{variable 'v1' declared const here}} */
+ __typeof__((const int)12) v2 = 12;
+
+ v1 = 100; /* expected-error {{cannot assign to variable 'v1' with const-qualified type 'typeof (i)' (aka 'const int')}} */
+ v2 = 100; /* Not an error; the qualifier was stripped. */
+}
+
diff --git a/clang/www/c_dr_status.html b/clang/www/c_dr_status.html
index d0ae947f4189f..aa2b21d7f604e 100644
--- a/clang/www/c_dr_status.html
+++ b/clang/www/c_dr_status.html
@@ -52,7 +52,7 @@ <h2 id="cdr">C defect report implementation status</h2>
<td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_001.html">1</a></td>
<td>C89</td>
<td>Do functions return values by copying?</td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr id="2">
<td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_002.html">2</a></td>
@@ -654,38 +654,38 @@ <h2 id="cdr">C defect report implementation status</h2>
<tr id="100">
<td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_100.html">100</a></td>
<td>Dup</td>
- <td>ANSI/ISO C Defect report #rfg7</td>
- <td class="unknown" align="center">Duplicate of <a href="#1">1</a></td>
+ <td>Defect with the return statement</td>
+ <td class="full" align="center">Duplicate of <a href="#1">1</a></td>
</tr>
<tr id="101">
<td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_101.html">101</a></td>
<td>C89</td>
- <td>ANSI/ISO C Defect report #rfg8</td>
- <td class="unknown" align="center">Unknown</td>
+ <td>Type qualifiers and "as if by assignment"</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr id="102">
<td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_102.html">102</a></td>
<td>NAD</td>
- <td>ANSI/ISO C Defect report #rfg9</td>
- <td class="unknown" align="center">Unknown</td>
+ <td>Tag redeclaration constraints</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr id="103">
<td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_103.html">103</a></td>
<td>NAD</td>
- <td>ANSI/ISO C Defect report #rfg10</td>
- <td class="unknown" align="center">Unknown</td>
+ <td>Formal parameters of incomplete type</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr id="104">
<td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_104.html">104</a></td>
<td>Dup</td>
- <td>ANSI/ISO C Defect report #rfg11</td>
- <td class="unknown" align="center">Duplicate of <a href="#84">84</a></td>
+ <td>Incomplete tag types in a parameter list</td>
+ <td class="full" align="center">Duplicate of <a href="#84">84</a></td>
</tr>
<tr id="105">
<td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_105.html">105</a></td>
<td>Dup</td>
- <td>ANSI/ISO C Defect report #rfg12</td>
- <td class="unknown" align="center">Duplicate of <a href="#17">17</a></td>
+ <td>Precedence of requirements on compatible types</td>
+ <td class="full" align="center">Duplicate of <a href="#17">17</a></td>
</tr>
<tr id="106">
<td><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_106.html">106</a></td>
@@ -2137,7 +2137,12 @@ <h2 id="cdr">C defect report implementation status</h2>
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2148.htm#dr_423">423</a></td>
<td>C11</td>
<td>Defect Report relative to n1570: underspecification for qualified rvalues</td>
- <td class="unreleased" align="center">Clang 15</td>
+ <td class="partial" align="center">
+ <details><summary>Partial</summary>
+ Clang properly handles dropping qualifiers from cast operations, but
+ does not yet handle dropping qualifiers from the function return type.
+ </details>
+ </td>
</tr>
<tr id="424">
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2148.htm#dr_424">424</a></td>
More information about the cfe-commits
mailing list