xref: /openbmc/docs/style/c/.clang-format (revision d1d05ee6)
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
70#IndentPPDirectives: None # Unknown to clang-format-5.0
71IndentWidth: 8
72IndentWrappedFunctionNames: false
73InsertNewlineAtEOF: true
74JavaScriptQuotes: Leave
75JavaScriptWrapImports: true
76KeepEmptyLinesAtTheStartOfBlocks: false
77LineEnding: LF
78MacroBlockBegin: ''
79MacroBlockEnd: ''
80MaxEmptyLinesToKeep: 1
81NamespaceIndentation: Inner
82#ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0
83ObjCBlockIndentWidth: 8
84ObjCSpaceAfterProperty: true
85ObjCSpaceBeforeProtocolList: true
86
87# Taken from git's rules
88PenaltyBreakAssignment: 10
89PenaltyBreakBeforeFirstCallParameter: 30
90PenaltyBreakComment: 10
91PenaltyBreakFirstLessLess: 0
92PenaltyBreakString: 10
93PenaltyExcessCharacter: 100
94PenaltyReturnTypeOnItsOwnLine: 60
95
96PointerAlignment: Right
97ReflowComments: false
98SortIncludes: false
99#SortUsingDeclarations: false # Unknown to clang-format-4.0
100SpaceAfterCStyleCast: false
101SpaceAfterTemplateKeyword: true
102SpaceBeforeAssignmentOperators: true
103#SpaceBeforeCtorInitializerColon: true # Unknown to clang-format-5.0
104#SpaceBeforeInheritanceColon: true # Unknown to clang-format-5.0
105SpaceBeforeParens: ControlStatements
106#SpaceBeforeRangeBasedForLoopColon: true # Unknown to clang-format-5.0
107SpaceInEmptyParentheses: false
108SpacesBeforeTrailingComments: 1
109SpacesInAngles: false
110SpacesInContainerLiterals: false
111SpacesInCStyleCastParentheses: false
112SpacesInParentheses: false
113SpacesInSquareBrackets: false
114Standard: Cpp03
115TabWidth: 8
116UseTab: Always
117...
118