From patchwork Fri Oct 30 13:16:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 1391035 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CN2rp0stsz9sSf for ; Sat, 31 Oct 2020 00:16:40 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E2006385ED4B; Fri, 30 Oct 2020 13:16:37 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id C9EFF385780B for ; Fri, 30 Oct 2020 13:16:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C9EFF385780B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Tobias_Burnus@mentor.com IronPort-SDR: OGDHWmr3ll9RwcZiypdvwTt7CKFFSkiywKmJwQSEfVDCn/TAdL0giVexWObouMPN6+YcEjl0gj RCCJpbzHvH3y4cyAMroopEkRFQeSEOg6oLgZEjxyZPbcpPS0uA7zPvOfEJ5aGWEa2FJduQSOwb hoCx8sSSC124Ug0nMPbtSu5rUUWECl8XLBtM9Gnl5BeNe+1mZjYy3b9bwnXytSdg2gt7uUfPPA qWdDeyEzi4/XGQz2MosZxu/4xJcCHdaYr7i13nlGt+pbEy043+zJjCHRkrZTXCshSLYoJOGNoN 6xs= X-IronPort-AV: E=Sophos;i="5.77,433,1596528000"; d="diff'?log'?scan'208";a="54646855" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 30 Oct 2020 05:16:32 -0800 IronPort-SDR: 14K09QAIBUNQRCZ9Ag6+T8j8UAkhDwwXXiEyAmOaiHauKwa9Fk7asRgMZDu75F/7r+NDATHQVM CzV3R6FzAgEmDmqQgMKpX+XD2XsSGnOrFLN3Io0FYiYPmxkYKRvwNSAWhZjN+tr1rB7HLaCF4w vTdbK0cqbmhB7ImxKQhItyeDo/ZPOxY42RdJIeX2/kUCOr9IejADbXOv1/uQ1cQghP+AZC9rT0 iphTKJ52yH7nXj61PxQNE10gJTrHiDPQdubERb46hUEiFnregHKEqBPGFpGbNLydPHhA2B4eVu 0F4= To: =?utf-8?q?Martin_Li=C5=A1ka?= , gcc-patches From: Tobias Burnus Subject: [Patch + RFC][contrib] gcc-changelog/git_commit.py: Check for missing description Message-ID: <7ac9cc26-f5d6-4825-6253-3c92ec3b2cb5@codesourcery.com> Date: Fri, 30 Oct 2020 14:16:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 Content-Language: en-US X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-05.mgc.mentorg.com (139.181.222.5) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_ASCII_DIVIDERS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_FILL_THIS_FORM_SHORT autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" In terms of issues, it seems as if Ubuntu 20.04.1 LTS has a too old unidiff – I copied the check from test_email.py and applied it to git_email.py – otherwise, nearly all tests fail. Still, I do see some fails – I have attached the fails I got. (fails.log, second attachment) Independent of that, I have now written a check for an empty description. OK for the patch and thoughts about the fails? Tobias ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter 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