1 #! /usr/bin/env python3
2 import sys, os, re, urllib.request
5 clang_www_dir = os.path.dirname(__file__)
6 default_issue_list_path = os.path.join(clang_www_dir, 'cwg_index.html')
7 issue_list_url = "https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_index.html"
8 output = os.path.join(clang_www_dir, 'cxx_dr_status.html')
9 dr_test_dir = os.path.join(clang_www_dir, '../test/CXX/drs')
12 def __init__(self, section, issue, url, status, title):
13 self.section, self.issue, self.url, self.status, self.title = \
14 section, issue, url, status, title
16 return '%s (%s): %s' % (self.issue, self.status, self.title)
20 section, issue_link, status, liaison, title = [
21 col.split('>', 1)[1].split('</TD>')[0]
22 for col in dr.split('</TR>', 1)[0].split('<TD')[1:]
24 except Exception as ex:
25 print(f"Parse error: {ex}\n{dr}", file=sys.stderr)
27 _, url, issue = issue_link.split('"', 2)
29 issue = int(issue.split('>', 1)[1].split('<', 1)[0])
30 title = title.replace('<issue_title>', '').replace('</issue_title>', '').replace('\r\n', '\n').strip()
31 return DR(section, issue, url, status, title)
34 status_re = re.compile(r'\bdr([0-9]+): (.*)')
36 for test_cpp in os.listdir(dr_test_dir):
37 if not test_cpp.endswith('.cpp'):
39 test_cpp = os.path.join(dr_test_dir, test_cpp)
41 for match in re.finditer(status_re, open(test_cpp, 'r').read()):
42 status_map[int(match.group(1))] = match.group(2)
45 print("warning:%s: no '// dr123: foo' comments in this file" % test_cpp, file=sys.stderr)
50 if not path and os.path.exists(default_issue_list_path):
51 path = default_issue_list_path
54 print('Fetching issue list from {}'.format(issue_list_url))
55 with urllib.request.urlopen(issue_list_url) as f:
56 buffer = f.read().decode('utf-8')
58 print('Opening issue list from file {}'.format(path))
59 with open(path, 'r') as f:
61 except Exception as ex:
62 print('Unable to read the core issue list', file=sys.stderr)
63 print(ex, file=sys.stderr)
66 return sorted((parse(dr) for dr in buffer.split('<TR>')[2:]),
67 key = lambda dr: dr.issue)
70 issue_list_path = None
71 if len(sys.argv) == 1:
73 elif len(sys.argv) == 2:
74 issue_list_path = sys.argv[1]
76 print('Usage: {} [<path to cwg_index.html>]'.format(sys.argv[0]), file=sys.stderr)
79 status_map = collect_tests()
80 drs = get_issues(issue_list_path)
81 out_file = open(output, 'w')
84 <!-- This file is auto-generated by make_cxx_dr_status. Do not modify. -->
87 <META http-equiv="Content-Type" content="text/html; charset=utf-8">
88 <title>Clang - C++ Defect Report Status</title>
89 <link type="text/css" rel="stylesheet" href="menu.css">
90 <link type="text/css" rel="stylesheet" href="content.css">
91 <style type="text/css">
92 .none { background-color: #FFCCCC }
93 .partial { background-color: #FFE0B0 }
94 .unreleased { background-color: #FFFF99 }
95 .full { background-color: #CCFF99 }
96 .na { background-color: #DDDDDD }
97 .open * { color: #AAAAAA }
98 //.open { filter: opacity(0.2) }
99 tr:target { background-color: #FFFFBB }
100 th { background-color: #FFDDAA }
105 <!--#include virtual="menu.html.incl"-->
109 <!--*************************************************************************-->
110 <h1>C++ Defect Report Support in Clang</h1>
111 <!--*************************************************************************-->
113 <h2 id="cxxdr">C++ defect report implementation status</h2>
115 <p>This page tracks which C++ defect reports are implemented within Clang.</p>
117 <table width="689" border="1" cellspacing="0">
122 <th>Available in Clang?</th>
127 def availability(issue):
128 status = status_map.get(issue, 'unknown')
130 unresolved_status = ''
131 if status.endswith(' open'):
133 unresolved_status = 'open'
134 elif status.endswith(' drafting'):
136 unresolved_status = 'drafting'
137 elif status.endswith(' review'):
139 unresolved_status = 'review'
142 if status.endswith(' c++11'):
144 avail_suffix = ' (C++11 onwards)'
145 elif status.endswith(' c++14'):
147 avail_suffix = ' (C++14 onwards)'
148 elif status.endswith(' c++17'):
150 avail_suffix = ' (C++17 onwards)'
151 elif status.endswith(' c++20'):
153 avail_suffix = ' (C++20 onwards)'
154 if status == 'unknown':
156 avail_style = ' class="none"'
157 elif re.match('^[0-9]+\.?[0-9]*', status):
158 avail = 'Clang %s' % status
159 if float(status) > latest_release:
160 avail_style = ' class="unreleased"'
162 avail_style = ' class="full"'
163 elif status == 'yes':
165 avail_style = ' class="full"'
166 elif status == 'partial':
168 avail_style = ' class="partial"'
171 avail_style = ' class="none"'
174 avail_style = ' class="na"'
175 elif status == 'na lib':
176 avail = 'N/A (Library DR)'
177 avail_style = ' class="na"'
178 elif status == 'na abi':
179 avail = 'N/A (ABI constraint)'
180 avail_style = ' class="na"'
181 elif status.startswith('sup '):
182 dup = status.split(' ', 1)[1]
183 if dup.startswith('P'):
184 avail = 'Superseded by <a href="https://wg21.link/%s">%s</a>' % (dup, dup)
185 avail_style = ' class="na"'
187 avail = 'Superseded by <a href="#%s">%s</a>' % (dup, dup)
189 _, avail_style, _ = availability(int(dup))
191 print("issue %s marked as sup %s" % (issue, dup), file=sys.stderr)
192 avail_style = ' class="none"'
193 elif status.startswith('dup '):
194 dup = int(status.split(' ', 1)[1])
195 avail = 'Duplicate of <a href="#%s">%s</a>' % (dup, dup)
196 _, avail_style, _ = availability(dup)
198 assert False, 'unknown status %s for issue %s' % (status, dr.issue)
199 return (avail + avail_suffix, avail_style, unresolved_status)
203 if dr.status in ('concepts',):
204 # This refers to the old ("C++0x") concepts feature, which was not part
205 # of any C++ International Standard or Technical Specification.
208 elif dr.status == 'extension':
209 row_style = ' class="open"'
213 elif dr.status in ('open', 'drafting', 'review'):
214 row_style = ' class="open"'
215 avail, avail_style, unresolved_status = availability(dr.issue)
216 if avail == 'Unknown':
217 avail = 'Not resolved'
220 assert unresolved_status == dr.status, \
221 "Issue %s is marked '%s', which differs from CWG index status '%s'" \
222 % (dr.issue, unresolved_status, dr.status)
225 avail, avail_style, unresolved_status = availability(dr.issue)
226 assert not unresolved_status, \
227 "Issue %s is marked '%s', even though it is resolved in CWG index" \
228 % (dr.issue, unresolved_status)
230 if not avail.startswith('Sup') and not avail.startswith('Dup'):
231 count[avail] = count.get(avail, 0) + 1
235 <td><a href="https://cplusplus.github.io/CWG/issues/%s.html">%s</a></td>
238 <td%s align="center">%s</td>
239 </tr>''' % (row_style, dr.issue, dr.issue, dr.issue, dr.status, dr.title, avail_style, avail))
241 for status, num in sorted(count.items()):
242 print("%s: %s" % (status, num), file=sys.stderr)