mklog: support parsing of DR.

* mklog.py: Support DR parsing.
	* test_mklog.py: New test for DR parsing.
This commit is contained in:
Martin Liska 2020-05-21 10:14:56 +02:00
parent f094665d46
commit e7c7cdc5f4
No known key found for this signature in database
GPG Key ID: 4DC182DC0FA73785
3 changed files with 52 additions and 1 deletions

View File

@ -1,3 +1,8 @@
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

View File

@ -36,6 +36,7 @@ import requests
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+'
@ -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)

View File

@ -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<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)
@ -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