Support DR entries for gcc-changelog.

Message ID 52663c8e-1327-d183-0e7f-38a1c50cda87@suse.cz
State New
Headers show
Series
  • Support DR entries for gcc-changelog.
Related show

Commit Message

Martin Liška May 21, 2020, 8:23 a.m.
Hi.

The patch understand DR entries in git commit messages and
preserve them for ChangeLog entries.

Installed to master.
Martin

contrib/ChangeLog:

2020-05-21  Martin Liska  <mliska@suse.cz>

	* gcc-changelog/git_commit.py: Support DR entries/
	* gcc-changelog/test_email.py: New test for it.
	* gcc-changelog/test_patches.txt: New patch for it.
---
  contrib/gcc-changelog/git_commit.py    |  5 ++++-
  contrib/gcc-changelog/test_email.py    |  4 ++++
  contrib/gcc-changelog/test_patches.txt | 27 ++++++++++++++++++++++++++
  3 files changed, 35 insertions(+), 1 deletion(-)

Comments

Marek Polacek via Gcc-patches May 21, 2020, 8:49 a.m. | #1
On Thu, May 21, 2020 at 10:23:38AM +0200, Martin Liška wrote:
> Hi.

> 

> The patch understand DR entries in git commit messages and

> preserve them for ChangeLog entries.


Do you handle other free-style comments above the commit?
I mean, especially in gcc/cp/ Jason, Marek and others use something like:
r11-292-g52c5933f5838adb7bf6035e648b770b4958d137f
	Resolve C++20 NB comment CA104
etc.?
Does it work only when one uses the email line in the commit message,
not at all or works fine even without that?

	Jakub
Martin Liška May 21, 2020, 9:15 a.m. | #2
On 5/21/20 10:49 AM, Jakub Jelinek wrote:
> On Thu, May 21, 2020 at 10:23:38AM +0200, Martin Liška wrote:

>> Hi.

>>

>> The patch understand DR entries in git commit messages and

>> preserve them for ChangeLog entries.

> 

> Do you handle other free-style comments above the commit?


No. Note that the PR (and DR now) are markers that identify start of
ChangeLog section in git commit message

> I mean, especially in gcc/cp/ Jason, Marek and others use something like:

> r11-292-g52c5933f5838adb7bf6035e648b770b4958d137f

> 	Resolve C++20 NB comment CA104

> etc.?

> Does it work only when one uses the email line in the commit message,

> not at all or works fine even without that?


Can you be please more concrete about this?

I've made a quick analysis of cp/ChangeLog entries and I see these
interesting beginnings:

	Resolve C++20 NB comment CA104
	CWG 2235
	Implement P2092R0, Disambiguating Nested-Requirements
	P1937R2 - Fixing inconsistencies between const{expr,eval} functions
	P1937R2 - Fixing inconsistencies between const{expr,eval} functions
	P0780R2: Resolve lambda init-capture pack grammar.
	Implement P1946R0, Allow defaulting comparisons by value.
	Implement D1957R0, T* to bool should be considered narrowing.
	Implement D1959R0, remove weak_equality and strong_equality.
	Implement D1907R1 "structural type".
	Implement P1286R2, Contra CWG1778
	Implement p1301 [[nodiscard("should have a reason")]] + p1771 DR
	P1091R3 - Extending structured bindings to be more like var decls
	P1381R1 - Reference capture of structured bindings
	CWG 2094 - volatile scalars are trivially copyable.
	CWG 2096 - constraints on literal unions.
	Implement P0634R3, Down with typename!
	Implement P1094R2, Nested inline namespaces.
	Implement P0479R5, [[likely]] and [[unlikely]].
	Remove ovl_used, it is no longer needed
	P1236R1 - Signed integers are two's complement
	Implement P0315R4, Lambdas in unevaluated contexts.
	Implement P0722R3, destroying operator delete.
	Implement P0780R2, pack expansion in lambda init-capture.
	Implement UDL changes from P0732R2.
	Implement P0732R2, class types in non-type template parameters.
	Implement P0846R0, ADL and function templates.
	Implement P0892R2, explicit(bool).
	Implement P0840, language support for empty objects.
	Add -Wclass-conversion.
	P1064R0 - Allowing Virtual Function Calls in Constant Expressions
	P0806R2 - Deprecate implicit capture of this via [=]
	P0595R1 - is_constant_evaluated
	P1008R1 - prohibit aggregates with user-declared constructors

