xref: /openbmc/docs/style/c/.clang-format (revision f31c96df)
1# SPDX-License-Identifier: GPL-2.0
2#
3# Originally from Linux v5.6
4---
5AccessModifierOffset: -4
6AlignAfterOpenBracket: Align
7AlignConsecutiveMacros: true
8AlignConsecutiveAssignments: false
9AlignConsecutiveDeclarations: false
10#AlignEscapedNewlines: Left # Unknown to clang-format-4.0
11AlignOperands:  Align
12AlignTrailingComments:
13  Kind: Always
14  OverEmptyLines: 1
15AllowAllParametersOfDeclarationOnNextLine: false
16AllowShortBlocksOnASingleLine: false
17AllowShortCaseLabelsOnASingleLine: false
18AllowShortFunctionsOnASingleLine: None
19AllowShortIfStatementsOnASingleLine: false
20AllowShortLoopsOnASingleLine: false
21AlwaysBreakAfterDefinitionReturnType: None
22AlwaysBreakAfterReturnType: None
23AlwaysBreakBeforeMultilineStrings: false
24AlwaysBreakTemplateDeclarations: false
25BinPackArguments: true
26BinPackParameters: true
27BraceWrapping:
28  AfterClass: false
29  AfterControlStatement: false
30  AfterEnum: false
31  AfterFunction: true
32  AfterNamespace: true
33  AfterObjCDeclaration: false
34  AfterStruct: false
35  AfterUnion: false
36  #AfterExternBlock: false # Unknown to clang-format-5.0
37  BeforeCatch: false
38  BeforeElse: false
39  IndentBraces: false
40  #SplitEmptyFunction: true # Unknown to clang-format-4.0
41  #SplitEmptyRecord: true # Unknown to clang-format-4.0
42  #SplitEmptyNamespace: true # Unknown to clang-format-4.0
43BreakAfterAttributes: Never
44BreakBeforeBinaryOperators: None
45BreakBeforeBraces: Custom
46#BreakBeforeInheritanceComma: false # Unknown to clang-format-4.0
47BreakBeforeTernaryOperators: false
48BreakConstructorInitializersBeforeComma: false
49#BreakConstructorInitializers: BeforeComma # Unknown to clang-format-4.0
50BreakAfterJavaFieldAnnotations: false
51BreakStringLiterals: false
52ColumnLimit: 80
53CommentPragmas: '^ IWYU pragma:'
54#CompactNamespaces: false # Unknown to clang-format-4.0
55ConstructorInitializerAllOnOneLineOrOnePerLine: false
56ConstructorInitializerIndentWidth: 8
57ContinuationIndentWidth: 8
58Cpp11BracedListStyle: false
59DeriveLineEnding: false
60DerivePointerAlignment: false
61DisableFormat: false
62ExperimentalAutoDetectBinPacking: false
63#FixNamespaceComments: false # Unknown to clang-format-4.0
64#IncludeBlocks: Preserve # Unknown to clang-format-5.0
65IncludeCategories:
66  - Regex: '.*'
67    Priority: 1
68IncludeIsMainRegex: '(Test)?$'
69IndentCaseLabels: false
70IndentExternBlock: NoIndent
71#IndentPPDirectives: None # Unknown to clang-format-5.0
72IndentWidth: 8
73IndentWrappedFunctionNames: false
74InsertNewlineAtEOF: true
75JavaScriptQuotes: Leave
76JavaScriptWrapImports: true
77KeepEmptyLinesAtTheStartOfBlocks: false
78LineEnding: LF
79MacroBlockBegin: ''
80MacroBlockEnd: ''
81MaxEmptyLinesToKeep: 1
82NamespaceIndentation: Inner
83#ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0
84ObjCBlockIndentWidth: 8
85ObjCSpaceAfterProperty: true
86ObjCSpaceBeforeProtocolList: true
87
88# Taken from git's rules
89PenaltyBreakAssignment: 10
90PenaltyBreakBeforeFirstCallParameter: 30
91PenaltyBreakComment: 10
92PenaltyBreakFirstLessLess: 0
93PenaltyBreakString: 10
94PenaltyExcessCharacter: 100
95PenaltyReturnTypeOnItsOwnLine: 60
96
97PointerAlignment: Right
98ReflowComments: false
99SortIncludes: false
100#SortUsingDeclarations: false # Unknown to clang-format-4.0
101SpaceAfterCStyleCast: false
102SpaceAfterTemplateKeyword: true
103SpaceBeforeAssignmentOperators: true
104#SpaceBeforeCtorInitializerColon: true # Unknown to clang-format-5.0
105#SpaceBeforeInheritanceColon: true # Unknown to clang-format-5.0
106SpaceBeforeParens: ControlStatements
107#SpaceBeforeRangeBasedForLoopColon: true # Unknown to clang-format-5.0
108SpaceInEmptyParentheses: false
109SpacesBeforeTrailingComments: 1
110SpacesInAngles: false
111SpacesInContainerLiterals: false
112SpacesInCStyleCastParentheses: false
113SpacesInParentheses: false
114SpacesInSquareBrackets: false
115Standard: Cpp03
116TabWidth: 8
117UseTab: Always
118...
119