summaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2012-07-30 23:41:22 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-31 02:25:17 +0200
commit66c80b6077256898df948ac6acf547b47ddb1fcf (patch)
tree20982260f1fd1e875188b24ddd598e77544e5354 /scripts/checkpatch.pl
parentcheckpatch: check usleep_range() arguments (diff)
downloadlinux-66c80b6077256898df948ac6acf547b47ddb1fcf.tar.xz
linux-66c80b6077256898df948ac6acf547b47ddb1fcf.zip
checkpatch: Add acheck for use of sizeof without parenthesis
Kernel style uses parenthesis around sizeof. Signed-off-by: Joe Perches <joe@perches.com> Cc: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl6
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4bad5700670a..40b0627aeb5e 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",