Jens Wiklander | fa17182 | 2023-05-12 10:58:21 +0200 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | # |
| 3 | # clang-format configuration file. Intended for clang-format >= 11. |
| 4 | # |
| 5 | # This is not perfect, but should help in most cases. |
| 6 | # Please note that the maintainers have the last word if there's |
| 7 | # disagrement with this tool. |
| 8 | # |
| 9 | # For more information, see: |
| 10 | # https://clang.llvm.org/docs/ClangFormat.html |
| 11 | # https://clang.llvm.org/docs/ClangFormatStyleOptions.html |
| 12 | # |
| 13 | --- |
| 14 | AccessModifierOffset: -4 |
| 15 | AlignAfterOpenBracket: Align |
| 16 | AlignConsecutiveAssignments: false |
| 17 | AlignConsecutiveDeclarations: false |
| 18 | AlignEscapedNewlines: Left |
| 19 | AlignOperands: true |
| 20 | AlignTrailingComments: false |
| 21 | AllowAllParametersOfDeclarationOnNextLine: false |
| 22 | AllowShortBlocksOnASingleLine: false |
| 23 | AllowShortCaseLabelsOnASingleLine: false |
| 24 | AllowShortFunctionsOnASingleLine: None |
| 25 | AllowShortIfStatementsOnASingleLine: false |
| 26 | AllowShortLoopsOnASingleLine: false |
| 27 | AlwaysBreakAfterDefinitionReturnType: None |
| 28 | AlwaysBreakAfterReturnType: None |
| 29 | AlwaysBreakBeforeMultilineStrings: false |
| 30 | AlwaysBreakTemplateDeclarations: false |
| 31 | BinPackArguments: true |
| 32 | BinPackParameters: true |
| 33 | BraceWrapping: |
| 34 | AfterClass: false |
| 35 | AfterControlStatement: false |
| 36 | AfterEnum: false |
| 37 | AfterFunction: true |
| 38 | AfterNamespace: true |
| 39 | AfterObjCDeclaration: false |
| 40 | AfterStruct: false |
| 41 | AfterUnion: false |
| 42 | AfterExternBlock: false |
| 43 | BeforeCatch: false |
| 44 | BeforeElse: false |
| 45 | IndentBraces: false |
| 46 | SplitEmptyFunction: true |
| 47 | SplitEmptyRecord: true |
| 48 | SplitEmptyNamespace: true |
| 49 | BreakBeforeBinaryOperators: None |
| 50 | BreakBeforeBraces: Custom |
| 51 | BreakBeforeInheritanceComma: false |
| 52 | BreakBeforeTernaryOperators: false |
| 53 | BreakConstructorInitializersBeforeComma: false |
| 54 | BreakConstructorInitializers: BeforeComma |
| 55 | BreakAfterJavaFieldAnnotations: false |
| 56 | BreakStringLiterals: false |
| 57 | ColumnLimit: 80 |
| 58 | CommentPragmas: '^ IWYU pragma:' |
| 59 | CompactNamespaces: false |
| 60 | ConstructorInitializerAllOnOneLineOrOnePerLine: false |
| 61 | ConstructorInitializerIndentWidth: 8 |
| 62 | ContinuationIndentWidth: 8 |
| 63 | Cpp11BracedListStyle: false |
| 64 | DerivePointerAlignment: false |
| 65 | DisableFormat: false |
| 66 | ExperimentalAutoDetectBinPacking: false |
| 67 | FixNamespaceComments: false |
| 68 | |
| 69 | # Taken from: |
| 70 | # find lib core -name "*.h" -path '*/include/*' -print0 | xargs -0 grep -E -h \ |
| 71 | # '^#define[[:blank:]]*[^[:blank:]]*(FOREACH|for_each)[^[:blank:]]' | \ |
| 72 | # sed \ |
| 73 | # -e "s,^#define[ \t]*\([^[:space:]]*for_each[^[:space:]]*\)(.*$, - '\1'," \ |
| 74 | # -e "s,^#define[ \t]*\([^[:space:]]*FOREACH[^[:space:]]*\)(.*$, - '\1'," | \ |
| 75 | # LC_ALL=C sort -u |
| 76 | ForEachMacros: |
| 77 | - 'CIRCLEQ_FOREACH' |
| 78 | - 'CIRCLEQ_FOREACH_REVERSE' |
| 79 | - 'LIST_FOREACH' |
| 80 | - 'LIST_FOREACH_SAFE' |
| 81 | - 'SCATTERED_ARRAY_FOREACH' |
| 82 | - 'SIMPLEQ_FOREACH' |
| 83 | - 'SLIST_FOREACH' |
| 84 | - 'SLIST_FOREACH_SAFE' |
| 85 | - 'STAILQ_FOREACH' |
| 86 | - 'STAILQ_FOREACH_SAFE' |
| 87 | - 'TAILQ_FOREACH' |
| 88 | - 'TAILQ_FOREACH_REVERSE' |
| 89 | - 'TAILQ_FOREACH_REVERSE_SAFE' |
| 90 | - 'TAILQ_FOREACH_SAFE' |
| 91 | - 'fdt_for_each_property_offset' |
| 92 | - 'fdt_for_each_subnode' |
| 93 | - 'for_each_dt_driver' |
| 94 | - 'for_each_early_ta' |
| 95 | - 'for_each_fip_sp' |
| 96 | - 'for_each_secure_partition' |
| 97 | |
| 98 | IncludeBlocks: Preserve |
| 99 | IncludeCategories: |
| 100 | - Regex: '.*' |
| 101 | Priority: 1 |
| 102 | IncludeIsMainRegex: '(Test)?$' |
| 103 | IndentCaseLabels: false |
| 104 | IndentGotoLabels: false |
| 105 | IndentPPDirectives: None |
| 106 | IndentWidth: 8 |
| 107 | IndentWrappedFunctionNames: false |
| 108 | JavaScriptQuotes: Leave |
| 109 | JavaScriptWrapImports: true |
| 110 | KeepEmptyLinesAtTheStartOfBlocks: false |
| 111 | MacroBlockBegin: '' |
| 112 | MacroBlockEnd: '' |
| 113 | MaxEmptyLinesToKeep: 1 |
| 114 | NamespaceIndentation: None |
| 115 | ObjCBinPackProtocolList: Auto |
| 116 | ObjCBlockIndentWidth: 8 |
| 117 | ObjCSpaceAfterProperty: true |
| 118 | ObjCSpaceBeforeProtocolList: true |
| 119 | |
| 120 | # Taken from git's rules |
| 121 | PenaltyBreakAssignment: 10 |
| 122 | PenaltyBreakBeforeFirstCallParameter: 30 |
| 123 | PenaltyBreakComment: 10 |
| 124 | PenaltyBreakFirstLessLess: 0 |
| 125 | PenaltyBreakString: 10 |
| 126 | PenaltyExcessCharacter: 100 |
| 127 | PenaltyReturnTypeOnItsOwnLine: 60 |
| 128 | |
| 129 | PointerAlignment: Right |
| 130 | ReflowComments: false |
| 131 | SortIncludes: false |
| 132 | SortUsingDeclarations: false |
| 133 | SpaceAfterCStyleCast: false |
| 134 | SpaceAfterTemplateKeyword: true |
| 135 | SpaceBeforeAssignmentOperators: true |
| 136 | SpaceBeforeCtorInitializerColon: true |
| 137 | SpaceBeforeInheritanceColon: true |
| 138 | SpaceBeforeParens: ControlStatementsExceptForEachMacros |
| 139 | SpaceBeforeRangeBasedForLoopColon: true |
| 140 | SpaceInEmptyParentheses: false |
| 141 | SpacesBeforeTrailingComments: 1 |
| 142 | SpacesInAngles: false |
| 143 | SpacesInContainerLiterals: false |
| 144 | SpacesInCStyleCastParentheses: false |
| 145 | SpacesInParentheses: false |
| 146 | SpacesInSquareBrackets: false |
| 147 | Standard: Cpp03 |
| 148 | TabWidth: 8 |
| 149 | UseTab: Always |
| 150 | ... |