1# SPDX-License-Identifier: Apache-2.0
2#
3# Note: The list of ForEachMacros can be obtained using:
4#
5#    git grep -h '^#define [^[:space:]]*FOR_EACH[^[:space:]]*(' include/ \
6#    | sed "s,^#define \([^[:space:]]*FOR_EACH[^[:space:]]*\)(.*$,  - '\1'," \
7#    | sort | uniq
8#
9# References:
10#   - https://clang.llvm.org/docs/ClangFormatStyleOptions.html
11
12---
13BasedOnStyle: LLVM
14AlignConsecutiveMacros: AcrossComments
15AllowShortBlocksOnASingleLine: Never
16AllowShortCaseLabelsOnASingleLine: false
17AllowShortEnumsOnASingleLine: false
18AllowShortFunctionsOnASingleLine: None
19AllowShortIfStatementsOnASingleLine: false
20AllowShortLoopsOnASingleLine: false
21AttributeMacros:
22  - __aligned
23  - __deprecated
24  - __packed
25  - __printf_like
26  - __syscall
27  - __syscall_always_inline
28  - __subsystem
29BitFieldColonSpacing: After
30BreakBeforeBraces: Linux
31ColumnLimit: 100
32ConstructorInitializerIndentWidth: 8
33ContinuationIndentWidth: 8
34ForEachMacros:
35  - 'ARRAY_FOR_EACH'
36  - 'ARRAY_FOR_EACH_PTR'
37  - 'FOR_EACH'
38  - 'FOR_EACH_FIXED_ARG'
39  - 'FOR_EACH_IDX'
40  - 'FOR_EACH_IDX_FIXED_ARG'
41  - 'FOR_EACH_NONEMPTY_TERM'
42  - 'FOR_EACH_FIXED_ARG_NONEMPTY_TERM'
43  - 'RB_FOR_EACH'
44  - 'RB_FOR_EACH_CONTAINER'
45  - 'SYS_DLIST_FOR_EACH_CONTAINER'
46  - 'SYS_DLIST_FOR_EACH_CONTAINER_SAFE'
47  - 'SYS_DLIST_FOR_EACH_NODE'
48  - 'SYS_DLIST_FOR_EACH_NODE_SAFE'
49  - 'SYS_SEM_LOCK'
50  - 'SYS_SFLIST_FOR_EACH_CONTAINER'
51  - 'SYS_SFLIST_FOR_EACH_CONTAINER_SAFE'
52  - 'SYS_SFLIST_FOR_EACH_NODE'
53  - 'SYS_SFLIST_FOR_EACH_NODE_SAFE'
54  - 'SYS_SLIST_FOR_EACH_CONTAINER'
55  - 'SYS_SLIST_FOR_EACH_CONTAINER_SAFE'
56  - 'SYS_SLIST_FOR_EACH_NODE'
57  - 'SYS_SLIST_FOR_EACH_NODE_SAFE'
58  - '_WAIT_Q_FOR_EACH'
59  - 'Z_FOR_EACH'
60  - 'Z_FOR_EACH_ENGINE'
61  - 'Z_FOR_EACH_EXEC'
62  - 'Z_FOR_EACH_FIXED_ARG'
63  - 'Z_FOR_EACH_FIXED_ARG_EXEC'
64  - 'Z_FOR_EACH_IDX'
65  - 'Z_FOR_EACH_IDX_EXEC'
66  - 'Z_FOR_EACH_IDX_FIXED_ARG'
67  - 'Z_FOR_EACH_IDX_FIXED_ARG_EXEC'
68  - 'Z_GENLIST_FOR_EACH_CONTAINER'
69  - 'Z_GENLIST_FOR_EACH_CONTAINER_SAFE'
70  - 'Z_GENLIST_FOR_EACH_NODE'
71  - 'Z_GENLIST_FOR_EACH_NODE_SAFE'
72  - 'STRUCT_SECTION_FOREACH'
73  - 'STRUCT_SECTION_FOREACH_ALTERNATE'
74  - 'TYPE_SECTION_FOREACH'
75  - 'K_SPINLOCK'
76  - 'COAP_RESOURCE_FOREACH'
77  - 'COAP_SERVICE_FOREACH'
78  - 'COAP_SERVICE_FOREACH_RESOURCE'
79  - 'HTTP_RESOURCE_FOREACH'
80  - 'HTTP_SERVER_CONTENT_TYPE_FOREACH'
81  - 'HTTP_SERVICE_FOREACH'
82  - 'HTTP_SERVICE_FOREACH_RESOURCE'
83  - 'I3C_BUS_FOR_EACH_I3CDEV'
84  - 'I3C_BUS_FOR_EACH_I2CDEV'
85IfMacros:
86  - 'CHECKIF'
87# Disabled for now, see bug https://github.com/zephyrproject-rtos/zephyr/issues/48520
88#IncludeBlocks: Regroup
89IncludeCategories:
90  - Regex: '^".*\.h"$'
91    Priority: 0
92  - 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>$'
93    Priority: 1
94  - Regex: '^\<zephyr/.*\.h\>$'
95    Priority: 2
96  - Regex: '.*'
97    Priority: 3
98IndentCaseLabels: false
99IndentGotoLabels: false
100IndentWidth: 8
101InsertBraces: true
102SpaceBeforeInheritanceColon: False
103SpaceBeforeParens: ControlStatementsExceptControlMacros
104SortIncludes: Never
105UseTab: ForContinuationAndIndentation
106WhitespaceSensitiveMacros:
107  - COND_CODE_0
108  - COND_CODE_1
109  - IF_DISABLED
110  - IF_ENABLED
111  - LISTIFY
112  - STRINGIFY
113  - Z_STRINGIFY
114  - DT_FOREACH_PROP_ELEM_SEP
115