Author: Vlad Serebrennikov Date: 2024-02-15T23:45:56+04:00 New Revision: df81055955d564dccfd43a9faeb2f54c8c998f68
URL: https://github.com/llvm/llvm-project/commit/df81055955d564dccfd43a9faeb2f54c8c998f68 DIFF: https://github.com/llvm/llvm-project/commit/df81055955d564dccfd43a9faeb2f54c8c998f68.diff LOG: [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: https://github.com/llvm/llvm-project/pull/67948 Added: Modified: clang/test/CXX/drs/dr12xx.cpp clang/test/CXX/drs/dr18xx.cpp clang/test/CXX/drs/dr20xx.cpp clang/test/CXX/drs/dr2335.cpp clang/test/CXX/drs/dr24xx.cpp clang/test/CXX/drs/dr25xx.cpp clang/test/CXX/drs/dr4xx.cpp clang/www/cxx_dr_status.html clang/www/make_cxx_dr_status Removed: ################################################################################ diff --git a/clang/test/CXX/drs/dr12xx.cpp b/clang/test/CXX/drs/dr12xx.cpp index cb4cc5aef17371..da5dd02a00677c 100644 --- a/clang/test/CXX/drs/dr12xx.cpp +++ b/clang/test/CXX/drs/dr12xx.cpp @@ -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; diff --git a/clang/test/CXX/drs/dr18xx.cpp b/clang/test/CXX/drs/dr18xx.cpp index 37ea450137ac5e..a7cee4ef8902f9 100644 --- a/clang/test/CXX/drs/dr18xx.cpp +++ b/clang/test/CXX/drs/dr18xx.cpp @@ -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 diff --git a/clang/test/CXX/drs/dr20xx.cpp b/clang/test/CXX/drs/dr20xx.cpp index f7f37379e61ad1..96f2572cfb524d 100644 --- a/clang/test/CXX/drs/dr20xx.cpp +++ b/clang/test/CXX/drs/dr20xx.cpp @@ -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; diff --git a/clang/test/CXX/drs/dr2335.cpp b/clang/test/CXX/drs/dr2335.cpp index d143aaf7cb0ac0..33eebb2c4a5c57 100644 --- a/clang/test/CXX/drs/dr2335.cpp +++ b/clang/test/CXX/drs/dr2335.cpp @@ -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 { diff --git a/clang/test/CXX/drs/dr24xx.cpp b/clang/test/CXX/drs/dr24xx.cpp index 66e9cf5a677f80..ae8dda3351f48e 100644 --- a/clang/test/CXX/drs/dr24xx.cpp +++ b/clang/test/CXX/drs/dr24xx.cpp @@ -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> @@ -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) {} diff --git a/clang/test/CXX/drs/dr25xx.cpp b/clang/test/CXX/drs/dr25xx.cpp index b1e54804fc895c..9fc7cf59485caa 100644 --- a/clang/test/CXX/drs/dr25xx.cpp +++ b/clang/test/CXX/drs/dr25xx.cpp @@ -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}} @@ -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 }; @@ -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) { } }; @@ -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) { diff --git a/clang/test/CXX/drs/dr4xx.cpp b/clang/test/CXX/drs/dr4xx.cpp index 2f11c92f86aca3..612a152aec4c4d 100644 --- a/clang/test/CXX/drs/dr4xx.cpp +++ b/clang/test/CXX/drs/dr4xx.cpp @@ -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 }; diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html index 1e527e1d1736e3..e9b18b1e283e66 100755 --- a/clang/www/cxx_dr_status.html +++ b/clang/www/cxx_dr_status.html @@ -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> @@ -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> @@ -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> @@ -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> @@ -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> @@ -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> @@ -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> @@ -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> @@ -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> @@ -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> @@ -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> diff --git a/clang/www/make_cxx_dr_status b/clang/www/make_cxx_dr_status index b0898ac25b7220..38f847cdc1b7f9 100755 --- a/clang/www/make_cxx_dr_status +++ b/clang/www/make_cxx_dr_status @@ -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'): @@ -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"' @@ -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 = {} @@ -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 diff ers 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 diff ers 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 @@ -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) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits