Skip to content

[clang] Do less advertising for unresolved issues in cxx_dr_status.html #78836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"'
Comment on lines +190 to +191
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this case happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have examples at the moment, but I think it's possible to only partially implement a proposed resolution in the same way one can partially implement an approved resolution: // dr1234: partial drafting 2024-02-13.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine keeping it on the assumption it might be used in the future, but I'm also fine stripping it out on the assumption that it's easy enough to add support for once we have an actual need for it.

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"'
Comment on lines +193 to +198
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the no case, I would leave it unknown / no comment... that we don't do something is not useful information for users. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see why we don't want to report this, if we report that some unresolved issues are available. For instance, I find it useful to mention that we test proposed resolution for 2335, and decided it's not available.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to agree; if we're telling users "there's some drafting and we do what the drafting said as of XXX", then there's similar value in telling users "there's some drafting and we do not do what the drafting said as of XXX" (for example, as the issue is resolved, it tells us that we can convert it into a No instead of an Unknown).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't agree (because telling users we don;t do something does not tell them what we do), but I will bow to whatever decision @AaronBallman takes.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should leave it. I agree that it doesn't tell users what we're actually doing, but the point here is more for a user who reads the draft wording and says "Clang isn't doing what that says, is that a bug?" without really realizing that "drafting" status may mean we don't want to work on the issue until a final decision has been reached. If we explicitly say "we don't do what the current drafting says", it at least tells the user "we're aware of the issue, don't expect us to do what the current drafting says".

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