提交 5023d347 编写于 作者: J Joe Perches 提交者: Linus Torvalds

checkpatch: warn on unnecessary line continuations

When the previous line is not a line continuation and the current line has
a line continuation but is not a #define, emit a warning.
Signed-off-by: NJoe Perches <joe@perches.com>
Cc: Peter Hurley <peter@hurleysoftware.com>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 0ad50c38
......@@ -3013,6 +3013,15 @@ sub process {
"Macros with complex values should be enclosed in parenthesis\n" . "$herectx");
}
}
# check for line continuations outside of #defines
} else {
if ($prevline !~ /^..*\\$/ &&
$line =~ /^\+.*\\$/) {
WARN("LINE_CONTINUATIONS",
"Avoid unnecessary line continuations\n" . $herecurr);
}
}
# do {} while (0) macro tests:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册