.clang-format 5.0 KB

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