Skip to content

Commit

Permalink
checkpatch: improve "no space after cast" test
Browse files Browse the repository at this point in the history
This --strict test previously worked only for what appeared to be cast
to pointer types.

Make it work for all casts.

Also, there's no reason to show the previous line for this type of
message, so don't.

Signed-off-by: Joe Perches <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
JoePerches authored and torvalds committed Aug 7, 2014
1 parent 1574a29 commit f27c95d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2260,12 +2260,12 @@ sub process {
}
}

if ($line =~ /^\+.*\*[ \t]*\)[ \t]+(?!$Assignment|$Arithmetic)/) {
if ($line =~ /^\+.*\(\s*$Type\s*\)[ \t]+(?!$Assignment|$Arithmetic)/) {
if (CHK("SPACING",
"No space is necessary after a cast\n" . $hereprev) &&
"No space is necessary after a cast\n" . $herecurr) &&
$fix) {
$fixed[$linenr - 1] =~
s/^(\+.*\*[ \t]*\))[ \t]+/$1/;
s/(\(\s*$Type\s*\))[ \t]+/$1/;
}
}

Expand Down

0 comments on commit f27c95d

Please sign in to comment.