Re: [RFC PATCH] .clang-format: Remove conditional comments

From: Miguel Ojeda
Date: Wed Nov 04 2020 - 00:24:40 EST


Hi Joe,

First of all, thanks for taking the time to write your reasoning.

On Wed, Nov 4, 2020 at 5:17 AM Joe Perches <joe@xxxxxxxxxxx> wrote:
>
> The current kernel is v5.10 which requires clang 10.0 or higher.

For building, yes.

> This patch is not to be applied or backported to old kernels so no
> person is going to use this patch on any old or backported kernel.

Agreed (see my answer to Nick).

> If a person is going to use clang-format on the current kernel sources
> unless they are developing for the current kernel.
>
> They are going to have to be using clang 10.0 or higher and therefore
> also will have and be using clang-format 10.0 or higher.

No, they might be using GCC as usual and installed clang-format from
their distro. In fact, I'd expect most developers accustomed to GCC to
try it out that way, and also most of them to install compilers from
their distro, not from the webpage, unless they need a newer version
for some reason (e.g. new warnings, new debugging features in the
kernel, etc.).

In principle, clang-format (as a tool) is not related to building the
kernel. We may call it "x-format" and think about it as a statically
linked binary. What I am saying is that aligning clang-format to LLVM
(now that LLVM has a minimum supported version) is not a necessity.

We can still do it, of course, since there are new features for
everyone and anybody that complains can install a newer version from
the webpage. But there is nothing that forces us to require it. It is
a decision that we balance w.r.t. new features. To put it concretely:
if there were 0 new features or big fixes in clang-format 10 compared
to 4, there would be no reason whatsoever to require users to download
a new version.

On the other side of the spectrum, some projects require a concrete
version (not just a minimum), because they automatically format their
entire codebase and want to avoid differences in output between
clang-format versions. But we are far from automatically formatting
the entire codebase.

> Take it or not, apply it or not. I don't use clang-format and unless
> there are improvements to it, I imagine I'll continue to use emacs
> indent-region and a few other reformatting tools instead.

Again, I am not opposed to the change. In fact, I am eager to improve
the output of clang-format so that more people get engaged with it. I
was just surprised you asserted so strongly that nobody is using
clang-format from their distro.

Cheers,
Miguel