1#
2# clang-format configuration file. Intended for clang-format >= 4.
3#
4# For more information, see:
5#
6#   Documentation/process/clang-format.rst
7#   https://clang.llvm.org/docs/ClangFormat.html
8#   https://clang.llvm.org/docs/ClangFormatStyleOptions.html
9#
10---
11AccessModifierOffset: -4
12AlignAfterOpenBracket: Align
13AlignConsecutiveAssignments: false
14AlignConsecutiveDeclarations: false
15#AlignEscapedNewlines: Left # Unknown to clang-format-4.0
16AlignOperands: true
17AlignTrailingComments: false
18AllowAllParametersOfDeclarationOnNextLine: false
19AllowShortBlocksOnASingleLine: false
20AllowShortCaseLabelsOnASingleLine: false
21AllowShortFunctionsOnASingleLine: None
22AllowShortIfStatementsOnASingleLine: false
23AllowShortLoopsOnASingleLine: false
24AlwaysBreakAfterDefinitionReturnType: All
25AlwaysBreakAfterReturnType: AllDefinitions
26AlwaysBreakBeforeMultilineStrings: false
27AlwaysBreakTemplateDeclarations: false
28BinPackArguments: true
29BinPackParameters: true
30BraceWrapping:
31  AfterClass: false
32  AfterControlStatement: false
33  AfterEnum: false
34  AfterFunction: true
35  AfterNamespace: true
36  AfterObjCDeclaration: false
37  AfterStruct: false
38  AfterUnion: false
39  #AfterExternBlock: false # Unknown to clang-format-5.0
40  BeforeCatch: false
41  BeforeElse: false
42  IndentBraces: false
43  #SplitEmptyFunction: true # Unknown to clang-format-4.0
44  #SplitEmptyRecord: true # Unknown to clang-format-4.0
45  #SplitEmptyNamespace: true # Unknown to clang-format-4.0
46BreakBeforeBinaryOperators: None
47BreakBeforeBraces: Custom
48#BreakBeforeInheritanceComma: false # Unknown to clang-format-4.0
49BreakBeforeTernaryOperators: false
50BreakConstructorInitializersBeforeComma: false
51#BreakConstructorInitializers: BeforeComma # Unknown to clang-format-4.0
52BreakAfterJavaFieldAnnotations: false
53BreakStringLiterals: false
54ColumnLimit: 80
55CommentPragmas: '^ IWYU pragma:'
56#CompactNamespaces: false # Unknown to clang-format-4.0
57ConstructorInitializerAllOnOneLineOrOnePerLine: false
58ConstructorInitializerIndentWidth: 4
59ContinuationIndentWidth: 4
60Cpp11BracedListStyle: false
61DerivePointerAlignment: false
62DisableFormat: false
63ExperimentalAutoDetectBinPacking: false
64#FixNamespaceComments: false # Unknown to clang-format-4.0
65
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
70ForEachMacros:
71  - 'apei_estatus_for_each_section'
72  - 'ata_for_each_dev'
73  - 'ata_for_each_link'
74  - '__ata_qc_for_each'
75  - 'ata_qc_for_each'
76  - 'ata_qc_for_each_raw'
77  - 'ata_qc_for_each_with_internal'
78  - 'ax25_for_each'
79  - 'ax25_uid_for_each'
80  - '__bio_for_each_bvec'
81  - 'bio_for_each_bvec'
82  - 'bio_for_each_bvec_all'
83  - 'bio_for_each_integrity_vec'
84  - '__bio_for_each_segment'
85  - 'bio_for_each_segment'
86  - 'bio_for_each_segment_all'
87  - 'bio_list_for_each'
88  - 'bip_for_each_vec'
89  - 'bitmap_for_each_clear_region'
90  - 'bitmap_for_each_set_region'
91  - 'blkg_for_each_descendant_post'
92  - 'blkg_for_each_descendant_pre'
93  - 'blk_queue_for_each_rl'
94  - 'bond_for_each_slave'
95  - 'bond_for_each_slave_rcu'
96  - 'bpf_for_each_spilled_reg'
97  - 'btree_for_each_safe128'
98  - 'btree_for_each_safe32'
99  - 'btree_for_each_safe64'
100  - 'btree_for_each_safel'
101  - 'card_for_each_dev'
102  - 'cgroup_taskset_for_each'
103  - 'cgroup_taskset_for_each_leader'
104  - 'cpufreq_for_each_entry'
105  - 'cpufreq_for_each_entry_idx'
106  - 'cpufreq_for_each_valid_entry'
107  - 'cpufreq_for_each_valid_entry_idx'
108  - 'css_for_each_child'
109  - 'css_for_each_descendant_post'
110  - 'css_for_each_descendant_pre'
111  - 'device_for_each_child_node'
112  - 'displayid_iter_for_each'
113  - 'dma_fence_chain_for_each'
114  - 'do_for_each_ftrace_op'
115  - 'drm_atomic_crtc_for_each_plane'
116  - 'drm_atomic_crtc_state_for_each_plane'
117  - 'drm_atomic_crtc_state_for_each_plane_state'
118  - 'drm_atomic_for_each_plane_damage'
119  - 'drm_client_for_each_connector_iter'
120  - 'drm_client_for_each_modeset'
121  - 'drm_connector_for_each_possible_encoder'
122  - 'drm_for_each_bridge_in_chain'
123  - 'drm_for_each_connector_iter'
124  - 'drm_for_each_crtc'
125  - 'drm_for_each_crtc_reverse'
126  - 'drm_for_each_encoder'
127  - 'drm_for_each_encoder_mask'
128  - 'drm_for_each_fb'
129  - 'drm_for_each_legacy_plane'
130  - 'drm_for_each_plane'
131  - 'drm_for_each_plane_mask'
132  - 'drm_for_each_privobj'
133  - 'drm_mm_for_each_hole'
134  - 'drm_mm_for_each_node'
135  - 'drm_mm_for_each_node_in_range'
136  - 'drm_mm_for_each_node_safe'
137  - 'flow_action_for_each'
138  - 'for_each_acpi_dev_match'
139  - 'for_each_active_dev_scope'
140  - 'for_each_active_drhd_unit'
141  - 'for_each_active_iommu'
142  - 'for_each_aggr_pgid'
143  - 'for_each_available_child_of_node'
144  - 'for_each_bio'
145  - 'for_each_board_func_rsrc'
146  - 'for_each_bvec'
147  - 'for_each_card_auxs'
148  - 'for_each_card_auxs_safe'
149  - 'for_each_card_components'
150  - 'for_each_card_dapms'
151  - 'for_each_card_pre_auxs'
152  - 'for_each_card_prelinks'
153  - 'for_each_card_rtds'
154  - 'for_each_card_rtds_safe'
155  - 'for_each_card_widgets'
156  - 'for_each_card_widgets_safe'
157  - 'for_each_cgroup_storage_type'
158  - 'for_each_child_of_node'
159  - 'for_each_clear_bit'
160  - 'for_each_clear_bit_from'
161  - 'for_each_cmsghdr'
162  - 'for_each_compatible_node'
163  - 'for_each_component_dais'
164  - 'for_each_component_dais_safe'
165  - 'for_each_comp_order'
166  - 'for_each_console'
167  - 'for_each_cpu'
168  - 'for_each_cpu_and'
169  - 'for_each_cpu_not'
170  - 'for_each_cpu_wrap'
171  - 'for_each_dapm_widgets'
172  - 'for_each_dev_addr'
173  - 'for_each_dev_scope'
174  - 'for_each_dma_cap_mask'
175  - 'for_each_dpcm_be'
176  - 'for_each_dpcm_be_rollback'
177  - 'for_each_dpcm_be_safe'
178  - 'for_each_dpcm_fe'
179  - 'for_each_drhd_unit'
180  - 'for_each_dss_dev'
181  - 'for_each_dtpm_table'
182  - 'for_each_efi_memory_desc'
183  - 'for_each_efi_memory_desc_in_map'
184  - 'for_each_element'
185  - 'for_each_element_extid'
186  - 'for_each_element_id'
187  - 'for_each_endpoint_of_node'
188  - 'for_each_evictable_lru'
189  - 'for_each_fib6_node_rt_rcu'
190  - 'for_each_fib6_walker_rt'
191  - 'for_each_free_mem_pfn_range_in_zone'
192  - 'for_each_free_mem_pfn_range_in_zone_from'
193  - 'for_each_free_mem_range'
194  - 'for_each_free_mem_range_reverse'
195  - 'for_each_func_rsrc'
196  - 'for_each_hstate'
197  - 'for_each_if'
198  - 'for_each_iommu'
199  - 'for_each_ip_tunnel_rcu'
200  - 'for_each_irq_nr'
201  - 'for_each_link_codecs'
202  - 'for_each_link_cpus'
203  - 'for_each_link_platforms'
204  - 'for_each_lru'
205  - 'for_each_matching_node'
206  - 'for_each_matching_node_and_match'
207  - 'for_each_member'
208  - 'for_each_memcg_cache_index'
209  - 'for_each_mem_pfn_range'
210  - '__for_each_mem_range'
211  - 'for_each_mem_range'
212  - '__for_each_mem_range_rev'
213  - 'for_each_mem_range_rev'
214  - 'for_each_mem_region'
215  - 'for_each_migratetype_order'
216  - 'for_each_msi_entry'
217  - 'for_each_msi_entry_safe'
218  - 'for_each_msi_vector'
219  - 'for_each_net'
220  - 'for_each_net_continue_reverse'
221  - 'for_each_netdev'
222  - 'for_each_netdev_continue'
223  - 'for_each_netdev_continue_rcu'
224  - 'for_each_netdev_continue_reverse'
225  - 'for_each_netdev_feature'
226  - 'for_each_netdev_in_bond_rcu'
227  - 'for_each_netdev_rcu'
228  - 'for_each_netdev_reverse'
229  - 'for_each_netdev_safe'
230  - 'for_each_net_rcu'
231  - 'for_each_new_connector_in_state'
232  - 'for_each_new_crtc_in_state'
233  - 'for_each_new_mst_mgr_in_state'
234  - 'for_each_new_plane_in_state'
235  - 'for_each_new_private_obj_in_state'
236  - 'for_each_node'
237  - 'for_each_node_by_name'
238  - 'for_each_node_by_type'
239  - 'for_each_node_mask'
240  - 'for_each_node_state'
241  - 'for_each_node_with_cpus'
242  - 'for_each_node_with_property'
243  - 'for_each_nonreserved_multicast_dest_pgid'
244  - 'for_each_of_allnodes'
245  - 'for_each_of_allnodes_from'
246  - 'for_each_of_cpu_node'
247  - 'for_each_of_pci_range'
248  - 'for_each_old_connector_in_state'
249  - 'for_each_old_crtc_in_state'
250  - 'for_each_old_mst_mgr_in_state'
251  - 'for_each_oldnew_connector_in_state'
252  - 'for_each_oldnew_crtc_in_state'
253  - 'for_each_oldnew_mst_mgr_in_state'
254  - 'for_each_oldnew_plane_in_state'
255  - 'for_each_oldnew_plane_in_state_reverse'
256  - 'for_each_oldnew_private_obj_in_state'
257  - 'for_each_old_plane_in_state'
258  - 'for_each_old_private_obj_in_state'
259  - 'for_each_online_cpu'
260  - 'for_each_online_node'
261  - 'for_each_online_pgdat'
262  - 'for_each_pci_bridge'
263  - 'for_each_pci_dev'
264  - 'for_each_pci_msi_entry'
265  - 'for_each_pcm_streams'
266  - 'for_each_physmem_range'
267  - 'for_each_populated_zone'
268  - 'for_each_possible_cpu'
269  - 'for_each_present_cpu'
270  - 'for_each_prime_number'
271  - 'for_each_prime_number_from'
272  - 'for_each_process'
273  - 'for_each_process_thread'
274  - 'for_each_prop_codec_conf'
275  - 'for_each_prop_dai_codec'
276  - 'for_each_prop_dai_cpu'
277  - 'for_each_prop_dlc_codecs'
278  - 'for_each_prop_dlc_cpus'
279  - 'for_each_prop_dlc_platforms'
280  - 'for_each_property_of_node'
281  - 'for_each_registered_fb'
282  - 'for_each_requested_gpio'
283  - 'for_each_requested_gpio_in_range'
284  - 'for_each_reserved_mem_range'
285  - 'for_each_reserved_mem_region'
286  - 'for_each_rtd_codec_dais'
287  - 'for_each_rtd_components'
288  - 'for_each_rtd_cpu_dais'
289  - 'for_each_rtd_dais'
290  - 'for_each_set_bit'
291  - 'for_each_set_bit_from'
292  - 'for_each_set_clump8'
293  - 'for_each_sg'
294  - 'for_each_sg_dma_page'
295  - 'for_each_sg_page'
296  - 'for_each_sgtable_dma_page'
297  - 'for_each_sgtable_dma_sg'
298  - 'for_each_sgtable_page'
299  - 'for_each_sgtable_sg'
300  - 'for_each_sibling_event'
301  - 'for_each_subelement'
302  - 'for_each_subelement_extid'
303  - 'for_each_subelement_id'
304  - '__for_each_thread'
305  - 'for_each_thread'
306  - 'for_each_unicast_dest_pgid'
307  - 'for_each_vsi'
308  - 'for_each_wakeup_source'
309  - 'for_each_zone'
310  - 'for_each_zone_zonelist'
311  - 'for_each_zone_zonelist_nodemask'
312  - 'fwnode_for_each_available_child_node'
313  - 'fwnode_for_each_child_node'
314  - 'fwnode_graph_for_each_endpoint'
315  - 'gadget_for_each_ep'
316  - 'genradix_for_each'
317  - 'genradix_for_each_from'
318  - 'hash_for_each'
319  - 'hash_for_each_possible'
320  - 'hash_for_each_possible_rcu'
321  - 'hash_for_each_possible_rcu_notrace'
322  - 'hash_for_each_possible_safe'
323  - 'hash_for_each_rcu'
324  - 'hash_for_each_safe'
325  - 'hctx_for_each_ctx'
326  - 'hlist_bl_for_each_entry'
327  - 'hlist_bl_for_each_entry_rcu'
328  - 'hlist_bl_for_each_entry_safe'
329  - 'hlist_for_each'
330  - 'hlist_for_each_entry'
331  - 'hlist_for_each_entry_continue'
332  - 'hlist_for_each_entry_continue_rcu'
333  - 'hlist_for_each_entry_continue_rcu_bh'
334  - 'hlist_for_each_entry_from'
335  - 'hlist_for_each_entry_from_rcu'
336  - 'hlist_for_each_entry_rcu'
337  - 'hlist_for_each_entry_rcu_bh'
338  - 'hlist_for_each_entry_rcu_notrace'
339  - 'hlist_for_each_entry_safe'
340  - 'hlist_for_each_entry_srcu'
341  - '__hlist_for_each_rcu'
342  - 'hlist_for_each_safe'
343  - 'hlist_nulls_for_each_entry'
344  - 'hlist_nulls_for_each_entry_from'
345  - 'hlist_nulls_for_each_entry_rcu'
346  - 'hlist_nulls_for_each_entry_safe'
347  - 'i3c_bus_for_each_i2cdev'
348  - 'i3c_bus_for_each_i3cdev'
349  - 'ide_host_for_each_port'
350  - 'ide_port_for_each_dev'
351  - 'ide_port_for_each_present_dev'
352  - 'idr_for_each_entry'
353  - 'idr_for_each_entry_continue'
354  - 'idr_for_each_entry_continue_ul'
355  - 'idr_for_each_entry_ul'
356  - 'in_dev_for_each_ifa_rcu'
357  - 'in_dev_for_each_ifa_rtnl'
358  - 'inet_bind_bucket_for_each'
359  - 'inet_lhash2_for_each_icsk_rcu'
360  - 'key_for_each'
361  - 'key_for_each_safe'
362  - 'klp_for_each_func'
363  - 'klp_for_each_func_safe'
364  - 'klp_for_each_func_static'
365  - 'klp_for_each_object'
366  - 'klp_for_each_object_safe'
367  - 'klp_for_each_object_static'
368  - 'kunit_suite_for_each_test_case'
369  - 'kvm_for_each_memslot'
370  - 'kvm_for_each_vcpu'
371  - 'list_for_each'
372  - 'list_for_each_codec'
373  - 'list_for_each_codec_safe'
374  - 'list_for_each_continue'
375  - 'list_for_each_entry'
376  - 'list_for_each_entry_continue'
377  - 'list_for_each_entry_continue_rcu'
378  - 'list_for_each_entry_continue_reverse'
379  - 'list_for_each_entry_from'
380  - 'list_for_each_entry_from_rcu'
381  - 'list_for_each_entry_from_reverse'
382  - 'list_for_each_entry_lockless'
383  - 'list_for_each_entry_rcu'
384  - 'list_for_each_entry_reverse'
385  - 'list_for_each_entry_safe'
386  - 'list_for_each_entry_safe_continue'
387  - 'list_for_each_entry_safe_from'
388  - 'list_for_each_entry_safe_reverse'
389  - 'list_for_each_entry_srcu'
390  - 'list_for_each_prev'
391  - 'list_for_each_prev_safe'
392  - 'list_for_each_safe'
393  - 'llist_for_each'
394  - 'llist_for_each_entry'
395  - 'llist_for_each_entry_safe'
396  - 'llist_for_each_safe'
397  - 'mci_for_each_dimm'
398  - 'media_device_for_each_entity'
399  - 'media_device_for_each_intf'
400  - 'media_device_for_each_link'
401  - 'media_device_for_each_pad'
402  - 'nanddev_io_for_each_page'
403  - 'netdev_for_each_lower_dev'
404  - 'netdev_for_each_lower_private'
405  - 'netdev_for_each_lower_private_rcu'
406  - 'netdev_for_each_mc_addr'
407  - 'netdev_for_each_uc_addr'
408  - 'netdev_for_each_upper_dev_rcu'
409  - 'netdev_hw_addr_list_for_each'
410  - 'nft_rule_for_each_expr'
411  - 'nla_for_each_attr'
412  - 'nla_for_each_nested'
413  - 'nlmsg_for_each_attr'
414  - 'nlmsg_for_each_msg'
415  - 'nr_neigh_for_each'
416  - 'nr_neigh_for_each_safe'
417  - 'nr_node_for_each'
418  - 'nr_node_for_each_safe'
419  - 'of_for_each_phandle'
420  - 'of_property_for_each_string'
421  - 'of_property_for_each_u32'
422  - 'pci_bus_for_each_resource'
423  - 'pcl_for_each_chunk'
424  - 'pcl_for_each_segment'
425  - 'pcm_for_each_format'
426  - 'ping_portaddr_for_each_entry'
427  - 'plist_for_each'
428  - 'plist_for_each_continue'
429  - 'plist_for_each_entry'
430  - 'plist_for_each_entry_continue'
431  - 'plist_for_each_entry_safe'
432  - 'plist_for_each_safe'
433  - 'pnp_for_each_card'
434  - 'pnp_for_each_dev'
435  - 'protocol_for_each_card'
436  - 'protocol_for_each_dev'
437  - 'queue_for_each_hw_ctx'
438  - 'radix_tree_for_each_slot'
439  - 'radix_tree_for_each_tagged'
440  - 'rb_for_each'
441  - 'rbtree_postorder_for_each_entry_safe'
442  - 'rdma_for_each_block'
443  - 'rdma_for_each_port'
444  - 'rdma_umem_for_each_dma_block'
445  - 'resource_list_for_each_entry'
446  - 'resource_list_for_each_entry_safe'
447  - 'rhl_for_each_entry_rcu'
448  - 'rhl_for_each_rcu'
449  - 'rht_for_each'
450  - 'rht_for_each_entry'
451  - 'rht_for_each_entry_from'
452  - 'rht_for_each_entry_rcu'
453  - 'rht_for_each_entry_rcu_from'
454  - 'rht_for_each_entry_safe'
455  - 'rht_for_each_from'
456  - 'rht_for_each_rcu'
457  - 'rht_for_each_rcu_from'
458  - '__rq_for_each_bio'
459  - 'rq_for_each_bvec'
460  - 'rq_for_each_segment'
461  - 'scsi_for_each_prot_sg'
462  - 'scsi_for_each_sg'
463  - 'sctp_for_each_hentry'
464  - 'sctp_skb_for_each'
465  - 'shdma_for_each_chan'
466  - '__shost_for_each_device'
467  - 'shost_for_each_device'
468  - 'sk_for_each'
469  - 'sk_for_each_bound'
470  - 'sk_for_each_entry_offset_rcu'
471  - 'sk_for_each_from'
472  - 'sk_for_each_rcu'
473  - 'sk_for_each_safe'
474  - 'sk_nulls_for_each'
475  - 'sk_nulls_for_each_from'
476  - 'sk_nulls_for_each_rcu'
477  - 'snd_array_for_each'
478  - 'snd_pcm_group_for_each_entry'
479  - 'snd_soc_dapm_widget_for_each_path'
480  - 'snd_soc_dapm_widget_for_each_path_safe'
481  - 'snd_soc_dapm_widget_for_each_sink_path'
482  - 'snd_soc_dapm_widget_for_each_source_path'
483  - 'tb_property_for_each'
484  - 'tcf_exts_for_each_action'
485  - 'udp_portaddr_for_each_entry'
486  - 'udp_portaddr_for_each_entry_rcu'
487  - 'usb_hub_for_each_child'
488  - 'v4l2_device_for_each_subdev'
489  - 'v4l2_m2m_for_each_dst_buf'
490  - 'v4l2_m2m_for_each_dst_buf_safe'
491  - 'v4l2_m2m_for_each_src_buf'
492  - 'v4l2_m2m_for_each_src_buf_safe'
493  - 'virtio_device_for_each_vq'
494  - 'while_for_each_ftrace_op'
495  - 'xa_for_each'
496  - 'xa_for_each_marked'
497  - 'xa_for_each_range'
498  - 'xa_for_each_start'
499  - 'xas_for_each'
500  - 'xas_for_each_conflict'
501  - 'xas_for_each_marked'
502  - 'xbc_array_for_each_value'
503  - 'xbc_for_each_key_value'
504  - 'xbc_node_for_each_array_value'
505  - 'xbc_node_for_each_child'
506  - 'xbc_node_for_each_key_value'
507  - 'zorro_for_each_dev'
508
509#IncludeBlocks: Preserve # Unknown to clang-format-5.0
510IncludeCategories:
511  - Regex: '.*'
512    Priority: 1
513IncludeIsMainRegex: '(Test)?$'
514IndentCaseLabels: false
515#IndentPPDirectives: None # Unknown to clang-format-5.0
516IndentWidth: 4
517IndentWrappedFunctionNames: false
518JavaScriptQuotes: Leave
519JavaScriptWrapImports: true
520KeepEmptyLinesAtTheStartOfBlocks: false
521MacroBlockBegin: ''
522MacroBlockEnd: ''
523MaxEmptyLinesToKeep: 1
524NamespaceIndentation: None
525#ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0
526ObjCBlockIndentWidth: 4
527ObjCSpaceAfterProperty: true
528ObjCSpaceBeforeProtocolList: true
529
530# Taken from git's rules
531#PenaltyBreakAssignment: 10 # Unknown to clang-format-4.0
532PenaltyBreakBeforeFirstCallParameter: 30
533PenaltyBreakComment: 10
534PenaltyBreakFirstLessLess: 0
535PenaltyBreakString: 10
536PenaltyExcessCharacter: 100
537PenaltyReturnTypeOnItsOwnLine: 60
538
539PointerAlignment: Right
540ReflowComments: false
541SortIncludes: false
542#SortUsingDeclarations: false # Unknown to clang-format-4.0
543SpaceAfterCStyleCast: false
544SpaceAfterTemplateKeyword: true
545SpaceBeforeAssignmentOperators: true
546#SpaceBeforeCtorInitializerColon: true # Unknown to clang-format-5.0
547#SpaceBeforeInheritanceColon: true # Unknown to clang-format-5.0
548SpaceBeforeParens: ControlStatements
549#SpaceBeforeRangeBasedForLoopColon: true # Unknown to clang-format-5.0
550SpaceInEmptyParentheses: false
551SpacesBeforeTrailingComments: 1
552SpacesInAngles: false
553SpacesInContainerLiterals: false
554SpacesInCStyleCastParentheses: false
555SpacesInParentheses: false
556SpacesInSquareBrackets: false
557Standard: Cpp03
558TabWidth: 8
559UseTab: Never
560...
561