checkpatch: Fix extraneous EXPORT_SYMBOL* warnings
Subsystems (2)
PATCH 1/1 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:
diff --git a/dummy.c b/dummy.c
new file mode 100644
index 0000000..3a932a5
--- /dev/null
+++ b/dummy.c
@@ -0,0 +1,12 @@
+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]>
--- scripts/checkpatch.pl | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
scripts/checkpatch.pl +3 -0
@@ -552,6 +552,9 @@ sub ctx_statement_block { $type = ($level != 0)? '{' : ''; if ($level == 0) { + if (substr($blk, $off + 1, 1) eq ';') { + $off++; + } last; } }
Signature · 1 line
1.7.2