From 2f809e773e8ecae72331002faf98986dd670580f Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Wed, 20 May 2020 16:10:02 +0200 Subject: [PATCH] git_email.py: fix duplicate author_lines. * gcc-changelog/git_commit.py: Add author_tuple only if not present in author_lines. * gcc-changelog/test_email.py: New test. * gcc-changelog/test_patches.txt: Add new patch. --- contrib/ChangeLog | 7 ++ contrib/gcc-changelog/git_commit.py | 3 +- contrib/gcc-changelog/test_email.py | 5 ++ contrib/gcc-changelog/test_patches.txt | 96 ++++++++++++++++++++++++++ 4 files changed, 110 insertions(+), 1 deletion(-) diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 11f47e69799..8ebae98cc14 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,10 @@ +2020-05-20 Martin Liska + + * gcc-changelog/git_commit.py: Add author_tuple + only if not present in author_lines. + * gcc-changelog/test_email.py: New test. + * gcc-changelog/test_patches.txt: Add new patch. + 2020-05-20 Martin Liska * gcc-changelog/git_commit.py: Refactor to make flake8 happy. diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py index e4903cac4ef..8c347d1c421 100755 --- a/contrib/gcc-changelog/git_commit.py +++ b/contrib/gcc-changelog/git_commit.py @@ -381,7 +381,8 @@ class GitCommit: self.changelog_entries.append(last_entry) will_deduce = True elif author_tuple: - last_entry.author_lines.append(author_tuple) + if author_tuple not in last_entry.author_lines: + last_entry.author_lines.append(author_tuple) continue if not line.startswith('\t'): diff --git a/contrib/gcc-changelog/test_email.py b/contrib/gcc-changelog/test_email.py index 92bcb89ed8b..ce69c64c79e 100755 --- a/contrib/gcc-changelog/test_email.py +++ b/contrib/gcc-changelog/test_email.py @@ -267,3 +267,8 @@ class TestGccChangelog(unittest.TestCase): email = self.from_patch_glob('0001-RISC-V-Make-unique.patch') assert not email.errors assert len(email.changelog_entries) == 1 + + def test_duplicate_top_level_author(self): + email = self.from_patch_glob('0001-Fortran-ProcPtr-function.patch') + assert not email.errors + assert len(email.changelog_entries[0].author_lines) == 1 diff --git a/contrib/gcc-changelog/test_patches.txt b/contrib/gcc-changelog/test_patches.txt index 7a78c4de897..d80cfc3a0c8 100644 --- a/contrib/gcc-changelog/test_patches.txt +++ b/contrib/gcc-changelog/test_patches.txt @@ -2445,3 +2445,99 @@ index e4c08d780db..1ad9799fce4 100644 -- 2.26.2 + +=== 0001-Fortran-ProcPtr-function.patch === +From eb069ae8819c3a84d7f78becc5501e21ee3a9554 Mon Sep 17 00:00:00 2001 +From: Mark Eggleston +Date: Thu, 7 May 2020 08:02:02 +0100 +Subject: [PATCH] Fortran : ProcPtr function results: 'ppr@' in error message + PR39695 + +The value 'ppr@' is set in the name of result symbol, the actual +name of the symbol is in the procedure name symbol pointed +to by the result symbol's namespace (ns). When reporting errors for +symbols that have the proc_pointer attribute check whether the +result attribute is set and set the name accordingly. + +2020-05-20 Mark Eggleston + +gcc/fortran/ + + PR fortran/39695 + * resolve.c (resolve_fl_procedure): Set name depending on + whether the result attribute is set. For PROCEDURE/RESULT + conflict use the name in sym->ns->proc_name->name. + * symbol.c (gfc_add_type): Add check for function and result + attributes use sym->ns->proc_name->name if both are set. + Where the symbol cannot have a type use the name in + sym->ns->proc_name->name. + +2020-05-20 Mark Eggleston + +gcc/testsuite/ + + PR fortran/39695 + * gfortran.dg/pr39695_1.f90: New test. + * gfortran.dg/pr39695_2.f90: New test. + * gfortran.dg/pr39695_3.f90: New test. + * gfortran.dg/pr39695_4.f90: New test. +--- + gcc/fortran/ChangeLog | 11 +++++++++++ + gcc/fortran/resolve.c | 6 ++++-- + gcc/fortran/symbol.c | 7 +++++-- + gcc/testsuite/ChangeLog | 8 ++++++++ + gcc/testsuite/gfortran.dg/pr39695_1.f90 | 8 ++++++++ + gcc/testsuite/gfortran.dg/pr39695_2.f90 | 12 ++++++++++++ + gcc/testsuite/gfortran.dg/pr39695_3.f90 | 11 +++++++++++ + gcc/testsuite/gfortran.dg/pr39695_4.f90 | 14 ++++++++++++++ + 8 files changed, 73 insertions(+), 4 deletions(-) + create mode 100644 gcc/testsuite/gfortran.dg/pr39695_1.f90 + create mode 100644 gcc/testsuite/gfortran.dg/pr39695_2.f90 + create mode 100644 gcc/testsuite/gfortran.dg/pr39695_3.f90 + create mode 100644 gcc/testsuite/gfortran.dg/pr39695_4.f90 + +diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c +index f6e10ea379c..aaee5eb6b9b 100644 +--- a/gcc/fortran/resolve.c ++++ b/gcc/fortran/resolve.c +@@ -1 +1,2 @@ + ++ +diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c +index 59f602d80d5..b96706138c9 100644 +--- a/gcc/fortran/symbol.c ++++ b/gcc/fortran/symbol.c +@@ -1 +1,2 @@ + ++ +diff --git a/gcc/testsuite/gfortran.dg/pr39695_1.f90 b/gcc/testsuite/gfortran.dg/pr39695_1.f90 +new file mode 100644 +index 00000000000..4c4b3045f69 +--- /dev/null ++++ b/gcc/testsuite/gfortran.dg/pr39695_1.f90 +@@ -0,0 +1 @@ ++ +diff --git a/gcc/testsuite/gfortran.dg/pr39695_2.f90 b/gcc/testsuite/gfortran.dg/pr39695_2.f90 +new file mode 100644 +index 00000000000..8534724959a +--- /dev/null ++++ b/gcc/testsuite/gfortran.dg/pr39695_2.f90 +@@ -0,0 +1 @@ ++ +diff --git a/gcc/testsuite/gfortran.dg/pr39695_3.f90 b/gcc/testsuite/gfortran.dg/pr39695_3.f90 +new file mode 100644 +index 00000000000..661e2540bb3 +--- /dev/null ++++ b/gcc/testsuite/gfortran.dg/pr39695_3.f90 +@@ -0,0 +1 @@ ++ +diff --git a/gcc/testsuite/gfortran.dg/pr39695_4.f90 b/gcc/testsuite/gfortran.dg/pr39695_4.f90 +new file mode 100644 +index 00000000000..ecb0a43929f +--- /dev/null ++++ b/gcc/testsuite/gfortran.dg/pr39695_4.f90 +@@ -0,0 +1 @@ ++ +-- +2.26.2 + -- 2.30.2