projects/linux·commit b998e001

checkpatch: fix extraneous EXPORT_SYMBOL* warnings

b998e001 · Patrick Pannuto <[email protected]> · 2010-08-09 17:21:03 -07:00

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: Patrick Pannuto <[email protected]>
Cc: Andy Whitcroft <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Commit
b998e001e6ce6540ea04a264debc50ae44d2db7a
Parents
09ef8725

Changes

1 files changed · +3 −0

FileStatusAddDelContent
scripts/checkpatch.plmodified+3−0View file

scripts/checkpatch.pl

View file
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index dd11bbe..2039acd 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -558,6 +558,9 @@ sub ctx_statement_block {
$type = ($level != 0)? '{' : '';
if ($level == 0) {
+ if (substr($blk, $off + 1, 1) eq ';') {
+ $off++;
+ }
last;
}
}