scripts/checkpatch.pl - fix *_NOTIFIER_HEAD handling
PATCH 1/1 scripts/checkpatch.pl - fix *_NOTIFIER_HEAD handling
commit 81398d99e9de80d9dbe65dfe7aadec9497f88242
Author: Gilad Ben-Yossef <[email protected]> Date: Wed Jul 31 14:44:23 2019 +1000
checkpatch: add *_NOTIFIER_HEAD as var definition
has a typo, resulting in a truly amazing error message:
Unescaped left brace in regex is passed through in regex; marked by <-- HERE in m/(?:
\n.}\s*$|
^.DEFINE_(?^x:
[A-Za-z_][A-Za-z\d_]*
(?:\s*\#\#\s*[A-Za-z_][A-Za-z\d_]*)*
)\(rtl_usb_probe\)|
^.DECLARE_(?^x:
[A-Za-z_][A-Za-z\d_]*
(?:\s*\#\#\s*[A-Za-z_][A-Za-z\d_]*)*
)\(rtl_usb_probe\)|
^.LIST_HEAD\(rtl_usb_probe\)|
^.{ <-- HERE (?^x:
[A-Za-z_][A-Za-z\d_]*
(?:\s*\#\#\s*[A-Za-z_][A-Za-z\d_]*)*
)}_NOTIFIER_HEAD\(rtl_usb_probe\)|(Rexexp dump continues for 236 lines total)
Fix the typo.
scripts/checkpatch.pl +1 -1
@@ -3891,7 +3891,7 @@ sub process { ^.DEFINE_$Ident\(\Q$name\E\)| ^.DECLARE_$Ident\(\Q$name\E\)| ^.LIST_HEAD\(\Q$name\E\)| - ^.{$Ident}_NOTIFIER_HEAD\(\Q$name\E\)| + ^.${Ident}_NOTIFIER_HEAD\(\Q$name\E\)| ^.(?:$Storage\s+)?$Type\s*\(\s*\*\s*\Q$name\E\s*\)\s*\(| \b\Q$name\E(?:\s+$Attribute)*\s*(?:;|=|\[|\() )/x) {
Joe Perches
maintainerQuoted 7 lines · Valdis Klētnieks
commit
81398d99e9de80d9dbe65dfe7aadec9497f88242Author: Gilad Ben-Yossef <[email protected]> Date: Wed Jul 31 14:44:23 2019 +1000checkpatch: add
*_NOTIFIER_HEADas var definitionhas a typo, resulting in a truly amazing error message:
Ouch, thanks.
Quoted 1 line
Unescaped left brace in regex is passed through in regex; marked by <-- HERE in m/(?:
[]
Quoted 1 line
Fix the typo.
[]
scripts/checkpatch.pl
Quoted 1 line
scripts/checkpatch.pl +0
-0
[]
scripts/checkpatch.pl sub process { · line 3894
Quoted 6 lines
scripts/checkpatch.pl +1
-1@@ -3891,7 +3891,7 @@ sub process { ^.DEFINE_$Ident\(\Q$name\E\)| ^.DECLARE_$Ident\(\Q$name\E\)| ^.LIST_HEAD\(\Q$name\E\)| - ^.{$Ident}_NOTIFIER_HEAD\(\Q$name\E\)| + ^.${Ident}_NOTIFIER_HEAD\(\Q$name\E\)|
Perhaps also better to convert all the '\Q$name\E' to '\s*\Q$name\E\s*'
Quoted 9 lines · Joe Perches
scripts/checkpatch.pl sub process { · line 3894
Quoted 5 lines · Valdis KlÄ“tnieks
scripts/checkpatch.pl +1
-1^.DEFINE_$Ident\(\Q$name\E\)| ^.DECLARE_$Ident\(\Q$name\E\)| ^.LIST_HEAD\(\Q$name\E\)| - ^.{$Ident}_NOTIFIER_HEAD\(\Q$name\E\)| + ^.${Ident}_NOTIFIER_HEAD\(\Q$name\E\)|Perhaps also better to convert all the '\Q$name\E' to '\s*\Q$name\E\s*'
Yes, but that would need to be a separate patch. The question would be if we consider 'DEFINE_foo( barbaz )' and similar with whitespace to be desirable style or not.
[/usr/src/linux-next] grep '\\Q$name\\E' scripts/checkpatch.pl
^.DEFINE_$Ident\(\Q$name\E\)|
^.DECLARE_$Ident\(\Q$name\E\)|
^.LIST_HEAD\(\Q$name\E\)|
^.${Ident}_NOTIFIER_HEAD\(\Q$name\E\)|
^.(?:$Storage\s+)?$Type\s*\(\s*\*\s*\Q$name\E\s*\)\s*\(|
\b\Q$name\E(?:\s+$Attribute)*\s*(?:;|=|\[|\()We already have the \s* in one place. Somebody else can decide if it should be in the other 5 places or not. :)
Joe Perches
maintainerQuoted 11 lines · Valdis Klētnieks
Quoted 8 lines · Joe Perches
scripts/checkpatch.pl sub process { · line 3894
Quoted 5 lines · Valdis Kltnieks
scripts/checkpatch.pl +1
-1^.DEFINE_$Ident\(\Q$name\E\)| ^.DECLARE_$Ident\(\Q$name\E\)| ^.LIST_HEAD\(\Q$name\E\)| - ^.{$Ident}_NOTIFIER_HEAD\(\Q$name\E\)| + ^.${Ident}_NOTIFIER_HEAD\(\Q$name\E\)|Perhaps also better to convert all the '\Q$name\E' to '\s*\Q$name\E\s*'
Yes, but that would need to be a separate patch.
Maybe so.
I'm just not a big fan of micro patches.
Quoted 3 lines
The question would be if we
consider 'DEFINE_foo( barbaz )' and similar with whitespace to be desirable style or not.
Oh, it would definitely be an uncomfortable style, it's just allowing it in the regex.
btw: I'm also fine with it being a separate global patch.
cheers, Joe
Quoted 2 lines
We already have the \s* in one place. Somebody else can decide if it should be in the other 5 places or not. :)
Is that supposed to be me? ;)
Joe Perches
maintainerQuoted 7 lines · Valdis Klētnieks
Quoted 6 lines · Joe Perches
scripts/checkpatch.pl sub process { · line 3894
Quoted 5 lines · Valdis Kltnieks
scripts/checkpatch.pl +1
-1^.DEFINE_$Ident\(\Q$name\E\)| ^.DECLARE_$Ident\(\Q$name\E\)| ^.LIST_HEAD\(\Q$name\E\)| - ^.{$Ident}_NOTIFIER_HEAD\(\Q$name\E\)| + ^.${Ident}_NOTIFIER_HEAD\(\Q$name\E\)|
oops.
I did reply with the correct form for Gilad's original patch.
https://lore.kernel.org/lkml/[email protected]/
My mistake not noticing again in Gilad's v2.
Oh well.