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