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

From: Joe Perches
Date: Thu Nov 05 2020 - 02:08:29 EST


On Thu, 2020-11-05 at 07:44 +0100, Miguel Ojeda wrote:
> There are a few important new features:

https://clang.llvm.org/docs/ClangFormatStyleOptions.html

>   - AlignConsecutiveMacros is probably one of the biggest one for the
> kernel that we were missing so far.

There's no control as to effective column nor sensible mechanism to
avoid extremely long indents with a single exceptional entry.

>   - IndentPPDirectives and

Some yes, mostly no.

AlignEscapedNewlines:

Generally the kernel uses column 72 but there's not real consistency.
clang-format doesn't have that option as far as I can tell.

> Then there are a few others that pertain to us too:
>   - SpaceBeforeSquareBrackets

no

>   - SpacesInConditionalStatement

no

>   - SpaceAfterLogicalNot

no

>   - SpaceInEmptyBlock

no

>   - IndentGotoLabels

no

>
> Others are also worth checking to see if we can take advantage of them:
>   - IncludeBlocks (and configuring IncludeCategories etc.)

Might be worthwhile. It's different by maintainer preference though.
Reverse Xmas tree is somewhat common in networking, (which I think is
silly, but DaveM likes it). Some like alphabetic ordering, others
by order of include.

>   - StatementMacros

Kernel is not c++ so this is irrelevant for gcc macro statement expressions.

> Then there are others that are not related to us, but to be consistent
> we would explicitly set them in the file. Finally, for extra points,
> we could already document the new ones in LLVM 11 if any, for the
> future, but that is optional.
>
> If no one is up for the task, I will eventually do it... :-)

Enjoy...