Skip to content

Commit 43f7fe5

Browse files
JoePerchestorvalds
authored andcommitted
checkpatch: improve "no space necessary after cast" test
Code like: if (a < sizeof(<type>) && and { .len = sizeof(<type>) }, incorrectly emits that warning, so add more exceptions to avoid the warning. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent caac1d5 commit 43f7fe5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scripts/checkpatch.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2541,7 +2541,7 @@ sub process {
25412541
}
25422542
}
25432543

2544-
if ($line =~ /^\+.*(\w+\s*)?\(\s*$Type\s*\)[ \t]+(?!$Assignment|$Arithmetic|[,;\({\[\<\>])/ &&
2544+
if ($line =~ /^\+.*(\w+\s*)?\(\s*$Type\s*\)[ \t]+(?!$Assignment|$Arithmetic|[,;:\?\(\{\}\[\<\>]|&&|\|\||\\$)/ &&
25452545
(!defined($1) || $1 !~ /sizeof\s*/)) {
25462546
if (CHK("SPACING",
25472547
"No space is necessary after a cast\n" . $herecurr) &&

0 commit comments

Comments
 (0)