Skip to content

Commit

Permalink
[clang] Do less advertising for unresolved issues in `cxx_dr_status.h…
Browse files Browse the repository at this point in the history
…tml` (#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
  • Loading branch information
Endilll committed Feb 15, 2024
1 parent 4d273b9 commit df81055
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 53 deletions.
2 changes: 1 addition & 1 deletion clang/test/CXX/drs/dr12xx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace dr1213 { // dr1213: 7
}

#if __cplusplus >= 201103L
namespace dr1223 { // dr1223: 17 drafting
namespace dr1223 { // dr1223: 17 drafting 2023-05-12
struct M;
template <typename T>
struct V;
Expand Down
2 changes: 1 addition & 1 deletion clang/test/CXX/drs/dr18xx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ namespace dr1881 { // dr1881: 7
static_assert(!__is_standard_layout(D), "");
}

namespace dr1890 { // dr1890: no drafting
namespace dr1890 { // dr1890: no drafting 2018-06-04
// FIXME: current consensus for CWG2335 is that the examples are well-formed.
namespace ex1 {
#if __cplusplus >= 201402L
Expand Down
2 changes: 1 addition & 1 deletion clang/test/CXX/drs/dr20xx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ namespace dr2026 { // dr2026: 11
}
}

namespace dr2049 { // dr2049: 18 drafting
namespace dr2049 { // dr2049: 18 drafting P2308R1
#if __cplusplus >= 202302L
template <int* x = {}> struct X {};
X<> a;
Expand Down
2 changes: 1 addition & 1 deletion clang/test/CXX/drs/dr2335.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// expected-no-diagnostics
#endif

namespace dr2335 { // dr2335: no drafting
namespace dr2335 { // dr2335: no drafting 2018-06
// FIXME: current consensus is that the examples are well-formed.
#if __cplusplus >= 201402L
namespace ex1 {
Expand Down
4 changes: 2 additions & 2 deletions clang/test/CXX/drs/dr24xx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void fallthrough(int n) {
#endif
}

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

namespace dr2459 { // dr2459: 18 drafting
namespace dr2459 { // dr2459: 18 drafting P2308R1
#if __cplusplus >= 202302L
struct A {
constexpr A(float) {}
Expand Down
8 changes: 4 additions & 4 deletions clang/test/CXX/drs/dr25xx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ using ::dr2521::operator""_div;


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

#if __cplusplus >= 202302L
namespace dr2554 { // dr2554: 18 review
namespace dr2554 { // dr2554: 18 review 2021-12-10
struct B {
virtual void f(); // #dr2554-g
};
Expand All @@ -130,7 +130,7 @@ struct D3 : B {
#endif

#if __cplusplus >= 202302L
namespace dr2561 { // dr2561: 18 review
namespace dr2561 { // dr2561: 18 review 2023-11-09
struct C {
constexpr C(auto) { }
};
Expand All @@ -145,7 +145,7 @@ void foo() {
#endif


namespace dr2565 { // dr2565: 16 open
namespace dr2565 { // dr2565: 16 open 2023-06-07
#if __cplusplus >= 202002L
template<typename T>
concept C = requires (typename T::type x) {
Expand Down
2 changes: 1 addition & 1 deletion clang/test/CXX/drs/dr4xx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ namespace dr471 { // dr471: 2.8
// expected-note@#dr471-G-using {{declared private here}}
}

namespace dr472 { // dr472: no drafting
namespace dr472 { // dr472: no drafting 2011-04
struct B {
int i; // #dr472-i
};
Expand Down
24 changes: 12 additions & 12 deletions clang/www/cxx_dr_status.html
Original file line number Diff line number Diff line change
Expand Up @@ -2872,7 +2872,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td><a href="https://cplusplus.github.io/CWG/issues/472.html">472</a></td>
<td>drafting</td>
<td>Casting across protected inheritance</td>
<td class="none" align="center">No</td>
<td title="Clang does not implement 2011-04 resolution" align="center">Not Resolved*</td>
</tr>
<tr id="473">
<td><a href="https://cplusplus.github.io/CWG/issues/473.html">473</a></td>
Expand Down Expand Up @@ -7146,7 +7146,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td><a href="https://cplusplus.github.io/CWG/issues/1223.html">1223</a></td>
<td>drafting</td>
<td>Syntactic disambiguation and <I>trailing-return-type</I>s</td>
<td class="full" align="center">Clang 17</td>
<td title="Clang 17 implements 2023-05-12 resolution" align="center">Not Resolved*</td>
</tr>
<tr id="1224">
<td><a href="https://cplusplus.github.io/CWG/issues/1224.html">1224</a></td>
Expand Down Expand Up @@ -11148,7 +11148,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td><a href="https://cplusplus.github.io/CWG/issues/1890.html">1890</a></td>
<td>drafting</td>
<td>Member type depending on definition of member function</td>
<td class="none" align="center">No</td>
<td title="Clang does not implement 2018-06-04 resolution" align="center">Not Resolved*</td>
</tr>
<tr id="1891">
<td><a href="https://cplusplus.github.io/CWG/issues/1891.html">1891</a></td>
Expand Down Expand Up @@ -12102,7 +12102,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td><a href="https://cplusplus.github.io/CWG/issues/2049.html">2049</a></td>
<td>drafting</td>
<td>List initializer in non-type template default argument</td>
<td class="unreleased" align="center">Clang 18</td>
<td title="Clang 18 implements P2308R1 resolution" align="center">Not Resolved*</td>
</tr>
<tr id="2050">
<td><a href="https://cplusplus.github.io/CWG/issues/2050.html">2050</a></td>
Expand Down Expand Up @@ -13818,7 +13818,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td><a href="https://cplusplus.github.io/CWG/issues/2335.html">2335</a></td>
<td>drafting</td>
<td>Deduced return types vs member types</td>
<td class="none" align="center">No</td>
<td title="Clang does not implement 2018-06 resolution" align="center">Not Resolved*</td>
</tr>
<tr id="2336">
<td><a href="https://cplusplus.github.io/CWG/issues/2336.html">2336</a></td>
Expand Down Expand Up @@ -13986,7 +13986,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td><a href="https://cplusplus.github.io/CWG/issues/2363.html">2363</a></td>
<td>NAD</td>
<td>Opaque enumeration friend declarations</td>
<td class="unknown" align="center">Unknown</td>
<td class="full" align="center">Yes</td>
</tr>
<tr id="2364">
<td><a href="https://cplusplus.github.io/CWG/issues/2364.html">2364</a></td>
Expand Down Expand Up @@ -14508,7 +14508,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td><a href="https://cplusplus.github.io/CWG/issues/2450.html">2450</a></td>
<td>review</td>
<td><I>braced-init-list</I> as a <I>template-argument</I></td>
<td class="unreleased" align="center">Clang 18</td>
<td title="Clang 18 implements P2308R1 resolution" align="center">Not Resolved*</td>
</tr>
<tr id="2451">
<td><a href="https://cplusplus.github.io/CWG/issues/2451.html">2451</a></td>
Expand Down Expand Up @@ -14562,7 +14562,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td><a href="https://cplusplus.github.io/CWG/issues/2459.html">2459</a></td>
<td>drafting</td>
<td>Template parameter initialization</td>
<td class="unreleased" align="center">Clang 18</td>
<td title="Clang 18 implements P2308R1 resolution" align="center">Not Resolved*</td>
</tr>
<tr id="2460">
<td><a href="https://cplusplus.github.io/CWG/issues/2460.html">2460</a></td>
Expand Down Expand Up @@ -15126,13 +15126,13 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td><a href="https://cplusplus.github.io/CWG/issues/2553.html">2553</a></td>
<td>review</td>
<td>Restrictions on explicit object member functions</td>
<td class="unreleased" align="center">Clang 18</td>
<td title="Clang 18 implements 2023-07-14 resolution" align="center">Not Resolved*</td>
</tr>
<tr class="open" id="2554">
<td><a href="https://cplusplus.github.io/CWG/issues/2554.html">2554</a></td>
<td>review</td>
<td>Overriding virtual functions, also with explicit object parameters</td>
<td class="unreleased" align="center">Clang 18</td>
<td title="Clang 18 implements 2021-12-10 resolution" align="center">Not Resolved*</td>
</tr>
<tr class="open" id="2555">
<td><a href="https://cplusplus.github.io/CWG/issues/2555.html">2555</a></td>
Expand Down Expand Up @@ -15174,7 +15174,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td><a href="https://cplusplus.github.io/CWG/issues/2561.html">2561</a></td>
<td>review</td>
<td>Conversion to function pointer for lambda with explicit object parameter</td>
<td class="unreleased" align="center">Clang 18</td>
<td title="Clang 18 implements 2023-11-09 resolution" align="center">Not Resolved*</td>
</tr>
<tr class="open" id="2562">
<td><a href="https://cplusplus.github.io/CWG/issues/2562.html">2562</a></td>
Expand All @@ -15198,7 +15198,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td><a href="https://cplusplus.github.io/CWG/issues/2565.html">2565</a></td>
<td>open</td>
<td>Invalid types in the <I>parameter-declaration-clause</I> of a <I>requires-expression</I></td>
<td class="full" align="center">Clang 16</td>
<td title="Clang 16 implements 2023-06-07 resolution" align="center">Not Resolved*</td>
</tr>
<tr class="open" id="2566">
<td><a href="https://cplusplus.github.io/CWG/issues/2566.html">2566</a></td>
Expand Down
101 changes: 71 additions & 30 deletions clang/www/make_cxx_dr_status
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,25 @@ out_file.write('''\

latest_release = 17

class AvailabilityError(RuntimeError):
pass

availability_error_occurred = False

def availability(issue):
status = status_map.get(issue, 'unknown')

unresolved_status = ''
if status.endswith(' open'):
status = status[:-5]
unresolved_status = 'open'
elif status.endswith(' drafting'):
status = status[:-9]
unresolved_status = 'drafting'
elif status.endswith(' review'):
status = status[:-7]
unresolved_status = 'review'
proposed_resolution = ''
unresolved_status_match = re.search(r' (open|drafting|review)', status)
if unresolved_status_match:
unresolved_status = unresolved_status_match.group(1)
proposed_resolution_match = re.search(r' (open|drafting|review) (\d{4}-\d{2}(?:-\d{2})?|P\d{4}R\d+)$', status)
if proposed_resolution_match is None:
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))
proposed_resolution = proposed_resolution_match.group(2)
status = status[:-1-len(proposed_resolution)]
status = status[:-1-len(unresolved_status)]

avail_suffix = ''
if status.endswith(' c++11'):
Expand All @@ -159,21 +165,37 @@ def availability(issue):
if status == 'unknown':
avail = 'Unknown'
avail_style = ' class="unknown"'
elif re.match('^[0-9]+\.?[0-9]*', status):
avail = 'Clang %s' % status
if float(status) > latest_release:
avail_style = ' class="unreleased"'
else:
avail_style = ' class="full"'
elif re.match(r'^[0-9]+\.?[0-9]*', status):
if not proposed_resolution:
avail = 'Clang %s' % status
if float(status) > latest_release:
avail_style = ' class="unreleased"'
else:
avail_style = ' class="full"'
else:
avail = 'Not Resolved*'
avail_style = f' title="Clang {status} implements {proposed_resolution} resolution"'
elif status == 'yes':
avail = 'Yes'
avail_style = ' class="full"'
if not proposed_resolution:
avail = 'Yes'
avail_style = ' class="full"'
else:
avail = 'Not Resolved*'
avail_style = f' title="Clang implements {proposed_resolution} resolution"'
elif status == 'partial':
avail = 'Partial'
avail_style = ' class="partial"'
if not proposed_resolution:
avail = 'Partial'
avail_style = ' class="partial"'
else:
avail = 'Not Resolved*'
avail_style = f' title="Clang partially implements {proposed_resolution} resolution"'
elif status == 'no':
avail = 'No'
avail_style = ' class="none"'
if not proposed_resolution:
avail = 'No'
avail_style = ' class="none"'
else:
avail = 'Not Resolved*'
avail_style = f' title="Clang does not implement {proposed_resolution} resolution"'
elif status == 'na':
avail = 'N/A'
avail_style = ' class="na"'
Expand All @@ -200,7 +222,7 @@ def availability(issue):
avail = 'Duplicate of <a href="#%s">%s</a>' % (dup, dup)
_, avail_style, _ = availability(dup)
else:
assert False, 'unknown status %s for issue %s' % (status, dr.issue)
raise AvailabilityError('Unknown status %s for issue %s' % (status, dr.issue))
return (avail + avail_suffix, avail_style, unresolved_status)

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

elif dr.status in ('open', 'drafting', 'review'):
row_style = ' class="open"'
avail, avail_style, unresolved_status = availability(dr.issue)
try:
avail, avail_style, unresolved_status = availability(dr.issue)
except AvailabilityError as e:
availability_error_occurred = True
print(e.args[0])
continue

if avail == 'Unknown':
avail = 'Not resolved'
avail_style = ''
else:
assert unresolved_status == dr.status, \
"Issue %s is marked '%s', which differs from CWG index status '%s'" \
% (dr.issue, unresolved_status, dr.status)
if unresolved_status != dr.status:
availability_error_occurred = True
print("Issue %s is marked '%s', which differs from CWG index status '%s'" \
% (dr.issue, unresolved_status, dr.status))
continue
else:
row_style = ''
avail, avail_style, unresolved_status = availability(dr.issue)
assert not unresolved_status, \
"Issue %s is marked '%s', even though it is resolved in CWG index" \
% (dr.issue, unresolved_status)
try:
avail, avail_style, unresolved_status = availability(dr.issue)
except AvailabilityError as e:
availability_error_occurred = True
print(e.args[0])
continue

if unresolved_status:
availability_error_occurred = True
print("Issue %s is marked '%s', even though it is resolved in CWG index" \
% (dr.issue, unresolved_status))
continue

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

if availability_error_occurred:
exit(1)

for status, num in sorted(count.items()):
print("%s: %s" % (status, num), file=sys.stderr)

Expand Down

0 comments on commit df81055

Please sign in to comment.