checkpatch: Update "Missing a blank line after declarations" test
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): 1395526999.3667.17.camel@joe-AO722
A message that is not in the archive (sent off-list or not yet received): [email protected]
Joe Perches
maintainerPATCH 1/1 checkpatch: Update "Missing a blank line after declarations" test
"struct foo *bar" does not match the regex "$Declare\s+$Ident" $Declare matches "struct foo *" but there is no required space between the pointer "*" and the $Ident.
Also it ends in a pointer, the $Declare variable also contains all trailing spaces after the declaration so there is no space between $Declare and $Ident.
ie: "struct foo * bar" does not match "$Declare\s+$Ident"
So, change the \s+ to \s* to have this regex match any of
"struct foo bar", "struct foo *bar", and "struct foo * bar"
--- scripts/checkpatch.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/checkpatch.pl +2 -2
@@ -2259,7 +2259,7 @@ sub process { # check for missing blank lines after declarations if ($sline =~ /^\+\s+\S/ && #Not at char 1 # actual declarations - ($prevline =~ /^\+\s+$Declare\s+$Ident\s*[=,;\[]/ || + ($prevline =~ /^\+\s+$Declare\s*$Ident\s*[=,;\[]/ || # foo bar; where foo is some local typedef or #define $prevline =~ /^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ || # known declaration macros
@@ -2271,7 +2271,7 @@ sub process { # not starting a section or a macro "\" extended line $prevline =~ /(?:\{\s*|\\)$/) && # looks like a declaration - !($sline =~ /^\+\s+$Declare/ || + !($sline =~ /^\+\s+$Declare\s*$Ident\s*[=,;\[]/ || # foo bar; where foo is some local typedef or #define $sline =~ /^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ || # known declaration macros
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty