xref: /freebsd/.clang-format (revision 3d265fce43746c293ae826e9603adbfe09f93cf6)
1# $FreeBSD$
2# Basic .clang-format
3---
4BasedOnStyle: WebKit
5AlignAfterOpenBracket: DontAlign
6AlignConsecutiveAssignments: false
7AlignConsecutiveDeclarations: false
8AlignEscapedNewlines: Left
9AlignOperands: false
10AlignTrailingComments: true
11AllowAllParametersOfDeclarationOnNextLine: false
12AllowShortBlocksOnASingleLine: Never
13AllowShortCaseLabelsOnASingleLine: false
14AllowShortFunctionsOnASingleLine: InlineOnly
15AllowShortIfStatementsOnASingleLine: Never
16AllowShortLoopsOnASingleLine: false
17AlwaysBreakAfterReturnType: TopLevelDefinitions
18AlwaysBreakBeforeMultilineStrings: false
19AlwaysBreakTemplateDeclarations: MultiLine
20BinPackArguments: true
21BinPackParameters: true
22BreakBeforeBinaryOperators: None
23BreakBeforeBraces: WebKit
24BreakBeforeTernaryOperators: false
25# TODO: BreakStringLiterals can cause very strange formatting so turn it off?
26BreakStringLiterals: false
27PenaltyBreakBeforeFirstCallParameter: 1000
28CompactNamespaces: true
29DerivePointerAlignment: false
30DisableFormat: false
31ForEachMacros:
32  - ARB_ARRFOREACH
33  - ARB_ARRFOREACH_REVWCOND
34  - ARB_ARRFOREACH_REVERSE
35  - ARB_FOREACH
36  - ARB_FOREACH_FROM
37  - ARB_FOREACH_SAFE
38  - ARB_FOREACH_REVERSE
39  - ARB_FOREACH_REVERSE_FROM
40  - ARB_FOREACH_REVERSE_SAFE
41  - CPU_FOREACH
42  - FOREACH_THREAD_IN_PROC
43  - FOREACH_PROC_IN_SYSTEM
44  - FOREACH_PRISON_CHILD
45  - FOREACH_PRISON_DESCENDANT
46  - FOREACH_PRISON_DESCENDANT_LOCKED
47  - FOREACH_PRISON_DESCENDANT_LOCKED_LEVEL
48  - MNT_VNODE_FOREACH_ALL
49  - MNT_VNODE_FOREACH_ACTIVE
50  - RB_FOREACH
51  - RB_FOREACH_FROM
52  - RB_FOREACH_SAFE
53  - RB_FOREACH_REVERSE
54  - RB_FOREACH_REVERSE_FROM
55  - RB_FOREACH_REVERSE_SAFE
56  - SLIST_FOREACH
57  - SLIST_FOREACH_FROM
58  - SLIST_FOREACH_FROM_SAFE
59  - SLIST_FOREACH_SAFE
60  - SLIST_FOREACH_PREVPTR
61  - SPLAY_FOREACH
62  - LIST_FOREACH
63  - LIST_FOREACH_FROM
64  - LIST_FOREACH_FROM_SAFE
65  - LIST_FOREACH_SAFE
66  - STAILQ_FOREACH
67  - STAILQ_FOREACH_FROM
68  - STAILQ_FOREACH_FROM_SAFE
69  - STAILQ_FOREACH_SAFE
70  - TAILQ_FOREACH
71  - TAILQ_FOREACH_FROM
72  - TAILQ_FOREACH_FROM_SAFE
73  - TAILQ_FOREACH_REVERSE
74  - TAILQ_FOREACH_REVERSE_FROM
75  - TAILQ_FOREACH_REVERSE_FROM_SAFE
76  - TAILQ_FOREACH_REVERSE_SAFE
77  - TAILQ_FOREACH_SAFE
78  - VM_MAP_ENTRY_FOREACH
79  - VM_PAGE_DUMP_FOREACH
80IndentCaseLabels: false
81IndentPPDirectives: None
82Language: Cpp
83NamespaceIndentation: None
84PointerAlignment: Right
85ContinuationIndentWidth: 4
86IndentWidth: 8
87TabWidth: 8
88ColumnLimit: 80
89UseTab: Always
90SpaceAfterCStyleCast: false
91IncludeBlocks: Regroup
92IncludeCategories:
93  - Regex: '^\"opt_.*\.h\"'
94    Priority: 1
95    SortPriority: 10
96  - Regex: '^<sys/cdefs\.h>'
97    Priority: 2
98    SortPriority: 20
99  - Regex: '^<sys/types\.h>'
100    Priority: 2
101    SortPriority: 21
102  - Regex: '^<sys/param\.h>'
103    Priority: 2
104    SortPriority: 22
105  - Regex: '^<sys.*/'
106    Priority: 2
107    SortPriority: 23
108  - Regex: '^<vm/vm\.h>'
109    Priority: 3
110    SortPriority: 30
111  - Regex: '^<vm/'
112    Priority: 3
113    SortPriority: 31
114  - Regex: '^<machine/'
115    Priority: 4
116    SortPriority: 40
117  - Regex: '^<(x86|amd64|i386|xen)/'
118    Priority: 5
119    SortPriority: 50
120  - Regex: '^<dev/'
121    Priority: 6
122    SortPriority: 60
123  - Regex: '^<net.*/'
124    Priority: 7
125    SortPriority: 70
126  - Regex: '^<protocols/'
127    Priority: 7
128    SortPriority: 71
129  - Regex: '^<(fs|nfs(|client|server)|ufs)/'
130    Priority: 8
131    SortPriority: 80
132  - Regex: '^<[^/].*\.h'
133    Priority: 9
134    SortPriority: 90
135  - Regex: '^\".*\.h\"'
136    Priority: 10
137    SortPriority: 100
138# LLVM's header include ordering style is almost the exact opposite of ours.
139# Unfortunately, they have hard-coded their preferences into clang-format.
140# Clobbering this regular expression to avoid matching prevents non-system
141# headers from being forcibly moved to the top of the include list.
142# http://llvm.org/docs/CodingStandards.html#include-style
143IncludeIsMainRegex: 'BLAH_DONT_MATCH_ANYTHING'
144SortIncludes: true
145KeepEmptyLinesAtTheStartOfBlocks: true
146TypenameMacros:
147  - ARB_ELMTYPE
148  - ARB_HEAD
149  - ARB8_HEAD
150  - ARB16_HEAD
151  - ARB32_HEAD
152  - ARB_ENTRY
153  - ARB8_ENTRY
154  - ARB16_ENTRY
155  - ARB32_ENTRY
156  - LIST_CLASS_ENTRY
157  - LIST_CLASS_HEAD
158  - LIST_ENTRY
159  - LIST_HEAD
160  - QUEUE_TYPEOF
161  - RB_ENTRY
162  - RB_HEAD
163  - SLIST_CLASS_HEAD
164  - SLIST_CLASS_ENTRY
165  - SLIST_HEAD
166  - SLIST_ENTRY
167  - SMR_POINTER
168  - SPLAY_ENTRY
169  - SPLAY_HEAD
170  - STAILQ_CLASS_ENTRY
171  - STAILQ_CLASS_HEAD
172  - STAILQ_ENTRY
173  - STAILQ_HEAD
174  - TAILQ_CLASS_ENTRY
175  - TAILQ_CLASS_HEAD
176  - TAILQ_ENTRY
177  - TAILQ_HEAD
178