forked from luck/tmp_suning_uos_patched
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>
This commit is contained in:
parent
4a273195a5
commit
66c80b6077
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue
Block a user