From: Joe Perches Date: Mon, 30 Jul 2012 21:41:22 +0000 (-0700) Subject: checkpatch: Add acheck for use of sizeof without parenthesis X-Git-Tag: v3.6-rc1~41^2~58 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=66c80b6077256898df948ac6acf547b47ddb1fcf;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git checkpatch: Add acheck for use of sizeof without parenthesis Kernel style uses parenthesis around sizeof. Signed-off-by: Joe Perches Cc: Andy Whitcroft Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 4bad570..40b0627 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3265,6 +3265,12 @@ sub process { "sizeof(& should be avoided\n" . $herecurr); } +# check for sizeof without parenthesis + if ($line =~ /\bsizeof\s+((?:\*\s*|)$Lval|$Type(?:\s+$Lval|))/) { + WARN("SIZEOF_PARENTHESIS", + "sizeof $1 should be sizeof($1)\n" . $herecurr); + } + # check for line continuations in quoted strings with odd counts of " if ($rawline =~ /\\$/ && $rawline =~ tr/"/"/ % 2) { WARN("LINE_CONTINUATIONS",