From: Joe Perches Date: Wed, 6 Aug 2014 23:10:52 +0000 (-0700) Subject: checkpatch: improve "no space after cast" test X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f27c95db1176b41c6c87d9d3480d15efbca8f3ff;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 57a11d7ee841..b351805149a5 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -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/; } }