1 #! /usr/bin/env python3
2 import sys, os, re, urllib.request
6 clang_www_dir = os.path.dirname(__file__)
7 default_issue_list_path = os.path.join(clang_www_dir, 'cwg_index.html')
8 issue_list_url = "https://raw.githubusercontent.com/cplusplus/CWG/gh-pages/issues/cwg_index.html"
9 output = os.path.join(clang_www_dir, 'cxx_dr_status.html')
10 dr_test_dir = os.path.join(clang_www_dir, '../test/CXX/drs')
13 def __init__(self, section, issue, url, status, title):
14 self.section, self.issue, self.url, self.status, self.title = \
15 section, issue, url, status, title
17 return '%s (%s): %s' % (self.issue, self.status, self.title)
21 section, issue_link, status, liaison, title = [
22 col.split('>', 1)[1].split('</TD>')[0]
23 for col in dr.split('</TR>', 1)[0].split('<TD')[1:]
25 except Exception as ex:
26 print(f"Parse error: {ex}\n{dr}", file=sys.stderr)
28 _, url, issue = issue_link.split('"', 2)
30 issue = int(issue.split('>', 1)[1].split('<', 1)[0])
31 title = title.replace('<issue_title>', '').replace('</issue_title>', '').replace('\r\n', '\n').strip()
32 return DR(section, issue, url, status, title)
35 status_re = re.compile(r'\bcwg([0-9]+): (.*)')
37 for test_cpp in os.listdir(dr_test_dir):
38 if not test_cpp.endswith('.cpp'):
40 test_cpp = os.path.join(dr_test_dir, test_cpp)
42 for match in re.finditer(status_re, open(test_cpp, 'r').read()):
43 dr_number = int(match.group(1))
44 if dr_number in status_map:
45 print("error: Comment for cwg{} encountered more than once. Duplicate found in {}".format(dr_number, test_cpp))
47 status_map[dr_number] = match.group(2)
50 print("warning:%s: no '// cwg123: foo' comments in this file" % test_cpp, file=sys.stderr)
55 if not path and os.path.exists(default_issue_list_path):
56 path = default_issue_list_path
59 print('Fetching issue list from {}'.format(issue_list_url))
60 with urllib.request.urlopen(issue_list_url) as f:
61 buffer = f.read().decode('utf-8')
63 print('Opening issue list from file {}'.format(path))
64 with open(path, 'r') as f:
66 except Exception as ex:
67 print('Unable to read the core issue list', file=sys.stderr)
68 print(ex, file=sys.stderr)
71 return sorted((parse(dr) for dr in buffer.split('<TR>')[2:]),
72 key = lambda dr: dr.issue)
75 issue_list_path = None
76 if len(sys.argv) == 1:
78 elif len(sys.argv) == 2:
79 issue_list_path = sys.argv[1]
81 print('Usage: {} [<path to cwg_index.html>]'.format(sys.argv[0]), file=sys.stderr)
84 status_map = collect_tests()
85 drs = get_issues(issue_list_path)
86 out_file = open(output, 'w')
89 <!-- This file is auto-generated by make_cxx_dr_status. Do not modify. -->
92 <META http-equiv="Content-Type" content="text/html; charset=utf-8">
93 <title>Clang - C++ Defect Report Status</title>
94 <link type="text/css" rel="stylesheet" href="menu.css">
95 <link type="text/css" rel="stylesheet" href="content.css">
96 <style type="text/css">
97 .none { background-color: #FFCCCC }
98 .none-superseded { background-color: rgba(255, 204, 204, 0.65) }
99 .unknown { background-color: #EBCAFE }
100 .unknown-superseded { background-color: rgba(234, 200, 254, 0.65) }
101 .partial { background-color: #FFE0B0 }
102 .partial-superseded { background-color: rgba(255, 224, 179, 0.65) }
103 .unreleased { background-color: #FFFF99 }
104 .unreleased-superseded { background-color: rgba(255, 255, 153, 0.65) }
105 .full { background-color: #CCFF99 }
106 .full-superseded { background-color: rgba(214, 255, 173, 0.65) }
107 .na { background-color: #DDDDDD }
108 .na-superseded { background-color: rgba(222, 222, 222, 0.65) }
109 .open * { color: #AAAAAA }
110 .open-superseded * { color: rgba(171, 171, 171, 0.65) }
111 //.open { filter: opacity(0.2) }
112 tr:target { background-color: #FFFFBB }
113 th { background-color: #FFDDAA }
118 <!--#include virtual="menu.html.incl"-->
122 <!--*************************************************************************-->
123 <h1>C++ Defect Report Support in Clang</h1>
124 <!--*************************************************************************-->
126 <h2 id="cxxdr">C++ defect report implementation status</h2>
128 <p>This page tracks which C++ defect reports are implemented within Clang.</p>
130 <table width="689" border="1" cellspacing="0">
135 <th>Available in Clang?</th>
138 class AvailabilityError(RuntimeError):
141 availability_error_occurred = False
143 def availability(issue):
144 status = status_map.get(issue, 'unknown')
145 unresolved_status = ''
146 proposed_resolution = ''
147 unresolved_status_match = re.search(r' (open|drafting|review|tentatively ready|ready)', status)
148 if unresolved_status_match:
149 unresolved_status = unresolved_status_match.group(1)
150 proposed_resolution_match = re.search(r' (open|drafting|review|tentatively ready|ready) (\d{4}-\d{2}(?:-\d{2})?|P\d{4}R\d+)$', status)
151 if proposed_resolution_match is None:
152 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))
153 proposed_resolution = proposed_resolution_match.group(2)
154 status = status[:-1-len(proposed_resolution)]
155 status = status[:-1-len(unresolved_status)]
160 if status.endswith(' c++11'):
162 avail_suffix = ' (C++11 onwards)'
163 elif status.endswith(' c++14'):
165 avail_suffix = ' (C++14 onwards)'
166 elif status.endswith(' c++17'):
168 avail_suffix = ' (C++17 onwards)'
169 elif status.endswith(' c++20'):
171 avail_suffix = ' (C++20 onwards)'
172 elif status.endswith(' c++23'):
174 avail_suffix = ' (C++23 onwards)'
175 elif status.endswith(' c++26'):
177 avail_suffix = ' (C++26 onwards)'
178 if status == 'unknown':
180 avail_style = 'unknown'
181 elif re.match(r'^[0-9]+\.?[0-9]*', status):
182 if not proposed_resolution:
183 avail = 'Clang %s' % status
184 if float(status) > latest_release:
185 avail_style = 'unreleased'
189 avail = 'Not resolved'
190 details = f'Clang {status} implements {proposed_resolution} resolution'
191 elif status == 'yes':
192 if not proposed_resolution:
196 avail = 'Not resolved'
197 details = f'Clang implements {proposed_resolution} resolution'
198 elif status == 'partial':
199 if not proposed_resolution:
201 avail_style = 'partial'
203 avail = 'Not resolved'
204 details = f'Clang partially implements {proposed_resolution} resolution'
206 if not proposed_resolution:
210 avail = 'Not resolved'
211 details = f'Clang does not implement {proposed_resolution} resolution'
215 elif status == 'na lib':
216 avail = 'N/A (Library DR)'
218 elif status == 'na abi':
219 avail = 'N/A (ABI constraint)'
221 elif status.startswith('sup '):
222 dup = status.split(' ', 1)[1]
223 if dup.startswith('P'):
224 avail = 'Superseded by <a href="https://wg21.link/%s">%s</a>' % (dup, dup)
227 avail = 'Superseded by <a href="#%s">%s</a>' % (dup, dup)
229 _, avail_style, _, _ = availability(int(dup))
230 avail_style += '-superseded'
232 print("issue %s marked as sup %s" % (issue, dup), file=sys.stderr)
234 elif status.startswith('dup '):
235 dup = int(status.split(' ', 1)[1])
236 avail = 'Duplicate of <a href="#%s">%s</a>' % (dup, dup)
237 _, avail_style, _, _ = availability(dup)
239 raise AvailabilityError('Unknown status %s for issue %s' % (status, dr.issue))
240 return (avail + avail_suffix, avail_style, unresolved_status, details)
244 if dr.status in ('concepts',):
245 # This refers to the old ("C++0x") concepts feature, which was not part
246 # of any C++ International Standard or Technical Specification.
249 elif dr.status == 'extension':
250 row_style = ' class="open"'
254 elif dr.status in ('open', 'drafting', 'review', 'tentatively ready', 'ready'):
255 row_style = ' class="open"'
257 avail, avail_style, unresolved_status, details = availability(dr.issue)
258 except AvailabilityError as e:
259 availability_error_occurred = True
263 if avail == 'Unknown':
264 avail = 'Not resolved'
267 if unresolved_status != dr.status:
268 availability_error_occurred = True
269 print("Issue %s is marked '%s', which differs from CWG index status '%s'" \
270 % (dr.issue, unresolved_status, dr.status))
275 avail, avail_style, unresolved_status, details = availability(dr.issue)
276 except AvailabilityError as e:
277 availability_error_occurred = True
281 if unresolved_status:
282 availability_error_occurred = True
283 print("Issue %s is marked '%s', even though it is resolved in CWG index" \
284 % (dr.issue, unresolved_status))
287 if not avail.startswith('Sup') and not avail.startswith('Dup'):
288 count[avail] = count.get(avail, 0) + 1
290 if avail_style != '':
291 avail_style = ' class="{}"'.format(avail_style)
296 <summary>{avail}</summary>
300 <tr{row_style} id="{dr.issue}">
301 <td><a href="https://cplusplus.github.io/CWG/issues/{dr.issue}.html">{dr.issue}</a></td>
304 <td{avail_style} align="center">{avail}</td>
307 if availability_error_occurred:
310 for status, num in sorted(count.items()):
311 print("%s: %s" % (status, num), file=sys.stderr)