Commit f27c95db authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds

checkpatch: improve "no space after cast" test

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: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 1574a29f
...@@ -2260,12 +2260,12 @@ sub process { ...@@ -2260,12 +2260,12 @@ sub process {
} }
} }
if ($line =~ /^\+.*\*[ \t]*\)[ \t]+(?!$Assignment|$Arithmetic)/) { if ($line =~ /^\+.*\(\s*$Type\s*\)[ \t]+(?!$Assignment|$Arithmetic)/) {
if (CHK("SPACING", if (CHK("SPACING",
"No space is necessary after a cast\n" . $hereprev) && "No space is necessary after a cast\n" . $herecurr) &&
$fix) { $fix) {
$fixed[$linenr - 1] =~ $fixed[$linenr - 1] =~
s/^(\+.*\*[ \t]*\))[ \t]+/$1/; s/(\(\s*$Type\s*\))[ \t]+/$1/;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment