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  - 'FOR_EACH'
36  - 'FOR_EACH_FIXED_ARG'
37  - 'FOR_EACH_IDX'
38  - 'FOR_EACH_IDX_FIXED_ARG'
39  - 'FOR_EACH_NONEMPTY_TERM'
40  - 'RB_FOR_EACH'
41  - 'RB_FOR_EACH_CONTAINER'
42  - 'SYS_DLIST_FOR_EACH_CONTAINER'
43  - 'SYS_DLIST_FOR_EACH_CONTAINER_SAFE'
44  - 'SYS_DLIST_FOR_EACH_NODE'
45  - 'SYS_DLIST_FOR_EACH_NODE_SAFE'
46  - 'SYS_SFLIST_FOR_EACH_CONTAINER'
47  - 'SYS_SFLIST_FOR_EACH_CONTAINER_SAFE'
48  - 'SYS_SFLIST_FOR_EACH_NODE'
49  - 'SYS_SFLIST_FOR_EACH_NODE_SAFE'
50  - 'SYS_SLIST_FOR_EACH_CONTAINER'
51  - 'SYS_SLIST_FOR_EACH_CONTAINER_SAFE'
52  - 'SYS_SLIST_FOR_EACH_NODE'
53  - 'SYS_SLIST_FOR_EACH_NODE_SAFE'
54  - '_WAIT_Q_FOR_EACH'
55  - 'Z_FOR_EACH'
56  - 'Z_FOR_EACH_ENGINE'
57  - 'Z_FOR_EACH_EXEC'
58  - 'Z_FOR_EACH_FIXED_ARG'
59  - 'Z_FOR_EACH_FIXED_ARG_EXEC'
60  - 'Z_FOR_EACH_IDX'
61  - 'Z_FOR_EACH_IDX_EXEC'
62  - 'Z_FOR_EACH_IDX_FIXED_ARG'
63  - 'Z_FOR_EACH_IDX_FIXED_ARG_EXEC'
64  - 'Z_GENLIST_FOR_EACH_CONTAINER'
65  - 'Z_GENLIST_FOR_EACH_CONTAINER_SAFE'
66  - 'Z_GENLIST_FOR_EACH_NODE'
67  - 'Z_GENLIST_FOR_EACH_NODE_SAFE'
68  - 'STRUCT_SECTION_FOREACH'
69  - 'TYPE_SECTION_FOREACH'
70  - 'K_SPINLOCK'
71IfMacros:
72  - 'CHECKIF'
73# Disabled for now, see bug https://github.com/zephyrproject-rtos/zephyr/issues/48520
74#IncludeBlocks: Regroup
75IncludeCategories:
76  - Regex: '^".*\.h"$'
77    Priority: 0
78  - 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>$'
79    Priority: 1
80  - Regex: '^\<zephyr/.*\.h\>$'
81    Priority: 2
82  - Regex: '.*'
83    Priority: 3
84IndentCaseLabels: false
85IndentWidth: 8
86InsertBraces: true
87SpaceBeforeParens: ControlStatementsExceptControlMacros
88SortIncludes: Never
89UseTab: ForContinuationAndIndentation
90WhitespaceSensitiveMacros:
91  - STRINGIFY
92  - Z_STRINGIFY
93