提交 b998e001 编写于 作者: P Patrick Pannuto 提交者: Linus Torvalds

checkpatch: fix extraneous EXPORT_SYMBOL* warnings

These are caused by checkpatch incorrectly parsing its internal
representation of a statement block for struct's (or anything else that is
a statement block encapsulated in {}'s that also ends with a ';').  Fix
this by properly parsing a statement block.

An example:

	+struct dummy_type dummy = {
	+	.foo	= "baz",
	+};
	+EXPORT_SYMBOL_GPL(dummy);
	+
	+static int dummy_func(void)
	+{
	+	return -EDUMMYCODE;
	+}
	+EXPORT_SYMBOL_GPL(dummy_func);

	WARNING: EXPORT_SYMBOL(foo); should immediately \
		follow its function/variable
	#19: FILE: dummy.c:4:
	+EXPORT_SYMBOL_GPL(dummy);

The above warning is issued when it should not be.
Signed-off-by: NPatrick Pannuto <ppannuto@codeaurora.org>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 09ef8725
...@@ -558,6 +558,9 @@ sub ctx_statement_block { ...@@ -558,6 +558,9 @@ sub ctx_statement_block {
$type = ($level != 0)? '{' : ''; $type = ($level != 0)? '{' : '';
if ($level == 0) { if ($level == 0) {
if (substr($blk, $off + 1, 1) eq ';') {
$off++;
}
last; last;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册