Richard Smith | c8adfc8 | 2013-05-16 01:23:30 +0000 | [diff] [blame] | 1 | #! /usr/bin/env python |
Richard Smith | 10bb5b9 | 2013-05-19 07:22:38 +0000 | [diff] [blame] | 2 | import sys, os, re |
Richard Smith | c8adfc8 | 2013-05-16 01:23:30 +0000 | [diff] [blame] | 3 | |
| 4 | index = 'cwg_index.html' |
Richard Smith | 10bb5b9 | 2013-05-19 07:22:38 +0000 | [diff] [blame] | 5 | output = 'cxx_dr_status.html' |
| 6 | dr_test_dir = '../test/CXX/drs' |
| 7 | |
Richard Smith | c8adfc8 | 2013-05-16 01:23:30 +0000 | [diff] [blame] | 8 | if len(sys.argv) == 1: |
| 9 | pass |
| 10 | elif len(sys.argv) == 2: |
| 11 | index = sys.argv[1] |
| 12 | else: |
| 13 | print >>sys.stderr, 'Usage: make_drs [<path to cwg_index.html>]' |
| 14 | sys.exit(1) |
| 15 | |
| 16 | class DR: |
| 17 | def __init__(self, section, issue, url, status, title): |
| 18 | self.section, self.issue, self.url, self.status, self.title = \ |
| 19 | section, issue, url, status, title |
| 20 | def __repr__(self): |
| 21 | return '%s (%s): %s' % (self.issue, self.status, self.title) |
| 22 | |
| 23 | def parse(dr): |
| 24 | section, issue_link, status, title = [ |
| 25 | col.split('>', 1)[1].split('</TD>')[0] |
| 26 | for col in dr.split('</TR>', 1)[0].split('<TD')[1:] |
| 27 | ] |
| 28 | _, url, issue = issue_link.split('"', 2) |
| 29 | url = url.strip() |
| 30 | issue = int(issue.split('>', 1)[1].split('<', 1)[0]) |
| 31 | title = title.replace('<issue_title>', '').replace('</issue_title>', '').strip() |
| 32 | return DR(section, issue, url, status, title) |
| 33 | |
Richard Smith | 10bb5b9 | 2013-05-19 07:22:38 +0000 | [diff] [blame] | 34 | status_re = re.compile(r'\bdr([0-9]+): (.*)') |
| 35 | status_map = {} |
| 36 | for test_cpp in os.listdir(dr_test_dir): |
Richard Smith | b7df8a7 | 2013-05-26 22:03:53 +0000 | [diff] [blame] | 37 | if not test_cpp.endswith('.cpp'): |
| 38 | continue |
Richard Smith | 10bb5b9 | 2013-05-19 07:22:38 +0000 | [diff] [blame] | 39 | test_cpp = os.path.join(dr_test_dir, test_cpp) |
| 40 | found_any = False; |
| 41 | for match in re.finditer(status_re, file(test_cpp, 'r').read()): |
| 42 | status_map[int(match.group(1))] = match.group(2) |
| 43 | found_any = True |
| 44 | if not found_any: |
| 45 | print >> sys.stderr, "warning:%s: no '// dr123: foo' comments in this file" % test_cpp |
| 46 | |
Richard Smith | c8adfc8 | 2013-05-16 01:23:30 +0000 | [diff] [blame] | 47 | drs = sorted((parse(dr) for dr in file(index, 'r').read().split('<TR>')[2:]), |
| 48 | key = lambda dr: dr.issue) |
Richard Smith | 10bb5b9 | 2013-05-19 07:22:38 +0000 | [diff] [blame] | 49 | out_file = file(output, 'w') |
Richard Smith | c8adfc8 | 2013-05-16 01:23:30 +0000 | [diff] [blame] | 50 | |
Richard Smith | 10bb5b9 | 2013-05-19 07:22:38 +0000 | [diff] [blame] | 51 | print >> out_file, '''\ |
| 52 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
Richard Smith | c8adfc8 | 2013-05-16 01:23:30 +0000 | [diff] [blame] | 53 | "http://www.w3.org/TR/html4/strict.dtd"> |
Richard Smith | e7f5249 | 2013-12-05 21:08:20 +0000 | [diff] [blame] | 54 | <!-- This file is auto-generated by make_cxx_dr_status. Do not modify. --> |
Richard Smith | c8adfc8 | 2013-05-16 01:23:30 +0000 | [diff] [blame] | 55 | <html> |
| 56 | <head> |
| 57 | <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| 58 | <title>Clang - C++ Defect Report Status</title> |
| 59 | <link type="text/css" rel="stylesheet" href="menu.css"> |
| 60 | <link type="text/css" rel="stylesheet" href="content.css"> |
| 61 | <style type="text/css"> |
| 62 | .none { background-color: #FFCCCC } |
| 63 | .partial { background-color: #FFE0B0 } |
| 64 | .svn { background-color: #FFFF99 } |
| 65 | .full { background-color: #CCFF99 } |
| 66 | .na { background-color: #DDDDDD } |
| 67 | .open * { color: #AAAAAA } |
| 68 | //.open { filter: opacity(0.2) } |
Richard Smith | a13f8ae | 2014-03-05 23:02:47 +0000 | [diff] [blame^] | 69 | tr:target { background-color: #FFFFBB } |
Richard Smith | c8adfc8 | 2013-05-16 01:23:30 +0000 | [diff] [blame] | 70 | th { background-color: #FFDDAA } |
| 71 | </style> |
| 72 | </head> |
| 73 | <body> |
| 74 | |
| 75 | <!--#include virtual="menu.html.incl"--> |
| 76 | |
| 77 | <div id="content"> |
| 78 | |
| 79 | <!--*************************************************************************--> |
| 80 | <h1>C++ Defect Report Support in Clang</h1> |
| 81 | <!--*************************************************************************--> |
| 82 | <p>Last updated: $Date$</p> |
| 83 | |
| 84 | <h2 id="cxxdr">C++ defect report implementation status</h2> |
| 85 | |
| 86 | <p>This page tracks which C++ defect reports are implemented within Clang.</p> |
| 87 | |
| 88 | <table width="689" border="1" cellspacing="0"> |
| 89 | <tr> |
| 90 | <th>Number</th> |
| 91 | <th>Status</th> |
| 92 | <th>Issue title</th> |
| 93 | <th>Available in Clang?</th> |
| 94 | </tr>''' |
| 95 | |
| 96 | def availability(issue): |
| 97 | status = status_map.get(issue, 'unknown') |
Richard Smith | 3cde3d2 | 2013-11-17 06:39:43 +0000 | [diff] [blame] | 98 | avail_suffix = '' |
| 99 | if status.endswith(' c++11'): |
| 100 | status = status[:-6] |
| 101 | avail_suffix = ' (C++11 onwards)' |
Richard Smith | c8adfc8 | 2013-05-16 01:23:30 +0000 | [diff] [blame] | 102 | if status == 'unknown': |
| 103 | avail = 'Unknown' |
| 104 | avail_style = ' class="none"' |
Richard Smith | a230224 | 2013-12-05 07:51:02 +0000 | [diff] [blame] | 105 | elif status == '3.5': |
Richard Smith | c8adfc8 | 2013-05-16 01:23:30 +0000 | [diff] [blame] | 106 | avail = 'SVN' |
| 107 | avail_style = ' class="svn"' |
Richard Smith | 209bbb7 | 2014-02-03 02:40:25 +0000 | [diff] [blame] | 108 | elif status in ('3.1', '3.2', '3.3', '3.4'): |
Richard Smith | c8adfc8 | 2013-05-16 01:23:30 +0000 | [diff] [blame] | 109 | avail = 'Clang %s' % status |
| 110 | avail_style = ' class="full"' |
| 111 | elif status == 'yes': |
| 112 | avail = 'Yes' |
| 113 | avail_style = ' class="full"' |
| 114 | elif status == 'partial': |
| 115 | avail = 'Partial' |
| 116 | avail_style = ' class="partial"' |
| 117 | elif status == 'no': |
| 118 | avail = 'No' |
| 119 | avail_style = ' class="none"' |
| 120 | elif status == 'na': |
| 121 | avail = 'N/A' |
| 122 | avail_style = ' class="na"' |
Richard Smith | 10bb5b9 | 2013-05-19 07:22:38 +0000 | [diff] [blame] | 123 | elif status.startswith('sup '): |
Richard Smith | b7df8a7 | 2013-05-26 22:03:53 +0000 | [diff] [blame] | 124 | dup = status.split(' ', 1)[1] |
Richard Smith | a13f8ae | 2014-03-05 23:02:47 +0000 | [diff] [blame^] | 125 | avail = 'Superseded by <a href="#%s">%s</a>' % (dup, dup) |
Richard Smith | b7df8a7 | 2013-05-26 22:03:53 +0000 | [diff] [blame] | 126 | try: |
| 127 | _, avail_style = availability(int(dup)) |
| 128 | except: |
| 129 | print >>sys.stderr, "issue %s marked as sup %s" % (issue, dup) |
| 130 | avail_style = ' class="none"' |
Richard Smith | c8adfc8 | 2013-05-16 01:23:30 +0000 | [diff] [blame] | 131 | elif status.startswith('dup '): |
| 132 | dup = int(status.split(' ', 1)[1]) |
Richard Smith | a13f8ae | 2014-03-05 23:02:47 +0000 | [diff] [blame^] | 133 | avail = 'Duplicate of <a href="#%s">%s</a>' % (dup, dup) |
Richard Smith | c8adfc8 | 2013-05-16 01:23:30 +0000 | [diff] [blame] | 134 | _, avail_style = availability(dup) |
| 135 | else: |
| 136 | assert False, 'unknown status %s for issue %s' % (status, dr.issue) |
Richard Smith | 3cde3d2 | 2013-11-17 06:39:43 +0000 | [diff] [blame] | 137 | return (avail + avail_suffix, avail_style) |
Richard Smith | c8adfc8 | 2013-05-16 01:23:30 +0000 | [diff] [blame] | 138 | |
Richard Smith | b09a4fe | 2013-11-15 08:55:01 +0000 | [diff] [blame] | 139 | count = {} |
Richard Smith | c8adfc8 | 2013-05-16 01:23:30 +0000 | [diff] [blame] | 140 | for dr in drs: |
| 141 | if dr.status in ('concepts',): |
| 142 | # Yeah, cool story bro. |
| 143 | continue |
| 144 | if dr.status in ('open', 'concurrency', 'drafting', 'review', 'extension'): |
| 145 | # We may have to deal with these some day, but not yet. |
| 146 | row_style = ' class="open"' |
| 147 | avail = 'Not resolved' |
| 148 | avail_style = '' |
| 149 | assert dr.issue not in status_map, "have status for not-ready dr %s" % dr.issue |
| 150 | else: |
| 151 | row_style = '' |
| 152 | avail, avail_style = availability(dr.issue) |
Richard Smith | b09a4fe | 2013-11-15 08:55:01 +0000 | [diff] [blame] | 153 | if not avail.startswith('Sup') and not avail.startswith('Dup'): |
| 154 | count[avail] = count.get(avail, 0) + 1 |
Richard Smith | c8adfc8 | 2013-05-16 01:23:30 +0000 | [diff] [blame] | 155 | |
Richard Smith | 10bb5b9 | 2013-05-19 07:22:38 +0000 | [diff] [blame] | 156 | print >> out_file, '''\ |
Richard Smith | a13f8ae | 2014-03-05 23:02:47 +0000 | [diff] [blame^] | 157 | <tr%s id="%s"> |
Richard Smith | c8adfc8 | 2013-05-16 01:23:30 +0000 | [diff] [blame] | 158 | <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/%s">%s</a></td> |
| 159 | <td>%s</td> |
| 160 | <td>%s</td> |
| 161 | <td%s align="center">%s</td> |
Richard Smith | a13f8ae | 2014-03-05 23:02:47 +0000 | [diff] [blame^] | 162 | </tr>''' % (row_style, dr.issue, dr.url, dr.issue, dr.status, dr.title, avail_style, avail) |
Richard Smith | c8adfc8 | 2013-05-16 01:23:30 +0000 | [diff] [blame] | 163 | |
Richard Smith | b09a4fe | 2013-11-15 08:55:01 +0000 | [diff] [blame] | 164 | for status, num in count.items(): |
| 165 | print "%s: %s" % (status, num) |
| 166 | |
Richard Smith | 10bb5b9 | 2013-05-19 07:22:38 +0000 | [diff] [blame] | 167 | print >> out_file, '''\ |
| 168 | </table> |
Richard Smith | c8adfc8 | 2013-05-16 01:23:30 +0000 | [diff] [blame] | 169 | |
| 170 | </div> |
| 171 | </body> |
| 172 | </html>''' |