Re: [PATCH v2 02/11] kcov: apply clang-format to kcov code
From: Peter Zijlstra
Date: Mon Jun 30 2025 - 04:09:40 EST
On Sun, Jun 29, 2025 at 09:25:34PM +0200, Miguel Ojeda wrote:
> > I think we can fix this by setting AllowShortFunctionsOnASingleLine:
> > Empty, SplitEmptyFunction: false in .clang-format
> >
> > Miguel, do you think this is a reasonable change?
>
> I have a few changes in the backlog for clang-format that I hope to
> get to soon -- the usual constraints are that the options are
> supported in all LLVMs we support (there are some options that I have
> to take a look into that weren't available back when we added the
> config),
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.
> and to try to match the style of as much as the kernel as
> possible (i.e. since different files in the kernel do different
> things).
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.
I suppose include/linux/ is going to be a wee problem..
Still, in general I don't like linters, they're too rigid, its either
all or nothing with those things.
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.