.clang-format 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. # $FreeBSD$
  2. # Basic .clang-format
  3. ---
  4. BasedOnStyle: WebKit
  5. AlignAfterOpenBracket: DontAlign
  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. - 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
  94. IndentCaseLabels: false
  95. IndentPPDirectives: None
  96. Language: Cpp
  97. NamespaceIndentation: None
  98. PointerAlignment: Right
  99. ContinuationIndentWidth: 4
  100. IndentWidth: 8
  101. TabWidth: 8
  102. ColumnLimit: 80
  103. UseTab: Always
  104. SpaceAfterCStyleCast: false
  105. IncludeBlocks: Regroup
  106. IncludeCategories:
  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
  160. IncludeIsMainRegex: 'BLAH_DONT_MATCH_ANYTHING'
  161. SortIncludes: true
  162. KeepEmptyLinesAtTheStartOfBlocks: true
  163. TypenameMacros:
  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