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.
Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all
Unified · Split
| @@ -558,6 +558,9 @@ sub ctx_statement_block { · 557 unmodified lines | |||
| 558 | $type = ($level != 0)? '{' : ''; | 558 | $type = ($level != 0)? '{' : ''; |
| 559 | 559 | ||
| 560 | if ($level == 0) { | 560 | if ($level == 0) { |
| 561 | if (substr($blk, $off + 1, 1) eq ';') { | ||
| 562 | $off++; | ||
| 563 | } | ||
| 561 | last; | 564 | last; |
| 562 | } | 565 | } |
| 563 | } | 566 | } |