Skip to content

Commit df81055

Browse files
authored
[clang] Do less advertising for unresolved issues in cxx_dr_status.html (#78836)
This patch places additional requirement on tests for open issues to specify what do they test, and reduce their advertising on `cxx_dr_status.html`. Tests for open issues have to either provide date of the proposed resolution they test, or a paper number that attempts to resolve the issue. Examples from this patch: `// dr1223: 17 drafting 2023-05-12`, `// dr2049: 18 drafting P2308R1`, `// dr2335: no drafting 2018-06`. Tests for open issues are no longer advertised in `cxx_dr_status.html` as tests for resolved issues. Instead, they are specified as `Not Resolved*` (note the asterisk). Such statuses have a tooltip with the following kind of text: `Clang 17 implements 2023-05-12 resolution` `Clang does not implement 2018-06-04 resolution` `Clang 18 implements P2308R1 resolution` I admit that the wording is a bit crude, but I tried to minimize amount of boilerplate in the `make_cxx_dr_status`. Hopefully, this whole setup matches [C++ compiler support](https://en.cppreference.com/w/cpp/compiler_support) page on cppreference enough for people to catch up. This patch also implement a quality-of-life feature for users of `make_cxx_dr_status`: now script is able to report multiple bad `// dr` comments in a single run. This has also been discussed in a PR for CWG472 test: #67948
1 parent 4d273b9 commit df81055

File tree

9 files changed

+94
-53
lines changed

9 files changed

+94
-53
lines changed

clang/test/CXX/drs/dr12xx.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace dr1213 { // dr1213: 7
3232
}
3333

3434
#if __cplusplus >= 201103L
35-
namespace dr1223 { // dr1223: 17 drafting
35+
namespace dr1223 { // dr1223: 17 drafting 2023-05-12
3636
struct M;
3737
template <typename T>
3838
struct V;

clang/test/CXX/drs/dr18xx.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ namespace dr1881 { // dr1881: 7
366366
static_assert(!__is_standard_layout(D), "");
367367
}
368368

369-
namespace dr1890 { // dr1890: no drafting
369+
namespace dr1890 { // dr1890: no drafting 2018-06-04
370370
// FIXME: current consensus for CWG2335 is that the examples are well-formed.
371371
namespace ex1 {
372372
#if __cplusplus >= 201402L

clang/test/CXX/drs/dr20xx.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ namespace dr2026 { // dr2026: 11
9090
}
9191
}
9292

93-
namespace dr2049 { // dr2049: 18 drafting
93+
namespace dr2049 { // dr2049: 18 drafting P2308R1
9494
#if __cplusplus >= 202302L
9595
template <int* x = {}> struct X {};
9696
X<> a;

clang/test/CXX/drs/dr2335.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// expected-no-diagnostics
1111
#endif
1212

13-
namespace dr2335 { // dr2335: no drafting
13+
namespace dr2335 { // dr2335: no drafting 2018-06
1414
// FIXME: current consensus is that the examples are well-formed.
1515
#if __cplusplus >= 201402L
1616
namespace ex1 {

clang/test/CXX/drs/dr24xx.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void fallthrough(int n) {
4545
#endif
4646
}
4747

48-
namespace dr2450 { // dr2450: 18 review
48+
namespace dr2450 { // dr2450: 18 review P2308R1
4949
#if __cplusplus >= 202302L
5050
struct S {int a;};
5151
template <S s>
@@ -59,7 +59,7 @@ f<{.a= 0}>();
5959
#endif
6060
}
6161

62-
namespace dr2459 { // dr2459: 18 drafting
62+
namespace dr2459 { // dr2459: 18 drafting P2308R1
6363
#if __cplusplus >= 202302L
6464
struct A {
6565
constexpr A(float) {}

clang/test/CXX/drs/dr25xx.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ using ::dr2521::operator""_div;
8585

8686

8787
#if __cplusplus >= 202302L
88-
namespace dr2553 { // dr2553: 18 review
88+
namespace dr2553 { // dr2553: 18 review 2023-07-14
8989
struct B {
9090
virtual void f(this B&);
9191
// since-cxx23-error@-1 {{an explicit object parameter cannot appear in a virtual function}}
@@ -103,7 +103,7 @@ struct D : B {
103103
#endif
104104

105105
#if __cplusplus >= 202302L
106-
namespace dr2554 { // dr2554: 18 review
106+
namespace dr2554 { // dr2554: 18 review 2021-12-10
107107
struct B {
108108
virtual void f(); // #dr2554-g
109109
};
@@ -130,7 +130,7 @@ struct D3 : B {
130130
#endif
131131

132132
#if __cplusplus >= 202302L
133-
namespace dr2561 { // dr2561: 18 review
133+
namespace dr2561 { // dr2561: 18 review 2023-11-09
134134
struct C {
135135
constexpr C(auto) { }
136136
};
@@ -145,7 +145,7 @@ void foo() {
145145
#endif
146146

147147

148-
namespace dr2565 { // dr2565: 16 open
148+
namespace dr2565 { // dr2565: 16 open 2023-06-07
149149
#if __cplusplus >= 202002L
150150
template<typename T>
151151
concept C = requires (typename T::type x) {

clang/test/CXX/drs/dr4xx.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ namespace dr471 { // dr471: 2.8
10551055
// expected-note@#dr471-G-using {{declared private here}}
10561056
}
10571057

1058-
namespace dr472 { // dr472: no drafting
1058+
namespace dr472 { // dr472: no drafting 2011-04
10591059
struct B {
10601060
int i; // #dr472-i
10611061
};

clang/www/cxx_dr_status.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2872,7 +2872,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
28722872
<td><a href="https://cplusplus.github.io/CWG/issues/472.html">472</a></td>
28732873
<td>drafting</td>
28742874
<td>Casting across protected inheritance</td>
2875-
<td class="none" align="center">No</td>
2875+
<td title="Clang does not implement 2011-04 resolution" align="center">Not Resolved*</td>
28762876
</tr>
28772877
<tr id="473">
28782878
<td><a href="https://cplusplus.github.io/CWG/issues/473.html">473</a></td>
@@ -7146,7 +7146,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
71467146
<td><a href="https://cplusplus.github.io/CWG/issues/1223.html">1223</a></td>
71477147
<td>drafting</td>
71487148
<td>Syntactic disambiguation and <I>trailing-return-type</I>s</td>
7149-
<td class="full" align="center">Clang 17</td>
7149+
<td title="Clang 17 implements 2023-05-12 resolution" align="center">Not Resolved*</td>
71507150
</tr>
71517151
<tr id="1224">
71527152
<td><a href="https://cplusplus.github.io/CWG/issues/1224.html">1224</a></td>
@@ -11148,7 +11148,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
1114811148
<td><a href="https://cplusplus.github.io/CWG/issues/1890.html">1890</a></td>
1114911149
<td>drafting</td>
1115011150
<td>Member type depending on definition of member function</td>
11151-
<td class="none" align="center">No</td>
11151+
<td title="Clang does not implement 2018-06-04 resolution" align="center">Not Resolved*</td>
1115211152
</tr>
1115311153
<tr id="1891">
1115411154
<td><a href="https://cplusplus.github.io/CWG/issues/1891.html">1891</a></td>
@@ -12102,7 +12102,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
1210212102
<td><a href="https://cplusplus.github.io/CWG/issues/2049.html">2049</a></td>
1210312103
<td>drafting</td>
1210412104
<td>List initializer in non-type template default argument</td>
12105-
<td class="unreleased" align="center">Clang 18</td>
12105+
<td title="Clang 18 implements P2308R1 resolution" align="center">Not Resolved*</td>
1210612106
</tr>
1210712107
<tr id="2050">
1210812108
<td><a href="https://cplusplus.github.io/CWG/issues/2050.html">2050</a></td>
@@ -13818,7 +13818,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
1381813818
<td><a href="https://cplusplus.github.io/CWG/issues/2335.html">2335</a></td>
1381913819
<td>drafting</td>
1382013820
<td>Deduced return types vs member types</td>
13821-
<td class="none" align="center">No</td>
13821+
<td title="Clang does not implement 2018-06 resolution" align="center">Not Resolved*</td>
1382213822
</tr>
1382313823
<tr id="2336">
1382413824
<td><a href="https://cplusplus.github.io/CWG/issues/2336.html">2336</a></td>
@@ -13986,7 +13986,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
1398613986
<td><a href="https://cplusplus.github.io/CWG/issues/2363.html">2363</a></td>
1398713987
<td>NAD</td>
1398813988
<td>Opaque enumeration friend declarations</td>
13989-
<td class="unknown" align="center">Unknown</td>
13989+
<td class="full" align="center">Yes</td>
1399013990
</tr>
1399113991
<tr id="2364">
1399213992
<td><a href="https://cplusplus.github.io/CWG/issues/2364.html">2364</a></td>
@@ -14508,7 +14508,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
1450814508
<td><a href="https://cplusplus.github.io/CWG/issues/2450.html">2450</a></td>
1450914509
<td>review</td>
1451014510
<td><I>braced-init-list</I> as a <I>template-argument</I></td>
14511-
<td class="unreleased" align="center">Clang 18</td>
14511+
<td title="Clang 18 implements P2308R1 resolution" align="center">Not Resolved*</td>
1451214512
</tr>
1451314513
<tr id="2451">
1451414514
<td><a href="https://cplusplus.github.io/CWG/issues/2451.html">2451</a></td>
@@ -14562,7 +14562,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
1456214562
<td><a href="https://cplusplus.github.io/CWG/issues/2459.html">2459</a></td>
1456314563
<td>drafting</td>
1456414564
<td>Template parameter initialization</td>
14565-
<td class="unreleased" align="center">Clang 18</td>
14565+
<td title="Clang 18 implements P2308R1 resolution" align="center">Not Resolved*</td>
1456614566
</tr>
1456714567
<tr id="2460">
1456814568
<td><a href="https://cplusplus.github.io/CWG/issues/2460.html">2460</a></td>
@@ -15126,13 +15126,13 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
1512615126
<td><a href="https://cplusplus.github.io/CWG/issues/2553.html">2553</a></td>
1512715127
<td>review</td>
1512815128
<td>Restrictions on explicit object member functions</td>
15129-
<td class="unreleased" align="center">Clang 18</td>
15129+
<td title="Clang 18 implements 2023-07-14 resolution" align="center">Not Resolved*</td>
1513015130
</tr>
1513115131
<tr class="open" id="2554">
1513215132
<td><a href="https://cplusplus.github.io/CWG/issues/2554.html">2554</a></td>
1513315133
<td>review</td>
1513415134
<td>Overriding virtual functions, also with explicit object parameters</td>
15135-
<td class="unreleased" align="center">Clang 18</td>
15135+
<td title="Clang 18 implements 2021-12-10 resolution" align="center">Not Resolved*</td>
1513615136
</tr>
1513715137
<tr class="open" id="2555">
1513815138
<td><a href="https://cplusplus.github.io/CWG/issues/2555.html">2555</a></td>
@@ -15174,7 +15174,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
1517415174
<td><a href="https://cplusplus.github.io/CWG/issues/2561.html">2561</a></td>
1517515175
<td>review</td>
1517615176
<td>Conversion to function pointer for lambda with explicit object parameter</td>
15177-
<td class="unreleased" align="center">Clang 18</td>
15177+
<td title="Clang 18 implements 2023-11-09 resolution" align="center">Not Resolved*</td>
1517815178
</tr>
1517915179
<tr class="open" id="2562">
1518015180
<td><a href="https://cplusplus.github.io/CWG/issues/2562.html">2562</a></td>
@@ -15198,7 +15198,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
1519815198
<td><a href="https://cplusplus.github.io/CWG/issues/2565.html">2565</a></td>
1519915199
<td>open</td>
1520015200
<td>Invalid types in the <I>parameter-declaration-clause</I> of a <I>requires-expression</I></td>
15201-
<td class="full" align="center">Clang 16</td>
15201+
<td title="Clang 16 implements 2023-06-07 resolution" align="center">Not Resolved*</td>
1520215202
</tr>
1520315203
<tr class="open" id="2566">
1520415204
<td><a href="https://cplusplus.github.io/CWG/issues/2566.html">2566</a></td>

clang/www/make_cxx_dr_status

Lines changed: 71 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -129,19 +129,25 @@ out_file.write('''\
129129

130130
latest_release = 17
131131

132+
class AvailabilityError(RuntimeError):
133+
pass
134+
135+
availability_error_occurred = False
136+
132137
def availability(issue):
133138
status = status_map.get(issue, 'unknown')
134139

135140
unresolved_status = ''
136-
if status.endswith(' open'):
137-
status = status[:-5]
138-
unresolved_status = 'open'
139-
elif status.endswith(' drafting'):
140-
status = status[:-9]
141-
unresolved_status = 'drafting'
142-
elif status.endswith(' review'):
143-
status = status[:-7]
144-
unresolved_status = 'review'
141+
proposed_resolution = ''
142+
unresolved_status_match = re.search(r' (open|drafting|review)', status)
143+
if unresolved_status_match:
144+
unresolved_status = unresolved_status_match.group(1)
145+
proposed_resolution_match = re.search(r' (open|drafting|review) (\d{4}-\d{2}(?:-\d{2})?|P\d{4}R\d+)$', status)
146+
if proposed_resolution_match is None:
147+
raise AvailabilityError('Issue {}: \'{}\' status should be followed by a paper number (P1234R5) or proposed resolution in YYYY-MM-DD format'.format(dr.issue, unresolved_status))
148+
proposed_resolution = proposed_resolution_match.group(2)
149+
status = status[:-1-len(proposed_resolution)]
150+
status = status[:-1-len(unresolved_status)]
145151

146152
avail_suffix = ''
147153
if status.endswith(' c++11'):
@@ -159,21 +165,37 @@ def availability(issue):
159165
if status == 'unknown':
160166
avail = 'Unknown'
161167
avail_style = ' class="unknown"'
162-
elif re.match('^[0-9]+\.?[0-9]*', status):
163-
avail = 'Clang %s' % status
164-
if float(status) > latest_release:
165-
avail_style = ' class="unreleased"'
166-
else:
167-
avail_style = ' class="full"'
168+
elif re.match(r'^[0-9]+\.?[0-9]*', status):
169+
if not proposed_resolution:
170+
avail = 'Clang %s' % status
171+
if float(status) > latest_release:
172+
avail_style = ' class="unreleased"'
173+
else:
174+
avail_style = ' class="full"'
175+
else:
176+
avail = 'Not Resolved*'
177+
avail_style = f' title="Clang {status} implements {proposed_resolution} resolution"'
168178
elif status == 'yes':
169-
avail = 'Yes'
170-
avail_style = ' class="full"'
179+
if not proposed_resolution:
180+
avail = 'Yes'
181+
avail_style = ' class="full"'
182+
else:
183+
avail = 'Not Resolved*'
184+
avail_style = f' title="Clang implements {proposed_resolution} resolution"'
171185
elif status == 'partial':
172-
avail = 'Partial'
173-
avail_style = ' class="partial"'
186+
if not proposed_resolution:
187+
avail = 'Partial'
188+
avail_style = ' class="partial"'
189+
else:
190+
avail = 'Not Resolved*'
191+
avail_style = f' title="Clang partially implements {proposed_resolution} resolution"'
174192
elif status == 'no':
175-
avail = 'No'
176-
avail_style = ' class="none"'
193+
if not proposed_resolution:
194+
avail = 'No'
195+
avail_style = ' class="none"'
196+
else:
197+
avail = 'Not Resolved*'
198+
avail_style = f' title="Clang does not implement {proposed_resolution} resolution"'
177199
elif status == 'na':
178200
avail = 'N/A'
179201
avail_style = ' class="na"'
@@ -200,7 +222,7 @@ def availability(issue):
200222
avail = 'Duplicate of <a href="#%s">%s</a>' % (dup, dup)
201223
_, avail_style, _ = availability(dup)
202224
else:
203-
assert False, 'unknown status %s for issue %s' % (status, dr.issue)
225+
raise AvailabilityError('Unknown status %s for issue %s' % (status, dr.issue))
204226
return (avail + avail_suffix, avail_style, unresolved_status)
205227

206228
count = {}
@@ -217,20 +239,36 @@ for dr in drs:
217239

218240
elif dr.status in ('open', 'drafting', 'review'):
219241
row_style = ' class="open"'
220-
avail, avail_style, unresolved_status = availability(dr.issue)
242+
try:
243+
avail, avail_style, unresolved_status = availability(dr.issue)
244+
except AvailabilityError as e:
245+
availability_error_occurred = True
246+
print(e.args[0])
247+
continue
248+
221249
if avail == 'Unknown':
222250
avail = 'Not resolved'
223251
avail_style = ''
224252
else:
225-
assert unresolved_status == dr.status, \
226-
"Issue %s is marked '%s', which differs from CWG index status '%s'" \
227-
% (dr.issue, unresolved_status, dr.status)
253+
if unresolved_status != dr.status:
254+
availability_error_occurred = True
255+
print("Issue %s is marked '%s', which differs from CWG index status '%s'" \
256+
% (dr.issue, unresolved_status, dr.status))
257+
continue
228258
else:
229259
row_style = ''
230-
avail, avail_style, unresolved_status = availability(dr.issue)
231-
assert not unresolved_status, \
232-
"Issue %s is marked '%s', even though it is resolved in CWG index" \
233-
% (dr.issue, unresolved_status)
260+
try:
261+
avail, avail_style, unresolved_status = availability(dr.issue)
262+
except AvailabilityError as e:
263+
availability_error_occurred = True
264+
print(e.args[0])
265+
continue
266+
267+
if unresolved_status:
268+
availability_error_occurred = True
269+
print("Issue %s is marked '%s', even though it is resolved in CWG index" \
270+
% (dr.issue, unresolved_status))
271+
continue
234272

235273
if not avail.startswith('Sup') and not avail.startswith('Dup'):
236274
count[avail] = count.get(avail, 0) + 1
@@ -243,6 +281,9 @@ for dr in drs:
243281
<td%s align="center">%s</td>
244282
</tr>''' % (row_style, dr.issue, dr.issue, dr.issue, dr.status, dr.title, avail_style, avail))
245283

284+
if availability_error_occurred:
285+
exit(1)
286+
246287
for status, num in sorted(count.items()):
247288
print("%s: %s" % (status, num), file=sys.stderr)
248289

0 commit comments

Comments
 (0)