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-Url: https://git.stricted.de/?a=commitdiff_plain;h=66c80b6077256898df948ac6acf547b47ddb1fcf;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.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 4bad5700670..40b0627aeb5 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",