.clang-format 4.8 KB

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