I'm open for supporting more of these, but I would like to keep it simple as possible.

Martin

> 

> 	Jakub

>

Patch

diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py
index 8c347d1c421..e22d3a2d6f0 100755
--- a/contrib/gcc-changelog/git_commit.py
+++ b/contrib/gcc-changelog/git_commit.py
@@ -145,6 +145,7 @@  author_line_regex = \
 additional_author_regex = re.compile(r'^\t(?P<spaces>\ *)?(?P<name>.*  <.*>)')
 changelog_regex = re.compile(r'^([a-z0-9+-/]*)/ChangeLog:?')
 pr_regex = re.compile(r'\tPR (?P<component>[a-z+-]+\/)?([0-9]+)$')
+dr_regex = re.compile(r'\tDR ([0-9]+)$')
 star_prefix_regex = re.compile(r'\t\*(?P<spaces>\ *)(?P<content>.*)')
 
 LINE_LIMIT = 100
@@ -297,7 +298,7 @@  class GitCommit:
                 continue
             if (changelog_regex.match(b) or self.find_changelog_location(b)
                     or star_prefix_regex.match(b) or pr_regex.match(b)
-                    or author_line_regex.match(b)):
+                    or dr_regex.match(b) or author_line_regex.match(b)):
                 self.changes = body[i:]
                 return
         self.errors.append(Error('cannot find a ChangeLog location in '
@@ -350,6 +351,8 @@  class GitCommit:
                         continue
                     else:
                         pr_line = line.lstrip()
+                elif dr_regex.match(line):
+                    pr_line = line.lstrip()
 
                 lowered_line = line.lower()
                 if lowered_line.startswith(CO_AUTHORED_BY_PREFIX):
diff --git a/contrib/gcc-changelog/test_email.py b/contrib/gcc-changelog/test_email.py
index ce69c64c79e..d522e6ef7e3 100755
--- a/contrib/gcc-changelog/test_email.py
+++ b/contrib/gcc-changelog/test_email.py
@@ -272,3 +272,7 @@  class TestGccChangelog(unittest.TestCase):
         email = self.from_patch_glob('0001-Fortran-ProcPtr-function.patch')
         assert not email.errors
         assert len(email.changelog_entries[0].author_lines) == 1
+
+    def test_dr_entry(self):
+        email = self.from_patch_glob('0001-c-C-20-DR-2237.patch')
+        assert email.changelog_entries[0].prs == ['DR 2237']
diff --git a/contrib/gcc-changelog/test_patches.txt b/contrib/gcc-changelog/test_patches.txt
index d80cfc3a0c8..3445c3d9f11 100644
--- a/contrib/gcc-changelog/test_patches.txt
+++ b/contrib/gcc-changelog/test_patches.txt
@@ -2541,3 +2541,30 @@  index 00000000000..ecb0a43929f
 -- 
 2.26.2
 
+=== 0001-c-C-20-DR-2237.patch ===
+From 4b38d56dbac6742b038551a36ec80200313123a1 Mon Sep 17 00:00:00 2001
+From: Marek Polacek <polacek@redhat.com>
+Date: Sat, 4 Apr 2020 18:09:53 -0400
+Subject: [PATCH] c++: C++20 DR 2237, disallow simple-template-id in cdtor.
+
+This patch implements DR 2237 which says that a simple-template-id is
+no longer valid as the declarator-id of a constructor or destructor;
+see [diff.cpp17.class]#2.  It is not explicitly stated but out-of-line
+destructors with a simple-template-id are also meant to be ill-formed
+now.  (Out-of-line constructors like that are invalid since DR1435 I
+think.)  This change only applies to C++20; it is not a DR against C++17.
+
+I'm not crazy about the diagnostic in constructors but ISTM that
+cp_parser_constructor_declarator_p shouldn't print errors.
+
+	DR 2237
+	* parser.c (cp_parser_unqualified_id): Reject simple-template-id as
+	the declarator-id of a destructor.
+---
+diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
+index a6a5d975af3..a8082d39aca 100644
+--- a/gcc/cp/parser.c
++++ b/gcc/cp/parser.c
+@@ -1 +1,2 @@
+
++