[Linux-kernel-mentees] [PATCH RFC] checkpatch: extend attributes check to handle more patterns

Dwaipayan Ray dwaipayanray1 at gmail.com
Thu Oct 22 14:29:20 UTC 2020


On Thu, Oct 22, 2020 at 7:50 PM Lukas Bulwahn <lukas.bulwahn at gmail.com> wrote:
>
>
>
> On Thu, 22 Oct 2020, Dwaipayan Ray wrote:
>
> > It is generally preferred that the macros from
> > include/linux/compiler_attributes.h are used, unless there
> > is a reason not to.
> >
>
> Did you checkpatch this patch?
>
> I always thought checkpatch warns to use ./include/...
> as path when somebody just use include/... in a commit message.
>
Yes, I did check it once again. I get no warnings even with
--strict.
>
> > Checkpatch currently checks __attribute__ for each of
> > packed, aligned, printf, scanf, and weak. Other declarations
> > in compiler_attributes.h are not handled.
> >
> > Add more definitions to the attribute check.
> > The following patterns are added:
> >
> > __alias__(#symbol)
> > __always_inline__
> > __assume_aligned__(a, ## __VA_ARGS__)
> > __cold__
> > __const__
> > __copy__(symbol)
> > __designated_init__
> > __externally_visible__
> > __gnu_inline__
> > __malloc__
> > __mode__(x)
> > __no_caller_saved_registers__
> > __noclone__
> > __fallthrough__
> > __noinline__
> > __nonstring__
> > __noreturn__
> > __pure__
> > __unused__
> > __used__
> >
> > Link: https://lore.kernel.org/linux-kernel-mentees/3ec15b41754b01666d94b76ce51b9832c2dd577a.camel@perches.com/
> > Signed-off-by: Dwaipayan Ray <dwaipayanray1 at gmail.com>
> > ---
>
>
> I guess you could add suggested-by.
>
> I am wondering if this could be refactored into a shared function and if
> all different warning messages each deserve to be an own type.
>
> But send it out as-is to Joe and the list and we continue the discussion
> there.

I was a bit sceptical myself as the code size for this is
too big. Function will probably help but then I think
parameterized/non parameterized types needs to be
differentiated.

But sure, I will send it to Joe with the comments about
refactoring.

Thanks,
Dwaipayan.


More information about the Linux-kernel-mentees mailing list