Hi Jan,

> On 2 Nov 2023, at 09:10, Jan Beulich <[email protected]> wrote:
> 
> On 31.10.2023 14:23, Luca Fancellu wrote:
>> Add a clang format configuration for the Xen Hypervisor.
>> 
>> Signed-off-by: Luca Fancellu <[email protected]>
>> ---
>> xen/.clang-format | 693 ++++++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 693 insertions(+)
>> create mode 100644 xen/.clang-format
> 
> I think this needs splitting and every setting then individually correlating
> with what we have in ./CODING_STYLE. That would entail extending 
> ./CODING_STYLE
> by anything not presently written down, but intended to be checked for.

Do you mean introducing one parameter for each patch with the corresponding 
entry in
CODING_STYLE?

It would make sense, however there are 116 parameters, from those I think at 
least 56 needs
to have a corresponding entry in CODING_STYLE (maybe in the end they will be 
less, but I don’t expect
them to be less than 40), so given the amount of patches, I’m afraid to flood 
the mailing list.

I was thinking we could discuss them in chunks and update the serie during 
time, we could put in this
patch also the update to the CODING_STYLE file. Something like the MISRA rule 
acceptance, what
do you think? Shall we do the discussion by ML or by meetings? Every time I 
could bring up a number
of parameters and update the serie when the discussion on them is finished.



This is my breakdown:

116 total configurables

================================================================================
13 straightforward

AttributeMacros:
  -[...]

ColumnLimit: 80

IndentWidth: 4

Language: Cpp

MacroBlockBegin: '^PLATFORM_START|^DT_DEVICE_START|^ACPI_DEVICE_START'

MacroBlockEnd: '^PLATFORM_END|^DT_DEVICE_END|^ACPI_DEVICE_END'

Standard: C++03

StatementMacros:
  - [...]

TabWidth: 4

TypenameMacros:
  - 'XEN_GUEST_HANDLE'
  - 'XEN_GUEST_HANDLE_64'
  - 'XEN_GUEST_HANDLE_PARAM'
  - 'ELF_HANDLE_DECL'

UseTab: Never

WhitespaceSensitiveMacros:
  - '__stringify'

================================================================================
56 that requires discussions

QualifierAlignment: Custom
QualifierOrder: ['static', 'inline', 'const', 'volatile', 'type']

AlignAfterOpenBracket: Align

AlignArrayOfStructures: Left

AlignConsecutiveAssignments:
  Enabled: false
  AcrossEmptyLines: false
  AcrossComments: false

AlignConsecutiveBitFields: None

AlignConsecutiveDeclarations: None

AlignConsecutiveMacros:
  Enabled: false
  AcrossEmptyLines: false
  AcrossComments: false

AlignEscapedNewlines: Right

AlignOperands: Align

AlignTrailingComments: false

AllowAllArgumentsOnNextLine: false

AllowAllParametersOfDeclarationOnNextLine: false

AllowShortBlocksOnASingleLine: Never

AllowShortCaseLabelsOnASingleLine: false

AllowShortFunctionsOnASingleLine: None

AllowShortIfStatementsOnASingleLine: Never

AllowShortLoopsOnASingleLine: false

AlwaysBreakAfterReturnType: None

AlwaysBreakBeforeMultilineStrings: false

BinPackArguments: true

BinPackParameters: true

BitFieldColonSpacing: None

BreakBeforeBraces: Custom
BraceWrapping:
  AfterCaseLabel: true
  AfterFunction: true
  BeforeElse: true
  AfterExternBlock: true
  AfterEnum: false
  AfterStruct: false
  AfterUnion: false
  AfterControlStatement: Always
  BeforeWhile: false
  IndentBraces: false
  SplitEmptyFunction: false
  AfterClass: false
  AfterNamespace: false
  AfterObjCDeclaration: false
  BeforeCatch: false
  BeforeLambdaBody: false
  SplitEmptyRecord: true
  SplitEmptyNamespace: true

BreakBeforeBinaryOperators: None

BreakBeforeTernaryOperators: true

BreakStringLiterals: false

IncludeBlocks: Preserve

IndentCaseBlocks: false

IndentCaseLabels: false

IndentGotoLabels: true

