.clang-format 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. # SPDX-License-Identifier: GPL-2.0
  2. #
  3. # clang-format configuration file. Intended for clang-format >= 4.
  4. #
  5. # For more information, see:
  6. #
  7. # Documentation/process/clang-format.rst
  8. # https://clang.llvm.org/docs/ClangFormat.html
  9. # https://clang.llvm.org/docs/ClangFormatStyleOptions.html
  10. #
  11. ---
  12. AccessModifierOffset: -4
  13. AlignAfterOpenBracket: Align
  14. AlignConsecutiveAssignments: false
  15. AlignConsecutiveDeclarations: false
  16. #AlignEscapedNewlines: Left # Unknown to clang-format-4.0
  17. AlignOperands: true
  18. AlignTrailingComments: false
  19. AllowAllParametersOfDeclarationOnNextLine: false
  20. AllowShortBlocksOnASingleLine: false
  21. AllowShortCaseLabelsOnASingleLine: false
  22. AllowShortFunctionsOnASingleLine: None
  23. AllowShortIfStatementsOnASingleLine: false
  24. AllowShortLoopsOnASingleLine: false
  25. AlwaysBreakAfterDefinitionReturnType: None
  26. AlwaysBreakAfterReturnType: None
  27. AlwaysBreakBeforeMultilineStrings: false
  28. AlwaysBreakTemplateDeclarations: false
  29. BinPackArguments: true
  30. BinPackParameters: true
  31. BraceWrapping:
  32. AfterClass: false
  33. AfterControlStatement: false
  34. AfterEnum: false
  35. AfterFunction: true
  36. AfterNamespace: true
  37. AfterObjCDeclaration: false
  38. AfterStruct: false
  39. AfterUnion: false
  40. #AfterExternBlock: false # Unknown to clang-format-5.0
  41. BeforeCatch: false
  42. BeforeElse: false
  43. IndentBraces: false
  44. #SplitEmptyFunction: true # Unknown to clang-format-4.0
  45. #SplitEmptyRecord: true # Unknown to clang-format-4.0
  46. #SplitEmptyNamespace: true # Unknown to clang-format-4.0
  47. BreakBeforeBinaryOperators: None
  48. BreakBeforeBraces: Custom
  49. #BreakBeforeInheritanceComma: false # Unknown to clang-format-4.0
  50. BreakBeforeTernaryOperators: false
  51. BreakConstructorInitializersBeforeComma: false
  52. #BreakConstructorInitializers: BeforeComma # Unknown to clang-format-4.0
  53. BreakAfterJavaFieldAnnotations: false
  54. BreakStringLiterals: false
  55. ColumnLimit: 80
  56. CommentPragmas: '^ IWYU pragma:'
  57. #CompactNamespaces: false # Unknown to clang-format-4.0
  58. ConstructorInitializerAllOnOneLineOrOnePerLine: false
  59. ConstructorInitializerIndentWidth: 8
  60. ContinuationIndentWidth: 8
  61. Cpp11BracedListStyle: false
  62. DerivePointerAlignment: false
  63. DisableFormat: false
  64. ExperimentalAutoDetectBinPacking: false
  65. #FixNamespaceComments: false # Unknown to clang-format-4.0
  66. # Taken from:
  67. # git grep -h '^#define [^[:space:]]*for_each[^[:space:]]*(' include/ \
  68. # | sed "s,^#define \([^[:space:]]*for_each[^[:space:]]*\)(.*$, - '\1'," \
  69. # | sort | uniq
  70. ForEachMacros:
  71. - 'apei_estatus_for_each_section'
  72. - 'ata_for_each_dev'
  73. - 'ata_for_each_link'
  74. - 'ax25_for_each'
  75. - 'ax25_uid_for_each'
  76. - 'bio_for_each_integrity_vec'
  77. - '__bio_for_each_segment'
  78. - 'bio_for_each_segment'
  79. - 'bio_for_each_segment_all'
  80. - 'bio_list_for_each'
  81. - 'bip_for_each_vec'
  82. - 'blkg_for_each_descendant_post'
  83. - 'blkg_for_each_descendant_pre'
  84. - 'blk_queue_for_each_rl'
  85. - 'bond_for_each_slave'
  86. - 'bond_for_each_slave_rcu'
  87. - 'btree_for_each_safe128'
  88. - 'btree_for_each_safe32'
  89. - 'btree_for_each_safe64'
  90. - 'btree_for_each_safel'
  91. - 'card_for_each_dev'
  92. - 'cgroup_taskset_for_each'
  93. - 'cgroup_taskset_for_each_leader'
  94. - 'cpufreq_for_each_entry'
  95. - 'cpufreq_for_each_entry_idx'
  96. - 'cpufreq_for_each_valid_entry'
  97. - 'cpufreq_for_each_valid_entry_idx'
  98. - 'css_for_each_child'
  99. - 'css_for_each_descendant_post'
  100. - 'css_for_each_descendant_pre'
  101. - 'device_for_each_child_node'
  102. - 'drm_atomic_crtc_for_each_plane'
  103. - 'drm_atomic_crtc_state_for_each_plane'
  104. - 'drm_atomic_crtc_state_for_each_plane_state'
  105. - 'drm_for_each_connector_iter'
  106. - 'drm_for_each_crtc'
  107. - 'drm_for_each_encoder'
  108. - 'drm_for_each_encoder_mask'
  109. - 'drm_for_each_fb'
  110. - 'drm_for_each_legacy_plane'
  111. - 'drm_for_each_plane'
  112. - 'drm_for_each_plane_mask'
  113. - 'drm_mm_for_each_hole'
  114. - 'drm_mm_for_each_node'
  115. - 'drm_mm_for_each_node_in_range'
  116. - 'drm_mm_for_each_node_safe'
  117. - 'for_each_active_drhd_unit'
  118. - 'for_each_active_iommu'
  119. - 'for_each_available_child_of_node'
  120. - 'for_each_bio'
  121. - 'for_each_board_func_rsrc'
  122. - 'for_each_bvec'
  123. - 'for_each_child_of_node'
  124. - 'for_each_clear_bit'
  125. - 'for_each_clear_bit_from'
  126. - 'for_each_cmsghdr'
  127. - 'for_each_compatible_node'
  128. - 'for_each_console'
  129. - 'for_each_cpu'
  130. - 'for_each_cpu_and'
  131. - 'for_each_cpu_not'
  132. - 'for_each_cpu_wrap'
  133. - 'for_each_dev_addr'
  134. - 'for_each_dma_cap_mask'
  135. - 'for_each_drhd_unit'
  136. - 'for_each_dss_dev'
  137. - 'for_each_efi_memory_desc'
  138. - 'for_each_efi_memory_desc_in_map'
  139. - 'for_each_endpoint_of_node'
  140. - 'for_each_evictable_lru'
  141. - 'for_each_fib6_node_rt_rcu'
  142. - 'for_each_fib6_walker_rt'
  143. - 'for_each_free_mem_range'
  144. - 'for_each_free_mem_range_reverse'
  145. - 'for_each_func_rsrc'
  146. - 'for_each_hstate'
  147. - 'for_each_if'
  148. - 'for_each_iommu'
  149. - 'for_each_ip_tunnel_rcu'
  150. - 'for_each_irq_nr'
  151. - 'for_each_lru'
  152. - 'for_each_matching_node'
  153. - 'for_each_matching_node_and_match'
  154. - 'for_each_memblock'
  155. - 'for_each_memblock_type'
  156. - 'for_each_memcg_cache_index'
  157. - 'for_each_mem_pfn_range'
  158. - 'for_each_mem_range'
  159. - 'for_each_mem_range_rev'
  160. - 'for_each_migratetype_order'
  161. - 'for_each_msi_entry'
  162. - 'for_each_net'
  163. - 'for_each_netdev'
  164. - 'for_each_netdev_continue'
  165. - 'for_each_netdev_continue_rcu'
  166. - 'for_each_netdev_feature'
  167. - 'for_each_netdev_in_bond_rcu'
  168. - 'for_each_netdev_rcu'
  169. - 'for_each_netdev_reverse'
  170. - 'for_each_netdev_safe'
  171. - 'for_each_net_rcu'
  172. - 'for_each_new_connector_in_state'
  173. - 'for_each_new_crtc_in_state'
  174. - 'for_each_new_plane_in_state'
  175. - 'for_each_new_private_obj_in_state'
  176. - 'for_each_node'
  177. - 'for_each_node_by_name'
  178. - 'for_each_node_by_type'
  179. - 'for_each_node_mask'
  180. - 'for_each_node_state'
  181. - 'for_each_node_with_cpus'
  182. - 'for_each_node_with_property'
  183. - 'for_each_of_allnodes'
  184. - 'for_each_of_allnodes_from'
  185. - 'for_each_of_pci_range'
  186. - 'for_each_old_connector_in_state'
  187. - 'for_each_old_crtc_in_state'
  188. - 'for_each_oldnew_connector_in_state'
  189. - 'for_each_oldnew_crtc_in_state'
  190. - 'for_each_oldnew_plane_in_state'
  191. - 'for_each_oldnew_private_obj_in_state'
  192. - 'for_each_old_plane_in_state'
  193. - 'for_each_old_private_obj_in_state'
  194. - 'for_each_online_cpu'
  195. - 'for_each_online_node'
  196. - 'for_each_online_pgdat'
  197. - 'for_each_pci_bridge'
  198. - 'for_each_pci_dev'
  199. - 'for_each_pci_msi_entry'
  200. - 'for_each_populated_zone'
  201. - 'for_each_possible_cpu'
  202. - 'for_each_present_cpu'
  203. - 'for_each_prime_number'
  204. - 'for_each_prime_number_from'
  205. - 'for_each_process'
  206. - 'for_each_process_thread'
  207. - 'for_each_property_of_node'
  208. - 'for_each_reserved_mem_region'
  209. - 'for_each_resv_unavail_range'
  210. - 'for_each_rtdcom'
  211. - 'for_each_rtdcom_safe'
  212. - 'for_each_set_bit'
  213. - 'for_each_set_bit_from'
  214. - 'for_each_sg'
  215. - 'for_each_sg_page'
  216. - '__for_each_thread'
  217. - 'for_each_thread'
  218. - 'for_each_zone'
  219. - 'for_each_zone_zonelist'
  220. - 'for_each_zone_zonelist_nodemask'
  221. - 'fwnode_for_each_available_child_node'
  222. - 'fwnode_for_each_child_node'
  223. - 'fwnode_graph_for_each_endpoint'
  224. - 'gadget_for_each_ep'
  225. - 'hash_for_each'
  226. - 'hash_for_each_possible'
  227. - 'hash_for_each_possible_rcu'
  228. - 'hash_for_each_possible_rcu_notrace'
  229. - 'hash_for_each_possible_safe'
  230. - 'hash_for_each_rcu'
  231. - 'hash_for_each_safe'
  232. - 'hctx_for_each_ctx'
  233. - 'hlist_bl_for_each_entry'
  234. - 'hlist_bl_for_each_entry_rcu'
  235. - 'hlist_bl_for_each_entry_safe'
  236. - 'hlist_for_each'
  237. - 'hlist_for_each_entry'
  238. - 'hlist_for_each_entry_continue'
  239. - 'hlist_for_each_entry_continue_rcu'
  240. - 'hlist_for_each_entry_continue_rcu_bh'
  241. - 'hlist_for_each_entry_from'
  242. - 'hlist_for_each_entry_from_rcu'
  243. - 'hlist_for_each_entry_rcu'
  244. - 'hlist_for_each_entry_rcu_bh'
  245. - 'hlist_for_each_entry_rcu_notrace'
  246. - 'hlist_for_each_entry_safe'
  247. - '__hlist_for_each_rcu'
  248. - 'hlist_for_each_safe'
  249. - 'hlist_nulls_for_each_entry'
  250. - 'hlist_nulls_for_each_entry_from'
  251. - 'hlist_nulls_for_each_entry_rcu'
  252. - 'hlist_nulls_for_each_entry_safe'
  253. - 'ide_host_for_each_port'
  254. - 'ide_port_for_each_dev'
  255. - 'ide_port_for_each_present_dev'
  256. - 'idr_for_each_entry'
  257. - 'idr_for_each_entry_continue'
  258. - 'idr_for_each_entry_ul'
  259. - 'inet_bind_bucket_for_each'
  260. - 'inet_lhash2_for_each_icsk_rcu'
  261. - 'iov_for_each'
  262. - 'key_for_each'
  263. - 'key_for_each_safe'
  264. - 'klp_for_each_func'
  265. - 'klp_for_each_object'
  266. - 'kvm_for_each_memslot'
  267. - 'kvm_for_each_vcpu'
  268. - 'list_for_each'
  269. - 'list_for_each_entry'
  270. - 'list_for_each_entry_continue'
  271. - 'list_for_each_entry_continue_rcu'
  272. - 'list_for_each_entry_continue_reverse'
  273. - 'list_for_each_entry_from'
  274. - 'list_for_each_entry_from_reverse'
  275. - 'list_for_each_entry_lockless'
  276. - 'list_for_each_entry_rcu'
  277. - 'list_for_each_entry_reverse'
  278. - 'list_for_each_entry_safe'
  279. - 'list_for_each_entry_safe_continue'
  280. - 'list_for_each_entry_safe_from'
  281. - 'list_for_each_entry_safe_reverse'
  282. - 'list_for_each_prev'
  283. - 'list_for_each_prev_safe'
  284. - 'list_for_each_safe'
  285. - 'llist_for_each'
  286. - 'llist_for_each_entry'
  287. - 'llist_for_each_entry_safe'
  288. - 'llist_for_each_safe'
  289. - 'media_device_for_each_entity'
  290. - 'media_device_for_each_intf'
  291. - 'media_device_for_each_link'
  292. - 'media_device_for_each_pad'
  293. - 'netdev_for_each_lower_dev'
  294. - 'netdev_for_each_lower_private'
  295. - 'netdev_for_each_lower_private_rcu'
  296. - 'netdev_for_each_mc_addr'
  297. - 'netdev_for_each_uc_addr'
  298. - 'netdev_for_each_upper_dev_rcu'
  299. - 'netdev_hw_addr_list_for_each'
  300. - 'nft_rule_for_each_expr'
  301. - 'nla_for_each_attr'
  302. - 'nla_for_each_nested'
  303. - 'nlmsg_for_each_attr'
  304. - 'nlmsg_for_each_msg'
  305. - 'nr_neigh_for_each'
  306. - 'nr_neigh_for_each_safe'
  307. - 'nr_node_for_each'
  308. - 'nr_node_for_each_safe'
  309. - 'of_for_each_phandle'
  310. - 'of_property_for_each_string'
  311. - 'of_property_for_each_u32'
  312. - 'pci_bus_for_each_resource'
  313. - 'ping_portaddr_for_each_entry'
  314. - 'plist_for_each'
  315. - 'plist_for_each_continue'
  316. - 'plist_for_each_entry'
  317. - 'plist_for_each_entry_continue'
  318. - 'plist_for_each_entry_safe'
  319. - 'plist_for_each_safe'
  320. - 'pnp_for_each_card'
  321. - 'pnp_for_each_dev'
  322. - 'protocol_for_each_card'
  323. - 'protocol_for_each_dev'
  324. - 'queue_for_each_hw_ctx'
  325. - 'radix_tree_for_each_contig'
  326. - 'radix_tree_for_each_slot'
  327. - 'radix_tree_for_each_tagged'
  328. - 'rbtree_postorder_for_each_entry_safe'
  329. - 'resource_list_for_each_entry'
  330. - 'resource_list_for_each_entry_safe'
  331. - 'rhl_for_each_entry_rcu'
  332. - 'rhl_for_each_rcu'
  333. - 'rht_for_each'
  334. - 'rht_for_each_continue'
  335. - 'rht_for_each_entry'
  336. - 'rht_for_each_entry_continue'
  337. - 'rht_for_each_entry_rcu'
  338. - 'rht_for_each_entry_rcu_continue'
  339. - 'rht_for_each_entry_safe'
  340. - 'rht_for_each_rcu'
  341. - 'rht_for_each_rcu_continue'
  342. - '__rq_for_each_bio'
  343. - 'rq_for_each_segment'
  344. - 'scsi_for_each_prot_sg'
  345. - 'scsi_for_each_sg'
  346. - 'sctp_for_each_hentry'
  347. - 'sctp_skb_for_each'
  348. - 'shdma_for_each_chan'
  349. - '__shost_for_each_device'
  350. - 'shost_for_each_device'
  351. - 'sk_for_each'
  352. - 'sk_for_each_bound'
  353. - 'sk_for_each_entry_offset_rcu'
  354. - 'sk_for_each_from'
  355. - 'sk_for_each_rcu'
  356. - 'sk_for_each_safe'
  357. - 'sk_nulls_for_each'
  358. - 'sk_nulls_for_each_from'
  359. - 'sk_nulls_for_each_rcu'
  360. - 'snd_pcm_group_for_each_entry'
  361. - 'snd_soc_dapm_widget_for_each_path'
  362. - 'snd_soc_dapm_widget_for_each_path_safe'
  363. - 'snd_soc_dapm_widget_for_each_sink_path'
  364. - 'snd_soc_dapm_widget_for_each_source_path'
  365. - 'tb_property_for_each'
  366. - 'udp_portaddr_for_each_entry'
  367. - 'udp_portaddr_for_each_entry_rcu'
  368. - 'usb_hub_for_each_child'
  369. - 'v4l2_device_for_each_subdev'
  370. - 'v4l2_m2m_for_each_dst_buf'
  371. - 'v4l2_m2m_for_each_dst_buf_safe'
  372. - 'v4l2_m2m_for_each_src_buf'
  373. - 'v4l2_m2m_for_each_src_buf_safe'
  374. - 'zorro_for_each_dev'
  375. #IncludeBlocks: Preserve # Unknown to clang-format-5.0
  376. IncludeCategories:
  377. - Regex: '.*'
  378. Priority: 1
  379. IncludeIsMainRegex: '(Test)?$'
  380. IndentCaseLabels: false
  381. #IndentPPDirectives: None # Unknown to clang-format-5.0
  382. IndentWidth: 8
  383. IndentWrappedFunctionNames: true
  384. JavaScriptQuotes: Leave
  385. JavaScriptWrapImports: true
  386. KeepEmptyLinesAtTheStartOfBlocks: false
  387. MacroBlockBegin: ''
  388. MacroBlockEnd: ''
  389. MaxEmptyLinesToKeep: 1
  390. NamespaceIndentation: Inner
  391. #ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0
  392. ObjCBlockIndentWidth: 8
  393. ObjCSpaceAfterProperty: true
  394. ObjCSpaceBeforeProtocolList: true
  395. # Taken from git's rules
  396. #PenaltyBreakAssignment: 10 # Unknown to clang-format-4.0
  397. PenaltyBreakBeforeFirstCallParameter: 30
  398. PenaltyBreakComment: 10
  399. PenaltyBreakFirstLessLess: 0
  400. PenaltyBreakString: 10
  401. PenaltyExcessCharacter: 100
  402. PenaltyReturnTypeOnItsOwnLine: 60
  403. PointerAlignment: Right
  404. ReflowComments: false
  405. SortIncludes: false
  406. #SortUsingDeclarations: false # Unknown to clang-format-4.0
  407. SpaceAfterCStyleCast: false
  408. SpaceAfterTemplateKeyword: true
  409. SpaceBeforeAssignmentOperators: true
  410. #SpaceBeforeCtorInitializerColon: true # Unknown to clang-format-5.0
  411. #SpaceBeforeInheritanceColon: true # Unknown to clang-format-5.0
  412. SpaceBeforeParens: ControlStatements
  413. #SpaceBeforeRangeBasedForLoopColon: true # Unknown to clang-format-5.0
  414. SpaceInEmptyParentheses: false
  415. SpacesBeforeTrailingComments: 1
  416. SpacesInAngles: false
  417. SpacesInContainerLiterals: false
  418. SpacesInCStyleCastParentheses: false
  419. SpacesInParentheses: false
  420. SpacesInSquareBrackets: false
  421. Standard: Cpp03
  422. TabWidth: 8
  423. UseTab: Always
  424. ...