1# SPDX-License-Identifier: GPL-2.0
2#
3# clang-format configuration file. Intended for clang-format >= 4.
4#
5# For more information, see:
6#
7#   Documentation/process/clang-format.rst
8#   https://clang.llvm.org/docs/ClangFormat.html
9#   https://clang.llvm.org/docs/ClangFormatStyleOptions.html
10#
11---
12AccessModifierOffset: -4
13AlignAfterOpenBracket: Align
14AlignConsecutiveAssignments: false
15AlignConsecutiveDeclarations: false
16#AlignEscapedNewlines: Left # Unknown to clang-format-4.0
17AlignOperands: true
18AlignTrailingComments: false
19AllowAllParametersOfDeclarationOnNextLine: false
20AllowShortBlocksOnASingleLine: false
21AllowShortCaseLabelsOnASingleLine: false
22AllowShortFunctionsOnASingleLine: None
23AllowShortIfStatementsOnASingleLine: false
24AllowShortLoopsOnASingleLine: false
25AlwaysBreakAfterDefinitionReturnType: None
26AlwaysBreakAfterReturnType: None
27AlwaysBreakBeforeMultilineStrings: false
28AlwaysBreakTemplateDeclarations: false
29BinPackArguments: true
30BinPackParameters: true
31BraceWrapping:
32  AfterClass: false
33  AfterControlStatement: false
34  AfterEnum: false
35  AfterFunction: true
36  AfterNamespace: true
37  AfterObjCDeclaration: false
38  AfterStruct: false
39  AfterUnion: false
40  #AfterExternBlock: false # Unknown to clang-format-5.0
41  BeforeCatch: false
42  BeforeElse: false
43  IndentBraces: false
44  #SplitEmptyFunction: true # Unknown to clang-format-4.0
45  #SplitEmptyRecord: true # Unknown to clang-format-4.0
46  #SplitEmptyNamespace: true # Unknown to clang-format-4.0
47BreakBeforeBinaryOperators: None
48BreakBeforeBraces: Custom
49#BreakBeforeInheritanceComma: false # Unknown to clang-format-4.0
50BreakBeforeTernaryOperators: false
51BreakConstructorInitializersBeforeComma: false
52#BreakConstructorInitializers: BeforeComma # Unknown to clang-format-4.0
53BreakAfterJavaFieldAnnotations: false
54BreakStringLiterals: false
55ColumnLimit: 100
56CommentPragmas: '^ IWYU pragma:'
57#CompactNamespaces: false # Unknown to clang-format-4.0
58ConstructorInitializerAllOnOneLineOrOnePerLine: false
59ConstructorInitializerIndentWidth: 8
60ContinuationIndentWidth: 8
61Cpp11BracedListStyle: false
62DerivePointerAlignment: false
63DisableFormat: false
64ExperimentalAutoDetectBinPacking: false
65#FixNamespaceComments: false # Unknown to clang-format-4.0
66
67# Taken from:
68#   git grep -h '^#define [^[:space:]]*FOR_EACH[^[:space:]]*(' include/ \
69#   | sed "s,^#define \([^[:space:]]*FOR_EACH[^[:space:]]*\)(.*$,  - '\1'," \
70#   | sort | uniq
71ForEachMacros:
72  - 'FOR_EACH'
73  - 'FOR_EACH_FIXED_ARG'
74  - 'RB_FOR_EACH'
75  - 'RB_FOR_EACH_CONTAINER'
76  - 'SYS_DLIST_FOR_EACH_CONTAINER'
77  - 'SYS_DLIST_FOR_EACH_CONTAINER_SAFE'
78  - 'SYS_DLIST_FOR_EACH_NODE'
79  - 'SYS_DLIST_FOR_EACH_NODE_SAFE'
80  - 'SYS_SFLIST_FOR_EACH_CONTAINER'
81  - 'SYS_SFLIST_FOR_EACH_CONTAINER_SAFE'
82  - 'SYS_SFLIST_FOR_EACH_NODE'
83  - 'SYS_SFLIST_FOR_EACH_NODE_SAFE'
84  - 'SYS_SLIST_FOR_EACH_CONTAINER'
85  - 'SYS_SLIST_FOR_EACH_CONTAINER_SAFE'
86  - 'SYS_SLIST_FOR_EACH_NODE'
87  - 'SYS_SLIST_FOR_EACH_NODE_SAFE'
88  - 'Z_GENLIST_FOR_EACH_CONTAINER'
89  - 'Z_GENLIST_FOR_EACH_CONTAINER_SAFE'
90  - 'Z_GENLIST_FOR_EACH_NODE'
91  - 'Z_GENLIST_FOR_EACH_NODE_SAFE'
92  - '_WAIT_Q_FOR_EACH'
93
94#IncludeBlocks: Preserve # Unknown to clang-format-5.0
95IncludeCategories:
96  - Regex: '.*'
97    Priority: 1
98IncludeIsMainRegex: '(Test)?$'
99IndentCaseLabels: false
100#IndentPPDirectives: None # Unknown to clang-format-5.0
101IndentWidth: 8
102IndentWrappedFunctionNames: false
103JavaScriptQuotes: Leave
104JavaScriptWrapImports: true
105KeepEmptyLinesAtTheStartOfBlocks: false
106MacroBlockBegin: ''
107MacroBlockEnd: ''
108MaxEmptyLinesToKeep: 1
109NamespaceIndentation: Inner
110#ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0
111ObjCBlockIndentWidth: 8
112ObjCSpaceAfterProperty: true
113ObjCSpaceBeforeProtocolList: true
114
115# Taken from git's rules
116#PenaltyBreakAssignment: 10 # Unknown to clang-format-4.0
117PenaltyBreakBeforeFirstCallParameter: 30
118PenaltyBreakComment: 10
119PenaltyBreakFirstLessLess: 0
120PenaltyBreakString: 10
121PenaltyExcessCharacter: 100
122PenaltyReturnTypeOnItsOwnLine: 60
123
124PointerAlignment: Right
125ReflowComments: false
126SortIncludes: false
127#SortUsingDeclarations: false # Unknown to clang-format-4.0
128SpaceAfterCStyleCast: false
129SpaceAfterTemplateKeyword: true
130SpaceBeforeAssignmentOperators: true
131#SpaceBeforeCtorInitializerColon: true # Unknown to clang-format-5.0
132#SpaceBeforeInheritanceColon: true # Unknown to clang-format-5.0
133SpaceBeforeParens: ControlStatements
134#SpaceBeforeRangeBasedForLoopColon: true # Unknown to clang-format-5.0
135SpaceInEmptyParentheses: false
136SpacesBeforeTrailingComments: 1
137SpacesInAngles: false
138SpacesInContainerLiterals: false
139SpacesInCStyleCastParentheses: false
140SpacesInParentheses: false
141SpacesInSquareBrackets: false
142Standard: Cpp03
143TabWidth: 8
144UseTab: Always
145...
146