linux/.clang-format
<<
>>
Prefs
   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_dma_page'
 217  - 'for_each_sg_page'
 218  - '__for_each_thread'
 219  - 'for_each_thread'
 220  - 'for_each_zone'
 221  - 'for_each_zone_zonelist'
 222  - 'for_each_zone_zonelist_nodemask'
 223  - 'fwnode_for_each_available_child_node'
 224  - 'fwnode_for_each_child_node'
 225  - 'fwnode_graph_for_each_endpoint'
 226  - 'gadget_for_each_ep'
 227  - 'hash_for_each'
 228  - 'hash_for_each_possible'
 229  - 'hash_for_each_possible_rcu'
 230  - 'hash_for_each_possible_rcu_notrace'
 231  - 'hash_for_each_possible_safe'
 232  - 'hash_for_each_rcu'
 233  - 'hash_for_each_safe'
 234  - 'hctx_for_each_ctx'
 235  - 'hlist_bl_for_each_entry'
 236  - 'hlist_bl_for_each_entry_rcu'
 237  - 'hlist_bl_for_each_entry_safe'
 238  - 'hlist_for_each'
 239  - 'hlist_for_each_entry'
 240  - 'hlist_for_each_entry_continue'
 241  - 'hlist_for_each_entry_continue_rcu'
 242  - 'hlist_for_each_entry_continue_rcu_bh'
 243  - 'hlist_for_each_entry_from'
 244  - 'hlist_for_each_entry_from_rcu'
 245  - 'hlist_for_each_entry_rcu'
 246  - 'hlist_for_each_entry_rcu_bh'
 247  - 'hlist_for_each_entry_rcu_notrace'
 248  - 'hlist_for_each_entry_safe'
 249  - '__hlist_for_each_rcu'
 250  - 'hlist_for_each_safe'
 251  - 'hlist_nulls_for_each_entry'
 252  - 'hlist_nulls_for_each_entry_from'
 253  - 'hlist_nulls_for_each_entry_rcu'
 254  - 'hlist_nulls_for_each_entry_safe'
 255  - 'ide_host_for_each_port'
 256  - 'ide_port_for_each_dev'
 257  - 'ide_port_for_each_present_dev'
 258  - 'idr_for_each_entry'
 259  - 'idr_for_each_entry_continue'
 260  - 'idr_for_each_entry_ul'
 261  - 'inet_bind_bucket_for_each'
 262  - 'inet_lhash2_for_each_icsk_rcu'
 263  - 'iov_for_each'
 264  - 'key_for_each'
 265  - 'key_for_each_safe'
 266  - 'klp_for_each_func'
 267  - 'klp_for_each_object'
 268  - 'kvm_for_each_memslot'
 269  - 'kvm_for_each_vcpu'
 270  - 'list_for_each'
 271  - 'list_for_each_entry'
 272  - 'list_for_each_entry_continue'
 273  - 'list_for_each_entry_continue_rcu'
 274  - 'list_for_each_entry_continue_reverse'
 275  - 'list_for_each_entry_from'
 276  - 'list_for_each_entry_from_reverse'
 277  - 'list_for_each_entry_lockless'
 278  - 'list_for_each_entry_rcu'
 279  - 'list_for_each_entry_reverse'
 280  - 'list_for_each_entry_safe'
 281  - 'list_for_each_entry_safe_continue'
 282  - 'list_for_each_entry_safe_from'
 283  - 'list_for_each_entry_safe_reverse'
 284  - 'list_for_each_prev'
 285  - 'list_for_each_prev_safe'
 286  - 'list_for_each_safe'
 287  - 'llist_for_each'
 288  - 'llist_for_each_entry'
 289  - 'llist_for_each_entry_safe'
 290  - 'llist_for_each_safe'
 291  - 'media_device_for_each_entity'
 292  - 'media_device_for_each_intf'
 293  - 'media_device_for_each_link'
 294  - 'media_device_for_each_pad'
 295  - 'netdev_for_each_lower_dev'
 296  - 'netdev_for_each_lower_private'
 297  - 'netdev_for_each_lower_private_rcu'
 298  - 'netdev_for_each_mc_addr'
 299  - 'netdev_for_each_uc_addr'
 300  - 'netdev_for_each_upper_dev_rcu'
 301  - 'netdev_hw_addr_list_for_each'
 302  - 'nft_rule_for_each_expr'
 303  - 'nla_for_each_attr'
 304  - 'nla_for_each_nested'
 305  - 'nlmsg_for_each_attr'
 306  - 'nlmsg_for_each_msg'
 307  - 'nr_neigh_for_each'
 308  - 'nr_neigh_for_each_safe'
 309  - 'nr_node_for_each'
 310  - 'nr_node_for_each_safe'
 311  - 'of_for_each_phandle'
 312  - 'of_property_for_each_string'
 313  - 'of_property_for_each_u32'
 314  - 'pci_bus_for_each_resource'
 315  - 'ping_portaddr_for_each_entry'
 316  - 'plist_for_each'
 317  - 'plist_for_each_continue'
 318  - 'plist_for_each_entry'
 319  - 'plist_for_each_entry_continue'
 320  - 'plist_for_each_entry_safe'
 321  - 'plist_for_each_safe'
 322  - 'pnp_for_each_card'
 323  - 'pnp_for_each_dev'
 324  - 'protocol_for_each_card'
 325  - 'protocol_for_each_dev'
 326  - 'queue_for_each_hw_ctx'
 327  - 'radix_tree_for_each_contig'
 328  - 'radix_tree_for_each_slot'
 329  - 'radix_tree_for_each_tagged'
 330  - 'rbtree_postorder_for_each_entry_safe'
 331  - 'resource_list_for_each_entry'
 332  - 'resource_list_for_each_entry_safe'
 333  - 'rhl_for_each_entry_rcu'
 334  - 'rhl_for_each_rcu'
 335  - 'rht_for_each'
 336  - 'rht_for_each_continue'
 337  - 'rht_for_each_entry'
 338  - 'rht_for_each_entry_continue'
 339  - 'rht_for_each_entry_rcu'
 340  - 'rht_for_each_entry_rcu_continue'
 341  - 'rht_for_each_entry_safe'
 342  - 'rht_for_each_rcu'
 343  - 'rht_for_each_rcu_continue'
 344  - '__rq_for_each_bio'
 345  - 'rq_for_each_segment'
 346  - 'scsi_for_each_prot_sg'
 347  - 'scsi_for_each_sg'
 348  - 'sctp_for_each_hentry'
 349  - 'sctp_skb_for_each'
 350  - 'shdma_for_each_chan'
 351  - '__shost_for_each_device'
 352  - 'shost_for_each_device'
 353  - 'sk_for_each'
 354  - 'sk_for_each_bound'
 355  - 'sk_for_each_entry_offset_rcu'
 356  - 'sk_for_each_from'
 357  - 'sk_for_each_rcu'
 358  - 'sk_for_each_safe'
 359  - 'sk_nulls_for_each'
 360  - 'sk_nulls_for_each_from'
 361  - 'sk_nulls_for_each_rcu'
 362  - 'snd_pcm_group_for_each_entry'
 363  - 'snd_soc_dapm_widget_for_each_path'
 364  - 'snd_soc_dapm_widget_for_each_path_safe'
 365  - 'snd_soc_dapm_widget_for_each_sink_path'
 366  - 'snd_soc_dapm_widget_for_each_source_path'
 367  - 'tb_property_for_each'
 368  - 'udp_portaddr_for_each_entry'
 369  - 'udp_portaddr_for_each_entry_rcu'
 370  - 'usb_hub_for_each_child'
 371  - 'v4l2_device_for_each_subdev'
 372  - 'v4l2_m2m_for_each_dst_buf'
 373  - 'v4l2_m2m_for_each_dst_buf_safe'
 374  - 'v4l2_m2m_for_each_src_buf'
 375  - 'v4l2_m2m_for_each_src_buf_safe'
 376  - 'zorro_for_each_dev'
 377
 378#IncludeBlocks: Preserve # Unknown to clang-format-5.0
 379IncludeCategories:
 380  - Regex: '.*'
 381    Priority: 1
 382IncludeIsMainRegex: '(Test)?$'
 383IndentCaseLabels: false
 384#IndentPPDirectives: None # Unknown to clang-format-5.0
 385IndentWidth: 8
 386IndentWrappedFunctionNames: true
 387JavaScriptQuotes: Leave
 388JavaScriptWrapImports: true
 389KeepEmptyLinesAtTheStartOfBlocks: false
 390MacroBlockBegin: ''
 391MacroBlockEnd: ''
 392MaxEmptyLinesToKeep: 1
 393NamespaceIndentation: Inner
 394#ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0
 395ObjCBlockIndentWidth: 8
 396ObjCSpaceAfterProperty: true
 397ObjCSpaceBeforeProtocolList: true
 398
 399# Taken from git's rules
 400#PenaltyBreakAssignment: 10 # Unknown to clang-format-4.0
 401PenaltyBreakBeforeFirstCallParameter: 30
 402PenaltyBreakComment: 10
 403PenaltyBreakFirstLessLess: 0
 404PenaltyBreakString: 10
 405PenaltyExcessCharacter: 100
 406PenaltyReturnTypeOnItsOwnLine: 60
 407
 408PointerAlignment: Right
 409ReflowComments: false
 410SortIncludes: false
 411#SortUsingDeclarations: false # Unknown to clang-format-4.0
 412SpaceAfterCStyleCast: false
 413SpaceAfterTemplateKeyword: true
 414SpaceBeforeAssignmentOperators: true
 415#SpaceBeforeCtorInitializerColon: true # Unknown to clang-format-5.0
 416#SpaceBeforeInheritanceColon: true # Unknown to clang-format-5.0
 417SpaceBeforeParens: ControlStatements
 418#SpaceBeforeRangeBasedForLoopColon: true # Unknown to clang-format-5.0
 419SpaceInEmptyParentheses: false
 420SpacesBeforeTrailingComments: 1
 421SpacesInAngles: false
 422SpacesInContainerLiterals: false
 423SpacesInCStyleCastParentheses: false
 424SpacesInParentheses: false
 425SpacesInSquareBrackets: false
 426Standard: Cpp03
 427TabWidth: 8
 428UseTab: Always
 429...
 430