Re: [PATCH 00/13] nvdimm: Use more common kernel coding style
From: Joe Perches
Date: Thu Sep 12 2019 - 18:15:12 EST
On Thu, 2019-09-12 at 23:58 +0200, Miguel Ojeda wrote:
> On Thu, Sep 12, 2019 at 11:08 PM Joe Perches <joe@xxxxxxxxxxx> wrote:
> > Please name the major projects and then point to their
> > .clang-format equivalents.
> >
> > Also note the size/scope/complexity of the major projects.
>
> Mozilla, WebKit, LLVM and Microsoft. They have their style distributed
> with the official clang-format, not sure if they enforce it.
>
> Same for Chromium/Chrome, but it looks like they indeed enforce it:
thanks for that list.
> > I used the latest one, and quite a bit of the conversion
> > was unpleasant to read.
>
> It would be good to see particularly bad snippets to see if we can do
> something about them (and, if needed, try to improve clang-format to
> support whatever we need).
As I mentioned earlier, look at the __stringify conversion.
Also the C() blocks.
btw: emacs 'mark-whole-buffer indent-region',
the tool I used for each file in patch 1, also
made a mess of the C() block.
> Did you tweak the parameters with the new ones?
No. I used
$ clang-format --version
clang-format version 10.0.0 (git://github.com/llvm/llvm-project.git 305b961f64b75e73110e309341535f6d5a48ed72)
and the existing .clang_format from
next-20190904 35394d031b710e832849fca60d0f53b513f0c390
> I am preparing an RFC
> patch for an updated .clang-format configuration that improves quite a
> bit the results w.r.t. to the current one (and allows for some leeway
> on the developer's side, which helps prevent some cases too).
Well, one day no doubt an automated tool will be
more useful for the kernel. Hope you keep at it
and good luck.
> > Marking sections _no_auto_format_ isn't really a
> > good solution is it?
>
> I am thinking about special tables that are hand-crafted or very
> complex macros. For those, yes, I think it is a fine solution. That is
> why clang-format has that feature to begin with, and you can see an
> example in Mozilla's style guide which points here:
>
> https://github.com/mozilla/gecko-dev/blob/master/xpcom/io/nsEscape.cpp#L22
>
> Cheers,
> Miguel