blob: 4a78b29e6bbb62fc6a706ccda51ba67ae3a480ab [file] [log] [blame]
Jens Wiklanderfa171822023-05-12 10:58:21 +02001# SPDX-License-Identifier: GPL-2.0
2#
3# clang-format configuration file. Intended for clang-format >= 11.
4#
5# This is not perfect, but should help in most cases.
6# Please note that the maintainers have the last word if there's
7# disagrement with this tool.
8#
9# For more information, see:
10# https://clang.llvm.org/docs/ClangFormat.html
11# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
12#
13---
14AccessModifierOffset: -4
15AlignAfterOpenBracket: Align
16AlignConsecutiveAssignments: false
17AlignConsecutiveDeclarations: false
18AlignEscapedNewlines: Left
19AlignOperands: true
20AlignTrailingComments: false
21AllowAllParametersOfDeclarationOnNextLine: false
22AllowShortBlocksOnASingleLine: false
23AllowShortCaseLabelsOnASingleLine: false
24AllowShortFunctionsOnASingleLine: None
25AllowShortIfStatementsOnASingleLine: false
26AllowShortLoopsOnASingleLine: false
27AlwaysBreakAfterDefinitionReturnType: None
28AlwaysBreakAfterReturnType: None
29AlwaysBreakBeforeMultilineStrings: false
30AlwaysBreakTemplateDeclarations: false
31BinPackArguments: true
32BinPackParameters: true
33BraceWrapping:
34 AfterClass: false
35 AfterControlStatement: false
36 AfterEnum: false
37 AfterFunction: true
38 AfterNamespace: true
39 AfterObjCDeclaration: false
40 AfterStruct: false
41 AfterUnion: false
42 AfterExternBlock: false
43 BeforeCatch: false
44 BeforeElse: false
45 IndentBraces: false
46 SplitEmptyFunction: true
47 SplitEmptyRecord: true
48 SplitEmptyNamespace: true
49BreakBeforeBinaryOperators: None
50BreakBeforeBraces: Custom
51BreakBeforeInheritanceComma: false
52BreakBeforeTernaryOperators: false
53BreakConstructorInitializersBeforeComma: false
54BreakConstructorInitializers: BeforeComma
55BreakAfterJavaFieldAnnotations: false
56BreakStringLiterals: false
57ColumnLimit: 80
58CommentPragmas: '^ IWYU pragma:'
59CompactNamespaces: false
60ConstructorInitializerAllOnOneLineOrOnePerLine: false
61ConstructorInitializerIndentWidth: 8
62ContinuationIndentWidth: 8
63Cpp11BracedListStyle: false
64DerivePointerAlignment: false
65DisableFormat: false
66ExperimentalAutoDetectBinPacking: false
67FixNamespaceComments: false
68
69# Taken from:
70# find lib core -name "*.h" -path '*/include/*' -print0 | xargs -0 grep -E -h \
71# '^#define[[:blank:]]*[^[:blank:]]*(FOREACH|for_each)[^[:blank:]]' | \
72# sed \
73# -e "s,^#define[ \t]*\([^[:space:]]*for_each[^[:space:]]*\)(.*$, - '\1'," \
74# -e "s,^#define[ \t]*\([^[:space:]]*FOREACH[^[:space:]]*\)(.*$, - '\1'," | \
75# LC_ALL=C sort -u
76ForEachMacros:
77 - 'CIRCLEQ_FOREACH'
78 - 'CIRCLEQ_FOREACH_REVERSE'
79 - 'LIST_FOREACH'
80 - 'LIST_FOREACH_SAFE'
81 - 'SCATTERED_ARRAY_FOREACH'
82 - 'SIMPLEQ_FOREACH'
83 - 'SLIST_FOREACH'
84 - 'SLIST_FOREACH_SAFE'
85 - 'STAILQ_FOREACH'
86 - 'STAILQ_FOREACH_SAFE'
87 - 'TAILQ_FOREACH'
88 - 'TAILQ_FOREACH_REVERSE'
89 - 'TAILQ_FOREACH_REVERSE_SAFE'
90 - 'TAILQ_FOREACH_SAFE'
91 - 'fdt_for_each_property_offset'
92 - 'fdt_for_each_subnode'
93 - 'for_each_dt_driver'
94 - 'for_each_early_ta'
95 - 'for_each_fip_sp'
96 - 'for_each_secure_partition'
97
98IncludeBlocks: Preserve
99IncludeCategories:
100 - Regex: '.*'
101 Priority: 1
102IncludeIsMainRegex: '(Test)?$'
103IndentCaseLabels: false
104IndentGotoLabels: false
105IndentPPDirectives: None
106IndentWidth: 8
107IndentWrappedFunctionNames: false
108JavaScriptQuotes: Leave
109JavaScriptWrapImports: true
110KeepEmptyLinesAtTheStartOfBlocks: false
111MacroBlockBegin: ''
112MacroBlockEnd: ''
113MaxEmptyLinesToKeep: 1
114NamespaceIndentation: None
115ObjCBinPackProtocolList: Auto
116ObjCBlockIndentWidth: 8
117ObjCSpaceAfterProperty: true
118ObjCSpaceBeforeProtocolList: true
119
120# Taken from git's rules
121PenaltyBreakAssignment: 10
122PenaltyBreakBeforeFirstCallParameter: 30
123PenaltyBreakComment: 10
124PenaltyBreakFirstLessLess: 0
125PenaltyBreakString: 10
126PenaltyExcessCharacter: 100
127PenaltyReturnTypeOnItsOwnLine: 60
128
129PointerAlignment: Right
130ReflowComments: false
131SortIncludes: false
132SortUsingDeclarations: false
133SpaceAfterCStyleCast: false
134SpaceAfterTemplateKeyword: true
135SpaceBeforeAssignmentOperators: true
136SpaceBeforeCtorInitializerColon: true
137SpaceBeforeInheritanceColon: true
138SpaceBeforeParens: ControlStatementsExceptForEachMacros
139SpaceBeforeRangeBasedForLoopColon: true
140SpaceInEmptyParentheses: false
141SpacesBeforeTrailingComments: 1
142SpacesInAngles: false
143SpacesInContainerLiterals: false
144SpacesInCStyleCastParentheses: false
145SpacesInParentheses: false
146SpacesInSquareBrackets: false
147Standard: Cpp03
148TabWidth: 8
149UseTab: Always
150...