* [PATCH] checkpatch: if no filenames then read stdin
@ 2016-07-29 22:27 Allen Hubbe
2016-07-29 22:27 ` [PATCH] checkpatch: fix perl warning about unescaped brace Allen Hubbe
2016-07-29 23:35 ` [PATCH] checkpatch: if no filenames then read stdin Joe Perches
0 siblings, 2 replies; 7+ messages in thread
From: Allen Hubbe @ 2016-07-29 22:27 UTC (permalink / raw)
To: linux-kernel; +Cc: Joe Perches, Andy Whitcroft, Andrew Morton, Allen Hubbe
If no filenames are given, then read the patch from stdin.
Signed-off-by: Allen Hubbe <allenbh@gmail.com>
---
scripts/checkpatch.pl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 90e1edc8dd42..b0659f1e9b09 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -178,9 +178,9 @@ if ($^V && $^V lt $minimum_perl_version) {
}
}
+#if no filenames are given, push '-' to read patch from stdin
if ($#ARGV < 0) {
- print "$P: no input files\n";
- exit(1);
+ push(@ARGV, '-');
}
sub hash_save_array_words {
--
2.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] checkpatch: fix perl warning about unescaped brace
2016-07-29 22:27 [PATCH] checkpatch: if no filenames then read stdin Allen Hubbe
@ 2016-07-29 22:27 ` Allen Hubbe
2016-07-29 23:06 ` Joe Perches
2016-07-29 23:35 ` [PATCH] checkpatch: if no filenames then read stdin Joe Perches
1 sibling, 1 reply; 7+ messages in thread
From: Allen Hubbe @ 2016-07-29 22:27 UTC (permalink / raw)
To: linux-kernel; +Cc: Joe Perches, Andy Whitcroft, Andrew Morton, Allen Hubbe
Perl warns:
Unescaped left brace in regex is deprecated, passed through in regex
This is explained under "Quantifiers" in perl doc:
http://perldoc.perl.org/perlre.html#Quantifiers
(If a curly bracket occurs in a context other than one of the
quantifiers listed above, where it does not form part of a backslashed
sequence like \x{...} , it is treated as a regular character. However, a
deprecation warning is raised for these occurrences, and in Perl v5.26,
literal uses of a curly bracket will be required to be escaped, say by
preceding them with a backslash ("\{" ) or enclosing them within square
brackets ("[{]" ). This change will allow for future syntax extensions
(like making the lower bound of a quantifier optional), and better error
checking of quantifiers.)
Signed-off-by: Allen Hubbe <allenbh@gmail.com>
---
scripts/checkpatch.pl | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b0659f1e9b09..7d40f4c8666a 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3520,7 +3520,7 @@ sub process {
# function brace can't be on same line, except for #defines of do while,
# or if closed on same line
if (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and
- !($line=~/\#\s*define.*do\s{/) and !($line=~/}/)) {
+ !($line=~/\#\s*define.*do\s\{/) and !($line=~/}/)) {
if (ERROR("OPEN_BRACE",
"open brace '{' following function declarations go on the next line\n" . $herecurr) &&
$fix) {
@@ -4032,12 +4032,12 @@ sub process {
## }
#need space before brace following if, while, etc
- if (($line =~ /\(.*\){/ && $line !~ /\($Type\){/) ||
- $line =~ /do{/) {
+ if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\)\{/) ||
+ $line =~ /do\{/) {
if (ERROR("SPACING",
"space required before the open brace '{'\n" . $herecurr) &&
$fix) {
- $fixed[$fixlinenr] =~ s/^(\+.*(?:do|\))){/$1 {/;
+ $fixed[$fixlinenr] =~ s/^(\+.*(?:do|\)))\{/$1 {/;
}
}
@@ -4480,7 +4480,7 @@ sub process {
$dstat !~ /^for\s*$Constant$/ && # for (...)
$dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ && # for (...) bar()
$dstat !~ /^do\s*{/ && # do {...
- $dstat !~ /^\({/ && # ({...
+ $dstat !~ /^\(\{/ && # ({...
$ctx !~ /^.\s*#\s*define\s+TRACE_(?:SYSTEM|INCLUDE_FILE|INCLUDE_PATH)\b/)
{
$ctx =~ s/\n*$//;
--
2.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] checkpatch: fix perl warning about unescaped brace
2016-07-29 22:27 ` [PATCH] checkpatch: fix perl warning about unescaped brace Allen Hubbe
@ 2016-07-29 23:06 ` Joe Perches
2016-07-29 23:57 ` Allen Hubbe
0 siblings, 1 reply; 7+ messages in thread
From: Joe Perches @ 2016-07-29 23:06 UTC (permalink / raw)
To: Allen Hubbe, linux-kernel; +Cc: Andy Whitcroft, Andrew Morton
On Fri, 2016-07-29 at 18:27 -0400, Allen Hubbe wrote:
> Perl warns:
>
> Unescaped left brace in regex is deprecated, passed through in regex
>
> This is explained under "Quantifiers" in perl doc:
> http://perldoc.perl.org/perlre.html#Quantifiers
Hey Allen.
I'm at 5.22 and don't see a warning.
For what version of perl does this warning get generated?
Only 5.24 and higher?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] checkpatch: if no filenames then read stdin
2016-07-29 22:27 [PATCH] checkpatch: if no filenames then read stdin Allen Hubbe
2016-07-29 22:27 ` [PATCH] checkpatch: fix perl warning about unescaped brace Allen Hubbe
@ 2016-07-29 23:35 ` Joe Perches
1 sibling, 0 replies; 7+ messages in thread
From: Joe Perches @ 2016-07-29 23:35 UTC (permalink / raw)
To: Allen Hubbe, linux-kernel; +Cc: Andy Whitcroft, Andrew Morton
On Fri, 2016-07-29 at 18:27 -0400, Allen Hubbe wrote:
> If no filenames are given, then read the patch from stdin.
Yes, that should work. Thanks Allen.
Acked-by: Joe Perches <joe@perches.com>
Got anymore?
> Signed-off-by: Allen Hubbe <allenbh@gmail.com>
> ---
> scripts/checkpatch.pl | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 90e1edc8dd42..b0659f1e9b09 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -178,9 +178,9 @@ if ($^V && $^V lt $minimum_perl_version) {
> }
> }
>
> +#if no filenames are given, push '-' to read patch from stdin
> if ($#ARGV < 0) {
> - print "$P: no input files\n";
> - exit(1);
> + push(@ARGV, '-');
> }
>
> sub hash_save_array_words {
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] checkpatch: fix perl warning about unescaped brace
2016-07-29 23:06 ` Joe Perches
@ 2016-07-29 23:57 ` Allen Hubbe
2016-07-30 1:41 ` Allen Hubbe
0 siblings, 1 reply; 7+ messages in thread
From: Allen Hubbe @ 2016-07-29 23:57 UTC (permalink / raw)
To: Joe Perches; +Cc: linux-kernel, Andy Whitcroft, Andrew Morton
This system has v5.22.1. I don't know exactly how this perl was
configured. I didn't see the warning on other systems. Strangely, I
don't remember seeing it yesterday on this system, either. I might
try to reproduce the warning on another system and let you know. The
warning and this fix seem to be in line with the perl documentation,
though.
perl --version
This is perl 5, version 22, subversion 1 (v5.22.1) built for
x86_64-linux-thread-multi
(with 15 registered patches, see perl -V for more detail)
cat /etc/fedora-release
Fedora release 23 (Twenty Three)
On Fri, Jul 29, 2016 at 7:06 PM, Joe Perches <joe@perches.com> wrote:
> On Fri, 2016-07-29 at 18:27 -0400, Allen Hubbe wrote:
>> Perl warns:
>>
>> Unescaped left brace in regex is deprecated, passed through in regex
>>
>> This is explained under "Quantifiers" in perl doc:
>> http://perldoc.perl.org/perlre.html#Quantifiers
>
> Hey Allen.
>
> I'm at 5.22 and don't see a warning.
> For what version of perl does this warning get generated?
> Only 5.24 and higher?
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] checkpatch: fix perl warning about unescaped brace
2016-07-29 23:57 ` Allen Hubbe
@ 2016-07-30 1:41 ` Allen Hubbe
2016-07-30 1:51 ` Joe Perches
0 siblings, 1 reply; 7+ messages in thread
From: Allen Hubbe @ 2016-07-30 1:41 UTC (permalink / raw)
To: Joe Perches; +Cc: linux-kernel, Andy Whitcroft, Andrew Morton
On Fri, Jul 29, 2016 at 7:57 PM, Allen Hubbe <allenbh@gmail.com> wrote:
> On Fri, Jul 29, 2016 at 7:06 PM, Joe Perches <joe@perches.com> wrote:
>> On Fri, 2016-07-29 at 18:27 -0400, Allen Hubbe wrote:
>>> Perl warns:
>>>
>>> Unescaped left brace in regex is deprecated, passed through in regex
>>>
>>> This is explained under "Quantifiers" in perl doc:
>>> http://perldoc.perl.org/perlre.html#Quantifiers
>>
>> Hey Allen.
>>
>> I'm at 5.22 and don't see a warning.
>> For what version of perl does this warning get generated?
>> Only 5.24 and higher?
>
> This system has v5.22.1. I don't know exactly how this perl was
> configured. I didn't see the warning on other systems. Strangely, I
> don't remember seeing it yesterday on this system, either. I might
> try to reproduce the warning on another system and let you know. The
> warning and this fix seem to be in line with the perl documentation,
> though.
>
> perl --version
>
> This is perl 5, version 22, subversion 1 (v5.22.1) built for
> x86_64-linux-thread-multi
> (with 15 registered patches, see perl -V for more detail)
>
> cat /etc/fedora-release
> Fedora release 23 (Twenty Three)
Mystery solved... and drop this patch.
My 'master' on this system was set to an old ref, v4.2-rc1. There are
no perl warnings as of v4.7.
docker pull fedora
docker run -it --rm fedora /bin/bash
dnf install wget perl perl-Term-ANSIColor perl-Getopt-Long
wget https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/scripts/checkpatch.pl
perl -c checkpatch.pl
huh... no errors :-/
wget https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/scripts/checkpatch.pl?h=v4.2-rc1
perl -c checkpatch.pl\?h\=v4.2-rc1
Unescaped left brace in regex is deprecated, passed through in regex;
marked by <-- HERE in m/\#\s*define.*do\s{ <-- HERE / at
checkpatch.pl?h=v4.2-rc1 line 3523.
Unescaped left brace in regex is deprecated, passed through in regex;
marked by <-- HERE in m/\(.*\){ <-- HERE / at checkpatch.pl?h=v4.2-rc1
line 4035.
Unescaped left brace in regex is deprecated, passed through in regex;
marked by <-- HERE in m/do{ <-- HERE / at checkpatch.pl?h=v4.2-rc1
line 4036.
Unescaped left brace in regex is deprecated, passed through in regex;
marked by <-- HERE in m/^\({ <-- HERE / at checkpatch.pl?h=v4.2-rc1
line 4483.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] checkpatch: fix perl warning about unescaped brace
2016-07-30 1:41 ` Allen Hubbe
@ 2016-07-30 1:51 ` Joe Perches
0 siblings, 0 replies; 7+ messages in thread
From: Joe Perches @ 2016-07-30 1:51 UTC (permalink / raw)
To: Allen Hubbe; +Cc: linux-kernel, Andy Whitcroft, Andrew Morton
On Fri, 2016-07-29 at 21:41 -0400, Allen Hubbe wrote:
> Mystery solved... and drop this patch.
>
> My 'master' on this system was set to an old ref, v4.2-rc1. There are
> no perl warnings as of v4.7.
OK great, thanks.
I had just built and tested with 5.24 and didn't see
any warnings and wondered a bit.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-07-30 1:51 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-29 22:27 [PATCH] checkpatch: if no filenames then read stdin Allen Hubbe
2016-07-29 22:27 ` [PATCH] checkpatch: fix perl warning about unescaped brace Allen Hubbe
2016-07-29 23:06 ` Joe Perches
2016-07-29 23:57 ` Allen Hubbe
2016-07-30 1:41 ` Allen Hubbe
2016-07-30 1:51 ` Joe Perches
2016-07-29 23:35 ` [PATCH] checkpatch: if no filenames then read stdin Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).