From: Joe Perches Date: Fri, 13 Feb 2015 22:38:52 +0000 (-0800) Subject: checkpatch: improve "no space necessary after cast" test X-Git-Tag: v5.15~16332^2~46 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=43f7fe52a82ec9f7aa6420af430745111674c7b9;p=platform%2Fkernel%2Flinux-starfive.git checkpatch: improve "no space necessary after cast" test Code like: if (a < sizeof() && and { .len = sizeof() }, incorrectly emits that warning, so add more exceptions to avoid the warning. 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 7f1804e0..a9baaab 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2541,7 +2541,7 @@ sub process { } } - if ($line =~ /^\+.*(\w+\s*)?\(\s*$Type\s*\)[ \t]+(?!$Assignment|$Arithmetic|[,;\({\[\<\>])/ && + if ($line =~ /^\+.*(\w+\s*)?\(\s*$Type\s*\)[ \t]+(?!$Assignment|$Arithmetic|[,;:\?\(\{\}\[\<\>]|&&|\|\||\\$)/ && (!defined($1) || $1 !~ /sizeof\s*/)) { if (CHK("SPACING", "No space is necessary after a cast\n" . $herecurr) &&