[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANiq72nURu5usLAjj+C47iXPLRrJsNChWKGkVtw9MuDaHUzkfQ@mail.gmail.com>
Date: Mon, 30 Jun 2025 20:14:37 +0200
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Alexander Potapenko <glider@...gle.com>, Miguel Ojeda <ojeda@...nel.org>, quic_jiangenj@...cinc.com,
linux-kernel@...r.kernel.org, kasan-dev@...glegroups.com,
Aleksandr Nogikh <nogikh@...gle.com>, Andrey Konovalov <andreyknvl@...il.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, Dmitry Vyukov <dvyukov@...gle.com>,
Ingo Molnar <mingo@...hat.com>, Josh Poimboeuf <jpoimboe@...nel.org>, Marco Elver <elver@...gle.com>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH v2 02/11] kcov: apply clang-format to kcov code
On Mon, Jun 30, 2025 at 10:09 AM Peter Zijlstra <peterz@...radead.org> wrote:
>
> Since clang format is an entirely optional thing, I don't think we
> should care about old versions when inconvenient. Perhaps stick to the
> very latest version.
I would love that, but I am not sure about others that use their
distribution toolchains (including for clang-format).
Hmm...
If it would now allow us to get very close to the average kernel
style, then we should definitely consider it -- years ago it wasn't
the case.
> You can have per directory .clang-format files to account for this. Eg.
> net/ can have its own file that allows their silly comment style etc.
Yeah, that is what I recommended in:
https://docs.kernel.org/dev-tools/clang-format.html
But nobody actually added their own files so far. (Which I guess, in a
sense, is good... :)
> Still, in general I don't like linters, they're too rigid, its either
> all or nothing with those things.
There is `// clang-format off/on` to locally disable it, so that is an
escape hatch, but it is ugly, because we would still need to use it
too much with the current setup.
> And like I said, in my neovim-lsp adventures, I had to stomp hard on
> clang-format, it got in the way far more than it was helpful.
Yeah, clang-format for the kernel so far is most useful for getting
reasonable formatting on e.g. snippets of existing code in an IDE, and
possibly for new files where the maintainer is OK with the style (I
mention a bit of that in the docs above).
But we are not (or, at least, back then) at the point where we could
consider using it on existing files (e.g. just the alignment on
`#define`s makes it a mess in many cases).
I will take a look at the config later this cycle and see how we would
fare nowadays. It would be nice to get to the point where some
subsystems can just use it for new files and look good enough.
Thanks!
Cheers,
Miguel
Powered by blists - more mailing lists