Bug 216374 - checkpatch.pl EXPORT_SYMBOL check false positive when #define precedes struct initialization without blank line
Summary: checkpatch.pl EXPORT_SYMBOL check false positive when #define precedes struct...
Status: NEW
Alias: None
Product: Tools
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Tools.Other
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-18 14:51 UTC by joetalbott
Modified: 2022-08-18 14:52 UTC (History)
1 user (show)

See Also:
Kernel Version: 568035b01cfb
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description joetalbott 2022-08-18 14:51:26 UTC
I believe I've found a bug in checkpatch.pl where an EXPORT_SYMBOL for
an initialized struct following a simple #define without an intervening
blank line falsely reports that EXPORT_SYMBOL doesn't follow the symbol
definition.  Here's an example:

        #define SOMETHING_ELSE 1
        struct blah foo = {
                .a = 1
        };
        EXPORT_SYMBOL(foo);

You can see from the debug print that the full statement has not been
identified.

        FOO A<+EXPORT_SYMBOL(foo);> stat<+      .a = 1
         };> name<foo>

A real world example can be found by running checkpatch.pl against drivers/iio/industrialio-core.c

Unfortunately my perl skills were not sufficient to find a fix.

Note You need to log in before you can comment on or make changes to this bug.