1- # SPDX-License-Identifier: GPL -2.0
1+ # SPDX-License-Identifier: Apache -2.0
22#
3- # clang-format configuration file. Intended for clang-format >= 4.
3+ # Note: The list of ForEachMacros can be obtained using:
44#
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
108#
9+ # References:
10+ # - https://clang.llvm.org/docs/ClangFormatStyleOptions.html
11+
1112---
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
2116AllowShortCaseLabelsOnASingleLine : false
17+ AllowShortEnumsOnASingleLine : false
2218AllowShortFunctionsOnASingleLine : None
2319AllowShortIfStatementsOnASingleLine : false
2420AllowShortLoopsOnASingleLine : 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
55- ColumnLimit : 80
56- CommentPragmas : ' ^ IWYU pragma:'
57- # CompactNamespaces: false # Unknown to clang-format-4.0
58- ConstructorInitializerAllOnOneLineOrOnePerLine : false
21+ AttributeMacros :
22+ - __aligned
23+ - __deprecated
24+ - __packed
25+ - __printf_like
26+ - __syscall
27+ - __syscall_always_inline
28+ - __subsystem
29+ BitFieldColonSpacing : After
30+ BreakBeforeBraces : Linux
31+ ColumnLimit : 100
5932ConstructorInitializerIndentWidth : 8
6033ContinuationIndentWidth : 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
7134ForEachMacros :
35+ - ' ARRAY_FOR_EACH'
36+ - ' ARRAY_FOR_EACH_PTR'
7237 - ' FOR_EACH'
7338 - ' FOR_EACH_FIXED_ARG'
39+ - ' FOR_EACH_IDX'
40+ - ' FOR_EACH_IDX_FIXED_ARG'
41+ - ' FOR_EACH_NONEMPTY_TERM'
7442 - ' RB_FOR_EACH'
7543 - ' RB_FOR_EACH_CONTAINER'
7644 - ' SYS_DLIST_FOR_EACH_CONTAINER'
@@ -85,61 +53,42 @@ ForEachMacros:
8553 - ' SYS_SLIST_FOR_EACH_CONTAINER_SAFE'
8654 - ' SYS_SLIST_FOR_EACH_NODE'
8755 - ' SYS_SLIST_FOR_EACH_NODE_SAFE'
56+ - ' _WAIT_Q_FOR_EACH'
57+ - ' Z_FOR_EACH'
58+ - ' Z_FOR_EACH_ENGINE'
59+ - ' Z_FOR_EACH_EXEC'
60+ - ' Z_FOR_EACH_FIXED_ARG'
61+ - ' Z_FOR_EACH_FIXED_ARG_EXEC'
62+ - ' Z_FOR_EACH_IDX'
63+ - ' Z_FOR_EACH_IDX_EXEC'
64+ - ' Z_FOR_EACH_IDX_FIXED_ARG'
65+ - ' Z_FOR_EACH_IDX_FIXED_ARG_EXEC'
8866 - ' Z_GENLIST_FOR_EACH_CONTAINER'
8967 - ' Z_GENLIST_FOR_EACH_CONTAINER_SAFE'
9068 - ' Z_GENLIST_FOR_EACH_NODE'
9169 - ' Z_GENLIST_FOR_EACH_NODE_SAFE'
92- - ' _WAIT_Q_FOR_EACH'
93-
94- # IncludeBlocks: Preserve # Unknown to clang-format-5.0
70+ - ' STRUCT_SECTION_FOREACH'
71+ - ' TYPE_SECTION_FOREACH'
72+ - ' K_SPINLOCK'
73+ IfMacros :
74+ - ' CHECKIF'
75+ # Disabled for now, see bug https://github.com/zephyrproject-rtos/zephyr/issues/48520
76+ # IncludeBlocks: Regroup
9577IncludeCategories :
96- - Regex : ' .*'
78+ - Regex : ' ^".*\.h"$'
79+ Priority : 0
80+ - 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>$'
9781 Priority : 1
98- IncludeIsMainRegex : ' (Test)?$'
82+ - Regex : ' ^\<zephyr/.*\.h\>$'
83+ Priority : 2
84+ - Regex : ' .*'
85+ Priority : 3
9986IndentCaseLabels : false
100- # IndentPPDirectives: None # Unknown to clang-format-5.0
10187IndentWidth : 8
102- IndentWrappedFunctionNames : false
103- JavaScriptQuotes : Leave
104- JavaScriptWrapImports : true
105- KeepEmptyLinesAtTheStartOfBlocks : false
106- MacroBlockBegin : ' '
107- MacroBlockEnd : ' '
108- MaxEmptyLinesToKeep : 1
109- NamespaceIndentation : Inner
110- # ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0
111- ObjCBlockIndentWidth : 8
112- ObjCSpaceAfterProperty : true
113- ObjCSpaceBeforeProtocolList : true
114-
115- # Taken from git's rules
116- # PenaltyBreakAssignment: 10 # Unknown to clang-format-4.0
117- PenaltyBreakBeforeFirstCallParameter : 30
118- PenaltyBreakComment : 10
119- PenaltyBreakFirstLessLess : 0
120- PenaltyBreakString : 10
121- PenaltyExcessCharacter : 100
122- PenaltyReturnTypeOnItsOwnLine : 60
123-
124- PointerAlignment : Right
125- ReflowComments : false
126- SortIncludes : false
127- # SortUsingDeclarations: false # Unknown to clang-format-4.0
128- SpaceAfterCStyleCast : false
129- SpaceAfterTemplateKeyword : true
130- SpaceBeforeAssignmentOperators : true
131- # SpaceBeforeCtorInitializerColon: true # Unknown to clang-format-5.0
132- # SpaceBeforeInheritanceColon: true # Unknown to clang-format-5.0
133- SpaceBeforeParens : ControlStatements
134- # SpaceBeforeRangeBasedForLoopColon: true # Unknown to clang-format-5.0
135- SpaceInEmptyParentheses : false
136- SpacesBeforeTrailingComments : 1
137- SpacesInAngles : false
138- SpacesInContainerLiterals : false
139- SpacesInCStyleCastParentheses : false
140- SpacesInParentheses : false
141- SpacesInSquareBrackets : false
142- Standard : Cpp03
143- TabWidth : 8
144- UseTab : Always
145- ...
88+ InsertBraces : true
89+ SpaceBeforeParens : ControlStatementsExceptControlMacros
90+ SortIncludes : Never
91+ UseTab : ForContinuationAndIndentation
92+ WhitespaceSensitiveMacros :
93+ - STRINGIFY
94+ - Z_STRINGIFY
0 commit comments