2022-04-24 02:25:19

by Mickaël Salaün

[permalink] [raw]
Subject: clang-format inconsistencies with checkpatch.pl

Hi,

I would like to use clang-format (with a pinned version, probably 14) to
keep a consistent coding style, or at least start with one. However,
there is some inconsistencies with the checkpatch.pl script:

In some cases, goto labels are indented, which checkpatch.pl doesn't like.

checkpatch.pl complains about some functions (e.g. FIXTURE or
FIXTURE_VARIANT_ADD) that get an open brace just after but without a space.

I also noticed that there is some clang-format configuration lines that
are commented because of incompatibilities with versions older than 6.
Shouldn't we require a minimal version, at least the 6th?

About checkpatch.pl, it incorrectly warns about space between function
name and open parenthesis for *for_each* functions (specifically
interpreted as "for" statements in .clang-format, e.g. list_for_each_entry).

Regards,
Mickaël


2022-04-24 16:20:23

by Miguel Ojeda

[permalink] [raw]
Subject: Re: clang-format inconsistencies with checkpatch.pl

Hi Mickaël,

On Sat, Apr 23, 2022 at 1:45 PM Mickaël Salaün <[email protected]> wrote:
>
> I also noticed that there is some clang-format configuration lines that
> are commented because of incompatibilities with versions older than 6.
> Shouldn't we require a minimal version, at least the 6th?

I will be increasing this cycle the version to 11, which is the
minimum LLVM supported at the moment, and then keep it sync'd to that
minimum.

> About checkpatch.pl, it incorrectly warns about space between function
> name and open parenthesis for *for_each* functions (specifically
> interpreted as "for" statements in .clang-format, e.g. list_for_each_entry).

Note that the prevailing kernel style is to not have a space. This
should be fixed with the increase to 11.

Cheers,
Miguel

2022-05-03 00:18:59

by Mickaël Salaün

[permalink] [raw]
Subject: Re: clang-format inconsistencies with checkpatch.pl



On 23/04/2022 18:14, Miguel Ojeda wrote:
> Hi Mickaël,
>
> On Sat, Apr 23, 2022 at 1:45 PM Mickaël Salaün <[email protected]> wrote:
>>
>> I also noticed that there is some clang-format configuration lines that
>> are commented because of incompatibilities with versions older than 6.
>> Shouldn't we require a minimal version, at least the 6th?
>
> I will be increasing this cycle the version to 11, which is the
> minimum LLVM supported at the moment, and then keep it sync'd to that
> minimum.

OK, thanks.

>
>> About checkpatch.pl, it incorrectly warns about space between function
>> name and open parenthesis for *for_each* functions (specifically
>> interpreted as "for" statements in .clang-format, e.g. list_for_each_entry).
>
> Note that the prevailing kernel style is to not have a space. This
> should be fixed with the increase to 11.

I was talking about the ForEachMacros exceptions. Should these be
removed or at least not updated for new for_each functions [1]?

[1] https://lore.kernel.org/r/[email protected]

2022-05-03 01:05:29

by Mickaël Salaün

[permalink] [raw]
Subject: Re: clang-format inconsistencies with checkpatch.pl


On 23/04/2022 13:45, Mickaël Salaün wrote:
> Hi,
>
> I would like to use clang-format (with a pinned version, probably 14) to
> keep a consistent coding style, or at least start with one. However,
> there is some inconsistencies with the checkpatch.pl script:
>
> In some cases, goto labels are indented, which checkpatch.pl doesn't like.

This can be fixed with SplitEmptyFunction: false. I'll send a patch for
that if it's OK with you.

>
> checkpatch.pl complains about some functions (e.g. FIXTURE or
> FIXTURE_VARIANT_ADD) that get an open brace just after but without a space.

Miguel, do you know how/if clang-format can enforce that style? FIXTURE
macros are struct declarations though.