From e7c7cdc5f427281c675b7a42a1554dfdaa03e185 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 21 May 2020 10:14:56 +0200 Subject: [PATCH] mklog: support parsing of DR. * mklog.py: Support DR parsing. * test_mklog.py: New test for DR parsing. --- contrib/ChangeLog | 5 +++++ contrib/mklog.py | 9 ++++++++- contrib/test_mklog.py | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 8ebae98cc14..83960ba1f94 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,8 @@ +2020-05-21 Martin Liska + + * mklog.py: Support DR parsing. + * test_mklog.py: New test for DR parsing. + 2020-05-20 Martin Liska * gcc-changelog/git_commit.py: Add author_tuple diff --git a/contrib/mklog.py b/contrib/mklog.py index b27fad0ca2e..7a19b5d0949 100755 --- a/contrib/mklog.py +++ b/contrib/mklog.py @@ -36,6 +36,7 @@ import requests from unidiff import PatchSet pr_regex = re.compile(r'(\/(\/|\*)|[Cc*!])\s+(?PPR [a-z+-]+\/[0-9]+)') +dr_regex = re.compile(r'(\/(\/|\*)|[Cc*!])\s+(?PDR [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+' @@ -142,7 +143,13 @@ def generate_changelog(data, no_functions=False, fill_pr_titles=False): 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) diff --git a/contrib/test_mklog.py b/contrib/test_mklog.py index 774b6ea62d0..ef7f2b1a594 100755 --- a/contrib/test_mklog.py +++ b/contrib/test_mklog.py @@ -344,6 +344,41 @@ gcc/ChangeLog: ''' +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 ++struct X { ++ X(); // { dg-error "expected" "" { target c++20 } } ++ X(int); // OK, injected-class-name used ++ ~X(); // { dg-error "template-id not allowed for destructor" "" { target c++20 } } ++}; ++ ++// ill-formed since DR1435 ++template X::X() {} // { dg-error "names the constructor|as no template constructors" } ++template X::~X() {} // { dg-error "template-id not allowed for destructor" "" { target c++20 } } ++ ++struct Q { ++ // ill-formed since DR1435 ++ template friend X::X(); // { dg-error "names the constructor|as no template constructors" } ++ template friend X::~X(); // { 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) @@ -372,3 +407,7 @@ class TestMklog(unittest.TestCase): 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 -- 2.30.2