gcc-changelog/git_commit.py: Check for missing description Especially when using mklog.py, it is simply to forget to fill in the entries after the '\t* file.c (section):' or '\t(section):'. contrib/ChangeLog: * gcc-changelog/git_commit.py (item_parenthesis_regex): Add. (parse_changelog): Detect missing descriptions. * gcc-changelog/git_email.py: Add unidiff_supports_renaming check. * gcc-changelog/test_email.py (test_emptry_entry_desc): Add. * gcc-changelog/test_patches.txt: Add testcase for it. contrib/gcc-changelog/git_commit.py | 9 +++++++++ contrib/gcc-changelog/git_email.py | 5 +++-- contrib/gcc-changelog/test_email.py | 5 +++++ contrib/gcc-changelog/test_patches.txt | 28 ++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 2 deletions(-) diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py index 1d0860cddd8..6adea9124fd 100755 --- a/contrib/gcc-changelog/git_commit.py +++ b/contrib/gcc-changelog/git_commit.py @@ -155,6 +155,7 @@ pr_regex = re.compile(r'\tPR (?P[a-z+-]+\/)?([0-9]+)$') dr_regex = re.compile(r'\tDR ([0-9]+)$') star_prefix_regex = re.compile(r'\t\*(?P\ *)(?P.*)') end_of_location_regex = re.compile(r'[\[<(:]') +item_parenthesis_regex = re.compile(r'\t(\* \S+ )?\(\S+\):\s*$') LINE_LIMIT = 100 TAB_WIDTH = 8 @@ -474,6 +475,14 @@ class GitCommit: self.errors.append(Error(msg, line)) else: last_entry.lines.append(line) + for entry in self.changelog_entries: + for idx, line in enumerate(entry.lines): + print (line) + if item_parenthesis_regex.match(line) and \ + (idx+1 not in entry.lines or \ + item_parenthesis_regex.match(entry.lines[idx+1])): + msg = 'Missing description for item' + self.errors.append(Error(msg, line)) def parse_file_names(self): for entry in self.changelog_entries: diff --git a/contrib/gcc-changelog/git_email.py b/contrib/gcc-changelog/git_email.py index 014fdd1004b..ef054d58d52 100755 --- a/contrib/gcc-changelog/git_email.py +++ b/contrib/gcc-changelog/git_email.py @@ -24,7 +24,7 @@ from dateutil.parser import parse from git_commit import GitCommit, GitInfo -from unidiff import PatchSet +from unidiff import PatchSet, PatchedFile DATE_PREFIX = 'Date: ' FROM_PREFIX = 'From: ' @@ -49,6 +49,7 @@ class GitEmail(GitCommit): body = lines[len(header) + 1:] modified_files = [] + unidiff_supports_renaming = hasattr(PatchedFile(), 'is_rename') for f in diff: # Strip "a/" and "b/" prefixes source = f.source_file[2:] @@ -58,7 +59,7 @@ class GitEmail(GitCommit): t = 'A' elif f.is_removed_file: t = 'D' - elif f.is_rename: + elif unidiff_supports_renaming and f.is_rename: # Consider that renamed files are two operations: the deletion # of the original name and the addition of the new one. modified_files.append((source, 'D')) diff --git a/contrib/gcc-changelog/test_email.py b/contrib/gcc-changelog/test_email.py index 98f2ecd258d..3020f152192 100755 --- a/contrib/gcc-changelog/test_email.py +++ b/contrib/gcc-changelog/test_email.py @@ -370,3 +370,8 @@ class TestGccChangelog(unittest.TestCase): email = self.from_patch_glob('0001-tree-optimization-97633-fix') assert len(email.errors) == 1 assert email.errors[0].message == 'empty group "()" found' + + def test_emptry_entry_desc(self): + email = self.from_patch_glob('0001-c-Set-CALL_FROM_NEW_OR') + assert len(email.errors) == 1 + assert email.errors[0].message == 'Missing description for item' diff --git a/contrib/gcc-changelog/test_patches.txt b/contrib/gcc-changelog/test_patches.txt index 148d020f23b..b1b85a4abc4 100644 --- a/contrib/gcc-changelog/test_patches.txt +++ b/contrib/gcc-changelog/test_patches.txt @@ -3235,4 +3235,32 @@ index 5d69a98c2a9..714e50697bd 100644 -- 2.7.4 +=== 0001-c-Set-CALL_FROM_NEW_OR_DELETE_P-on-more-calls.patch === +From 4f4ced28826ece7b7b76649522ee2a9601a63b90 Mon Sep 17 00:00:00 2001 +From: Jason Merrill +Date: Fri, 2 Oct 2020 09:00:49 +0200 +Subject: [PATCH] c++: Set CALL_FROM_NEW_OR_DELETE_P on more calls. + +We were failing to set the flag on a delete call in a new expression, in a +deleting destructor, and in a coroutine. Fixed by setting it in the +function that builds the call. + +2020-10-02 Jason Merril + +gcc/cp/ChangeLog: + * init.c (build_new_1, build_vec_delete_1, build_delete): Not here. + (build_delete): + +--- + gcc/cp/init.c | 1 - + 1 files changed, 0 insertions(+), 1 deletions(-) + +diff --git a/gcc/cp/init.c b/gcc/cp/init.c +index e84e985492d..00fff3f7327 100644 +--- a/gcc/cp/init.c ++++ b/gcc/cp/init.c +@@ -3436,1 +3435,0 @@ build_new_1 (vec **placement, tree type, tree nelts, +- +-- +2.25.1