xref: /freebsd/.clang-format (revision 5ffd83dbcc34f10e07f6d3e968ae6365869615f4)
1# $FreeBSD$
2# Basic .clang-format
3---
4BasedOnStyle: WebKit
5AlignAfterOpenBracket: DontAlign
6AlignConsecutiveAssignments: false
7AlignConsecutiveDeclarations: false
8AlignEscapedNewlines: Left
9AlignOperands: false
10AlignTrailingComments: false
11AllowAllParametersOfDeclarationOnNextLine: false
12AllowShortBlocksOnASingleLine: false
13AllowShortCaseLabelsOnASingleLine: false
14AllowShortFunctionsOnASingleLine: InlineOnly
15AllowShortIfStatementsOnASingleLine: false
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
79IndentCaseLabels: false
80IndentPPDirectives: None
81Language: Cpp
82NamespaceIndentation: None
83PointerAlignment: Right
84ContinuationIndentWidth: 4
85IndentWidth: 8
86TabWidth: 8
87ColumnLimit: 80
88UseTab: Always
89SpaceAfterCStyleCast: false
90IncludeBlocks: Regroup
91IncludeCategories:
92  - Regex: '^\"opt_.*\.h\"'
93    Priority: 1
94    SortPriority: 10
95  - Regex: '^<sys/cdefs\.h>'
96    Priority: 2
97    SortPriority: 20
98  - Regex: '^<sys/types\.h>'
99    Priority: 2
100    SortPriority: 21
101  - Regex: '^<sys/param\.h>'
102    Priority: 2
103    SortPriority: 22
104  - Regex: '^<sys.*/'
105    Priority: 2
106    SortPriority: 23
107  - Regex: '^<vm/vm\.h>'
108    Priority: 3
109    SortPriority: 30
110  - Regex: '^<vm/'
111    Priority: 3
112    SortPriority: 31
113  - Regex: '^<machine/'
114    Priority: 4
115    SortPriority: 40
116  - Regex: '^<(x86|amd64|i386|xen)/'
117    Priority: 5
118    SortPriority: 50
119  - Regex: '^<dev/'
120    Priority: 6
121    SortPriority: 60
122  - Regex: '^<net.*/'
123    Priority: 7
124    SortPriority: 70
125  - Regex: '^<protocols/'
126    Priority: 7
127    SortPriority: 71
128  - Regex: '^<(fs|nfs(|client|server)|ufs)/'
129    Priority: 8
130    SortPriority: 80
131  - Regex: '^<[^/].*\.h'
132    Priority: 9
133    SortPriority: 90
134  - Regex: '^\".*\.h\"'
135    Priority: 10
136    SortPriority: 100
137# LLVM's header include ordering style is almost the exact opposite of ours.
138# Unfortunately, they have hard-coded their preferences into clang-format.
139# Clobbering this regular expression to avoid matching prevents non-system
140# headers from being forcibly moved to the top of the include list.
141# http://llvm.org/docs/CodingStandards.html#include-style
142IncludeIsMainRegex: 'BLAH_DONT_MATCH_ANYTHING'
143SortIncludes: true
144KeepEmptyLinesAtTheStartOfBlocks: true
145TypenameMacros:
146  - ARB_ELMTYPE
147  - ARB_HEAD
148  - ARB8_HEAD
149  - ARB16_HEAD
150  - ARB32_HEAD
151  - ARB_ENTRY
152  - ARB8_ENTRY
153  - ARB16_ENTRY
154  - ARB32_ENTRY
155  - LIST_CLASS_ENTRY
156  - LIST_CLASS_HEAD
157  - LIST_ENTRY
158  - LIST_HEAD
159  - QUEUE_TYPEOF
160  - RB_ENTRY
161  - RB_HEAD
162  - SLIST_CLASS_HEAD
163  - SLIST_CLASS_ENTRY
164  - SLIST_HEAD
165  - SLIST_ENTRY
166  - SMR_POINTER
167  - SPLAY_ENTRY
168  - SPLAY_HEAD
169  - STAILQ_CLASS_ENTRY
170  - STAILQ_CLASS_HEAD
171  - STAILQ_ENTRY
172  - STAILQ_HEAD
173  - TAILQ_CLASS_ENTRY
174  - TAILQ_CLASS_HEAD
175  - TAILQ_ENTRY
176  - TAILQ_HEAD
177