From patchwork Tue May 19 10:34:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 1293186 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=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 49RC1Y5lTvz9sT4 for ; Tue, 19 May 2020 20:34:39 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 15A473897800; Tue, 19 May 2020 10:34:37 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 4B1263851C0F for ; Tue, 19 May 2020 10:34:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4B1263851C0F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mliska@suse.cz X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id DF42DAE25 for ; Tue, 19 May 2020 10:34:35 +0000 (UTC) From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH] mklog.py: improve parsing of struct names (ignore GTY). To: gcc-patches@gcc.gnu.org Message-ID: <3ffd3b82-c0bb-4b5c-089b-6c5ea913e080@suse.cz> Date: Tue, 19 May 2020 12:34:32 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 Content-Language: en-US X-Spam-Status: No, score=-16.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP 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" Hi. It's a small tweak to the newly added script. Installed. Martin * mklog.py: Skip GTY for struct names. Make flake8 happy. * test_mklog.py: Add test for GTY. --- contrib/ChangeLog | 5 +++++ contrib/mklog.py | 12 ++++++++---- contrib/test_mklog.py | 29 +++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/contrib/ChangeLog b/contrib/ChangeLog index ca2834e541f..5ef08f41a92 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,8 @@ +2020-05-19 Martin Liska + + * mklog.py: Skip GTY for struct names. Make flake8 happy. + * test_mklog.py: Add test for GTY. + 2020-05-19 Martin Liska * gcc-changelog/git_update_version.py: diff --git a/contrib/mklog.py b/contrib/mklog.py index cc3f937c253..45559afbe6b 100755 --- a/contrib/mklog.py +++ b/contrib/mklog.py @@ -27,18 +27,21 @@ # Author: Martin Liska import argparse -import bs4 import os import re -import requests import sys +import bs4 + +import requests + from unidiff import PatchSet pr_regex = re.compile(r'(\/(\/|\*)|[Cc*!])\s+(?PPR [a-z+-]+\/[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+[a-zA-Z0-9_]+)') +struct_regex = re.compile(r'^(class|struct|union|enum)\s+' + r'(GTY\(.*\)\s+)?([a-zA-Z0-9_]+)') macro_regex = re.compile(r'#\s*(define|undef)\s+([a-zA-Z0-9_]+)') super_macro_regex = re.compile(r'^DEF[A-Z0-9_]+\s*\(([a-zA-Z0-9_]+)') fn_regex = re.compile(r'([a-zA-Z_][^()\s]*)\s*\([^*]') @@ -73,7 +76,7 @@ def extract_function_name(line): m = struct_regex.search(line) if m: # Struct declaration - return m.group(1) + return m.group(1) + ' ' + m.group(3) m = macro_regex.search(line) if m: # Macro definition @@ -117,6 +120,7 @@ def get_pr_titles(prs): output += '\n' return output + def generate_changelog(data, no_functions=False, fill_pr_titles=False): changelogs = {} changelog_list = [] diff --git a/contrib/test_mklog.py b/contrib/test_mklog.py index ca7b9e79d95..774b6ea62d0 100755 --- a/contrib/test_mklog.py +++ b/contrib/test_mklog.py @@ -319,6 +319,31 @@ gcc/testsuite/ChangeLog: ''' +PATCH6 = '''\ +diff --git a/gcc/cgraph.h b/gcc/cgraph.h +index 5ddeb65269b..cfae6e91da9 100644 +--- a/gcc/cgraph.h ++++ b/gcc/cgraph.h +@@ -937,7 +937,8 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node + split_part (false), indirect_call_target (false), local (false), + versionable (false), can_change_signature (false), + redefined_extern_inline (false), tm_may_enter_irr (false), +- ipcp_clone (false), m_uid (uid), m_summary_id (-1) ++ ipcp_clone (false), declare_variant_alt (false), ++ calls_declare_variant_alt (false), m_uid (uid), m_summary_id (-1) + {} + + /* Remove the node from cgraph and all inline clones inlined into it. + +''' + +EXPECTED6 = '''\ +gcc/ChangeLog: + + * cgraph.h (struct cgraph_node): + +''' + class TestMklog(unittest.TestCase): def test_macro_definition(self): changelog = generate_changelog(PATCH1) @@ -343,3 +368,7 @@ class TestMklog(unittest.TestCase): def test_pr_bugzilla_download(self): changelog = generate_changelog(PATCH5, fill_pr_titles=True) assert changelog == EXPECTED5 + + def test_gty_in_struct(self): + changelog = generate_changelog(PATCH6, fill_pr_titles=True) + assert changelog == EXPECTED6