xref: /aosp_15_r20/external/coreboot/.clang-format (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1# SPDX-License-Identifier: GPL-2.0-only
2#
3# clang-format configuration file. Intended for clang-format >= 16.
4#
5# For more information, see:
6#
7#   https://clang.llvm.org/docs/ClangFormat.html
8#   https://clang.llvm.org/docs/ClangFormatStyleOptions.html
9#   https://clang-format-configurator.site/
10#
11
12---
13Language:        Cpp
14AccessModifierOffset: -4
15AlignAfterOpenBracket: Align
16AlignArrayOfStructures: Left
17AlignConsecutiveAssignments:
18  Enabled:         false
19  AcrossEmptyLines: false
20  AcrossComments:  true
21  AlignCompound:   false
22  PadOperators:    true
23AlignConsecutiveBitFields:
24  Enabled:         true
25  AcrossEmptyLines: false
26  AcrossComments:  false
27  AlignCompound:   false
28  PadOperators:    true
29AlignConsecutiveDeclarations:
30  Enabled:         false
31  AcrossEmptyLines: false
32  AcrossComments:  false
33  AlignCompound:   false
34  PadOperators:    true
35AlignConsecutiveMacros:
36  Enabled:         true
37  AcrossEmptyLines: false
38  AcrossComments:  false
39  AlignCompound:   false
40  PadOperators:    true
41AlignEscapedNewlines: Left
42AlignOperands:   Align
43AlignTrailingComments:
44  Kind:            Always
45  OverEmptyLines:  0
46AllowAllArgumentsOnNextLine: true
47AllowAllParametersOfDeclarationOnNextLine: false
48AllowShortBlocksOnASingleLine: Never
49AllowShortCaseLabelsOnASingleLine: false
50AllowShortEnumsOnASingleLine: true
51AllowShortFunctionsOnASingleLine: None
52AllowShortIfStatementsOnASingleLine: Never
53AllowShortLambdasOnASingleLine: All
54AllowShortLoopsOnASingleLine: false
55AlwaysBreakAfterDefinitionReturnType: None
56AlwaysBreakAfterReturnType: None
57AlwaysBreakBeforeMultilineStrings: false
58AlwaysBreakTemplateDeclarations: MultiLine
59
60# git grep '^#define [^[:space:]]*__.*[^[:space:]]*__attribute__' | grep -v "vendorcode\|payloads\|util" | sed "s|.*:||;s|^#define \([^[:space:]]*__[^([:space:]]*\).*$|  - '\1'|" | LC_ALL=C sort -u
61AttributeMacros:
62  - '__aligned'
63  - '__always_inline'
64  - '__always_unused'
65  - '__cpu_driver'
66  - '__fallthrough'
67  - '__maybe_unused'
68  - '__must_check'
69  - '__noreturn'
70  - '__packed'
71  - '__pci_driver'
72  - '__printf'
73  - '__weak'
74BinPackArguments: true
75BinPackParameters: true
76BitFieldColonSpacing: Both
77BraceWrapping:
78  AfterCaseLabel:  false
79  AfterClass:      false
80  AfterControlStatement: Never
81  AfterEnum:       false
82  AfterExternBlock: false
83  AfterFunction:   true
84  AfterNamespace:  true
85  AfterObjCDeclaration: false
86  AfterStruct:     false
87  AfterUnion:      false
88  BeforeCatch:     false
89  BeforeElse:      false
90  BeforeLambdaBody: false
91  BeforeWhile:     false
92  IndentBraces:    false
93  SplitEmptyFunction: true
94  SplitEmptyRecord: true
95  SplitEmptyNamespace: true
96BreakAfterAttributes: Never
97BreakAfterJavaFieldAnnotations: false
98BreakArrays:     false
99BreakBeforeBinaryOperators: None
100BreakBeforeConceptDeclarations: Always
101BreakBeforeBraces: Custom
102BreakBeforeInlineASMColon: OnlyMultiline
103BreakBeforeTernaryOperators: false
104BreakConstructorInitializers: AfterColon
105BreakInheritanceList: AfterColon
106BreakStringLiterals: false
107ColumnLimit:     96
108CommentPragmas:  '^ IWYU pragma:'
109CompactNamespaces: false
110ConstructorInitializerIndentWidth: 8
111ContinuationIndentWidth: 8
112Cpp11BracedListStyle: true
113DerivePointerAlignment: false
114DisableFormat:   false
115EmptyLineAfterAccessModifier: Never
116EmptyLineBeforeAccessModifier: LogicalBlock
117ExperimentalAutoDetectBinPacking: false
118FixNamespaceComments: false
119
120# git grep '^#define [^[:space:]]*for_each[^[:space:]]*(' | grep -v "vendorcode\|payloads\|util" | sed "s|.*:||;s|^#define \([^[:space:]]*for_each[^[:space:]]*\)(.*$|  - '\1'|" | LC_ALL=C sort -u
121ForEachMacros:
122  - 'list_for_each'
123
124# git grep -i '^#define \+if[^[:space:]]*(' | grep -v "vendorcode\|payloads\|util" | sed "s|.*:||;s|^#define \([^[:space:]]*if[^[:space:]]*\)(.*$|  - '\1'|I" | grep -v IFIX | LC_ALL=C sort -u
125IfMacros:
126  - 'IF_CHANNEL_POPULATED'
127  - 'IF_DIMM_POPULATED'
128  - 'IF_RANK_POPULATED'
129  - 'IfBit0'
130IncludeBlocks:   Preserve
131IncludeIsMainSourceRegex: ''
132IndentAccessModifiers: false
133IndentCaseBlocks: false
134IndentCaseLabels: false
135IndentExternBlock: AfterExternBlock
136IndentGotoLabels: false
137IndentPPDirectives: None
138IndentRequiresClause: true
139IndentWidth:     8
140IndentWrappedFunctionNames: false
141InsertBraces:    false
142InsertNewlineAtEOF: true
143InsertTrailingCommas: None
144IntegerLiteralSeparator:
145  Binary:          0
146  BinaryMinDigits: 0
147  Decimal:         0
148  DecimalMinDigits: 0
149  Hex:             0
150  HexMinDigits:    0
151JavaScriptQuotes: Leave
152JavaScriptWrapImports: true
153KeepEmptyLinesAtTheStartOfBlocks: false
154LambdaBodyIndentation: Signature
155LineEnding:      LF
156MacroBlockBegin: ''
157MacroBlockEnd:   ''
158MaxEmptyLinesToKeep: 1
159NamespaceIndentation: None
160ObjCBinPackProtocolList: Auto
161ObjCBlockIndentWidth: 8
162ObjCBreakBeforeNestedBlockParam: true
163ObjCSpaceAfterProperty: true
164ObjCSpaceBeforeProtocolList: true
165PackConstructorInitializers: BinPack
166PenaltyBreakAssignment: 10
167PenaltyBreakBeforeFirstCallParameter: 30
168PenaltyBreakComment: 10
169PenaltyBreakFirstLessLess: 0
170PenaltyBreakOpenParenthesis: 0
171PenaltyBreakString: 10
172PenaltyBreakTemplateDeclaration: 10
173PenaltyExcessCharacter: 100
174PenaltyIndentedWhitespace: 0
175PenaltyReturnTypeOnItsOwnLine: 60
176PointerAlignment: Right
177PPIndentWidth:   -1
178QualifierAlignment: Left
179ReferenceAlignment: Pointer
180ReflowComments:  false
181RemoveBracesLLVM: false
182RemoveSemicolon: false
183RequiresClausePosition: OwnLine
184RequiresExpressionIndentation: OuterScope
185SeparateDefinitionBlocks: Leave
186ShortNamespaceLines: 1
187SortIncludes:    Never
188SortJavaStaticImport: Before
189SortUsingDeclarations: Never
190SpaceAfterCStyleCast: false
191SpaceAfterLogicalNot: false
192SpaceAfterTemplateKeyword: true
193SpaceAroundPointerQualifiers: Default
194SpaceBeforeAssignmentOperators: true
195SpaceBeforeCaseColon: false
196SpaceBeforeCpp11BracedList: false
197SpaceBeforeCtorInitializerColon: true
198SpaceBeforeInheritanceColon: true
199SpaceBeforeParens: ControlStatementsExceptControlMacros
200SpaceBeforeParensOptions:
201  AfterControlStatements: true
202  AfterForeachMacros: false
203  AfterFunctionDefinitionName: false
204  AfterFunctionDeclarationName: false
205  AfterIfMacros:   false
206  AfterOverloadedOperator: false
207  AfterRequiresInClause: false
208  AfterRequiresInExpression: false
209  BeforeNonEmptyParentheses: false
210SpaceBeforeRangeBasedForLoopColon: true
211SpaceBeforeSquareBrackets: false
212SpaceInEmptyBlock: false
213SpaceInEmptyParentheses: false
214SpacesBeforeTrailingComments: 1
215SpacesInAngles:  Never
216SpacesInConditionalStatement: false
217SpacesInContainerLiterals: false
218SpacesInCStyleCastParentheses: false
219SpacesInLineCommentPrefix:
220  Minimum:         1
221  Maximum:         1
222SpacesInParentheses: false
223SpacesInSquareBrackets: false
224Standard:        c++17
225TabWidth:        8
226UseTab:          ForContinuationAndIndentation
227...
228
229