mirror of
https://gcc.gnu.org/git/gcc.git
synced 2025-01-23 21:04:29 +08:00
mklog.py: improve parsing of struct names (ignore GTY).
* mklog.py: Skip GTY for struct names. Make flake8 happy. * test_mklog.py: Add test for GTY.
This commit is contained in:
parent
53cc8cf9f0
commit
4f85a52c94
@ -1,3 +1,8 @@
|
||||
2020-05-19 Martin Liska <mliska@suse.cz>
|
||||
|
||||
* mklog.py: Skip GTY for struct names. Make flake8 happy.
|
||||
* test_mklog.py: Add test for GTY.
|
||||
|
||||
2020-05-19 Martin Liska <mliska@suse.cz>
|
||||
|
||||
* gcc-changelog/git_update_version.py:
|
||||
|
@ -27,18 +27,21 @@
|
||||
# Author: Martin Liska <mliska@suse.cz>
|
||||
|
||||
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+(?P<pr>PR [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 = []
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user