summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Kosov <claprix@yandex.ru>2019-06-12 22:36:43 +0300
committerEugene Kosov <claprix@yandex.ru>2019-06-12 22:36:43 +0300
commit039b8782d4794f34c5f0219d8a8d21f6e21d74f1 (patch)
tree23c08e4767204e5df7e8020eba18182a37fe2c67
parent7a7d9904e12335ee8b1eea9671138b3c469a3829 (diff)
downloadmariadb-git-039b8782d4794f34c5f0219d8a8d21f6e21d74f1.tar.gz
MDEV-13631 Make use of clang-format
Explicitly mention every options in .clang-format to protect us from possible future changes. Remove separate InnoDB style. Change style to look more like this script: for x in $@ do indent -kr -bl -bli0 -l79 -i2 -nut -c48 -dj -cp0 $x sed -ri -e 's/ = /= /g'\ -e '/switch.*\)$/{N;s/\n[ ]+/ /}' $x done Significant different is that 'switch' and '{' are put on different lines because it's impossible in clang-format to set formatting rules just for 'switch' statement.
-rw-r--r--.clang-format123
-rw-r--r--storage/innobase/.clang-format10
2 files changed, 111 insertions, 22 deletions
diff --git a/.clang-format b/.clang-format
index 3b735b16d74..1ad93ead80a 100644
--- a/.clang-format
+++ b/.clang-format
@@ -1,18 +1,117 @@
-SpaceBeforeAssignmentOperators: false
-SpaceAfterCStyleCast: true
-
-BreakBeforeBraces: Custom
+---
+Language: Cpp
+AccessModifierOffset: -2
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignEscapedNewlines: Right
+AlignOperands: true
+AlignTrailingComments: true
+AllowAllArgumentsOnNextLine: true
+AllowAllConstructorInitializersOnNextLine: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: false
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: All
+AllowShortLambdasOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: Never
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakAfterReturnType: None
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: MultiLine
+BinPackArguments: true
+BinPackParameters: true
BraceWrapping:
- AfterClass: true
+ AfterCaseLabel: true
+ AfterClass: true
AfterControlStatement: true
- AfterEnum: true
- AfterFunction: true
- AfterNamespace: true
- AfterStruct: true
- AfterUnion: true
+ AfterEnum: true
+ AfterFunction: true
+ AfterNamespace: true
+ AfterStruct: true
+ AfterUnion: true
AfterExternBlock: true
- BeforeCatch: true
- BeforeElse: true
+ BeforeCatch: true
+ BeforeElse: true
+ IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Custom
+BreakBeforeInheritanceComma: false
+BreakInheritanceList: BeforeColon
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+BreakConstructorInitializers: BeforeColon
+BreakStringLiterals: true
+ColumnLimit: 79
+CommentPragmas: '^ IWYU pragma:'
+CompactNamespaces: false
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: true
+DerivePointerAlignment: false
+DisableFormat: false
+ExperimentalAutoDetectBinPacking: false
+FixNamespaceComments: true
+ForEachMacros:
+ - foreach
+ - Q_FOREACH
+ - BOOST_FOREACH
+IncludeBlocks: Preserve
+IncludeCategories:
+ - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
+ Priority: 2
+ - Regex: '^(<|"(gtest|gmock|isl|json)/)'
+ Priority: 3
+ - Regex: '.*'
+ Priority: 1
+IncludeIsMainRegex: '(Test)?$'
+IndentCaseLabels: false
+IndentPPDirectives: None
+IndentWidth: 2
+IndentWrappedFunctionNames: false
+KeepEmptyLinesAtTheStartOfBlocks: true
+Language: Cpp
+MacroBlockBegin: ''
+MacroBlockEnd: ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+PenaltyBreakAssignment: 2
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyBreakTemplateDeclaration: 10
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+PointerAlignment: Right
+ReflowComments: true
+SortIncludes: true
+SortUsingDeclarations: true
+SpaceAfterCStyleCast: true
+SpaceAfterLogicalNot: false
+SpaceAfterTemplateKeyword: true
+SpaceBeforeAssignmentOperators: false
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
+SpaceBeforeParens: ControlStatements
+SpaceBeforeRangeBasedForLoopColon: true
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles: false
+SpacesInContainerLiterals: true
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard: Cpp11
+StatementMacros:
+ - Q_UNUSED
+ - QT_REQUIRE_VERSION
+TabWidth: 8
+UseTab: Never
+...
diff --git a/storage/innobase/.clang-format b/storage/innobase/.clang-format
deleted file mode 100644
index f7a72f3cf24..00000000000
--- a/storage/innobase/.clang-format
+++ /dev/null
@@ -1,10 +0,0 @@
-UseTab: Always
-TabWidth: 8
-IndentWidth: 8
-BreakBeforeBinaryOperators: All
-PointerAlignment: Left
-AlwaysBreakAfterReturnType: TopLevel
-BreakBeforeBraces: Custom
-BraceWrapping:
- AfterFunction: true
-AccessModifierOffset: -8