提交 8f53a9b8 编写于 作者: J Joe Perches 提交者: Linus Torvalds

scripts/checkpatch.pl: add WARN on sizeof(&foo)

sizeof(&foo) is frequently an error.  Warn on its use.
Signed-off-by: NJoe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 84938294
......@@ -2572,6 +2572,11 @@ sub process {
WARN("plain inline is preferred over $1\n" . $herecurr);
}
# check for sizeof(&)
if ($line =~ /\bsizeof\s*\(\s*\&/) {
WARN("sizeof(& should be avoided\n" . $herecurr);
}
# check for new externs in .c files.
if ($realfile =~ /\.c$/ && defined $stat &&
$stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册