I tried to follow https://wiki.winehq.org/Wine_Developer%27s_Guide/Coding_Practice as closely as possible.
Known issues:
- No break before brace for assignments. Upstream issue: https://github.com/llvm/llvm-project/issues/79054 - `ContinuationIndentWidth` affects everything. Instead, we want it to be 8 for function arguments and 4 for assignments.
From: Davide Beatrici git@davidebeatrici.dev
--- .clang-format | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 .clang-format
diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000000..dbd0fa92b55 --- /dev/null +++ b/.clang-format @@ -0,0 +1,105 @@ +Language: Cpp + +AlignAfterOpenBracket: DontAlign +AlignArrayOfStructures: None # This affects everything, we want "Right" just for digits +AlignConsecutiveAssignments: + Enabled: true + AcrossComments: true + AcrossEmptyLines: false + AlignCompound: true + PadOperators: true +AlignConsecutiveBitFields: + Enabled: true + AcrossComments: true + AcrossEmptyLines: false +AlignConsecutiveDeclarations: + Enabled: true + AcrossComments: true + AcrossEmptyLines: false + AlignFunctionPointers: true +AlignConsecutiveMacros: + Enabled: true + AcrossComments: true + AcrossEmptyLines: false +AlignConsecutiveShortCaseStatements: + Enabled: true + AcrossComments: true + AcrossEmptyLines: false +AlignEscapedNewlines: DontAlign # Set to LeftWithLastLine when supported +AlignOperands: Align +AlignTrailingComments: + Kind: Always + OverEmptyLines: 0 +AllowAllArgumentsOnNextLine: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: Always +AllowShortCaseLabelsOnASingleLine: true +AllowShortEnumsOnASingleLine: true +AllowShortFunctionsOnASingleLine: Empty +AllowShortIfStatementsOnASingleLine: WithoutElse +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterCaseLabel: true + AfterClass: true + AfterControlStatement: Always + AfterEnum: true + AfterFunction: true + AfterNamespace: true + AfterStruct: true + AfterUnion: true + AfterExternBlock: true + BeforeElse: true + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakAdjacentStringLiterals: false +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Custom +BreakBeforeTernaryOperators: false +BreakStringLiterals: false +ColumnLimit: 100 +ContinuationIndentWidth: 8 +IncludeBlocks: Preserve +IndentCaseBlocks: true +IndentCaseLabels: true +IndentExternBlock: false +IndentGotoLabels: false +IndentPPDirectives: None +IndentWidth: 4 +IndentWrappedFunctionNames: false +InsertBraces: false +InsertNewlineAtEOF: true +InsertTrailingCommas: None +KeepEmptyLinesAtEOF: false +KeepEmptyLinesAtTheStartOfBlocks: false +LineEnding: LF +MaxEmptyLinesToKeep: 1 +PPIndentWidth: 0 +PointerAlignment: Right +QualifierAlignment: Leave +ReferenceAlignment: Pointer +ReflowComments: true +SkipMacroDefinitionBody: true +SortIncludes: Never # Otherwise breakage ensues when headers must be included in a specific order +SpaceAfterLogicalNot: false +SpaceAroundPointerQualifiers: Default +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeParens: ControlStatementsExceptControlMacros +SpaceBeforeSquareBrackets: false +SpaceInEmptyBlock: false +SpacesBeforeTrailingComments: 1 +SpacesInContainerLiterals: true +SpacesInLineCommentPrefix: + Maximum: -1 + Minimum: 1 +SpacesInParens: Never +SpacesInSquareBrackets: false +TabWidth: 4 +UseTab: Never