提交 3d130fd0 编写于 作者: J Joe Perches 提交者: Linus Torvalds

checkpatch.pl: add "prefer __packed" check

There's a __packed #define for __attribute__((packed)).  Add a checkpatch
to tell people about it.
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>
上级 88f8831c
......@@ -2743,6 +2743,11 @@ sub process {
WARN("plain inline is preferred over $1\n" . $herecurr);
}
# Check for __attribute__ packed, prefer __packed
if ($line =~ /\b__attribute__\s*\(\s*\(.*\bpacked\b/) {
WARN("__packed is preferred over __attribute__((packed))\n" . $herecurr);
}
# check for sizeof(&)
if ($line =~ /\bsizeof\s*\(\s*\&/) {
WARN("sizeof(& should be avoided\n" . $herecurr);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册