From 200f58c07e5a1a9d16a97428e22d2bea912fffa5 Mon Sep 17 00:00:00 2001 From: Mateusz Starzyk Date: Tue, 20 Jul 2021 15:49:39 +0200 Subject: [PATCH] Add .clang-format file compatible with Clang12. Config file template generated with `clang-format-12 --style=llvm --dump-config > .clang-format` And adjusted to fit K&R style. Signed-off-by: Mateusz Starzyk --- .clang-format | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000000..20adf93463 --- /dev/null +++ b/.clang-format @@ -0,0 +1,113 @@ +--- +Language: Cpp +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignConsecutiveBitFields: Consecutive +AlignConsecutiveDeclarations: false +AlignConsecutiveMacros: Consecutive +AlignEscapedNewlines: Left +AlignOperands: true +AlignTrailingComments: false +AllowAllArgumentsOnNextLine: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortEnumsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: false +BinPackArguments: true +BinPackParameters: false +BitFieldColonSpacing: Both +BreakBeforeBinaryOperators: None +BraceWrapping: + AfterCaseLabel: false + AfterControlStatement: Never + AfterEnum: false + AfterFunction: true + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeElse: false + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBraces: Custom +BreakBeforeInheritanceComma: false +BreakBeforeTernaryOperators: false +BreakStringLiterals: false +ColumnLimit: 80 +# CommentPragmas prevent formatting of comments fitting particular patterns. +# Clang-format accepts only one pragma, so we need too prepapre a list of patterns joined with "|". +# * test cases: BEGIN_CASE|END_CASE +# * special string for check-names script: ^no-check-names +# * doxygen blocks: \\name|\\brief|\\param|\\return|^ {11}|\{.*\} +# The '^ {11}' stands for minimal indent in multiline Doxygen comments. +# It comes from the length of \brief keyword + 1 space prefix before the keyword +# and 4 spaces suffix after it, as in: " * \brief Function description ..." +# ^_________^ +# * KreMLin code generation: "KreMLin invocation" +CommentPragmas: 'BEGIN_CASE|END_CASE|^no-check-names|\\name|\\brief|\\param|\\return|^ {11}|\{.*\}|KreMLin invocation' +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: false +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +ForEachMacros: [] +IncludeBlocks: Preserve +IncludeCategories: + - Regex: '.*' + Priority: 1 +IncludeIsMainRegex: '(Test)?$' +IndentCaseBlocks: true +IndentCaseLabels: true +IndentExternBlock: NoIndent +IndentGotoLabels: false +IndentPPDirectives: AfterHash +IndentWidth: 4 +IndentWrappedFunctionNames: false +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +PenaltyBreakAssignment: 10 +PenaltyBreakBeforeFirstCallParameter: 30 +PenaltyBreakComment: 10 +PenaltyBreakFirstLessLess: 0 +PenaltyBreakString: 50 +PenaltyExcessCharacter: 100 +PenaltyReturnTypeOnItsOwnLine: 60 +PointerAlignment: Right +ReflowComments: true +SortIncludes: false +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAroundPointerQualifiers: Default +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeParens: ControlStatements +SpaceBeforeSquareBrackets: false +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInContainerLiterals: false +SpacesInCStyleCastParentheses: false +SpacesInConditionalStatement: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Cpp11 +StatementAttributeLikeMacros: [] +StatementMacros: [] +TypenameMacros: ['MBEDTLS_PRIVATE'] +UseCRLF: false +UseTab: Never +WhitespaceSensitiveMacros: [] +...