diff options
Diffstat (limited to '.clang-format')
-rw-r--r-- | .clang-format | 99 |
1 files changed, 74 insertions, 25 deletions
diff --git a/.clang-format b/.clang-format index 0f4d2b52..7fc30f61 100644 --- a/.clang-format +++ b/.clang-format @@ -1,6 +1,6 @@ -# SPDX-License-Identifier: GPL-2.0 +# SPDX-License-Identifier: GPL-2.0-only # -# clang-format configuration file. Intended for clang-format >= 4. +# clang-format configuration file. Intended for clang-format >= 12. # # For more information, see: # @@ -9,23 +9,24 @@ # https://clang.llvm.org/docs/ClangFormatStyleOptions.html # --- +Language: Cpp AccessModifierOffset: -8 AlignAfterOpenBracket: Align AlignConsecutiveAssignments: false AlignConsecutiveDeclarations: false -#AlignEscapedNewlines: Left # Unknown to clang-format-4.0 +AlignEscapedNewlines: Right AlignOperands: true AlignTrailingComments: false AllowAllParametersOfDeclarationOnNextLine: false AllowShortBlocksOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false -AllowShortFunctionsOnASingleLine: Inline +AllowShortFunctionsOnASingleLine: InlineOnly AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: false +AlwaysBreakTemplateDeclarations: MultiLine BinPackArguments: true BinPackParameters: true BraceWrapping: @@ -37,24 +38,24 @@ BraceWrapping: AfterObjCDeclaration: false AfterStruct: false AfterUnion: false - #AfterExternBlock: false # Unknown to clang-format-5.0 + AfterExternBlock: false BeforeCatch: false BeforeElse: false IndentBraces: false - #SplitEmptyFunction: true # Unknown to clang-format-4.0 - #SplitEmptyRecord: true # Unknown to clang-format-4.0 - #SplitEmptyNamespace: true # Unknown to clang-format-4.0 + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true BreakBeforeBinaryOperators: None BreakBeforeBraces: Custom -#BreakBeforeInheritanceComma: false # Unknown to clang-format-4.0 +BreakBeforeInheritanceComma: false +BreakInheritanceList: BeforeColon BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: false -#BreakConstructorInitializers: BeforeComma # Unknown to clang-format-4.0 +BreakConstructorInitializers: BeforeColon BreakAfterJavaFieldAnnotations: false BreakStringLiterals: false ColumnLimit: 0 CommentPragmas: '^ IWYU pragma:' -#CompactNamespaces: false # Unknown to clang-format-4.0 +CompactNamespaces: false ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerIndentWidth: 8 ContinuationIndentWidth: 8 @@ -62,16 +63,62 @@ Cpp11BracedListStyle: false DerivePointerAlignment: false DisableFormat: false ExperimentalAutoDetectBinPacking: false -#FixNamespaceComments: false # Unknown to clang-format-4.0 +FixNamespaceComments: true ForEachMacros: - 'udev_list_entry_foreach' -#IncludeBlocks: Preserve # Unknown to clang-format-5.0 +IncludeBlocks: Regroup IncludeCategories: - - Regex: '.*' - Priority: 1 + # Headers matching the name of the component are matched automatically. + # Priority 1 + # Other library headers (explicit overrides to match before system headers) + - Regex: '(<jpeglib.h>|<libudev.h>|<tiffio.h>|<xf86drm.h>|<xf86drmMode.h>|<yaml.h>)' + Priority: 9 + # Qt includes (match before C++ standard library) + - Regex: '<Q([A-Za-z0-9\-_])+>' + CaseSensitive: true + Priority: 9 + # Headers in <> with an extension. (+system libraries) + - Regex: '<([A-Za-z0-9\-_])+\.h>' + Priority: 2 + # System headers + - Regex: '<sys/.*>' + Priority: 2 + # C++ standard library includes (no extension) + - Regex: '<([A-Za-z0-9\-_/])+>' + Priority: 2 + # Linux headers, as a second group/subset of system headers + - Regex: '<linux/.*>' + Priority: 3 + # Headers for libcamera Base support + - Regex: '<libcamera/base/private.h>' + Priority: 4 + - Regex: '<libcamera/base/.*\.h>' + Priority: 5 + # Public API Headers for libcamera, which are not in a subdir (i.e. ipa/,internal/) + - Regex: '<libcamera/([A-Za-z0-9\-_])+.h>' + Priority: 6 + # IPA Interfaces + - Regex: '<libcamera/ipa/.*\.h>' + Priority: 7 + # libcamera Internal headers in "" + - Regex: '"libcamera/internal/.*\.h"' + Priority: 8 + # Other libraries headers with one group per library (.h or .hpp) + - Regex: '<.*/.*\.hp*>' + Priority: 9 + # local modular includes "path/file.h" (.h or .hpp) + - Regex: '"(.*/)+.*\.hp*"' + Priority: 10 + # Other local headers "file.h" with extension (.h or .hpp) + - Regex: '".*.hp*"' + Priority: 11 + # Any unmatched line, separated from the last group + - Regex: '"*"' + Priority: 100 + IncludeIsMainRegex: '(_test)?$' IndentCaseLabels: false -#IndentPPDirectives: None # Unknown to clang-format-5.0 +IndentPPDirectives: None IndentWidth: 8 IndentWrappedFunctionNames: false JavaScriptQuotes: Leave @@ -81,31 +128,33 @@ MacroBlockBegin: '' MacroBlockEnd: '' MaxEmptyLinesToKeep: 1 NamespaceIndentation: None -#ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0 +ObjCBinPackProtocolList: Auto ObjCBlockIndentWidth: 8 ObjCSpaceAfterProperty: true ObjCSpaceBeforeProtocolList: true # Taken from git's rules -#PenaltyBreakAssignment: 10 # Unknown to clang-format-4.0 +PenaltyBreakAssignment: 10 PenaltyBreakBeforeFirstCallParameter: 30 PenaltyBreakComment: 10 PenaltyBreakFirstLessLess: 0 PenaltyBreakString: 10 +PenaltyBreakTemplateDeclaration: 10 PenaltyExcessCharacter: 100 PenaltyReturnTypeOnItsOwnLine: 60 PointerAlignment: Right ReflowComments: false -SortIncludes: false -#SortUsingDeclarations: false # Unknown to clang-format-4.0 +SortIncludes: true +SortUsingDeclarations: true SpaceAfterCStyleCast: false SpaceAfterTemplateKeyword: false SpaceBeforeAssignmentOperators: true -#SpaceBeforeCtorInitializerColon: true # Unknown to clang-format-5.0 -#SpaceBeforeInheritanceColon: true # Unknown to clang-format-5.0 +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true SpaceBeforeParens: ControlStatements -#SpaceBeforeRangeBasedForLoopColon: true # Unknown to clang-format-5.0 +SpaceBeforeRangeBasedForLoopColon: true SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 1 SpacesInAngles: false |