Messages in this thread | | | Date | Tue, 11 Apr 2023 16:38:14 +0300 | From | Andy Shevchenko <> | Subject | Re: [RFC PATCH] checkpatch: Support __initconst combined with struct definition |
| |
On Wed, Mar 01, 2023 at 10:43:20AM +0100, Björn Töpel wrote: > From: Björn Töpel <bjorn@rivosinc.com> > > Checkpatch sometimes report a false positive for __initconst. E.g., for the > following snippet: > > | static const struct strspn_test { > | const char str[16]; > | const char accept[16]; > | const char reject[16]; > | unsigned a; > | unsigned r; > | } tests[] __initconst = { > | { "foobar", "", "", 0, 6 }, > | { "abba", "abc", "ABBA", 4, 4 }, > | { "abba", "a", "b", 1, 1 }, > | { "", "abc", "abc", 0, 0}, > | }; > > checkpatch would report: > > | ERROR: Use of __initconst requires a separate use of const > | #190: FILE: ./test_string.c:190: > | + } tests[] __initconst = { > > Improve the reporting by trying harder to find the 'const'.
Joe, what do you think about this?
-- With Best Regards, Andy Shevchenko
| |