mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
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
1 changed files with 6 additions and 0 deletions
|
@ -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 a new issue