Re: ChangeLog files - server and client scripts

2020-05-26 Thread Alexandre Oliva
Hi, Martin,

On May 26, 2020, Martin Liška  wrote:

>> I've long used the following syntax to start ChangeLog entries:
>> 
>> for  /ChangeLog

> Ah, it's new for me.

>> 
>> It was introduced over 20 years ago, with the (so far never formally
>> released) GNU CVS-Utilities.  Among other goodies, there were scripts to
>> turn diffs for ChangeLog files into the above format, and vice-versa,
>> that I've used to this day.  It went through cvs, svn and git.  It would
>> be quite nice if I could keep on using it with GCC. ^^

For clarity, I meant the syntax in the last sentence above.  The
ChangeLog-related functionality in the scripts now becomes mostly
obsolete.

>> The patch below seems to be enough to pass gcc-verify, and to recognize
>> and print the expected ChangeLog files.

'cept it broke cases without 'for' because I missed a '?' in the
regexp.  Good thing I had to adjust for the old format to be able to
push it ;-)  2x0 ;-)

>> Do any hooks need to be adjusted to match?

> Yes, we sync the script from the GCC repository.

Here's what I'm about to push


accept for dir/ChangeLog entries

From: Alexandre Oliva 

I've long introduced ChangeLog entries as "for  dir/ChangeLog", a
format adopted by GNU CVS-Utilities some 20 years ago.  My commits
have been formatted like this forever.

This patch makes it acceptable for git gcc-verify.


contrib/ChangeLog:

* gcc-changelog/git_commit.py (changelog_regex): Accept optional
'for' prefix.
---
 contrib/gcc-changelog/git_commit.py |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/gcc-changelog/git_commit.py 
b/contrib/gcc-changelog/git_commit.py
index 2cfdbc8..732a9bd8 100755
--- a/contrib/gcc-changelog/git_commit.py
+++ b/contrib/gcc-changelog/git_commit.py
@@ -144,7 +144,7 @@ misc_files = [
 author_line_regex = \
 re.compile(r'^(?P\d{4}-\d{2}-\d{2})\ {2}(?P.*  <.*>)')
 additional_author_regex = re.compile(r'^\t(?P\ *)?(?P.*  <.*>)')
-changelog_regex = re.compile(r'^([a-z0-9+-/]*)/ChangeLog:?')
+changelog_regex = re.compile(r'^(?:[fF]or +)?([a-z0-9+-/]*)/ChangeLog:?')
 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.*)')


-- 
Alexandre Oliva, freedom fighterhe/himhttps://FSFLA.org/blogs/lxo/
Free Software Evangelist  Stallman was right, but he's left :(
GNU Toolchain Engineer   Live long and free, and prosper ethically


Re: ChangeLog files - server and client scripts

2020-05-26 Thread Martin Liška

On 5/26/20 7:31 AM, Alexandre Oliva wrote:

On May 25, 2020, Martin Liška  wrote:


On 5/21/20 5:14 PM, Rainer Orth wrote:

* In changelog_location, you allow only (among others) "a/b/c/" and
"\ta/b/c/".  Please also accept the "a/b/c:" and "\ta/b/c:" forms
here: especially the second seems quite common.



Ok, I believe these formats are supported as well. Feel free to mention
some git revisions that are not recognized.


Hello.



I've long used the following syntax to start ChangeLog entries:

for  /ChangeLog


Ah, it's new for me.



It was introduced over 20 years ago, with the (so far never formally
released) GNU CVS-Utilities.  Among other goodies, there were scripts to
turn diffs for ChangeLog files into the above format, and vice-versa,
that I've used to this day.  It went through cvs, svn and git.  It would
be quite nice if I could keep on using it with GCC.


Sure. Starting from now, you don't need to put ChangeLog entries to their
corresponding files, it will be done automatically.



The patch below seems to be enough to pass gcc-verify, and to recognize
and print the expected ChangeLog files.  I suppose I'll have to adjust
the formatting to be able to push it, but, aside from that, is it ok to
install?


I'm fine with the patch. Alternative approach is to start using
./contrib/mklog.py (a.k.a. git mklog).



Do any hooks need to be adjusted to match?


Yes, we sync the script from the GCC repository.




I'm also a little concerned about '*/ChangeLog.*' files.  Are we no
longer supposed to introduce them, or new ChangeLog entries to them?  Or
should the scripts be extended to cover them?


Right now we cover only ChangeLog files, so e.g. ChangeLog.dataflow is not 
affected
(and checked). For newly added ChangeLog files, we can add them, but they must 
first
appear in the git_commit.py script where we list all allowed locations.

Martin




for  contrib/ChangeLog

* gcc-changelog/git_commit.py (changelog_regex): Accept optional
'for' prefix.

diff --git a/contrib/gcc-changelog/git_commit.py 
b/contrib/gcc-changelog/git_commit.py
index 2cfdbc8..b8362c1 100755
--- a/contrib/gcc-changelog/git_commit.py
+++ b/contrib/gcc-changelog/git_commit.py
@@ -144,7 +144,7 @@ misc_files = [
  author_line_regex = \
  re.compile(r'^(?P\d{4}-\d{2}-\d{2})\ {2}(?P.*  <.*>)')
  additional_author_regex = re.compile(r'^\t(?P\ *)?(?P.*  <.*>)')
-changelog_regex = re.compile(r'^([a-z0-9+-/]*)/ChangeLog:?')
+changelog_regex = re.compile(r'^(?:[fF]or +)([a-z0-9+-/]*)/ChangeLog:?')
  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.*)')







Re: ChangeLog files - server and client scripts

2020-05-25 Thread Alexandre Oliva
On May 25, 2020, Martin Liška  wrote:

> On 5/21/20 5:14 PM, Rainer Orth wrote:
>> * In changelog_location, you allow only (among others) "a/b/c/" and
>> "\ta/b/c/".  Please also accept the "a/b/c:" and "\ta/b/c:" forms
>> here: especially the second seems quite common.

> Ok, I believe these formats are supported as well. Feel free to mention
> some git revisions that are not recognized.

I've long used the following syntax to start ChangeLog entries:

for  /ChangeLog

It was introduced over 20 years ago, with the (so far never formally
released) GNU CVS-Utilities.  Among other goodies, there were scripts to
turn diffs for ChangeLog files into the above format, and vice-versa,
that I've used to this day.  It went through cvs, svn and git.  It would
be quite nice if I could keep on using it with GCC.

The patch below seems to be enough to pass gcc-verify, and to recognize
and print the expected ChangeLog files.  I suppose I'll have to adjust
the formatting to be able to push it, but, aside from that, is it ok to
install?

Do any hooks need to be adjusted to match?


I'm also a little concerned about '*/ChangeLog.*' files.  Are we no
longer supposed to introduce them, or new ChangeLog entries to them?  Or
should the scripts be extended to cover them?


for  contrib/ChangeLog

* gcc-changelog/git_commit.py (changelog_regex): Accept optional
'for' prefix.

diff --git a/contrib/gcc-changelog/git_commit.py 
b/contrib/gcc-changelog/git_commit.py
index 2cfdbc8..b8362c1 100755
--- a/contrib/gcc-changelog/git_commit.py
+++ b/contrib/gcc-changelog/git_commit.py
@@ -144,7 +144,7 @@ misc_files = [
 author_line_regex = \
 re.compile(r'^(?P\d{4}-\d{2}-\d{2})\ {2}(?P.*  <.*>)')
 additional_author_regex = re.compile(r'^\t(?P\ *)?(?P.*  <.*>)')
-changelog_regex = re.compile(r'^([a-z0-9+-/]*)/ChangeLog:?')
+changelog_regex = re.compile(r'^(?:[fF]or +)([a-z0-9+-/]*)/ChangeLog:?')
 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.*)')



-- 
Alexandre Oliva, freedom fighterhe/himhttps://FSFLA.org/blogs/lxo/
Free Software Evangelist  Stallman was right, but he's left :(
GNU Toolchain Engineer   Live long and free, and prosper ethically


Re: ChangeLog files - server and client scripts

2020-05-25 Thread Ian Lance Taylor via Gcc-patches
On Mon, May 25, 2020 at 12:48 AM Martin Liška  wrote:
>
> On 5/23/20 12:14 AM, Ian Lance Taylor wrote:
> > Sure, I can wait.  Thanks for looking at it.
>
> Hello.
>
> Thank you for patience. There's a patch that fixes that,
> I'm going to install it.

Thanks.  I was able to push my change to master.

Ian


Re: ChangeLog files - server and client scripts

2020-05-25 Thread Martin Liška

On 5/21/20 5:14 PM, Rainer Orth wrote:

* In changelog_location, you allow only (among others) "a/b/c/" and
   "\ta/b/c/".  Please also accept the "a/b/c:" and "\ta/b/c:" forms
   here: especially the second seems quite common.


Ok, I believe these formats are supported as well. Feel free to mention
some git revisions that are not recognized.

Thanks,
Martin




Re: ChangeLog files - server and client scripts

2020-05-25 Thread Martin Liška

On 5/23/20 12:14 AM, Ian Lance Taylor wrote:

Sure, I can wait.  Thanks for looking at it.


Hello.

Thank you for patience. There's a patch that fixes that,
I'm going to install it.

Martin
>From 76e18b91250f265a37d85063860fb38aa8f6aac3 Mon Sep 17 00:00:00 2001
From: Martin Liska 
Date: Mon, 25 May 2020 09:40:50 +0200
Subject: [PATCH] Allow only ignored files in ChangeLog entries.

contrib/ChangeLog:

2020-05-25  Martin Liska  

	* gcc-changelog/git_commit.py: Add trailing '/'
	for libdruntime.  Allow empty changelog for
	only ignored files.
	* gcc-changelog/test_email.py: New test for go
	patch in ignored location.
	* gcc-changelog/test_patches.txt: Add test.
---
 contrib/gcc-changelog/git_commit.py|  5 +--
 contrib/gcc-changelog/test_email.py|  4 +++
 contrib/gcc-changelog/test_patches.txt | 43 ++
 3 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py
index 8c5fa2c0fc9..2cfdbc83d09 100755
--- a/contrib/gcc-changelog/git_commit.py
+++ b/contrib/gcc-changelog/git_commit.py
@@ -130,7 +130,7 @@ ignored_prefixes = [
 'gcc/go/gofrontend/',
 'gcc/testsuite/go.test/test/',
 'libgo/',
-'libphobos/libdruntime',
+'libphobos/libdruntime/',
 'libphobos/src/',
 'libsanitizer/',
 ]
@@ -233,7 +233,8 @@ class GitCommit:
 
 project_files = [f for f in self.modified_files
  if self.is_changelog_filename(f[0])
- or f[0] in misc_files]
+ or f[0] in misc_files
+ or self.in_ignored_location(f[0])]
 if len(project_files) == len(self.modified_files):
 # All modified files are only MISC files
 return
