+2020-05-21 Martin Liska <mliska@suse.cz>
+
+ * mklog.py: Support DR parsing.
+ * test_mklog.py: New test for DR parsing.
+
2020-05-20 Martin Liska <mliska@suse.cz>
* gcc-changelog/git_commit.py: Add author_tuple
from unidiff import PatchSet
pr_regex = re.compile(r'(\/(\/|\*)|[Cc*!])\s+(?P<pr>PR [a-z+-]+\/[0-9]+)')
+dr_regex = re.compile(r'(\/(\/|\*)|[Cc*!])\s+(?P<dr>DR [0-9]+)')
identifier_regex = re.compile(r'^([a-zA-Z0-9_#].*)')
comment_regex = re.compile(r'^\/\*')
struct_regex = re.compile(r'^(class|struct|union|enum)\s+'
if pr not in prs:
prs.append(pr)
else:
- break
+ m = dr_regex.search(line.value)
+ if m:
+ dr = m.group('dr')
+ if dr not in prs:
+ prs.append(dr)
+ else:
+ break
if fill_pr_titles:
out += get_pr_titles(prs)
'''
+PATCH7 = '''\
+diff --git a/gcc/testsuite/g++.dg/DRs/dr2237.C b/gcc/testsuite/g++.dg/DRs/dr2237.C
+new file mode 100644
+index 00000000000..f3d6d11e61e
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/DRs/dr2237.C
+@@ -0,0 +1,18 @@
++// DR 2237 - Can a template-id name a constructor?
++
++template<class T>
++struct X {
++ X<T>(); // { dg-error "expected" "" { target c++20 } }
++ X(int); // OK, injected-class-name used
++ ~X<T>(); // { dg-error "template-id not allowed for destructor" "" { target c++20 } }
++};
++
++// ill-formed since DR1435
++template<typename T> X<T>::X<T>() {} // { dg-error "names the constructor|as no template constructors" }
++template<typename T> X<T>::~X<T>() {} // { dg-error "template-id not allowed for destructor" "" { target c++20 } }
++
++struct Q {
++ // ill-formed since DR1435
++ template<typename T> friend X<T>::X<T>(); // { dg-error "names the constructor|as no template constructors" }
++ template<typename T> friend X<T>::~X<T>(); // { dg-error "template-id not allowed for destructor" "" { target c++20 } }
++};
+'''
+
+EXPECTED7 = '''\
+gcc/testsuite/ChangeLog:
+
+ DR 2237
+ * g++.dg/DRs/dr2237.C: New test.
+
+'''
+
class TestMklog(unittest.TestCase):
def test_macro_definition(self):
changelog = generate_changelog(PATCH1)
def test_gty_in_struct(self):
changelog = generate_changelog(PATCH6, fill_pr_titles=True)
assert changelog == EXPECTED6
+
+ def test_dr_detection_in_test_case(self):
+ changelog = generate_changelog(PATCH7)
+ assert changelog == EXPECTED7