IndentPPDirectives: None

IndentWrappedFunctionNames: false

InsertBraces: false

KeepEmptyLinesAtTheStartOfBlocks: false

MaxEmptyLinesToKeep: 1

PointerAlignment: Right

PPIndentWidth: -1

ReflowComments: false

SeparateDefinitionBlocks: Always

SortIncludes: Never

SpaceAfterCStyleCast: false

SpaceAfterLogicalNot: false

SpaceAroundPointerQualifiers: After

SpaceBeforeAssignmentOperators: true

SpaceBeforeCaseColon: false

SpaceBeforeParens: ControlStatementsExceptForEachMacros

SpaceBeforeSquareBrackets: false

SpaceInEmptyParentheses: false

SpacesBeforeTrailingComments: 1

SpacesInConditionalStatement: true

SpacesInCStyleCastParentheses: false

SpaceInEmptyBlock: false

SpacesInLineCommentPrefix:
  Minimum: 1
  Maximum: -1

SpacesInParentheses: false

SpacesInSquareBrackets: false

================================================================================
10 don't really need a discussion

PenaltyBreakAssignment: 30

PenaltyBreakBeforeFirstCallParameter: 30

PenaltyBreakComment: 10

PenaltyBreakFirstLessLess: 0

PenaltyBreakOpenParenthesis: 100

PenaltyBreakString: 10

PenaltyExcessCharacter: 100

PenaltyIndentedWhitespace: 0

PenaltyReturnTypeOnItsOwnLine: 60

CommentPragmas: '^ IWYU pragma:'

================================================================================
37 non related to C language

AlwaysBreakTemplateDeclarations: false

BreakConstructorInitializers: BeforeComma

AccessModifierOffset: -4

AllowShortLambdasOnASingleLine: None

BreakAfterJavaFieldAnnotations: false

BreakBeforeConceptDeclarations: Never

BreakInheritanceList: BeforeColon

CompactNamespaces: false

ConstructorInitializerAllOnOneLineOrOnePerLine: false

ConstructorInitializerIndentWidth: 4

Cpp11BracedListStyle: false

EmptyLineAfterAccessModifier: Leave

EmptyLineBeforeAccessModifier: Leave

FixNamespaceComments: false

IndentAccessModifiers: false

IndentRequiresClause: false

InsertTrailingCommas: None

JavaScriptQuotes: Leave

JavaScriptWrapImports: true

NamespaceIndentation: None

ObjCBinPackProtocolList: Auto

ObjCBlockIndentWidth: 4

ObjCBreakBeforeNestedBlockParam: false

ObjCSpaceAfterProperty: true

ObjCSpaceBeforeProtocolList: true

PackConstructorInitializers: Never

PenaltyBreakTemplateDeclaration: 0

ReferenceAlignment: Right

SortUsingDeclarations: false

SpaceAfterTemplateKeyword: true

SpaceBeforeCpp11BracedList: false

SpaceBeforeCtorInitializerColon: false

SpaceBeforeInheritanceColon: true

SpacesInAngles: false

SpacesInContainerLiterals: false

SpaceBeforeRangeBasedForLoopColon: true

IndentExternBlock: NoIndent

> 
>> --- /dev/null
>> +++ b/xen/.clang-format
>> @@ -0,0 +1,693 @@
>> +# SPDX-License-Identifier: GPL-2.0-only
>> +#
>> +# clang-format configuration file. Intended for clang-format >= 15.
>> +#
>> +# For more information, see:
>> +#
>> +#   Documentation/process/clang-format.rst
>> +#   https://clang.llvm.org/docs/ClangFormat.html
>> +#   https://clang.llvm.org/docs/ClangFormatStyleOptions.html
> 
> ... pointing to further doc is helpful in general, but imo insufficient for
> the introduction of the various settings.

Yes I realise now that I’ve copied this from Linux and I should have dropped at 
least
the line Documentation/process/clang-format.rst and 
https://clang.llvm.org/docs/ClangFormat.html.
The line https://clang.llvm.org/docs/ClangFormatStyleOptions.html I think makes 
sense
because it’s a documentation to the clang-format parameter present in the file.

Thanks for your review.

Cheers,
Luca

Reply via email to