1
- # SPDX-License-Identifier: GPL -2.0
1
+ # SPDX-License-Identifier: Apache -2.0
2
2
#
3
- # clang-format configuration file. Intended for clang-format >= 4.
3
+ # Note: The list of ForEachMacros can be obtained using:
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
5
+ # git grep -h '^#define [^[:space:]]*FOR_EACH[^[:space:]]*(' include/ \
6
+ # | sed "s,^#define \([^[:space:]]*FOR_EACH[^[:space:]]*\)(.*$, - '\1'," \
7
+ # | sort | uniq
10
8
#
9
+ # References:
10
+ # - https://clang.llvm.org/docs/ClangFormatStyleOptions.html
11
+
11
12
---
12
- AccessModifierOffset : -4
13
- AlignAfterOpenBracket : Align
14
- AlignConsecutiveAssignments : false
15
- AlignConsecutiveDeclarations : false
16
- # AlignEscapedNewlines: Left # Unknown to clang-format-4.0
17
- AlignOperands : true
18
- AlignTrailingComments : false
19
- AllowAllParametersOfDeclarationOnNextLine : false
20
- AllowShortBlocksOnASingleLine : false
13
+ BasedOnStyle : LLVM
14
+ AlignConsecutiveMacros : AcrossComments
15
+ AllowShortBlocksOnASingleLine : Never
21
16
AllowShortCaseLabelsOnASingleLine : false
17
+ AllowShortEnumsOnASingleLine : false
22
18
AllowShortFunctionsOnASingleLine : None
23
19
AllowShortIfStatementsOnASingleLine : false
24
20
AllowShortLoopsOnASingleLine : false
25
- AlwaysBreakAfterDefinitionReturnType : None
26
- AlwaysBreakAfterReturnType : None
27
- AlwaysBreakBeforeMultilineStrings : false
28
- AlwaysBreakTemplateDeclarations : false
29
- BinPackArguments : true
30
- BinPackParameters : true
31
- BraceWrapping :
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
47
- BreakBeforeBinaryOperators : None
48
- BreakBeforeBraces : Custom
49
- # BreakBeforeInheritanceComma: false # Unknown to clang-format-4.0
50
- BreakBeforeTernaryOperators : false
51
- BreakConstructorInitializersBeforeComma : false
52
- # BreakConstructorInitializers: BeforeComma # Unknown to clang-format-4.0
53
- BreakAfterJavaFieldAnnotations : false
54
- BreakStringLiterals : false
21
+ AttributeMacros :
22
+ - __aligned
23
+ - __deprecated
24
+ - __packed
25
+ - __printf_like
26
+ - __syscall
27
+ - __subsystem
28
+ BitFieldColonSpacing : After
29
+ BreakBeforeBraces : Linux
55
30
ColumnLimit : 100
56
- CommentPragmas : ' ^ IWYU pragma:'
57
- # CompactNamespaces: false # Unknown to clang-format-4.0
58
- ConstructorInitializerAllOnOneLineOrOnePerLine : false
59
31
ConstructorInitializerIndentWidth : 8
60
32
ContinuationIndentWidth : 8
61
- Cpp11BracedListStyle : false
62
- DerivePointerAlignment : false
63
- DisableFormat : false
64
- ExperimentalAutoDetectBinPacking : 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
71
33
ForEachMacros :
72
34
- ' FOR_EACH'
73
- - ' metal_bitmap_for_each_clear_bit'
74
- - ' metal_bitmap_for_each_set_bit'
75
- - ' metal_for_each_page_size_down'
76
- - ' metal_for_each_page_size_up'
77
- - ' metal_list_for_each'
35
+ - ' FOR_EACH_FIXED_ARG'
36
+ - ' FOR_EACH_IDX'
37
+ - ' FOR_EACH_IDX_FIXED_ARG'
38
+ - ' FOR_EACH_NONEMPTY_TERM'
78
39
- ' RB_FOR_EACH'
79
40
- ' RB_FOR_EACH_CONTAINER'
80
41
- ' SYS_DLIST_FOR_EACH_CONTAINER'
@@ -90,62 +51,38 @@ ForEachMacros:
90
51
- ' SYS_SLIST_FOR_EACH_NODE'
91
52
- ' SYS_SLIST_FOR_EACH_NODE_SAFE'
92
53
- ' _WAIT_Q_FOR_EACH'
54
+ - ' Z_FOR_EACH'
55
+ - ' Z_FOR_EACH_ENGINE'
56
+ - ' Z_FOR_EACH_EXEC'
57
+ - ' Z_FOR_EACH_FIXED_ARG'
58
+ - ' Z_FOR_EACH_FIXED_ARG_EXEC'
59
+ - ' Z_FOR_EACH_IDX'
60
+ - ' Z_FOR_EACH_IDX_EXEC'
61
+ - ' Z_FOR_EACH_IDX_FIXED_ARG'
62
+ - ' Z_FOR_EACH_IDX_FIXED_ARG_EXEC'
93
63
- ' Z_GENLIST_FOR_EACH_CONTAINER'
94
64
- ' Z_GENLIST_FOR_EACH_CONTAINER_SAFE'
95
65
- ' Z_GENLIST_FOR_EACH_NODE'
96
66
- ' Z_GENLIST_FOR_EACH_NODE_SAFE'
97
-
98
- # IncludeBlocks: Preserve # Unknown to clang-format-5.0
67
+ IfMacros :
68
+ - ' CHECKIF'
69
+ # Disabled for now, see bug https://github.com/zephyrproject-rtos/zephyr/issues/48520
70
+ # IncludeBlocks: Regroup
99
71
IncludeCategories :
100
- - Regex : ' .*'
72
+ - Regex : ' ^".*\.h"$'
73
+ Priority : 0
74
+ - Regex : ' ^<(assert|complex|ctype|errno|fenv|float|inttypes|limits|locale|math|setjmp|signal|stdarg|stdbool|stddef|stdint|stdio|stdlib|string|tgmath|time|wchar|wctype)\.h>$'
101
75
Priority : 1
102
- IncludeIsMainRegex : ' (Test)?$'
76
+ - Regex : ' ^\<zephyr/.*\.h\>$'
77
+ Priority : 2
78
+ - Regex : ' .*'
79
+ Priority : 3
103
80
IndentCaseLabels : false
104
- IndentGotoLabels : false
105
- # IndentPPDirectives: None # Unknown to clang-format-5.0
106
81
IndentWidth : 8
107
- IndentWrappedFunctionNames : false
108
- JavaScriptQuotes : Leave
109
- JavaScriptWrapImports : true
110
- KeepEmptyLinesAtTheStartOfBlocks : false
111
- MacroBlockBegin : ' '
112
- MacroBlockEnd : ' '
113
- MaxEmptyLinesToKeep : 1
114
- NamespaceIndentation : Inner
115
- # ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0
116
- ObjCBlockIndentWidth : 8
117
- ObjCSpaceAfterProperty : true
118
- ObjCSpaceBeforeProtocolList : true
119
-
120
- # Taken from git's rules
121
- # PenaltyBreakAssignment: 10 # Unknown to clang-format-4.0
122
- PenaltyBreakBeforeFirstCallParameter : 30
123
- PenaltyBreakComment : 10
124
- PenaltyBreakFirstLessLess : 0
125
- PenaltyBreakString : 10
126
- PenaltyExcessCharacter : 100
127
- PenaltyReturnTypeOnItsOwnLine : 60
128
-
129
- PointerAlignment : Right
130
- ReflowComments : false
131
- SortIncludes : false
132
- # SortUsingDeclarations: false # Unknown to clang-format-4.0
133
- SpaceAfterCStyleCast : false
134
- SpaceAfterTemplateKeyword : true
135
- SpaceBeforeAssignmentOperators : true
136
- # SpaceBeforeCtorInitializerColon: true # Unknown to clang-format-5.0
137
- # SpaceBeforeInheritanceColon: true # Unknown to clang-format-5.0
138
- SpaceBeforeParens : ControlStatements
139
- # SpaceBeforeRangeBasedForLoopColon: true # Unknown to clang-format-5.0
140
- # BitFieldColonSpacing: BFCS_None # Supported from clang-format-12.0
141
- SpaceInEmptyParentheses : false
142
- SpacesBeforeTrailingComments : 1
143
- SpacesInAngles : false
144
- SpacesInContainerLiterals : false
145
- SpacesInCStyleCastParentheses : false
146
- SpacesInParentheses : false
147
- SpacesInSquareBrackets : false
148
- Standard : Cpp03
149
- TabWidth : 8
82
+ InsertBraces : true
83
+ SpaceBeforeParens : ControlStatementsExceptControlMacros
84
+ SortIncludes : Never
150
85
UseTab : Always
151
- ...
86
+ WhitespaceSensitiveMacros :
87
+ - STRINGIFY
88
+ - Z_STRINGIFY
0 commit comments