Re: [PATCH] scsi: megaraid: cleanup formatting of megaraid

From: Joe Perches
Date: Fri Mar 04 2022 - 12:37:21 EST


On Fri, 2022-03-04 at 15:02 +0100, Miguel Ojeda wrote:
> On Fri, Mar 4, 2022 at 2:46 PM Tom Rix <trix@xxxxxxxxxx> wrote:
> >
> > The churn level will be very high.
>
> Nobody is planning to reformat the entire kernel, at least not until
> the tool is close enough to the kernel style, which will take a while.

I rather doubt clang-format will ever be 'close enough'.

A human's sense of 'taste' for reading code is very different than
what an automated tool produces.

For instance, clang-format does a quite poor job when comments are
intermixed with definitions.

Also, try looking at the changes clang-format does on a file chosen
at random:

$ clang-format -i drivers/hid/hid-sony.c
$ git diff drivers/hid/hid-sony.c
[...]

o columnarized definitions -> not columnarized
o odd line continuation placement using spaces and not tabs before \
o odd array definition layouts
o per line definitions with comments poorly laid out
o individual line definitions rewrapped
o enum definitions on multiple lines compressed to single lines
o u8 array definition layouts where the first element has a separate
meaning than the subsequent elements are compressed and made
difficult to understand

I think _some_ clang-format output is ok, but the concept of
enabling/disabling specific reformatting bits would be quite useful.

And sprinkling "clang-format on/off" lines in the code is not good.

Any control codes that determine when source code layout might be
immutable or allowed to be modified could be should be tool name
agnostic.