xref: /openbmc/linux/.clang-format (revision d0e22329)
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  - 'ax25_for_each'
76  - 'ax25_uid_for_each'
77  - 'bio_for_each_integrity_vec'
78  - '__bio_for_each_segment'
79  - 'bio_for_each_segment'
80  - 'bio_for_each_segment_all'
81  - 'bio_list_for_each'
82  - 'bip_for_each_vec'
83  - 'blkg_for_each_descendant_post'
84  - 'blkg_for_each_descendant_pre'
85  - 'blk_queue_for_each_rl'
86  - 'bond_for_each_slave'
87  - 'bond_for_each_slave_rcu'
88  - 'btree_for_each_safe128'
89  - 'btree_for_each_safe32'
90  - 'btree_for_each_safe64'
91  - 'btree_for_each_safel'
92  - 'card_for_each_dev'
93  - 'cgroup_taskset_for_each'
94  - 'cgroup_taskset_for_each_leader'
95  - 'cpufreq_for_each_entry'
96  - 'cpufreq_for_each_entry_idx'
97  - 'cpufreq_for_each_valid_entry'
98  - 'cpufreq_for_each_valid_entry_idx'
99  - 'css_for_each_child'
100  - 'css_for_each_descendant_post'
101  - 'css_for_each_descendant_pre'
102  - 'device_for_each_child_node'
103  - 'drm_atomic_crtc_for_each_plane'
104  - 'drm_atomic_crtc_state_for_each_plane'
105  - 'drm_atomic_crtc_state_for_each_plane_state'
106  - 'drm_for_each_connector_iter'
107  - 'drm_for_each_crtc'
108  - 'drm_for_each_encoder'
109  - 'drm_for_each_encoder_mask'
110  - 'drm_for_each_fb'
111  - 'drm_for_each_legacy_plane'
112  - 'drm_for_each_plane'
113  - 'drm_for_each_plane_mask'
114  - 'drm_mm_for_each_hole'
115  - 'drm_mm_for_each_node'
116  - 'drm_mm_for_each_node_in_range'
117  - 'drm_mm_for_each_node_safe'
118  - 'for_each_active_drhd_unit'
119  - 'for_each_active_iommu'
120  - 'for_each_available_child_of_node'
121  - 'for_each_bio'
122  - 'for_each_board_func_rsrc'
123  - 'for_each_bvec'
124  - 'for_each_child_of_node'
125  - 'for_each_clear_bit'
126  - 'for_each_clear_bit_from'
127  - 'for_each_cmsghdr'
128  - 'for_each_compatible_node'
129  - 'for_each_console'
130  - 'for_each_cpu'
131  - 'for_each_cpu_and'
132  - 'for_each_cpu_not'
133  - 'for_each_cpu_wrap'
134  - 'for_each_dev_addr'
135  - 'for_each_dma_cap_mask'
136  - 'for_each_drhd_unit'
137  - 'for_each_dss_dev'
138  - 'for_each_efi_memory_desc'
139  - 'for_each_efi_memory_desc_in_map'
140  - 'for_each_endpoint_of_node'
141  - 'for_each_evictable_lru'
142  - 'for_each_fib6_node_rt_rcu'
143  - 'for_each_fib6_walker_rt'
144  - 'for_each_free_mem_range'
145  - 'for_each_free_mem_range_reverse'
146  - 'for_each_func_rsrc'
147  - 'for_each_hstate'
148  - 'for_each_if'
149  - 'for_each_iommu'
150  - 'for_each_ip_tunnel_rcu'
151  - 'for_each_irq_nr'
152  - 'for_each_lru'
153  - 'for_each_matching_node'
154  - 'for_each_matching_node_and_match'
155  - 'for_each_memblock'
156  - 'for_each_memblock_type'
157  - 'for_each_memcg_cache_index'
158  - 'for_each_mem_pfn_range'
159  - 'for_each_mem_range'
160  - 'for_each_mem_range_rev'
161  - 'for_each_migratetype_order'
162  - 'for_each_msi_entry'
163  - 'for_each_net'
164  - 'for_each_netdev'
165  - 'for_each_netdev_continue'
166  - 'for_each_netdev_continue_rcu'
167  - 'for_each_netdev_feature'
168  - 'for_each_netdev_in_bond_rcu'
169  - 'for_each_netdev_rcu'
170  - 'for_each_netdev_reverse'
171  - 'for_each_netdev_safe'
172  - 'for_each_net_rcu'
173  - 'for_each_new_connector_in_state'
174  - 'for_each_new_crtc_in_state'
175  - 'for_each_new_plane_in_state'
176  - 'for_each_new_private_obj_in_state'
177  - 'for_each_node'
178  - 'for_each_node_by_name'
179  - 'for_each_node_by_type'
180  - 'for_each_node_mask'
181  - 'for_each_node_state'
182  - 'for_each_node_with_cpus'
183  - 'for_each_node_with_property'
184  - 'for_each_of_allnodes'
185  - 'for_each_of_allnodes_from'
186  - 'for_each_of_pci_range'
187  - 'for_each_old_connector_in_state'
188  - 'for_each_old_crtc_in_state'
189  - 'for_each_oldnew_connector_in_state'
190  - 'for_each_oldnew_crtc_in_state'
191  - 'for_each_oldnew_plane_in_state'
192  - 'for_each_oldnew_private_obj_in_state'
193  - 'for_each_old_plane_in_state'
194  - 'for_each_old_private_obj_in_state'
195  - 'for_each_online_cpu'
196  - 'for_each_online_node'
197  - 'for_each_online_pgdat'
198  - 'for_each_pci_bridge'
199  - 'for_each_pci_dev'
200  - 'for_each_pci_msi_entry'
201  - 'for_each_populated_zone'
202  - 'for_each_possible_cpu'
203  - 'for_each_present_cpu'
204  - 'for_each_prime_number'
205  - 'for_each_prime_number_from'
206  - 'for_each_process'
207  - 'for_each_process_thread'
208  - 'for_each_property_of_node'
209  - 'for_each_reserved_mem_region'
210  - 'for_each_resv_unavail_range'
211  - 'for_each_rtdcom'
212  - 'for_each_rtdcom_safe'
213  - 'for_each_set_bit'
214  - 'for_each_set_bit_from'
215  - 'for_each_sg'
216  - 'for_each_sg_page'
217  - '__for_each_thread'
218  - 'for_each_thread'
219  - 'for_each_zone'
220  - 'for_each_zone_zonelist'
221  - 'for_each_zone_zonelist_nodemask'
222  - 'fwnode_for_each_available_child_node'
223  - 'fwnode_for_each_child_node'
224  - 'fwnode_graph_for_each_endpoint'
225  - 'gadget_for_each_ep'
226  - 'hash_for_each'
227  - 'hash_for_each_possible'
228  - 'hash_for_each_possible_rcu'
229  - 'hash_for_each_possible_rcu_notrace'
230  - 'hash_for_each_possible_safe'
231  - 'hash_for_each_rcu'
232  - 'hash_for_each_safe'
233  - 'hctx_for_each_ctx'
234  - 'hlist_bl_for_each_entry'
235  - 'hlist_bl_for_each_entry_rcu'
236  - 'hlist_bl_for_each_entry_safe'
237  - 'hlist_for_each'
238  - 'hlist_for_each_entry'
239  - 'hlist_for_each_entry_continue'
240  - 'hlist_for_each_entry_continue_rcu'
241  - 'hlist_for_each_entry_continue_rcu_bh'
242  - 'hlist_for_each_entry_from'
243  - 'hlist_for_each_entry_from_rcu'
244  - 'hlist_for_each_entry_rcu'
245  - 'hlist_for_each_entry_rcu_bh'
246  - 'hlist_for_each_entry_rcu_notrace'
247  - 'hlist_for_each_entry_safe'
248  - '__hlist_for_each_rcu'
249  - 'hlist_for_each_safe'
250  - 'hlist_nulls_for_each_entry'
251  - 'hlist_nulls_for_each_entry_from'
252  - 'hlist_nulls_for_each_entry_rcu'
253  - 'hlist_nulls_for_each_entry_safe'
254  - 'ide_host_for_each_port'
255  - 'ide_port_for_each_dev'
256  - 'ide_port_for_each_present_dev'
257  - 'idr_for_each_entry'
258  - 'idr_for_each_entry_continue'
259  - 'idr_for_each_entry_ul'
260  - 'inet_bind_bucket_for_each'
261  - 'inet_lhash2_for_each_icsk_rcu'
262  - 'iov_for_each'
263  - 'key_for_each'
264  - 'key_for_each_safe'
265  - 'klp_for_each_func'
266  - 'klp_for_each_object'
267  - 'kvm_for_each_memslot'
268  - 'kvm_for_each_vcpu'
269  - 'list_for_each'
270  - 'list_for_each_entry'
271  - 'list_for_each_entry_continue'
272  - 'list_for_each_entry_continue_rcu'
273  - 'list_for_each_entry_continue_reverse'
274  - 'list_for_each_entry_from'
275  - 'list_for_each_entry_from_reverse'
276  - 'list_for_each_entry_lockless'
277  - 'list_for_each_entry_rcu'
278  - 'list_for_each_entry_reverse'
279  - 'list_for_each_entry_safe'
280  - 'list_for_each_entry_safe_continue'
281  - 'list_for_each_entry_safe_from'
282  - 'list_for_each_entry_safe_reverse'
283  - 'list_for_each_prev'
284  - 'list_for_each_prev_safe'
285  - 'list_for_each_safe'
286  - 'llist_for_each'
287  - 'llist_for_each_entry'
288  - 'llist_for_each_entry_safe'
289  - 'llist_for_each_safe'
290  - 'media_device_for_each_entity'
291  - 'media_device_for_each_intf'
292  - 'media_device_for_each_link'
293  - 'media_device_for_each_pad'
294  - 'netdev_for_each_lower_dev'
295  - 'netdev_for_each_lower_private'
296  - 'netdev_for_each_lower_private_rcu'
297  - 'netdev_for_each_mc_addr'
298  - 'netdev_for_each_uc_addr'
299  - 'netdev_for_each_upper_dev_rcu'
300  - 'netdev_hw_addr_list_for_each'
301  - 'nft_rule_for_each_expr'
302  - 'nla_for_each_attr'
303  - 'nla_for_each_nested'
304  - 'nlmsg_for_each_attr'
305  - 'nlmsg_for_each_msg'
306  - 'nr_neigh_for_each'
307  - 'nr_neigh_for_each_safe'
308  - 'nr_node_for_each'
309  - 'nr_node_for_each_safe'
310  - 'of_for_each_phandle'
311  - 'of_property_for_each_string'
312  - 'of_property_for_each_u32'
313  - 'pci_bus_for_each_resource'
314  - 'ping_portaddr_for_each_entry'
315  - 'plist_for_each'
316  - 'plist_for_each_continue'
317  - 'plist_for_each_entry'
318  - 'plist_for_each_entry_continue'
319  - 'plist_for_each_entry_safe'
320  - 'plist_for_each_safe'
321  - 'pnp_for_each_card'
322  - 'pnp_for_each_dev'
323  - 'protocol_for_each_card'
324  - 'protocol_for_each_dev'
325  - 'queue_for_each_hw_ctx'
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
376#IncludeBlocks: Preserve # Unknown to clang-format-5.0
377IncludeCategories:
378  - Regex: '.*'
379    Priority: 1
380IncludeIsMainRegex: '(Test)?$'
381IndentCaseLabels: false
382#IndentPPDirectives: None # Unknown to clang-format-5.0
383IndentWidth: 8
384IndentWrappedFunctionNames: false
385JavaScriptQuotes: Leave
386JavaScriptWrapImports: true
387KeepEmptyLinesAtTheStartOfBlocks: false
388MacroBlockBegin: ''
389MacroBlockEnd: ''
390MaxEmptyLinesToKeep: 1
391NamespaceIndentation: Inner
392#ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0
393ObjCBlockIndentWidth: 8
394ObjCSpaceAfterProperty: true
395ObjCSpaceBeforeProtocolList: true
396
397# Taken from git's rules
398#PenaltyBreakAssignment: 10 # Unknown to clang-format-4.0
399PenaltyBreakBeforeFirstCallParameter: 30
400PenaltyBreakComment: 10
401PenaltyBreakFirstLessLess: 0
402PenaltyBreakString: 10
403PenaltyExcessCharacter: 100
404PenaltyReturnTypeOnItsOwnLine: 60
405
406PointerAlignment: Right
407ReflowComments: false
408SortIncludes: false
409#SortUsingDeclarations: false # Unknown to clang-format-4.0
410SpaceAfterCStyleCast: false
411SpaceAfterTemplateKeyword: true
412SpaceBeforeAssignmentOperators: true
413#SpaceBeforeCtorInitializerColon: true # Unknown to clang-format-5.0
414#SpaceBeforeInheritanceColon: true # Unknown to clang-format-5.0
415SpaceBeforeParens: ControlStatements
416#SpaceBeforeRangeBasedForLoopColon: true # Unknown to clang-format-5.0
417SpaceInEmptyParentheses: false
418SpacesBeforeTrailingComments: 1
419SpacesInAngles: false
420SpacesInContainerLiterals: false
421SpacesInCStyleCastParentheses: false
422SpacesInParentheses: false
423SpacesInSquareBrackets: false
424Standard: Cpp03
425TabWidth: 8
426UseTab: Always
427...
428