diff --git a/contrib/gcc-changelog/test_email.py b/contrib/gcc-changelog/test_email.py
index d522e6ef7e3..aa516c6e6d1 100755
--- a/contrib/gcc-changelog/test_email.py
+++ b/contrib/gcc-changelog/test_email.py
@@ -276,3 +276,7 @@ class TestGccChangelog(unittest.TestCase):
 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']
+
+def test_changes_only_in_ignored_location(self):
+email = self.from_patch_glob('0001-go-in-ignored-location.patch')
+assert not email.errors
diff --git a/contrib/gcc-changelog/test_patches.txt b/contrib/gcc-changelog/test_patches.txt
index 3445c3d9f11..58fd81c85c9 100644
--- a/contrib/gcc-changelog/test_patches.txt
+++ b/contrib/gcc-changelog/test_patches.txt
@@ -2568,3 +2568,46 @@ index a6a5d975af3..a8082d39aca 100644
 @@ -1 +1,2 @@
 
 +
+
+=== 0001-go-in-ignored-location.patch ===
+From 81994eab700da7fea6644541c163aa0f0f3b8cf1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Cl=C3=A9ment=20Chigot?= 
+Date: Tue, 19 May 2020 16:03:54 +0200
+Subject: libgo: update x/sys/cpu after gccgo support added
+
+Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/234597
+---
+ gcc/go/gofrontend/MERGE   |  2 +-
+ .../sys/cpu/{cpu_aix_ppc64.go => cpu_aix.go}  |  2 +-
+ .../golang.org/x/sys/cpu/syscall_aix_gccgo.go | 27 +++
+ 3 files changed, 29 insertions(+), 2 deletions(-)
+ rename libgo/go/golang.org/x/sys/cpu/{cpu_aix_ppc64.go => cpu_aix.go} (96%)
+ create mode 100644 libgo/go/golang.org/x/sys/cpu/syscall_aix_gccgo.go
+
+diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
+index bc9c1f07eda..284374820b0 100644
+--- a/gcc/go/gofrontend/MERGE
 b/gcc/go/gofrontend/MERGE
+@@ -1 +1,2 @@
+
++
+diff --git a/libgo/go/golang.org/x/sys/cpu/cpu_aix_ppc64.go b/libgo/go/golang.org/x/sys/cpu/cpu_aix.go
+similarity index 96%
+rename from libgo/go/golang.org/x/sys/cpu/cpu_aix_ppc64.go
+rename to libgo/go/golang.org/x/sys/cpu/cpu_aix.go
+index b0ede112d4e..02d03129e50 100644
+--- a/libgo/go/golang.org/x/sys/cpu/cpu_aix_ppc64.go
 b/libgo/go/golang.org/x/sys/cpu/cpu_aix.go
+@@ -1 +1,2 @@
+
++
+diff --git a/libgo/go/golang.org/x/sys/cpu/syscall_aix_gccgo.go b/libgo/go/golang.org/x/sys/cpu/syscall_aix_gccgo.go
+new file mode 100644
+index 000..2609cc49ae7
+--- /dev/null
 b/libgo/go/golang.org/x/sys/cpu/syscall_aix_gccgo.go
+@@ -0,0 +1 @@
++
+
+-- 
+2.27.0.rc0.183.gde8f92d652-goog
-- 
2.26.2



Re: ChangeLog files - server and client scripts

2020-05-22 Thread Ian Lance Taylor via Gcc-patches
On Fri, May 22, 2020 at 12:48 PM Jakub Jelinek  wrote:
>
> On Fri, May 22, 2020 at 12:37:29PM -0700, Ian Lance Taylor wrote:
> > Thanks for looking into this.
> >
> > Unfortunately, my push is still failing.  I'm not sure why.
> >
> > remote: *** ChangeLog format failed:
> > remote: ERR: cannot find a ChangeLog location in message
> > remote:
> > remote: Please see: https://gcc.gnu.org/codingconventions.html#ChangeLogs
> > remote:
> > remote: error: hook declined to update refs/heads/master
> > To git+ssh://gcc.gnu.org/git/gcc
> >  ! [remote rejected] master -> master (hook declined)
> > error: failed to push some refs to 'git+ssh://gcc.gnu.org/git/gcc'
> >
> >
> > I've attached the output of "git format-patch -k 1 --stdout", in case
> > that helps.
>
> Bet the script first looks for the ChangeLog entry and only considers the
> ignored prefixes if it finds files in the patch that are not mentioned in
> the ChangeLog entry.  So, if you say modified gcc/go/whatever.cc and had
> ChangeLog entry for that and not for the files you've changed, it would be
> ok.
>
> So, I think before emitting the above message, it should look through the
> patch and if it finds all files in ignored prefixes, it should just not to
> do anything.
>
> We'll need it e.g. for the DATESTAMP bump job too which only modifies those
> files too and doesn't write ChangeLog entry for that.
>
> I'm sorry but I don't know the script well enough to fix it quickly, will
> defer to Martin as the author.
>
> Can you wait with the commit until Monday?  If not, I could just temporarily
> disable this for your commit.

Sure, I can wait.  Thanks for looking at it.

Ian


Re: ChangeLog files - server and client scripts

2020-05-22 Thread Jakub Jelinek via Gcc-patches
On Fri, May 22, 2020 at 12:37:29PM -0700, Ian Lance Taylor wrote:
> Thanks for looking into this.
> 
> Unfortunately, my push is still failing.  I'm not sure why.
> 
> remote: *** ChangeLog format failed:
> remote: ERR: cannot find a ChangeLog location in message
> remote:
> remote: Please see: https://gcc.gnu.org/codingconventions.html#ChangeLogs
> remote:
> remote: error: hook declined to update refs/heads/master
> To git+ssh://gcc.gnu.org/git/gcc
>  ! [remote rejected] master -> master (hook declined)
> error: failed to push some refs to 'git+ssh://gcc.gnu.org/git/gcc'
> 
> 
> I've attached the output of "git format-patch -k 1 --stdout", in case
> that helps.

Bet the script first looks for the ChangeLog entry and only considers the
ignored prefixes if it finds files in the patch that are not mentioned in
the ChangeLog entry.  So, if you say modified gcc/go/whatever.cc and had
ChangeLog entry for that and not for the files you've changed, it would be
ok.

So, I think before emitting the above message, it should look through the
patch and if it finds all files in ignored prefixes, it should just not to
do anything.

We'll need it e.g. for the DATESTAMP bump job too which only modifies those
files too and doesn't write ChangeLog entry for that.

I'm sorry but I don't know the script well enough to fix it quickly, will
defer to Martin as the author.

Can you wait with the commit until Monday?  If not, I could just temporarily
disable this for your commit.

Jakub



Re: ChangeLog files - server and client scripts

