.clang-format 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. # SPDX-License-Identifier: GPL-2.0
  2. #
  3. # Linux kernel clang-format style (https://github.com/torvalds/linux, .clang-format).
  4. # The upstream file's ~680-line ForEachMacros list is omitted: those entries only
  5. # affect formatting of the kernel's own iterator macros, none of which exist here,
  6. # so they have no effect on this codebase. Pin: clang-format 18 (see Makefile/CI).
  7. #
  8. # Docs: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
  9. #
  10. ---
  11. AccessModifierOffset: -4
  12. AlignAfterOpenBracket: Align
  13. AlignConsecutiveAssignments: false
  14. AlignConsecutiveDeclarations: false
  15. AlignEscapedNewlines: Left
  16. AlignOperands: true
  17. AlignTrailingComments: false
  18. AllowAllParametersOfDeclarationOnNextLine: false
  19. AllowShortBlocksOnASingleLine: false
  20. AllowShortCaseLabelsOnASingleLine: false
  21. AllowShortFunctionsOnASingleLine: None
  22. AllowShortIfStatementsOnASingleLine: false
  23. AllowShortLoopsOnASingleLine: false
  24. AlwaysBreakAfterDefinitionReturnType: None
  25. AlwaysBreakAfterReturnType: None
  26. AlwaysBreakBeforeMultilineStrings: false
  27. AlwaysBreakTemplateDeclarations: false
  28. BinPackArguments: true
  29. BinPackParameters: true
  30. BraceWrapping:
  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
  40. BeforeCatch: false
  41. BeforeElse: false
  42. IndentBraces: false
  43. SplitEmptyFunction: true
  44. SplitEmptyRecord: true
  45. SplitEmptyNamespace: true
  46. BreakBeforeBinaryOperators: None
  47. BreakBeforeBraces: Custom
  48. BreakBeforeInheritanceComma: false
  49. BreakBeforeTernaryOperators: false
  50. BreakConstructorInitializersBeforeComma: false
  51. BreakConstructorInitializers: BeforeComma
  52. BreakAfterJavaFieldAnnotations: false
  53. BreakStringLiterals: false
  54. ColumnLimit: 80
  55. CommentPragmas: '^ IWYU pragma:'
  56. CompactNamespaces: false
  57. ConstructorInitializerAllOnOneLineOrOnePerLine: false
  58. ConstructorInitializerIndentWidth: 8
  59. ContinuationIndentWidth: 8
  60. Cpp11BracedListStyle: false
  61. DerivePointerAlignment: false
  62. DisableFormat: false
  63. ExperimentalAutoDetectBinPacking: false
  64. FixNamespaceComments: false
  65. IncludeBlocks: Preserve
  66. IncludeCategories:
  67. - Regex: '.*'
  68. Priority: 1
  69. IncludeIsMainRegex: '(Test)?$'
  70. IndentCaseLabels: false
  71. IndentGotoLabels: false
  72. IndentPPDirectives: None
  73. IndentWidth: 8
  74. IndentWrappedFunctionNames: false
  75. JavaScriptQuotes: Leave
  76. JavaScriptWrapImports: true
  77. KeepEmptyLinesAtTheStartOfBlocks: false
  78. MacroBlockBegin: ''
  79. MacroBlockEnd: ''
  80. MaxEmptyLinesToKeep: 1
  81. NamespaceIndentation: None
  82. ObjCBinPackProtocolList: Auto
  83. ObjCBlockIndentWidth: 8
  84. ObjCSpaceAfterProperty: true
  85. ObjCSpaceBeforeProtocolList: true
  86. # Taken from git's rules
  87. PenaltyBreakAssignment: 10
  88. PenaltyBreakBeforeFirstCallParameter: 30
  89. PenaltyBreakComment: 10
  90. PenaltyBreakFirstLessLess: 0
  91. PenaltyBreakString: 10
  92. PenaltyExcessCharacter: 100
  93. PenaltyReturnTypeOnItsOwnLine: 60
  94. PointerAlignment: Right
  95. ReflowComments: false
  96. SortIncludes: false
  97. SortUsingDeclarations: false
  98. SpaceAfterCStyleCast: false
  99. SpaceAfterTemplateKeyword: true
  100. SpaceBeforeAssignmentOperators: true
  101. SpaceBeforeCtorInitializerColon: true
  102. SpaceBeforeInheritanceColon: true
  103. SpaceBeforeParens: ControlStatementsExceptForEachMacros
  104. SpaceBeforeRangeBasedForLoopColon: true
  105. SpaceInEmptyParentheses: false
  106. SpacesBeforeTrailingComments: 1
  107. SpacesInAngles: false
  108. SpacesInContainerLiterals: false
  109. SpacesInCStyleCastParentheses: false
  110. SpacesInParentheses: false
  111. SpacesInSquareBrackets: false
  112. Standard: Cpp03
  113. TabWidth: 8
  114. UseTab: Always
  115. ...