linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* clang-format inconsistencies with checkpatch.pl
@ 2022-04-23 11:45 Mickaël Salaün
  2022-04-23 16:14 ` Miguel Ojeda
  2022-05-02 19:13 ` Mickaël Salaün
  0 siblings, 2 replies; 4+ messages in thread
From: Mickaël Salaün @ 2022-04-23 11:45 UTC (permalink / raw)
  To: Miguel Ojeda, Andy Whitcroft, Joe Perches, Dwaipayan Ray, Lukas Bulwahn
  Cc: Nathan Chancellor, Nick Desaulniers, Tom Rix, llvm, linux-kernel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: clang-format inconsistencies with checkpatch.pl
  2022-04-23 11:45 clang-format inconsistencies with checkpatch.pl Mickaël Salaün
@ 2022-04-23 16:14 ` Miguel Ojeda
  2022-05-02 10:29   ` Mickaël Salaün
  2022-05-02 19:13 ` Mickaël Salaün
  1 sibling, 1 reply; 4+ messages in thread
From: Miguel Ojeda @ 2022-04-23 16:14 UTC (permalink / raw)
  To: Mickaël Salaün
  Cc: Miguel Ojeda, Andy Whitcroft, Joe Perches, Dwaipayan Ray,
	Lukas Bulwahn, Nathan Chancellor, Nick Desaulniers, Tom Rix,
	llvm, linux-kernel

Hi Mickaël,

On Sat, Apr 23, 2022 at 1:45 PM Mickaël Salaün <mic@digikod.net> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: clang-format inconsistencies with checkpatch.pl
  2022-04-23 16:14 ` Miguel Ojeda
@ 2022-05-02 10:29   ` Mickaël Salaün
  0 siblings, 0 replies; 4+ messages in thread
From: Mickaël Salaün @ 2022-05-02 10:29 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Miguel Ojeda, Andy Whitcroft, Joe Perches, Dwaipayan Ray,
	Lukas Bulwahn, Nathan Chancellor, Nick Desaulniers, Tom Rix,
	llvm, linux-kernel



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 <mic@digikod.net> 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/20220412153906.428179-1-mic@digikod.net

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: clang-format inconsistencies with checkpatch.pl
  2022-04-23 11:45 clang-format inconsistencies with checkpatch.pl Mickaël Salaün
  2022-04-23 16:14 ` Miguel Ojeda
@ 2022-05-02 19:13 ` Mickaël Salaün
  1 sibling, 0 replies; 4+ messages in thread
From: Mickaël Salaün @ 2022-05-02 19:13 UTC (permalink / raw)
  To: Miguel Ojeda, Andy Whitcroft, Joe Perches, Dwaipayan Ray, Lukas Bulwahn
  Cc: Nathan Chancellor, Nick Desaulniers, Tom Rix, llvm, linux-kernel


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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-02 19:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-23 11:45 clang-format inconsistencies with checkpatch.pl Mickaël Salaün
2022-04-23 16:14 ` Miguel Ojeda
2022-05-02 10:29   ` Mickaël Salaün
2022-05-02 19:13 ` Mickaël Salaün

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).