2020-05-22 Thread Ian Lance Taylor via Gcc-patches
On Fri, May 22, 2020 at 4:11 AM Jakub Jelinek  wrote:
>
> On Fri, May 22, 2020 at 12:04:10PM +0100, Richard Earnshaw wrote:
> > >> The directories in question are
> > >>
> > >> gcc/go/gofrontend
> > >> libgo
> > >> gcc/testsuite/go.test/test
> > >
> > > The script has:
> > > ignored_prefixes = [
> > > 'gcc/d/dmd/',
> > > 'gcc/go/frontend/',
> >
> > The directory is gcc/go/gofrontend
> >
> > so it's missing 'go' from frontend.
>
> Thanks for spotting.  I believe Martin said he will be afk
> today, so I've fixed it for him and committed as obvious and
> am going to install into git-hooks now too.
>
> diff --git a/contrib/ChangeLog b/contrib/ChangeLog
> index 7b61bb8915b..64a0db18e58 100644
> --- a/contrib/ChangeLog
> +++ b/contrib/ChangeLog
> @@ -1,3 +1,9 @@
> +2020-05-22  Jakub Jelinek  
> +
> +   * gcc-changelog/git_commit.py: Add trailing / to
> +   gcc/testsuite/go.test/test and replace gcc/go/frontend/
> +   with gcc/go/gofrontend/ in ignored locations.
> +
>  2020-05-22  Martin Liska  
>
> * gcc-changelog/git_commit.py: Add gcc/testsuite/go.test/test
> diff --git a/contrib/gcc-changelog/git_commit.py 
> b/contrib/gcc-changelog/git_commit.py
> index ba9f5ce9650..8c5fa2c0fc9 100755
> --- a/contrib/gcc-changelog/git_commit.py
> +++ b/contrib/gcc-changelog/git_commit.py
> @@ -127,8 +127,8 @@ bug_components = set([
>
>  ignored_prefixes = [
>  'gcc/d/dmd/',
> -'gcc/go/frontend/',
> -'gcc/testsuite/go.test/test',
> +'gcc/go/gofrontend/',
> +'gcc/testsuite/go.test/test/',
>  'libgo/',
>  'libphobos/libdruntime',
>  'libphobos/src/',

Thanks for looking into this.

Unfortunately, my push is still failing.  I'm not sure why.

remote: *** ChangeLog format failed:
remote: ERR: cannot find a ChangeLog location in message
remote:
remote: Please see: https://gcc.gnu.org/codingconventions.html#ChangeLogs
remote:
remote: error: hook declined to update refs/heads/master
To git+ssh://gcc.gnu.org/git/gcc
 ! [remote rejected] master -> master (hook declined)
error: failed to push some refs to 'git+ssh://gcc.gnu.org/git/gcc'


I've attached the output of "git format-patch -k 1 --stdout", in case
that helps.

Ian
From 81994eab700da7fea6644541c163aa0f0f3b8cf1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20Chigot?= 
Date: Tue, 19 May 2020 16:03:54 +0200
Subject: libgo: update x/sys/cpu after gccgo support added

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/234597
---
 gcc/go/gofrontend/MERGE   |  2 +-
 .../sys/cpu/{cpu_aix_ppc64.go => cpu_aix.go}  |  2 +-
 .../golang.org/x/sys/cpu/syscall_aix_gccgo.go | 27 +++
 3 files changed, 29 insertions(+), 2 deletions(-)
 rename libgo/go/golang.org/x/sys/cpu/{cpu_aix_ppc64.go => cpu_aix.go} (96%)
 create mode 100644 libgo/go/golang.org/x/sys/cpu/syscall_aix_gccgo.go

diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index bc9c1f07eda..284374820b0 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-bc27341f245a5cc54ac7530d037a609db72b677c
+ea58b8491064fbed18a220571a3043c38dccf7c7
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
diff --git a/libgo/go/golang.org/x/sys/cpu/cpu_aix_ppc64.go 
b/libgo/go/golang.org/x/sys/cpu/cpu_aix.go
similarity index 96%
rename from libgo/go/golang.org/x/sys/cpu/cpu_aix_ppc64.go
rename to libgo/go/golang.org/x/sys/cpu/cpu_aix.go
index b0ede112d4e..02d03129e50 100644
--- a/libgo/go/golang.org/x/sys/cpu/cpu_aix_ppc64.go
+++ b/libgo/go/golang.org/x/sys/cpu/cpu_aix.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build aix,ppc64
+// +build aix
 
 package cpu
 
diff --git a/libgo/go/golang.org/x/sys/cpu/syscall_aix_gccgo.go 
b/libgo/go/golang.org/x/sys/cpu/syscall_aix_gccgo.go
new file mode 100644
index 000..2609cc49ae7
--- /dev/null
+++ b/libgo/go/golang.org/x/sys/cpu/syscall_aix_gccgo.go
@@ -0,0 +1,27 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Recreate a getsystemcfg syscall handler instead of
+// using the one provided by x/sys/unix to avoid having
+// the dependency between them. (See golang.org/issue/32102)
+// Morover, this file will be used during the building of
+// gccgo's libgo and thus must not use a CGo method.
+
+// +build aix
+// +build gccgo
+
+package cpu
+
+import (
+   "syscall"
+)
+
+//extern getsystemcfg
+func gccgoGetsystemcfg(label uint32) (r uint64)
+
+func callgetsystemcfg(label int) (r1 uintptr, e1 syscall.Errno) {
+   r1 = uintptr(gccgoGetsystemcfg(uint32(label)))
+   e1 = syscall.GetErrno()
+   return
+}
-- 
2.27.0.rc0.183.gde8f92d652-goog



Re: ChangeLog files - server and client scripts

2020-05-22 Thread Jakub Jelinek via Gcc-patches
On Fri, May 22, 2020 at 12:04:10PM +0100, Richard Earnshaw wrote:
> >> The directories in question are
> >>
> >> gcc/go/gofrontend
> >> libgo
> >> gcc/testsuite/go.test/test
> > 
> > The script has:
> > ignored_prefixes = [
> > 'gcc/d/dmd/',
> > 'gcc/go/frontend/',
> 
> The directory is gcc/go/gofrontend
> 
> so it's missing 'go' from frontend.

Thanks for spotting.  I believe Martin said he will be afk
today, so I've fixed it for him and committed as obvious and
am going to install into git-hooks now too.

diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index 7b61bb8915b..64a0db18e58 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,9 @@
+2020-05-22  Jakub Jelinek  
+
+   * gcc-changelog/git_commit.py: Add trailing / to
+   gcc/testsuite/go.test/test and replace gcc/go/frontend/
+   with gcc/go/gofrontend/ in ignored locations.
+
 2020-05-22  Martin Liska  
 
* gcc-changelog/git_commit.py: Add gcc/testsuite/go.test/test
diff --git a/contrib/gcc-changelog/git_commit.py 
b/contrib/gcc-changelog/git_commit.py
index ba9f5ce9650..8c5fa2c0fc9 100755
--- a/contrib/gcc-changelog/git_commit.py
+++ b/contrib/gcc-changelog/git_commit.py
@@ -127,8 +127,8 @@ bug_components = set([
 
 ignored_prefixes = [
 'gcc/d/dmd/',
-'gcc/go/frontend/',
-'gcc/testsuite/go.test/test',
+'gcc/go/gofrontend/',
+'gcc/testsuite/go.test/test/',
 'libgo/',
 'libphobos/libdruntime',
 'libphobos/src/',

Jakub



Re: ChangeLog files - server and client scripts

2020-05-22 Thread Richard Earnshaw
On 22/05/2020 05:57, Jakub Jelinek wrote:
> On Thu, May 21, 2020 at 03:12:21PM -0700, Ian Lance Taylor via Gcc wrote:
>> Hi, this unfortunately breaks gccgo development.  Significant parts of
>> the gccgo sources are simply copied from other repositories.  Those
>> other repositories do not use ChangeLog files.  The git commit hook
>> should not require ChangeLog files for those changes.  And, when the
>> time comes, no ChangeLog files should be created for changes in those
>> directories.
>>
>> The directories in question are
>>
>> gcc/go/gofrontend
>> libgo
>> gcc/testsuite/go.test/test
> 
> The script has:
> ignored_prefixes = [
> 'gcc/d/dmd/',
> 'gcc/go/frontend/',

The directory is gcc/go/gofrontend

so it's missing 'go' from frontend.

> 'libgo/',
> 'libphobos/libdruntime',
> 'libphobos/src/',
> 'libsanitizer/',
> ]
> so perhaps it just misses gcc/testsuite/go.test/test ?
> Or what exact files you've changed in your script?
> 
>   Jakub
> 

R.


Re: ChangeLog files - server and client scripts

2020-05-22 Thread Martin Liška

On 5/22/20 6:57 AM, Jakub Jelinek wrote:

so perhaps it just misses gcc/testsuite/go.test/test ?


Hello.

I've just added the location to ignored locations.


Or what exact files you've changed in your script?


@Ian: Please send us patch with git format-patch.
@Jakub: Can you please sync up the script to the server hooks? I'll
be AFK till Monday.

Martin



Re: ChangeLog files - server and client scripts

2020-05-21 Thread Jakub Jelinek via Gcc-patches
On Thu, May 21, 2020 at 03:12:21PM -0700, Ian Lance Taylor via Gcc wrote:
> Hi, this unfortunately breaks gccgo development.  Significant parts of
> the gccgo sources are simply copied from other repositories.  Those
> other repositories do not use ChangeLog files.  The git commit hook
> should not require ChangeLog files for those changes.  And, when the
> time comes, no ChangeLog files should be created for changes in those
> directories.
> 
> The directories in question are
> 
> gcc/go/gofrontend
> libgo
> gcc/testsuite/go.test/test

The script has:
ignored_prefixes = [
'gcc/d/dmd/',
'gcc/go/frontend/',
'libgo/',
'libphobos/libdruntime',
'libphobos/src/',
'libsanitizer/',
]
so perhaps it just misses gcc/testsuite/go.test/test ?
Or what exact files you've changed in your script?

Jakub



Re: ChangeLog files - server and client scripts

2020-05-21 Thread Ian Lance Taylor via Gcc-patches
On Tue, May 19, 2020 at 2:26 AM Martin Liška  wrote:
>
> We've just installed server git hooks that verify git messages
> for a correct ChangeLog format. For a limited time period, please
> still apply ChangeLog changes to the corresponding ChangeLog files.
> We'll use it for comparison of auto-generated CangeLog entries.
>
> The format is documented here:
> https://gcc.gnu.org/codingconventions.html#ChangeLogs
>
> And I would recommend to install the new 'git gcc-verify' hook from:
> contrib/gcc-git-customization.sh
>
> Feel free to contact me about future troubles you'll see.

Hi, this unfortunately breaks gccgo development.  Significant parts of
the gccgo sources are simply copied from other repositories.  Those
other repositories do not use ChangeLog files.  The git commit hook
should not require ChangeLog files for those changes.  And, when the
time comes, no ChangeLog files should be created for changes in those
directories.

The directories in question are

gcc/go/gofrontend
libgo
gcc/testsuite/go.test/test

This is as documented in the README.gcc files in those directories.

How can I exempt those directories from the server hook?  Right now,
as far as I can tell, I cannot commit Go changes.  I get

remote: *** ChangeLog format failed:
remote: ERR: cannot find a ChangeLog location in message
remote:
remote: Please see: https://gcc.gnu.org/codingconventions.html#ChangeLogs
remote:
remote: error: hook declined to update refs/heads/master
To git+ssh://gcc.gnu.org/git/gcc
 ! [remote rejected] master -> master (hook declined)
error: failed to push some refs to 'git+ssh://gcc.gnu.org/git/gcc'

Thanks.

Ian


Re: ChangeLog files - server and client scripts

2020-05-21 Thread Martin Liška

On 5/21/20 11:01 PM, Jason Merrill wrote:

Why?  What is the use of requiring ChangeLog entries at all for these changes?


I must confirm a common test-suite ChangeLog entry is something like:

$ grep ':' gcc/testsuite/ChangeLog | sed 's/.*://' | sort | uniq -c | sort -n | 
tac | head -n 15
   6309  Likewise.
   1306  New test.
231  New.
 68  New testcase.
 55
 54  Ditto.
 47  New file.
 33  Same.
 27  Move into ...
 24  New tests.
 21  Add typedef for int32_t.
 19  This.  Clean up
 17  Rename to...
 16  This.
 12  ...this.

$ grep ':' gcc/testsuite/ChangeLog-2019 | sed 's/.*://' | sort | uniq -c | sort 
-n | tac | head -n 15
   2981  Likewise.
   2287  New test.
399  New testcase.
263  Same.
263  New.
217  Ditto.
111  Adjust.
 88  New file.
 62
 32  Require exceptions.
 30  Remove.
 25  New
 20  Update test.
 17  New tests.
 15  Add

$ grep ':' gcc/testsuite/ChangeLog-2018 | sed 's/.*://' | sort | uniq -c | sort 
-n | tac | head -n 15
   5071  Likewise.
   2071  New test.
443  New.
413  New testcase.
395  Remove.
256  Ditto.
224  Same.
108  New file.
 66  Likwise.
 65  Adjust.
 53
 52  Dito.
 39  Add -flinker-output=nolto-rel.
 32  New test case.
 26  Delete testcase.

So I'm open for relaxation of the rule.
What about the others?

Martin


Re: ChangeLog files - server and client scripts

2020-05-21 Thread Jason Merrill via Gcc-patches
On Thu, May 21, 2020 at 4:27 PM Martin Liška  wrote:

> On 5/21/20 9:51 PM, Jason Merrill wrote:
> > Modified.  Adjustments to expected errors in testcases don't seem to me
> worth documenting in a ChangeLog.
>
> I see. As Jakub mentioned, I would keep the hook stricter for now.
>

Why?  What is the use of requiring ChangeLog entries at all for these
changes?

Jason


Re: ChangeLog files - server and client scripts

2020-05-21 Thread Martin Liška

On 5/21/20 9:51 PM, Jason Merrill wrote:

Modified.  Adjustments to expected errors in testcases don't seem to me worth 
documenting in a ChangeLog.


I see. As Jakub mentioned, I would keep the hook stricter for now.

Martin


Re: ChangeLog files - server and client scripts

2020-05-21 Thread Jason Merrill via Gcc-patches
On Thu, May 21, 2020 at 2:58 PM Martin Liška  wrote:

> On 5/21/20 8:52 PM, Jason Merrill wrote:
> > Was there a decision somewhere to require ChangeLog entries for all
> testcase changes now, as the hook is enforcing?  They were optional before.
>
> Right now we ignore newly added test-case, these don't have to be
> mentioned.
> Can you please attach the patch (git format-patch)?
>
> Are you talking about modified or delete test-cases? If so, we can
> definitely
> relax the rules..
>

Modified.  Adjustments to expected errors in testcases don't seem to me
worth documenting in a ChangeLog.
From c5a15303c57171b5b284b7a8ec0eb97f991779d6 Mon Sep 17 00:00:00 2001
From: Jason Merrill 
Date: Thu, 21 May 2020 10:27:11 -0400
Subject: [PATCH 1/4] c++: Improve error-recovery for parms.
To: gcc-patches@gcc.gnu.org

If a parameter is erroneous, we currently drop it, leading to "too many
arguments" errors later.  Treating the function as (...) avoids those
errors.

gcc/cp/ChangeLog
2020-05-21  Jason Merrill  

	* decl.c (grokparms): Return NULL_TREE if any parms were erroneous.
---
 gcc/cp/decl.c| 18 +-
 gcc/testsuite/g++.dg/parse/error33.C |  4 ++--
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 024ddc88a4c..a389579ee52 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -13961,7 +13961,10 @@ grokparms (tree parmlist, tree *parms)
 	break;
 
   if (! decl || TREE_TYPE (decl) == error_mark_node)
-	continue;
+	{
+	  any_error = 1;
+	  continue;
+	}
 
   type = TREE_TYPE (decl);
   if (VOID_TYPE_P (type))
@@ -14014,7 +14017,8 @@ grokparms (tree parmlist, tree *parms)
 	  TREE_TYPE (decl) = type;
 	}
 	  else if (abstract_virtuals_error (decl, type))
-	any_error = 1;  /* Seems like a good idea.  */
+	/* Ignore any default argument.  */
+	init = NULL_TREE;
 	  else if (cxx_dialect < cxx17 && INDIRECT_TYPE_P (type))
 	{
 	  /* Before C++17 DR 393:
@@ -14043,9 +14047,7 @@ grokparms (tree parmlist, tree *parms)
 			 decl, t);
 	}
 
-	  if (any_error)
-	init = NULL_TREE;
-	  else if (init && !processing_template_decl)
+	  if (init && !processing_template_decl)
 	init = check_default_argument (decl, init, tf_warning_or_error);
 	}
 
@@ -14058,6 +14060,12 @@ grokparms (tree parmlist, tree *parms)
   if (parm)
 result = chainon (result, void_list_node);
   *parms = decls;
+  if (any_error)
+result = NULL_TREE;
+
+  if (any_error)
+/* We had parm errors, recover by giving the function (...) type.  */
+result = NULL_TREE;
 
   return result;
 }
diff --git a/gcc/testsuite/g++.dg/parse/error33.C b/gcc/testsuite/g++.dg/parse/error33.C
index 0d25386a879..61b0cc3f2dc 100644
--- a/gcc/testsuite/g++.dg/parse/error33.C
+++ b/gcc/testsuite/g++.dg/parse/error33.C
@@ -8,9 +8,9 @@ struct A
 
 typedef void (A::T)(); /* { dg-error "15:typedef name may not be a nested" } */
 
-void bar(T); /* { dg-message "note: declared here" } */
+void bar(T);
 
 void baz()
 {
-  bar(::foo); /* { dg-error "too many arguments" } */
+  bar(::foo);
 }
-- 
2.18.1



Re: ChangeLog files - server and client scripts

2020-05-21 Thread Martin Liška

On 5/21/20 8:52 PM, Jason Merrill wrote:

Was there a decision somewhere to require ChangeLog entries for all testcase 
changes now, as the hook is enforcing?  They were optional before.


Right now we ignore newly added test-case, these don't have to be mentioned.
Can you please attach the patch (git format-patch)?

Are you talking about modified or delete test-cases? If so, we can definitely
relax the rules..

Martin


Re: ChangeLog files - server and client scripts

2020-05-21 Thread Jakub Jelinek via Gcc-patches
On Thu, May 21, 2020 at 02:52:37PM -0400, Jason Merrill wrote:
> Was there a decision somewhere to require ChangeLog entries for all
> testcase changes now, as the hook is enforcing?  They were optional before.
> 
> remote: *** ChangeLog format failed:
> remote: ERR: changed file not mentioned in a
> ChangeLog:"gcc/testsuite/g++.dg/parse/error33.C"

They are optional for newly added testcases (even other new files); for that
it will add : New test. or something similar, Martin knows the details.

But right now they are not optional if an existing file is modified, because
in that case no script can (easily) find out what to say about it,
: Some change.
would be too useless/fuzzy.

Jakub



Re: ChangeLog files - server and client scripts

2020-05-21 Thread Jason Merrill via Gcc-patches
Was there a decision somewhere to require ChangeLog entries for all
testcase changes now, as the hook is enforcing?  They were optional before.

remote: *** ChangeLog format failed:
remote: ERR: changed file not mentioned in a
ChangeLog:"gcc/testsuite/g++.dg/parse/error33.C"

On Thu, May 21, 2020 at 11:38 AM Rainer Orth 
wrote:

> Hi Martin,
>
> >> two comments:
> >>
> >> * Can you please avoid the use grey highlighting in that section?  Black
> >>script on a grey background is already hard to read for someone with
> >>reasonable vision.  I suspect it will be much harder for
> >>vision-impaired people.
> >
> > You are right, I fixed that.
>
> thanks.
>
> >> * In changelog_location, you allow only (among others) "a/b/c/" and
> >>"\ta/b/c/".  Please also accept the "a/b/c:" and "\ta/b/c:" forms
> >>here: especially the second seems quite common.
> >
> > Sure, can you please link some git revisions that use the format?
>
> Apart from using it myself ;-), I've seen it several times, but no
> examples off-hand.  However, it seems only consistent with the forms
> ending in /ChangeLog where you allow the trailing colon, too.
>
> Rainer
>
> --
>
> -
> Rainer Orth, Center for Biotechnology, Bielefeld University
>
>


Re: ChangeLog files - server and client scripts

2020-05-21 Thread Rainer Orth
Hi Martin,

>> two comments:
>>
>> * Can you please avoid the use grey highlighting in that section?  Black
>>script on a grey background is already hard to read for someone with
>>reasonable vision.  I suspect it will be much harder for
>>vision-impaired people.
>
> You are right, I fixed that.

thanks.

>> * In changelog_location, you allow only (among others) "a/b/c/" and
>>"\ta/b/c/".  Please also accept the "a/b/c:" and "\ta/b/c:" forms
>>here: especially the second seems quite common.
>
> Sure, can you please link some git revisions that use the format?

Apart from using it myself ;-), I've seen it several times, but no
examples off-hand.  However, it seems only consistent with the forms
ending in /ChangeLog where you allow the trailing colon, too.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: ChangeLog files - server and client scripts

2020-05-21 Thread Martin Liška

On 5/21/20 5:14 PM, Rainer Orth wrote:

Hi Martin,


We've just installed server git hooks that verify git messages
for a correct ChangeLog format. For a limited time period, please
still apply ChangeLog changes to the corresponding ChangeLog files.
We'll use it for comparison of auto-generated CangeLog entries.

The format is documented here:
https://gcc.gnu.org/codingconventions.html#ChangeLogs


two comments:

* Can you please avoid the use grey highlighting in that section?  Black
   script on a grey background is already hard to read for someone with
   reasonable vision.  I suspect it will be much harder for
   vision-impaired people.


You are right, I fixed that.



* In changelog_location, you allow only (among others) "a/b/c/" and
   "\ta/b/c/".  Please also accept the "a/b/c:" and "\ta/b/c:" forms
   here: especially the second seems quite common.


Sure, can you please link some git revisions that use the format?

Thanks,
Martin



Thanks.
 Rainer





Re: ChangeLog files - server and client scripts

2020-05-21 Thread Rainer Orth
Hi Martin,

> We've just installed server git hooks that verify git messages
> for a correct ChangeLog format. For a limited time period, please
> still apply ChangeLog changes to the corresponding ChangeLog files.
> We'll use it for comparison of auto-generated CangeLog entries.
>
> The format is documented here:
> https://gcc.gnu.org/codingconventions.html#ChangeLogs

two comments:

* Can you please avoid the use grey highlighting in that section?  Black
  script on a grey background is already hard to read for someone with
  reasonable vision.  I suspect it will be much harder for
  vision-impaired people.

* In changelog_location, you allow only (among others) "a/b/c/" and
  "\ta/b/c/".  Please also accept the "a/b/c:" and "\ta/b/c:" forms
  here: especially the second seems quite common.

Thanks.
Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: ChangeLog files - server and client scripts (git cherry-pick)

2020-05-20 Thread Richard Earnshaw
On 20/05/2020 10:27, Jakub Jelinek via Gcc wrote:
> On Wed, May 20, 2020 at 11:19:49AM +0200, Thomas Koenig wrote:
>> Hm, one question: I find the r11-1234 type commit to be much more
>> readable, in ChangeLog files and everywhere else.
>>
>> Would it be possible to have that format instead of
>> "cherry picked from commit $HEX_SOUP" ?
> 
> I think if you git cherry-pick -x r11-1234-g123bcdef1234
> then it will show up in the commit message rather than just
> 123bcdef1234.  That command will not accept just r11-1234,
> as that is not a valid git commit-ish, so you'd need to do
> git cherry-pick -x `git gcc-undescr r11-1234`
> and then it would show just hash, or
> git cherry-pick -x `git gcc-descr --full $(git gcc-undescr r11-1234)`
> and then I think it should show up as that r11-1234-g
> 
>   Jakub
> 

Do I smell a git gcc-pick alias?

R.


Re: ChangeLog files - server and client scripts (git cherry-pick)

2020-05-20 Thread Jakub Jelinek via Gcc-patches
On Wed, May 20, 2020 at 11:19:49AM +0200, Thomas Koenig wrote:
> Hm, one question: I find the r11-1234 type commit to be much more
> readable, in ChangeLog files and everywhere else.
> 
> Would it be possible to have that format instead of
> "cherry picked from commit $HEX_SOUP" ?

I think if you git cherry-pick -x r11-1234-g123bcdef1234
then it will show up in the commit message rather than just
123bcdef1234.  That command will not accept just r11-1234,
as that is not a valid git commit-ish, so you'd need to do
git cherry-pick -x `git gcc-undescr r11-1234`
and then it would show just hash, or
git cherry-pick -x `git gcc-descr --full $(git gcc-undescr r11-1234)`
and then I think it should show up as that r11-1234-g

Jakub



Re: ChangeLog files - server and client scripts (git cherry-pick)

2020-05-20 Thread Martin Liška

On 5/20/20 11:19 AM, Thomas Koenig wrote:

Hm, one question: I find the r11-1234 type commit to be much more
readable, in ChangeLog files and everywhere else.

Would it be possible to have that format instead of
"cherry picked from commit $HEX_SOUP" ?


I'm not aware of how to do it.
Please let's keep it simple as possible (cherry-pick -x). You can
always adjust the commit message and mention a r11-1234 revision
there.

Martin


Re: ChangeLog files - server and client scripts (git cherry-pick)

2020-05-20 Thread Thomas Koenig via Gcc-patches

Hm, one question: I find the r11-1234 type commit to be much more
readable, in ChangeLog files and everywhere else.

Would it be possible to have that format instead of
"cherry picked from commit $HEX_SOUP" ?


Re: ChangeLog files - server and client scripts

2020-05-20 Thread Martin Liška

On 5/20/20 12:20 AM, Jonathan Wakely wrote:

Or this one that actually adds the closing parenthesis


Thank you, it's definitely an improvement.

There's final version of the patch I've just applied.

Martin
>From a55c1018c9d7c53b643203e7f71b06953fae86a1 Mon Sep 17 00:00:00 2001
From: Jonathan Wakely 
Date: Wed, 20 May 2020 10:03:51 +0200
Subject: [PATCH] git_check_commit: shorted option name

contrib/ChangeLog:

2020-05-20  Martin Liska  

	* gcc-changelog/git_check_commit.py: Change
	--allow-non-strict-mode to --non-strict-mode.
---
 contrib/gcc-changelog/git_check_commit.py | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/contrib/gcc-changelog/git_check_commit.py b/contrib/gcc-changelog/git_check_commit.py
index 8553c90a96f..2601ae4f613 100755
--- a/contrib/gcc-changelog/git_check_commit.py
+++ b/contrib/gcc-changelog/git_check_commit.py
@@ -28,14 +28,14 @@ parser.add_argument('-g', '--git-path', default='.',
 help='Path to git repository')
 parser.add_argument('-p', '--print-changelog', action='store_true',
 help='Print final changelog entires')
-parser.add_argument('-n', '--allow-non-strict-mode', action='store_true',
-help='Allow non-strict mode (change in both ChangeLog and '
-'other files.')
+parser.add_argument('-n', '--non-strict-mode', action='store_true',
+help='Use non-strict mode (allow changes in ChangeLog and '
+'other automatically updated files).')
 args = parser.parse_args()
 
 retval = 0
 for git_commit in parse_git_revisions(args.git_path, args.revisions,
-  not args.allow_non_strict_mode):
+  not args.non_strict_mode):
 res = 'OK' if git_commit.success else 'FAILED'
 print('Checking %s: %s' % (git_commit.hexsha, res))
 if git_commit.success:
-- 
2.26.2



Re: ChangeLog files - server and client scripts (git cherry-pick)

2020-05-20 Thread Martin Liška

On 5/14/20 2:42 PM, Martin Liška wrote:

Hello.

I'm sending patch candidate that adds 2 new git aliases:
- gcc-backport - simple alias to 'git cherry-pick -x'
- gcc-revert - it similarly appends '(this reverts commit 
365e3cde4978c6a7dbfa50865720226254c016be)'
to a reverted commit message

The script normally parses content of a git message and adds corresponding 
'Revert:' or
'Backport from master:' lines. Right now, there's missing date of the original 
commit and
author. I hope it's acceptable.

Thoughts?
Martin


Hello.

I'm going to install the following patch that will allow '(cherry picked from 
commit hash)' line.
Generated ChangeLog entry will look the same as the original one (No Backported 
from leading lines).
Apart from that, I'm adding 'git gcc-backport' which is simple alias for 
'cherry-pick -x'.

Martin

>From 5394cd8d0ec4aa774228bff1687cdace5cdc7552 Mon Sep 17 00:00:00 2001
From: Martin Liska 
Date: Wed, 20 May 2020 09:49:48 +0200
Subject: [PATCH] Add gcc-backport and support git cherry pick.

Unknown ChangeLog:

2020-05-20  Martin Liska  

	* contrib/gcc-changelog/git_commit.py: Support cherry pick
	prefix.
	* contrib/gcc-changelog/test_email.py: Test it.
	* contrib/gcc-changelog/test_patches.txt: Add new patch.
	* contrib/gcc-git-customization.sh: Add gcc-backport.
---
 contrib/gcc-changelog/git_commit.py|  3 +++
 contrib/gcc-changelog/test_email.py|  4 
 contrib/gcc-changelog/test_patches.txt | 29 ++
 contrib/gcc-git-customization.sh   |  1 +
 4 files changed, 37 insertions(+)

diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py
index f6b9c5b1586..5cc8c4f5935 100755
--- a/contrib/gcc-changelog/git_commit.py
+++ b/contrib/gcc-changelog/git_commit.py
@@ -150,6 +150,7 @@ star_prefix_regex = re.compile(r'\t\*(?P\ *)(?P.*)')
 LINE_LIMIT = 100
 TAB_WIDTH = 8
 CO_AUTHORED_BY_PREFIX = 'co-authored-by: '
+CHERRY_PICK_PREFIX = '(cherry picked from commit '
 
 
 class Error:
@@ -349,6 +350,8 @@ class GitCommit:
 author = self.format_git_author(name)
 self.co_authors.append(author)
 continue
+elif line.startswith(CHERRY_PICK_PREFIX):
+continue
 
 # ChangeLog name will be deduced later
 if not last_entry:
diff --git a/contrib/gcc-changelog/test_email.py b/contrib/gcc-changelog/test_email.py
index 03abc763212..5e99d3240e8 100755
--- a/contrib/gcc-changelog/test_email.py
+++ b/contrib/gcc-changelog/test_email.py
@@ -258,3 +258,7 @@ class TestGccChangelog(unittest.TestCase):
 email = self.from_patch_glob('0020-IPA-Avoid')
 assert (email.errors[0].message
 == 'first line should start with a tab, asterisk and space')
+
+def test_cherry_pick_format(self):
+email = self.from_patch_glob('0001-c-Alias.patch')
+assert not email.errors
diff --git a/contrib/gcc-changelog/test_patches.txt b/contrib/gcc-changelog/test_patches.txt
index 39e4753c0ab..ec667be9a92 100644
--- a/contrib/gcc-changelog/test_patches.txt
+++ b/contrib/gcc-changelog/test_patches.txt
@@ -2382,3 +2382,32 @@ index 000..66c87d48694
 -- 
 2.26.1
 
+=== 0001-c-Alias.patch ===
+From 3f1a149fc35cdba988464562e2fb824b10652d6b Mon Sep 17 00:00:00 2001
+From: Nathan Sidwell 
+Date: Tue, 19 May 2020 13:29:19 -0700
+Subject: [PATCH] c++: Alias template instantiation template info
+
+I discovered that the alias instantiation machinery would setup
+template_info, and then sometime later overwrite that with equivalent
+info.  This broke modules, because the template info, once set, is
+logically immutable.  Let's just not do that.
+
+	* pt.c (lookup_template_class_1): Do not reinit template_info of an
+	alias here.
+
+(cherry picked from commit 74744bb1f2847b5b9ce3e97e0fec9c23bb0e499f)
+---
+ gcc/cp/pt.c | 17 +++--
+ 1 file changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
+index b8f03d18541..7230ac724ba 100644
+--- a/gcc/cp/pt.c
 b/gcc/cp/pt.c
+@@ -1 +1,2 @@
+
++
+-- 
+2.26.2
+
diff --git a/contrib/gcc-git-customization.sh b/contrib/gcc-git-customization.sh
index 91d378ba32a..7a950ae5f38 100755
--- a/contrib/gcc-git-customization.sh
+++ b/contrib/gcc-git-customization.sh
@@ -26,6 +26,7 @@ git config alias.gcc-descr \!"f() { if test \${1:-no} = --full; then c=\${2:-mas
 git config alias.gcc-undescr \!"f() { o=\$(git config --get gcc-config.upstream); r=\$(echo \$1 | sed -n 's,^r\\([0-9]\\+\\)-[0-9]\\+\$,\\1,p'); n=\$(echo \$1 | sed -n 's,^r[0-9]\\+-\\([0-9]\\+\\)\$,\\1,p'); test -z \$r && echo Invalid id \$1 && exit 1; h=\$(git rev-parse --verify --quiet \${o:-origin}/releases/gcc-\$r); test -z \$h && h=\$(git rev-parse --verify --quiet \${o:-origin}/master); p=\$(git describe --all --match 'basepoints/gcc-'\$r \$h | sed -n 

Re: ChangeLog files - server and client scripts

2020-05-19 Thread Jonathan Wakely via Gcc-patches
On Tue, 19 May 2020 at 23:19, Jonathan Wakely  wrote:
>
> On Tue, 19 May 2020 at 11:44, Martin Liška  wrote:
> >
> > Hello.
> >
> > We've just installed server git hooks that verify git messages
> > for a correct ChangeLog format. For a limited time period, please
> > still apply ChangeLog changes to the corresponding ChangeLog files.
> > We'll use it for comparison of auto-generated CangeLog entries.
> >
> > The format is documented here:
> > https://gcc.gnu.org/codingconventions.html#ChangeLogs
> >
> > And I would recommend to install the new 'git gcc-verify' hook from:
> > contrib/gcc-git-customization.sh
> >
> > Feel free to contact me about future troubles you'll see.
>
> The --allow-non-strict-mode option seems unnecessarily verbose. It's
> not allowing non-strict mode, it's enabling it. Would --non-strict or
> --relaxed be better?
>
> And I don't understand the help text for it. 'Use non-strict mode
> (change in both ChangeLog and other files.' It seems that non-strict
> mode allows changes to certain "project files" that are not supposed
> to be manually edited, but I can't correlate that to "change in both
> ChangeLog and other files". It's also missing the closing parenthesis.
>
> Would this patch make sense?

Or this one that actually adds the closing parenthesis :-)
diff --git a/contrib/gcc-changelog/git_check_commit.py 
b/contrib/gcc-changelog/git_check_commit.py
index 8553c90a96f..4fa2bb0b4a2 100755
--- a/contrib/gcc-changelog/git_check_commit.py
+++ b/contrib/gcc-changelog/git_check_commit.py
@@ -28,9 +28,9 @@ parser.add_argument('-g', '--git-path', default='.',
 help='Path to git repository')
 parser.add_argument('-p', '--print-changelog', action='store_true',
 help='Print final changelog entires')
-parser.add_argument('-n', '--allow-non-strict-mode', action='store_true',
-help='Allow non-strict mode (change in both ChangeLog and '
-'other files.')
+parser.add_argument('-n', '--non-strict-mode', action='store_true',
+help='Use non-strict mode (allow changes in ChangeLog and '
+'other automatically updated files).')
 args = parser.parse_args()
 
 retval = 0


Re: ChangeLog files - server and client scripts

2020-05-19 Thread Jonathan Wakely via Gcc-patches
On Tue, 19 May 2020 at 11:44, Martin Liška  wrote:
>
> Hello.
>
> We've just installed server git hooks that verify git messages
> for a correct ChangeLog format. For a limited time period, please
> still apply ChangeLog changes to the corresponding ChangeLog files.
> We'll use it for comparison of auto-generated CangeLog entries.
>
> The format is documented here:
> https://gcc.gnu.org/codingconventions.html#ChangeLogs
>
> And I would recommend to install the new 'git gcc-verify' hook from:
> contrib/gcc-git-customization.sh
>
> Feel free to contact me about future troubles you'll see.

The --allow-non-strict-mode option seems unnecessarily verbose. It's
not allowing non-strict mode, it's enabling it. Would --non-strict or
--relaxed be better?

And I don't understand the help text for it. 'Use non-strict mode
(change in both ChangeLog and other files.' It seems that non-strict
mode allows changes to certain "project files" that are not supposed
to be manually edited, but I can't correlate that to "change in both
ChangeLog and other files". It's also missing the closing parenthesis.

Would this patch make sense?
diff --git a/contrib/gcc-changelog/git_check_commit.py 
b/contrib/gcc-changelog/git_check_commit.py
index 8553c90a96f..d504be9dbde 100755
--- a/contrib/gcc-changelog/git_check_commit.py
+++ b/contrib/gcc-changelog/git_check_commit.py
@@ -28,9 +28,9 @@ parser.add_argument('-g', '--git-path', default='.',
 help='Path to git repository')
 parser.add_argument('-p', '--print-changelog', action='store_true',
 help='Print final changelog entires')
-parser.add_argument('-n', '--allow-non-strict-mode', action='store_true',
-help='Allow non-strict mode (change in both ChangeLog and '
-'other files.')
+parser.add_argument('-n', '--non-strict-mode', action='store_true',
+help='Use non-strict mode (allow changes in ChangeLog and '
+'other automatically updated files.')
 args = parser.parse_args()
 
 retval = 0


Re: ChangeLog files - server and client scripts

2020-05-19 Thread Martin Liška

Hello.

We've just installed server git hooks that verify git messages
for a correct ChangeLog format. For a limited time period, please
still apply ChangeLog changes to the corresponding ChangeLog files.
We'll use it for comparison of auto-generated CangeLog entries.

The format is documented here:
https://gcc.gnu.org/codingconventions.html#ChangeLogs

And I would recommend to install the new 'git gcc-verify' hook from:
contrib/gcc-git-customization.sh

Feel free to contact me about future troubles you'll see.

Thanks,
Martin


Re: ChangeLog files - server and client scripts

2020-05-15 Thread Martin Liška

On 5/14/20 6:47 PM, Joseph Myers wrote:

On Thu, 14 May 2020, Martin Liška wrote:


On 5/13/20 7:53 PM, Joseph Myers wrote:

On Wed, 13 May 2020, Martin Liška wrote:


I'm sending the gcc-changelog relates scripts which should be added to
contrib
folder. The patch contains:
- git_check_commit.py - checking script that verifies git message format


We need a documentation patch to contribute.html or gitwrite.html that
describes the exact commit message format being used.


Sure, I'm sending patch for that.


Thanks.  There are references to author timestamps there.  The date in a
ChangeLog entry should always be a commit timestamp, not an author one, so
author timestamps present either in commit messages or in the git commit
metadata should be ignored, with only the committer timestamps from the
git commit metadata being used when generating ChangeLog files.


You are fully right, a committer date is what should be used.
Fixed in the documentation, note that the scripts use committed date.

Martin

diff --git a/htdocs/codingconventions.html b/htdocs/codingconventions.html
index f4732ef6..d2e73962 100644
--- a/htdocs/codingconventions.html
+++ b/htdocs/codingconventions.html
@@ -112,9 +112,14 @@ maintained and kept up to date.  In particular:
 
 ChangeLogs
 
-GCC requires ChangeLog entries for documentation changes; for the web
-pages (apart from java/ and libstdc++/) the CVS
-commit logs are sufficient.
+
+ChangeLog entries are part of git commit messages and are automatically put
+into a corresponding ChangeLog file.  A ChangeLog template can be easily generated
+with ./contrib/mklog script.  GCC offers a checking script that
+verifies a proper ChangeLog formatting (see git gcc-verify git alias).
+for a particular git commit.  The checking script covers most commonly used ChangeLog
+formats and the following paragraphs explain what it supports.
+
 
 See also what the http://www.gnu.org/prep/standards_toc.html;>GNU Coding
@@ -124,19 +129,95 @@ in comments rather than the ChangeLog, though a single line overall
 description of the changes may be useful above the ChangeLog entry for
 a large batch of changes.
 
-For changes that are ported from another branch, we recommend to
-use a single entry whose body contains a verbatim copy of the original
-entries describing the changes on that branch, possibly preceded by a
-single-line overall description of the changes.
+Components
+
+
+git_description - a leading text with git commit description
+committer_timestamp - line with timestamp and an author name and email (2 spaces before and after name) 
+example: 2020-04-23␣␣Martin Liska␣␣mli...@suse.cz
+additional_author - line with additional commit author name and email (starting with a tabular and 4 spaces) 
+example: \tMartin Liska␣␣mli...@suse.cz
+changelog_location - a location to a ChangeLog file 
+supported formats: a/b/c/ChangeLog, a/b/c/ChangeLog:, a/b/c/ (where ChangeLog file lives in the folder), \ta/b/c/ and a/b/c
+pr_entry - bug report reference 
+example: \tPR component/12345
+changelog_file - a modified file mentined in a ChangeLog:
+supported formats: \t* a/b/c/file.c:, \t* a/b/c/file.c (function):, \t* a/b/c/file1.c, a/b/c/file2.c:
+changelog_file_comment - line that follows a changelog_file with description of changes in the file;
+must start with \t
+co_authored_by - https://help.github.com/en/github/committing-changes-to-your-project/creating-a-commit-with-multiple-authors;>GitHub format for a Co-Authored-By
+
+
+Format rules
+
+
+git_description - optional; ends right before one of the other compoments is found
+committer_timestamp - optional; when found before a changelog_file, then it is added
+to each changelog entry
+additional_author - optional
+changelog_location - optional; parser attempts to identify ChangeLog file based
+on modified files; $changelog_location belonging to a different ChangeLog must
+be separated with an empty line
+pr_entry - optional; can contain any number of PR entries
+changelog_file - each changelog_location must contain at least one file
+changelog_file_comment - optional
+co_authored_by - optional, can contain more than one
+
+
+Documented behaviour
+
+
+a missing changelog_location file location can be deduced based on group of changelog_files
+script automatically generates missing "New file." entries for files that are added in a commit
+changed files that are not mentioned in a ChangeLog file generate an error
+similarly for unchanged files that are mentioned in a ChangeLog file
+a commit author and committer date stamp can be automatically deduced from a git commit - we recommend to use it
+co_authored_by is added to each ChangeLog entry
+a PR component is checked against list of valid components
+ChangeLog files, DATESTAMP, BASE-VER and DEV-PHASE can be modified only separately from other files
+
 

Re: ChangeLog files - server and client scripts

2020-05-14 Thread Joseph Myers
On Thu, 14 May 2020, Martin Liška wrote:

> On 5/13/20 7:53 PM, Joseph Myers wrote:
> > On Wed, 13 May 2020, Martin Liška wrote:
> > 
> > > I'm sending the gcc-changelog relates scripts which should be added to
> > > contrib
> > > folder. The patch contains:
> > > - git_check_commit.py - checking script that verifies git message format
> > 
> > We need a documentation patch to contribute.html or gitwrite.html that
> > describes the exact commit message format being used.
> 
> Sure, I'm sending patch for that.

Thanks.  There are references to author timestamps there.  The date in a 
ChangeLog entry should always be a commit timestamp, not an author one, so 
author timestamps present either in commit messages or in the git commit 
metadata should be ignored, with only the committer timestamps from the 
git commit metadata being used when generating ChangeLog files.

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: ChangeLog files - server and client scripts

2020-05-14 Thread Martin Liška

On 5/13/20 7:53 PM, Joseph Myers wrote:

On Wed, 13 May 2020, Martin Liška wrote:


I'm sending the gcc-changelog relates scripts which should be added to contrib
folder. The patch contains:
- git_check_commit.py - checking script that verifies git message format


We need a documentation patch to contribute.html or gitwrite.html that
describes the exact commit message format being used.


Sure, I'm sending patch for that.




- git_update_version.py - a replacement of
maintainer-scripts/update_version_git which
bumps DATESTAMP and generates ChangeLog entries (for now into ChangeLog.test
files)


Where does this check things out?  (The existing ~gccadmin/gcc-checkout
isn't suitable for that, it needs to stay on master to have the correct
version of maintainer-scripts rather than being switched to other
branches, though I suppose a second long-lived checkout that gets updated
automatically could be used.  If you check things out somewhere else
temporarily, it's important to be sure the checkout gets deleted
afterwards rather than having multiple checkouts accumulating.  That's
especially the case if you use a checkout in /tmp as a single GCC
repository clone / checkout uses a significant proportion of the free
space on the root filesystem; /sourceware/snapshot-tmp/gcc has more free
space for large temporary directories.)


Well, we can make a proper git clone of the original repository that will
be used for the daily bumps. I bet we'll have a place for one more clone?




The second part is git hook that will reject all commits for release and
master branches.
that violate ChangeLog format. Right now, strict mode is disabled in the
hooks.


Note that the present state of having GCC-specific patches to the git
hooks is supposed to be a temporary one; we want to move to all relevant
GCC-specific configuration being in refs/meta/config rather than custom
code, so GCC and sourceware can share a single instance of the hooks which
in turn can use the same code as in the upstream AdaCore repository, so
that future updates of the hooks from upstream are easier.  See the issues
I filed at https://github.com/AdaCore/git-hooks/issues for the existing
custom GCC changes and the pull request
https://github.com/AdaCore/git-hooks/pull/12 to bring in implementations
of many of those features (not sure if it covers everything or not).  So
it's important to consider how these checks could be implemented without
needing GCC-specific code directly in these hooks (for example, using the
new hooks.update-hook mechanism added by one of the commits in that pull
request, or getting extra features added to the upstream hooks in a
generic form if necessary).



I welcome the attempt to unify the hooks with AdaCore upstream. I believe this
should not block gcc-changelog attempt now. Later on, we can add it to
hooks.update-hook mechanism.

Thanks,
Martin
diff --git a/htdocs/codingconventions.html b/htdocs/codingconventions.html
index f4732ef6..ffa6db32 100644
--- a/htdocs/codingconventions.html
+++ b/htdocs/codingconventions.html
@@ -112,9 +112,14 @@ maintained and kept up to date.  In particular:
 
 ChangeLogs
 
-GCC requires ChangeLog entries for documentation changes; for the web
-pages (apart from java/ and libstdc++/) the CVS
-commit logs are sufficient.
+
+ChangeLog entries are part of git commit messages and are automatically put
+into a corresponding ChangeLog file.  A ChangeLog template can be easily generated
+with ./contrib/mklog script.  GCC offers a checking script that
+verifies a proper ChangeLog formatting (see git gcc-verify git alias).
+for a particular git commit.  The checking script covers most commonly used ChangeLog
+formats and the following paragraphs explain what it supports.
+
 
 See also what the http://www.gnu.org/prep/standards_toc.html;>GNU Coding
@@ -124,19 +129,95 @@ in comments rather than the ChangeLog, though a single line overall
 description of the changes may be useful above the ChangeLog entry for
 a large batch of changes.
 
-For changes that are ported from another branch, we recommend to
-use a single entry whose body contains a verbatim copy of the original
-entries describing the changes on that branch, possibly preceded by a
-single-line overall description of the changes.
+Components
+
+
+git_description - a leading text with git commit description
+author_timestamp - line with timestamp and an author name and email (2 spaces before and after name) 
+example: 2020-04-23␣␣Martin Liska␣␣mli...@suse.cz
+additional_author - line with additional commit author name and email (starting with a tabular and 4 spaces) 
+example: \tMartin Liska␣␣mli...@suse.cz
+changelog_location - a location to a ChangeLog file 
+supported formats: a/b/c/ChangeLog, a/b/c/ChangeLog:, a/b/c/ (where ChangeLog file lives in the folder), \ta/b/c/ and a/b/c
+pr_entry - bug report reference 
+example: \tPR component/12345
+changelog_file - a modified file 

Re: ChangeLog files - server and client scripts (git cherry-pick)

2020-05-14 Thread Martin Liška

Hello.

I'm sending patch candidate that adds 2 new git aliases:
- gcc-backport - simple alias to 'git cherry-pick -x'
- gcc-revert - it similarly appends '(this reverts commit 
365e3cde4978c6a7dbfa50865720226254c016be)'
to a reverted commit message

The script normally parses content of a git message and adds corresponding 
'Revert:' or
'Backport from master:' lines. Right now, there's missing date of the original 
commit and
author. I hope it's acceptable.

Thoughts?
Martin
>From fd916394f66831ebe8f5cadb455d559aa3917fc3 Mon Sep 17 00:00:00 2001
From: Martin Liska 
Date: Thu, 14 May 2020 14:34:18 +0200
Subject: [PATCH] gcc-changelog: introduce gcc-revert and gcc-backport.

contrib/ChangeLog:

2020-05-14  Martin Liska  

	* gcc-changelog/git_commit.py: Add support
	for CHERRY_PICK_PREFIX and REVERT_PREFIX.
	* gcc-changelog/test_email.py: Add 2 new tests.
	* gcc-changelog/test_patches.txt: Add 2 patches.
	* gcc-git-customization.sh: Add gcc-backport and
	gcc-revert aliases.
---
 contrib/gcc-changelog/git_commit.py| 46 ++
 contrib/gcc-changelog/test_email.py| 14 
 contrib/gcc-changelog/test_patches.txt | 88 ++
 contrib/gcc-git-customization.sh   |  3 +
 4 files changed, 140 insertions(+), 11 deletions(-)

diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py
index 5214cc36538..bf82f6206b6 100755
--- a/contrib/gcc-changelog/git_commit.py
+++ b/contrib/gcc-changelog/git_commit.py
@@ -150,6 +150,8 @@ star_prefix_regex = re.compile(r'\t\*(?P\ *)(?P.*)')
 LINE_LIMIT = 100
 TAB_WIDTH = 8
 CO_AUTHORED_BY_PREFIX = 'co-authored-by: '
+CHERRY_PICK_PREFIX = '(cherry picked from commit '
+REVERT_PREFIX = '(this reverts commit '
 
 
 class Error:
@@ -221,6 +223,8 @@ class GitCommit:
 self.top_level_authors = []
 self.co_authors = []
 self.top_level_prs = []
+self.cherry_pick = False
+self.revert = False
 
 project_files = [f for f in self.modified_files
  if self.is_changelog_filename(f[0])
@@ -372,7 +376,11 @@ class GitCommit:
 last_entry.author_lines.append(author_tuple)
 continue
 
-if not line.startswith('\t'):
+if line.startswith(CHERRY_PICK_PREFIX):
+self.cherry_pick = True
+elif line.startswith(REVERT_PREFIX):
+self.revert = True
+elif not line.startswith('\t'):
 err = Error('line should start with a tab', line)
 self.errors.append(err)
 elif pr_line:
@@ -500,24 +508,40 @@ class GitCommit:
 err = Error(msg % (entry.folder, changelog_location), file)
 self.errors.append(err)
 
+@classmethod
+def format_authors_in_changelog(cls, authors, timestamp, prefix=''):
+output = ''
+for i, author in enumerate(authors):
+if i == 0:
+output += '%s%s  %s\n' % (prefix, timestamp, author)
+else:
+output += '%s\t%s\n' % (prefix, author)
+output += '\n'
+return output
+
 def to_changelog_entries(self):
+current_timestamp = self.date.strftime('%Y-%m-%d')
 for entry in self.changelog_entries:
 output = ''
 timestamp = entry.datetime
 if not timestamp:
 timestamp = self.date.strftime('%Y-%m-%d')
 authors = entry.authors if entry.authors else [self.author]
-# add Co-Authored-By authors to all ChangeLog entries
-for author in self.co_authors:
-if author not in authors:
-authors.append(author)
-
-for i, author in enumerate(authors):
-if i == 0:
-output += '%s  %s\n' % (timestamp, author)
+if self.cherry_pick or self.revert:
+output += self.format_authors_in_changelog(authors,
+   current_timestamp)
+if self.cherry_pick:
+header = 'Backport from master'
 else:
-output += '\t%s\n' % author
-output += '\n'
+header = 'Revert'
+output += '\t%s:\n' % header
+else:
+# add Co-Authored-By authors to all ChangeLog entries
+for author in self.co_authors:
+if author not in authors:
+authors.append(author)
+
+output += self.format_authors_in_changelog(authors, timestamp)
 for pr in entry.prs:
 output += '\t%s\n' % pr
 for line in entry.lines:
diff --git a/contrib/gcc-changelog/test_email.py b/contrib/gcc-changelog/test_email.py
index 03abc763212..e1d955a9c21 100755
--- a/contrib/gcc-changelog/test_email.py
+++ 

Re: ChangeLog files - server and client scripts

2020-05-13 Thread Joseph Myers
On Wed, 13 May 2020, Martin Liška wrote:

> I'm sending the gcc-changelog relates scripts which should be added to contrib
> folder. The patch contains:
> - git_check_commit.py - checking script that verifies git message format

We need a documentation patch to contribute.html or gitwrite.html that 
describes the exact commit message format being used.

> - git_update_version.py - a replacement of
> maintainer-scripts/update_version_git which
> bumps DATESTAMP and generates ChangeLog entries (for now into ChangeLog.test
> files)

Where does this check things out?  (The existing ~gccadmin/gcc-checkout 
isn't suitable for that, it needs to stay on master to have the correct 
version of maintainer-scripts rather than being switched to other 
branches, though I suppose a second long-lived checkout that gets updated 
automatically could be used.  If you check things out somewhere else 
temporarily, it's important to be sure the checkout gets deleted 
afterwards rather than having multiple checkouts accumulating.  That's 
especially the case if you use a checkout in /tmp as a single GCC 
repository clone / checkout uses a significant proportion of the free 
space on the root filesystem; /sourceware/snapshot-tmp/gcc has more free 
space for large temporary directories.)

> The second part is git hook that will reject all commits for release and
> master branches.
> that violate ChangeLog format. Right now, strict mode is disabled in the
> hooks.

Note that the present state of having GCC-specific patches to the git 
hooks is supposed to be a temporary one; we want to move to all relevant 
GCC-specific configuration being in refs/meta/config rather than custom 
code, so GCC and sourceware can share a single instance of the hooks which 
in turn can use the same code as in the upstream AdaCore repository, so 
that future updates of the hooks from upstream are easier.  See the issues 
I filed at https://github.com/AdaCore/git-hooks/issues for the existing 
custom GCC changes and the pull request 
https://github.com/AdaCore/git-hooks/pull/12 to bring in implementations 
of many of those features (not sure if it covers everything or not).  So 
it's important to consider how these checks could be implemented without 
needing GCC-specific code directly in these hooks (for example, using the 
new hooks.update-hook mechanism added by one of the commits in that pull 
request, or getting extra features added to the upstream hooks in a 
generic form if necessary).

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: ChangeLog files - server and client scripts

2020-05-13 Thread Martin Liška

On 5/13/20 3:24 PM, Richard Earnshaw wrote:

I've just realized this doesn't give us an easy way to mark changes for
the root-level ChangeLog file, unless, perhaps "@@ CL ." works?


This works fine:
'ChangeLog:'

as seen for instance here:

commit 9ad3c1d81c129fc76594b9df5b798c380cbf03ee
Author: Stefan Schulze Frielinghaus 
Date:   Wed Apr 22 09:20:08 2020 +0200

MAINTAINERS: add myself for write after approval

ChangeLog:

2020-04-22  Stefan Schulze Frielinghaus  

* MAINTAINERS (Write After Approval): add myself


Martin


Re: ChangeLog files - server and client scripts

2020-05-13 Thread Richard Earnshaw
On 13/05/2020 12:05, Martin Liška wrote:
> Hi.
> 
> I'm sending the gcc-changelog relates scripts which should be added to
> contrib
> folder. The patch contains:
> - git_check_commit.py - checking script that verifies git message format
> - git_update_version.py - a replacement of
> maintainer-scripts/update_version_git which
> bumps DATESTAMP and generates ChangeLog entries (for now into
> ChangeLog.test files)
> - git_commit.py, git_email.py and git_repository.py - helper classes
> 
> I also added a new git.config alias: 'gcc-verify' which can be used in
> the following
> way:
> 
> $ git gcc-verify HEAD~2..HEAD -p -n
> Checking 0e4009e9d523270e26856d2441c1be3d8119a477
> OK
> @@CL contrib
> 2020-05-13  Martin Liska  
> 
> * gcc-changelog/git_check_commit.py: New file.
> * gcc-changelog/git_commit.py: New file.
> * gcc-changelog/git_email.py: New file.
> * gcc-changelog/git_repository.py: New file.
> * gcc-changelog/git_update_version.py: New file.
> * gcc-git-customization.sh: Add gcc-verify alias.
> @@CL
> Checking 18edc195442291525e04f0fa4d5ef972155117da
> OK
> @@CL gcc
> 2020-05-13  Jakub Jelinek  
> 
> PR debug/95080
> * cfgrtl.c (purge_dead_edges): Skip over debug and note insns even
> if the last insn is a note.
> @@CL gcc/testsuite
> 2020-05-13  Jakub Jelinek  
> 
> PR debug/95080
> * g++.dg/opt/pr95080.C: New test.
> @@CL
> 
> Note the -n option which disables _strict mode_ (modification of both
> ChangeLog
> and another files).
> 
> The second part is git hook that will reject all commits for release and
> master branches.
> that violate ChangeLog format. Right now, strict mode is disabled in the
> hooks.
> 
> What's still missing to be done is format of Revert and Backport commits.
> I suggest to use native 'git revert XYZ' and 'git cherry-pick -x XYZ'.
> Doing that the commit messages will provide link to original commit and
> the script
> can later append corresponding 'Backported ..' or 'Reverted' line.
> 
> Thoughts?
> Martin

I've just realized this doesn't give us an easy way to mark changes for
the root-level ChangeLog file, unless, perhaps "@@ CL ." works?

R.


Re: ChangeLog files - server and client scripts

2020-05-13 Thread Martin Liška

The scripts were just installed to master except the git alias.
I'm sending that in a separate patch. Now the alias can be used
from any subfolder in a gcc git repository.

Martin
>From eb47191e8d8cbbda285c4df7eb2d1e98091edab9 Mon Sep 17 00:00:00 2001
From: Martin Liska 
Date: Wed, 13 May 2020 14:32:50 +0200
Subject: [PATCH] Add gcc-verify alias.

contrib/ChangeLog:

2020-05-13  Martin Liska  

	* gcc-git-customization.sh: Add gcc-verify alias
	that uses contrib/gcc-changelog/git_check_commit.py.
---
 contrib/gcc-git-customization.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/contrib/gcc-git-customization.sh b/contrib/gcc-git-customization.sh
index a932bf8c06a..ce293d1fe42 100755
--- a/contrib/gcc-git-customization.sh
+++ b/contrib/gcc-git-customization.sh
@@ -25,6 +25,8 @@ git config alias.svn-rev '!f() { rev=$1; shift; git log --all --grep="^From-SVN:
 git config alias.gcc-descr \!"f() { if test \${1:-no} = --full; then c=\${2:-master}; r=\$(git describe --all --abbrev=40 --match 'basepoints/gcc-[0-9]*' \$c | sed -n 's,^\\(tags/\\)\\?basepoints/gcc-,r,p'); expr match \${r:-no} '^r[0-9]\\+\$' >/dev/null && r=\${r}-0-g\$(git rev-parse \${2:-master}); else c=\${1:-master}; r=\$(git describe --all --match 'basepoints/gcc-[0-9]*' \$c | sed -n 's,^\\(tags/\\)\\?basepoints/gcc-\\([0-9]\\+\\)-\\([0-9]\\+\\)-g[0-9a-f]*\$,r\\2-\\3,p;s,^\\(tags/\\)\\?basepoints/gcc-\\([0-9]\\+\\)\$,r\\2-0,p'); fi; if test -n \$r; then o=\$(git config --get gcc-config.upstream); rr=\$(echo \$r | sed -n 's,^r\\([0-9]\\+\\)-[0-9]\\+\\(-g[0-9a-f]\\+\\)\\?\$,\\1,p'); if git rev-parse --verify --quiet \${o:-origin}/releases/gcc-\$rr >/dev/null; then m=releases/gcc-\$rr; else m=master; fi; git merge-base --is-ancestor \$c \${o:-origin}/\$m && \echo \${r}; fi; }; f"
 git config alias.gcc-undescr \!"f() { o=\$(git config --get gcc-config.upstream); r=\$(echo \$1 | sed -n 's,^r\\([0-9]\\+\\)-[0-9]\\+\$,\\1,p'); n=\$(echo \$1 | sed -n 's,^r[0-9]\\+-\\([0-9]\\+\\)\$,\\1,p'); test -z \$r && echo Invalid id \$1 && exit 1; h=\$(git rev-parse --verify --quiet \${o:-origin}/releases/gcc-\$r); test -z \$h && h=\$(git rev-parse --verify --quiet \${o:-origin}/master); p=\$(git describe --all --match 'basepoints/gcc-'\$r \$h | sed -n 's,^\\(tags/\\)\\?basepoints/gcc-[0-9]\\+-\\([0-9]\\+\\)-g[0-9a-f]*\$,\\2,p;s,^\\(tags/\\)\\?basepoints/gcc-[0-9]\\+\$,0,p'); git rev-parse --verify \$h~\$(expr \$p - \$n); }; f"
 
+git config alias.gcc-verify '!f() { "`git rev-parse --show-toplevel`/contrib/gcc-changelog/git_check_commit.py" $@; } ; f'
+
 # Make diff on MD files use "(define" as a function marker.
 # Use this in conjunction with a .gitattributes file containing
 # *.mddiff=md
-- 
2.26.2



ChangeLog files - server and client scripts (git cherry-pick)

2020-05-13 Thread Martin Liška

On 5/13/20 1:05 PM, Martin Liška wrote:

I suggest to use native 'git revert XYZ' and 'git cherry-pick -x XYZ'.


I've prepared a working version of Revert format:
https://github.com/marxin/gcc-changelog/tree/cherry-pick

So using git cherry-pick -x HASH one gets something like:

$ cat patches-artificial/0001-Test-tree.h.patch
From a71eeba28ffa2427d24d5b2654e93b261980b9e3 Mon Sep 17 00:00:00 2001
From: Martin Liska 
Date: Wed, 13 May 2020 13:19:22 +0200
Subject: [PATCH] Test tree.h.

gcc/ChangeLog:

2020-01-03  Martin Liska  

PR ipa/12345
* tree.h: Just test it.

(cherry picked from commit a2bdf56b15b51c3a7bd988943bdbc42aa156f133)
---
 gcc/tree.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/tree.h b/gcc/tree.h
index 9ca9ab58ec0..99a9e1a73d9 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1,6 +1,8 @@
 /* Definitions for the ubiquitous 'tree' type for GNU compilers.
Copyright (C) 1989-2020 Free Software Foundation, Inc.
 
+

+
 This file is part of GCC.
 
 GCC is free software; you can redistribute it and/or modify it under

--
2.26.2

and the script generates:

$ ./git_email.py patches-artificial/0001-Test-tree.h.patch
OK
@@CL gcc
2020-05-13  Martin Liska  

Backport from master:
2020-01-03  Martin Liska  

PR ipa/12345
* tree.h: Just test it.
@@CL

So the datestamp and the author is taken from commit and original authors
are added after 'Backport from master' line. The script scans for the
'(cherry picked from commit' line in the message.

Benefit of the approach is that one can adjust the commit message (which 
influences
ChangeLog output).

Martin


ChangeLog files - server and client scripts

2020-05-13 Thread Martin Liška

Hi.

I'm sending the gcc-changelog relates scripts which should be added to contrib
folder. The patch contains:
- git_check_commit.py - checking script that verifies git message format
- git_update_version.py - a replacement of 
maintainer-scripts/update_version_git which
bumps DATESTAMP and generates ChangeLog entries (for now into ChangeLog.test 
files)
- git_commit.py, git_email.py and git_repository.py - helper classes

I also added a new git.config alias: 'gcc-verify' which can be used in the 
following
way:

$ git gcc-verify HEAD~2..HEAD -p -n
Checking 0e4009e9d523270e26856d2441c1be3d8119a477
OK
@@CL contrib
2020-05-13  Martin Liska  

* gcc-changelog/git_check_commit.py: New file.
* gcc-changelog/git_commit.py: New file.
* gcc-changelog/git_email.py: New file.
* gcc-changelog/git_repository.py: New file.
* gcc-changelog/git_update_version.py: New file.
* gcc-git-customization.sh: Add gcc-verify alias.
@@CL
Checking 18edc195442291525e04f0fa4d5ef972155117da
OK
@@CL gcc
2020-05-13  Jakub Jelinek  

PR debug/95080
* cfgrtl.c (purge_dead_edges): Skip over debug and note insns even
if the last insn is a note.
@@CL gcc/testsuite
2020-05-13  Jakub Jelinek  

PR debug/95080
* g++.dg/opt/pr95080.C: New test.
@@CL

Note the -n option which disables _strict mode_ (modification of both ChangeLog
and another files).

The second part is git hook that will reject all commits for release and master 
branches.
that violate ChangeLog format. Right now, strict mode is disabled in the hooks.

What's still missing to be done is format of Revert and Backport commits.
I suggest to use native 'git revert XYZ' and 'git cherry-pick -x XYZ'.
Doing that the commit messages will provide link to original commit and the 
script
can later append corresponding 'Backported ..' or 'Reverted' line.

Thoughts?
Martin
>From 0e4009e9d523270e26856d2441c1be3d8119a477 Mon Sep 17 00:00:00 2001
From: Martin Liska 
Date: Wed, 13 May 2020 12:22:39 +0200
Subject: [PATCH] Add gcc-changelog related scripts.

contrib/ChangeLog:

2020-05-13  Martin Liska  

	* gcc-changelog/git_check_commit.py: New file.
	* gcc-changelog/git_commit.py: New file.
	* gcc-changelog/git_email.py: New file.
	* gcc-changelog/git_repository.py: New file.
	* gcc-changelog/git_update_version.py: New file.
	* gcc-git-customization.sh: Add gcc-verify alias.
---
 contrib/gcc-changelog/git_check_commit.py   |  49 ++
 contrib/gcc-changelog/git_commit.py | 536 
 contrib/gcc-changelog/git_email.py  |  92 
 contrib/gcc-changelog/git_repository.py |  60 +++
 contrib/gcc-changelog/git_update_version.py | 105 
 contrib/gcc-git-customization.sh|   2 +
 6 files changed, 844 insertions(+)
 create mode 100755 contrib/gcc-changelog/git_check_commit.py
 create mode 100755 contrib/gcc-changelog/git_commit.py
 create mode 100755 contrib/gcc-changelog/git_email.py
 create mode 100755 contrib/gcc-changelog/git_repository.py
 create mode 100755 contrib/gcc-changelog/git_update_version.py

diff --git a/contrib/gcc-changelog/git_check_commit.py b/contrib/gcc-changelog/git_check_commit.py
new file mode 100755
index 000..b2d1d08a242
--- /dev/null
+++ b/contrib/gcc-changelog/git_check_commit.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python3
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3, or (at your option) any later
+# version.
+#
+# GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# .  */
+
+import argparse
+
+from git_repository import parse_git_revisions
+
+parser = argparse.ArgumentParser(description='Check git ChangeLog format '
+ 'of a commit')
+parser.add_argument('revisions',
+help='Git revisions (e.g. hash~5..hash or just hash)')
+parser.add_argument('-g', '--git-path', default='.',
+help='Path to git repository')
+parser.add_argument('-p', '--print-changelog', action='store_true',
+help='Print final changelog entires')
+parser.add_argument('-n', '--allow-non-strict-mode', action='store_true',
+help='Allow non-strict mode (change in both ChangeLog and '
+'other files.')
+args = parser.parse_args()
+
+retval = 0
+for git_commit in parse_git_revisions(args.git_path, args.revisions,
+  not args.allow_non_strict_mode):
+print('Checking %s' % git_commit.hexsha)
+if