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