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 if status == 'unknown':
174 avail_style = 'unknown'
175 elif re.match(r'^[0-9]+\.?[0-9]*', status):
176 if not proposed_resolution:
177 avail = 'Clang %s' % status
178 if float(status) > latest_release:
179 avail_style = 'unreleased'
183 avail = 'Not resolved'
184 details = f'Clang {status} implements {proposed_resolution} resolution'
185 elif status == 'yes':
186 if not proposed_resolution:
190 avail = 'Not resolved'
191 details = f'Clang implements {proposed_resolution} resolution'
192 elif status == 'partial':
193 if not proposed_resolution:
195 avail_style = 'partial'
197 avail = 'Not resolved'
198 details = f'Clang partially implements {proposed_resolution} resolution'
200 if not proposed_resolution:
204 avail = 'Not resolved'
205 details = f'Clang does not implement {proposed_resolution} resolution'
209 elif status == 'na lib':
210 avail = 'N/A (Library DR)'
212 elif status == 'na abi':
213 avail = 'N/A (ABI constraint)'
215 elif status.startswith('sup '):
216 dup = status.split(' ', 1)[1]
217 if dup.startswith('P'):
218 avail = 'Superseded by <a href="https://wg21.link/%s">%s</a>' % (dup, dup)
221 avail = 'Superseded by <a href="#%s">%s</a>' % (dup, dup)
223 _, avail_style, _, _ = availability(int(dup))
224 avail_style += '-superseded'
226 print("issue %s marked as sup %s" % (issue, dup), file=sys.stderr)
228 elif status.startswith('dup '):
229 dup = int(status.split(' ', 1)[1])
230 avail = 'Duplicate of <a href="#%s">%s</a>' % (dup, dup)
231 _, avail_style, _, _ = availability(dup)
233 raise AvailabilityError('Unknown status %s for issue %s' % (status, dr.issue))
234 return (avail + avail_suffix, avail_style, unresolved_status, details)
238 if dr.status in ('concepts',):
239 # This refers to the old ("C++0x") concepts feature, which was not part
240 # of any C++ International Standard or Technical Specification.
243 elif dr.status == 'extension':
244 row_style = ' class="open"'
248 elif dr.status in ('open', 'drafting', 'review', 'tentatively ready', 'ready'):
249 row_style = ' class="open"'
251 avail, avail_style, unresolved_status, details = availability(dr.issue)
252 except AvailabilityError as e:
253 availability_error_occurred = True
257 if avail == 'Unknown':
258 avail = 'Not resolved'
261 if unresolved_status != dr.status:
262 availability_error_occurred = True
263 print("Issue %s is marked '%s', which differs from CWG index status '%s'" \
264 % (dr.issue, unresolved_status, dr.status))
269 avail, avail_style, unresolved_status, details = availability(dr.issue)
270 except AvailabilityError as e:
271 availability_error_occurred = True
275 if unresolved_status:
276 availability_error_occurred = True
277 print("Issue %s is marked '%s', even though it is resolved in CWG index" \
278 % (dr.issue, unresolved_status))
281 if not avail.startswith('Sup') and not avail.startswith('Dup'):
282 count[avail] = count.get(avail, 0) + 1
284 if avail_style != '':
285 avail_style = ' class="{}"'.format(avail_style)
290 <summary>{avail}</summary>
294 <tr{row_style} id="{dr.issue}">
295 <td><a href="https://cplusplus.github.io/CWG/issues/{dr.issue}.html">{dr.issue}</a></td>
298 <td{avail_style} align="center">{avail}</td>
301 if availability_error_occurred:
304 for status, num in sorted(count.items()):
305 print("%s: %s" % (status, num), file=sys.stderr)