From: Jérémie Galarneau Date: Tue, 16 Jul 2019 18:45:36 +0000 (-0400) Subject: Add .clang-format X-Git-Tag: v2.12.0-rc1~535 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=3aa937ab446c323bec53fc3581c424a3cc5c020e;p=lttng-tools.git Add .clang-format Add a first draft of a .clang-format. I have attempted to set it up so that it conforms to the project's usual coding convention. Signed-off-by: Jérémie Galarneau --- diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..fff075fbf --- /dev/null +++ b/.clang-format @@ -0,0 +1,80 @@ +AlignAfterOpenBracket: DontAlign +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Left +AlignOperands: true +AlignTrailingComments: false +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +BinPackArguments: true +BinPackParameters: false +BraceWrapping: + AfterControlStatement: false + AfterEnum: false + AfterFunction: true + AfterNamespace: true + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Custom +BreakBeforeTernaryOperators: false +BreakStringLiterals: false +ColumnLimit: 80 +ContinuationIndentWidth: 16 +DerivePointerAlignment: false +DisableFormat: false +ForEachMacros: + - 'cds_lfht_for_each_entry' + - 'cds_lfht_for_each_entry_safe' + - 'cds_lfht_for_each_duplicate' + - 'cds_list_for_each_entry' + - 'cds_list_for_each_entry_safe' + +IncludeBlocks: Preserve +IncludeCategories: + - Regex: '.*' + Priority: 1 +IncludeIsMainRegex: '(Test)?$' +IndentCaseLabels: false +IndentPPDirectives: None +IndentWidth: 8 +IndentWrappedFunctionNames: false +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 + +# Taken from git's rules +PenaltyBreakAssignment: 10 +PenaltyBreakBeforeFirstCallParameter: 30 +PenaltyBreakComment: 10 +PenaltyBreakString: 10 +PenaltyExcessCharacter: 100 +PenaltyReturnTypeOnItsOwnLine: 60 + +PointerAlignment: Right +ReflowComments: true +SortIncludes: true +SpaceAfterCStyleCast: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInContainerLiterals: false +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Cpp11 +TabWidth: 8 +UseTab: Always +...