projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4a27319
)
checkpatch: Add acheck for use of sizeof without parenthesis
author
Joe Perches
<
[email protected]
>
Mon, 30 Jul 2012 21:41:22 +0000
(14:41 -0700)
committer
Linus Torvalds
<
[email protected]
>
Tue, 31 Jul 2012 00:25:17 +0000
(17:25 -0700)
Kernel style uses parenthesis around sizeof.
Signed-off-by: Joe Perches <
[email protected]
>
Cc: Andy Whitcroft <
[email protected]
>
Signed-off-by: Andrew Morton <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
scripts/checkpatch.pl
patch
|
blob
|
history
diff --git
a/scripts/checkpatch.pl
b/scripts/checkpatch.pl
index 4bad5700670ae7212ec18b5efaf936ed91e39895..40b0627aeb5e57731892c3c2b470f9da95888644 100755
(executable)
--- 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",