Commit 43f7fe52 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds

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: 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 caac1d5f
...@@ -2541,7 +2541,7 @@ sub process { ...@@ -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*/)) { (!defined($1) || $1 !~ /sizeof\s*/)) {
if (CHK("SPACING", if (CHK("SPACING",
"No space is necessary after a cast\n" . $herecurr) && "No space is necessary after a cast\n" . $herecurr) &&
......
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