<div dir="auto"><div>Looks like this might break tests: <a href="http://45.33.8.238/linux/80043/step_7.txt">http://45.33.8.238/linux/80043/step_7.txt</a><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 30, 2022, 9:47 PM Aaron Ballman via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Author: Aaron Ballman<br>
Date: 2022-06-30T15:46:47-04:00<br>
New Revision: cce06da1ecf789658551ca5f3b255c361f063abf<br>
<br>
URL: <a href="https://github.com/llvm/llvm-project/commit/cce06da1ecf789658551ca5f3b255c361f063abf" rel="noreferrer noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/cce06da1ecf789658551ca5f3b255c361f063abf</a><br>
DIFF: <a href="https://github.com/llvm/llvm-project/commit/cce06da1ecf789658551ca5f3b255c361f063abf.diff" rel="noreferrer noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/cce06da1ecf789658551ca5f3b255c361f063abf.diff</a><br>
<br>
LOG: Test and document some C99 DRs<br>
<br>
This captures the first 15 or so DRs in C99<br>
<br>
Added: <br>
clang/test/C/drs/dr206.c<br>
clang/test/C/drs/dr208.c<br>
clang/test/C/drs/dr209.c<br>
clang/test/C/drs/dr2xx.c<br>
<br>
Modified: <br>
clang/www/c_dr_status.html<br>
<br>
Removed: <br>
<br>
<br>
<br>
################################################################################<br>
diff --git a/clang/test/C/drs/dr206.c b/clang/test/C/drs/dr206.c<br>
new file mode 100644<br>
index 0000000000000..d5686a43b3304<br>
--- /dev/null<br>
+++ b/clang/test/C/drs/dr206.c<br>
@@ -0,0 +1,23 @@<br>
+/* RUN: %clang_cc1 -std=c89 -Wno-deprecated-non-prototype -ast-dump -o - %s | FileCheck %s<br>
+ RUN: %clang_cc1 -std=c99 -Wno-deprecated-non-prototype -ast-dump -o - %s | FileCheck %s<br>
+ RUN: %clang_cc1 -std=c11 -Wno-deprecated-non-prototype -ast-dump -o - %s | FileCheck %s<br>
+ RUN: %clang_cc1 -std=c17 -Wno-deprecated-non-prototype -ast-dump -o - %s | FileCheck %s<br>
+ */<br>
+<br>
+/* WG14 DR206: yes<br>
+ * Default argument conversion of float _Complex<br>
+ */<br>
+void dr206_unprototyped();<br>
+void dr206(void) {<br>
+ /* Ensure that _Complex float is not promoted to _Complex double but is<br>
+ * instead passed directly without a type conversion.<br>
+ */<br>
+ _Complex float f = 1.2f;<br>
+ dr206_unprototyped(f);<br>
+ // CHECK: CallExpr 0x{{.*}} <line:16:3, col:23> 'void'<br>
+ // CHECK-NEXT: ImplicitCastExpr 0x{{.*}} <col:3> 'void (*)()' <FunctionToPointerDecay><br>
+ // CHECK-NEXT: DeclRefExpr 0x{{.*}} <col:3> 'void ()' Function 0x{{.*}} 'dr206_unprototyped' 'void ()'<br>
+ // CHECK-NEXT: ImplicitCastExpr 0x{{.*}} <col:22> '_Complex float' <LValueToRValue><br>
+ // CHECK-NEXT: DeclRefExpr 0x{{.*}} <col:22> '_Complex float' lvalue Var 0x{{.*}} 'f' '_Complex float'<br>
+}<br>
+<br>
<br>
diff --git a/clang/test/C/drs/dr208.c b/clang/test/C/drs/dr208.c<br>
new file mode 100644<br>
index 0000000000000..aac27e7c1ad31<br>
--- /dev/null<br>
+++ b/clang/test/C/drs/dr208.c<br>
@@ -0,0 +1,24 @@<br>
+/* RUN: %clang_cc1 -std=c99 -verify -emit-llvm -o - %s | FileCheck %s<br>
+ RUN: %clang_cc1 -std=c11 -verify -emit-llvm -o - %s | FileCheck %s<br>
+ RUN: %clang_cc1 -std=c17 -verify -emit-llvm -o - %s | FileCheck %s<br>
+ RUN: %clang_cc1 -std=c2x -verify -emit-llvm -o - %s | FileCheck %s<br>
+ */<br>
+<br>
+/* WG14 DR208: yes<br>
+ * Ambiguity in initialization<br>
+ */<br>
+int dr208_init(int);<br>
+void dr208(void) {<br>
+ int a[2] = {<br>
+ dr208_init(0), /* expected-note {{previous initialization with side effects is here (side effects will not occur at run time)}} */<br>
+ dr208_init(1),<br>
+ [0] = dr208_init(2) /* expected-warning {{initializer overrides prior initialization of this subobject}} */<br>
+ };<br>
+<br>
+ /* CHECK-NOT: call i32 @dr208_init(i32 noundef 0)<br>
+ CHECK-DAG: call i32 @dr208_init(i32 noundef 1)<br>
+ CHECK-DAG: call i32 @dr208_init(i32 noundef 2)<br>
+ CHECK-NOT: call i32 @dr208_init(i32 noundef 0)<br>
+ */<br>
+}<br>
+<br>
<br>
diff --git a/clang/test/C/drs/dr209.c b/clang/test/C/drs/dr209.c<br>
new file mode 100644<br>
index 0000000000000..6cd6093a4b918<br>
--- /dev/null<br>
+++ b/clang/test/C/drs/dr209.c<br>
@@ -0,0 +1,61 @@<br>
+/* RUN: %clang_cc1 -std=c99 -ffreestanding -triple x86_64-unknown-linux -fsyntax-only -verify -pedantic -Wno-c11-extensions %s<br>
+ RUN: %clang_cc1 -std=c99 -ffreestanding -triple x86_64-unknown-win32 -fms-compatibility -fsyntax-only -verify -pedantic -Wno-c11-extensions %s<br>
+ RUN: %clang_cc1 -std=c11 -ffreestanding -fsyntax-only -verify -pedantic %s<br>
+ RUN: %clang_cc1 -std=c17 -ffreestanding -fsyntax-only -verify -pedantic %s<br>
+ RUN: %clang_cc1 -std=c2x -ffreestanding -fsyntax-only -verify -pedantic %s<br>
+ */<br>
+<br>
+/* WG14 DR209: partial<br>
+ * Problem implementing INTN_C macros<br>
+ */<br>
+#include <stdint.h><br>
+<br>
+#if INT8_C(0) != 0<br>
+#error "uh oh"<br>
+#elif INT16_C(0) != 0<br>
+#error "uh oh"<br>
+#elif INT32_C(0) != 0<br>
+#error "uh oh"<br>
+#elif INT64_C(0) != 0LL<br>
+#error "uh oh"<br>
+#elif UINT8_C(0) != 0U<br>
+#error "uh oh"<br>
+#elif UINT16_C(0) != 0U<br>
+#error "uh oh"<br>
+#elif UINT32_C(0) != 0U<br>
+#error "uh oh"<br>
+#elif UINT64_C(0) != 0ULL<br>
+#error "uh oh"<br>
+#endif<br>
+<br>
+void dr209(void) {<br>
+ (void)_Generic(INT8_C(0), __typeof__(+(int_least8_t){0}) : 1);<br>
+ (void)_Generic(INT16_C(0), __typeof__(+(int_least16_t){0}) : 1);<br>
+ (void)_Generic(INT32_C(0), __typeof__(+(int_least32_t){0}) : 1);<br>
+ (void)_Generic(INT64_C(0), __typeof__(+(int_least64_t){0}) : 1);<br>
+ (void)_Generic(UINT8_C(0), __typeof__(+(uint_least8_t){0}) : 1);<br>
+ (void)_Generic(UINT16_C(0), __typeof__(+(uint_least16_t){0}) : 1);<br>
+ // FIXME: This is not the expected behavior; the type of the expanded value<br>
+ // in both of these cases should be 'int',<br>
+ //<br>
+ // C99 7.18.4p3: The type of the expression shall have the same type as would<br>
+ // an expression of the corresponding type converted according to the integer<br>
+ // promotions.<br>
+ //<br>
+ // C99 7.18.4.1p1: The macro UINTN_C(value) shall expand to an integer<br>
+ // constant expression corresponding to the type uint_leastN_t.<br>
+ //<br>
+ // C99 7.18.1.2p2: The typedef name uint_leastN_t designates an unsigned<br>
+ // integer type with a width of at least N, ...<br>
+ //<br>
+ // So the value's type is the same underlying type as uint_leastN_t, which is<br>
+ // unsigned char for uint_least8_t, and unsigned short for uint_least16_t,<br>
+ // but then the value undergoes integer promotions which would convert both<br>
+ // of those types to int.<br>
+ //<br>
+ // expected-error@-2 {{controlling expression type 'unsigned int' not compatible with any generic association type}}<br>
+ // expected-error@-2 {{controlling expression type 'unsigned int' not compatible with any generic association type}}<br>
+ (void)_Generic(UINT32_C(0), __typeof__(+(uint_least32_t){0}) : 1);<br>
+ (void)_Generic(UINT64_C(0), __typeof__(+(uint_least64_t){0}) : 1);<br>
+}<br>
+<br>
<br>
diff --git a/clang/test/C/drs/dr2xx.c b/clang/test/C/drs/dr2xx.c<br>
new file mode 100644<br>
index 0000000000000..0fa0f97858197<br>
--- /dev/null<br>
+++ b/clang/test/C/drs/dr2xx.c<br>
@@ -0,0 +1,82 @@<br>
+/* RUN: %clang_cc1 -std=c89 -fsyntax-only -verify=expected,c89only -pedantic -Wno-c11-extensions %s<br>
+ RUN: %clang_cc1 -std=c99 -triple x86_64-unknown-linux -fsyntax-only -verify=expected,c99untilc2x -pedantic -Wno-c11-extensions %s<br>
+ RUN: %clang_cc1 -std=c99 -triple x86_64-unknown-win32 -fms-compatibility -fsyntax-only -verify=expected,c99untilc2x -pedantic -Wno-c11-extensions %s<br>
+ RUN: %clang_cc1 -std=c11 -fsyntax-only -verify=expected,c99untilc2x -pedantic %s<br>
+ RUN: %clang_cc1 -std=c17 -fsyntax-only -verify=expected,c99untilc2x -pedantic %s<br>
+ RUN: %clang_cc1 -std=c2x -fsyntax-only -verify=expected,c2xandup -pedantic %s<br>
+ */<br>
+<br>
+/* The following are DRs which do not require tests to demonstrate<br>
+ * conformance or nonconformance.<br>
+ *<br>
+ * WG14 DR201: yes<br>
+ * Integer types longer than long<br>
+ *<br>
+ * WG14 DR211: yes<br>
+ * Accuracy of decimal string to/from "binary" (non-decimal) floating-point conversions<br>
+ *<br>
+ * WG14 DR215: yes<br>
+ * Equality operators<br>
+ */<br>
+<br>
+<br>
+/* WG14 DR204: yes<br>
+ * size_t and ptr<br>
diff _t as a long long type<br>
+ */<br>
+void dr204(void) {<br>
+ __typeof__(sizeof(0)) s;<br>
+ __typeof__((int *)0 - (int *)0) p;<br>
+ signed long sl;<br>
+#if __LLONG_WIDTH__ > __LONG_WIDTH__<br>
+ /* If the implementation supports a standard integer type larger than signed<br>
+ * long, it's okay for size_t and ptr<br>
diff _t to have a greater integer<br>
+ * conversion rank than signed long.<br>
+ */<br>
+ (void)_Generic(s + sl, __typeof__(s) : 1);<br>
+ (void)_Generic(p + sl, __typeof__(p) : 1);<br>
+#elif __LLONG_WIDTH__ == __LONG_WIDTH__<br>
+ /* But if the implementation doesn't support a larger standard integer type<br>
+ * than signed long, the conversion rank should prefer signed long if the type<br>
+ * is signed (ptr<br>
diff _t) or unsigned long if the type is unsigned (size_t).<br>
+ */<br>
+ (void)_Generic(s + sl, unsigned long : 1);<br>
+ (void)_Generic(p + sl, signed long : 1);<br>
+#else<br>
+#error "Something has gone off the rails"<br>
+#endif<br>
+}<br>
+<br>
+/* WG14 DR207: partial<br>
+ * Handling of imaginary types<br>
+ *<br>
+ * FIXME: Clang recognizes the _Imaginary keyword but does not support the data<br>
+ * type.<br>
+ */<br>
+void dr207(void) {<br>
+ _Imaginary float f; /* expected-error {{imaginary types are not supported}}<br>
+ c89only-warning {{'_Imaginary' is a C99 extension}}<br>
+ */<br>
+}<br>
+<br>
+/* WG14 DR216: yes<br>
+ * Source character encodings<br>
+ */<br>
+void dr216(void) {<br>
+#define A(x) _Static_assert((char)x >= 0, "no")<br>
+ A('A'); A('B'); A('C'); A('D'); A('E'); A('F'); A('G'); A('H'); A('I');<br>
+ A('J'); A('K'); A('L'); A('M'); A('N'); A('O'); A('P'); A('Q'); A('R');<br>
+ A('S'); A('T'); A('U'); A('V'); A('W'); A('X'); A('Y'); A('Z');<br>
+<br>
+ A('a'); A('b'); A('c'); A('d'); A('e'); A('f'); A('g'); A('h'); A('i');<br>
+ A('j'); A('k'); A('l'); A('m'); A('n'); A('o'); A('p'); A('q'); A('r');<br>
+ A('s'); A('t'); A('u'); A('v'); A('w'); A('x'); A('y'); A('z');<br>
+<br>
+ A('0'); A('1'); A('2'); A('3'); A('4');<br>
+ A('5'); A('6'); A('7'); A('8'); A('9');<br>
+<br>
+ A('!'); A('"'); A('#'); A('%'); A('&'); A('\''); A('('); A(')'); A('*');<br>
+ A('+'); A(','); A('-'); A('.'); A('/'); A(':'); A(';'); A('<'); A('=');<br>
+ A('>'); A('?'); A('['); A('\\'); A(']'); A('^'); A('_'); A('{'); A('|');<br>
+ A('}'); A('~');<br>
+#undef A<br>
+}<br>
<br>
diff --git a/clang/www/c_dr_status.html b/clang/www/c_dr_status.html<br>
index e6e339d5f18ce..ea604b498a539 100644<br>
--- a/clang/www/c_dr_status.html<br>
+++ b/clang/www/c_dr_status.html<br>
@@ -1129,7 +1129,7 @@ <h2 id="cdr">C defect report implementation status</h2><br>
<td><a href="<a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_201.htm" rel="noreferrer noreferrer" target="_blank">https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_201.htm</a>">201</a></td><br>
<td>NAD</td><br>
<td>Integer types longer than long</td><br>
- <td class="unknown" align="center">Unknown</td><br>
+ <td class="full" align="center">Yes</td><br>
</tr><br>
<tr id="202"><br>
<td><a href="<a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_202.htm" rel="noreferrer noreferrer" target="_blank">https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_202.htm</a>">202</a></td><br>
@@ -1147,7 +1147,7 @@ <h2 id="cdr">C defect report implementation status</h2><br>
<td><a href="<a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_204.htm" rel="noreferrer noreferrer" target="_blank">https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_204.htm</a>">204</a></td><br>
<td>C99</td><br>
<td>size_t and ptr<br>
diff _t as a long long type</td><br>
- <td class="unknown" align="center">Unknown</td><br>
+ <td class="full" align="center">Yes</td><br>
</tr><br>
<tr id="205"><br>
<td><a href="<a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_205.htm" rel="noreferrer noreferrer" target="_blank">https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_205.htm</a>">205</a></td><br>
@@ -1159,25 +1159,36 @@ <h2 id="cdr">C defect report implementation status</h2><br>
<td><a href="<a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_206.htm" rel="noreferrer noreferrer" target="_blank">https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_206.htm</a>">206</a></td><br>
<td>NAD</td><br>
<td>Default argument conversion of float _Complex</td><br>
- <td class="unknown" align="center">Unknown</td><br>
+ <td class="full" align="center">Yes</td><br>
</tr><br>
<tr id="207"><br>
<td><a href="<a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_207.htm" rel="noreferrer noreferrer" target="_blank">https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_207.htm</a>">207</a></td><br>
<td>C99</td><br>
<td>Handling of imaginary types</td><br>
- <td class="unknown" align="center">Unknown</td><br>
+ <td class="partial" align="center"><br>
+ <details><summary>Partial</summary><br>
+ Clang detects use of the _Imaginary keyword but does not otherwise<br>
+ support the type yet.<br>
+ </details><br>
+ </td><br>
</tr><br>
<tr id="208"><br>
<td><a href="<a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_208.htm" rel="noreferrer noreferrer" target="_blank">https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_208.htm</a>">208</a></td><br>
<td>C99</td><br>
<td>Ambiguity in initialization</td><br>
- <td class="unknown" align="center">Unknown</td><br>
+ <td class="full" align="center">Yes</td><br>
</tr><br>
<tr id="209"><br>
<td><a href="<a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_209.htm" rel="noreferrer noreferrer" target="_blank">https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_209.htm</a>">209</a></td><br>
<td>C99</td><br>
<td>Problem implementing INTN_C macros</td><br>
- <td class="na" align="center">N/A</td><br>
+ <td class="partial" align="center"><br>
+ <details><summary>Partial</summary><br>
+ Clang provides these definitions in a freestanding compilation, but the<br>
+ type of the value produced by <code>UINT8_C</code> and <code>UINT16_C</code><br>
+ is not the type after integer promotion per C99 7.18.4p3.<br>
+ </details><br>
+ </td><br>
</tr><br>
<tr id="210"><br>
<td><a href="<a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_210.htm" rel="noreferrer noreferrer" target="_blank">https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_210.htm</a>">210</a></td><br>
@@ -1189,7 +1200,7 @@ <h2 id="cdr">C defect report implementation status</h2><br>
<td><a href="<a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_211.htm" rel="noreferrer noreferrer" target="_blank">https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_211.htm</a>">211</a></td><br>
<td>C99</td><br>
<td>Accuracy of decimal string to/from "binary" (non-decimal) floating-point conversions</td><br>
- <td class="unknown" align="center">Unknown</td><br>
+ <td class="full" align="center">Yes</td><br>
</tr><br>
<tr id="212"><br>
<td><a href="<a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_212.htm" rel="noreferrer noreferrer" target="_blank">https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_212.htm</a>">212</a></td><br>
@@ -1213,13 +1224,13 @@ <h2 id="cdr">C defect report implementation status</h2><br>
<td><a href="<a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_215.htm" rel="noreferrer noreferrer" target="_blank">https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_215.htm</a>">215</a></td><br>
<td>C99</td><br>
<td>Equality operators</td><br>
- <td class="unknown" align="center">Unknown</td><br>
+ <td class="full" align="center">Yes</td><br>
</tr><br>
<tr id="216"><br>
<td><a href="<a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_216.htm" rel="noreferrer noreferrer" target="_blank">https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_216.htm</a>">216</a></td><br>
<td>C99</td><br>
<td>Source character encodings</td><br>
- <td class="unknown" align="center">Unknown</td><br>
+ <td class="full" align="center">Yes</td><br>
</tr><br>
<tr id="217"><br>
<td><a href="<a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_217.htm" rel="noreferrer noreferrer" target="_blank">https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_217.htm</a>">217</a></td><br>
<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank" rel="noreferrer">cfe-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div></div>