From 934ede9f4674f07004266e3b6944f6d0c43e46f5 Mon Sep 17 00:00:00 2001 From: Martin Zink Date: Wed, 9 Oct 2024 13:31:11 +0200 Subject: [PATCH 1/3] MINIFICPP-2473 Add .clang-format to project --- .clang-format | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000000..2ce781e0aa --- /dev/null +++ b/.clang-format @@ -0,0 +1,67 @@ +BasedOnStyle: Google +AccessModifierOffset: -1 +AlignAfterOpenBracket: DontAlign +AlignConsecutiveAssignments: None +AlignOperands: DontAlign +AllowAllArgumentsOnNextLine: false +AllowAllConstructorInitializersOnNextLine: false +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: Always +AllowShortCaseLabelsOnASingleLine: true +AllowShortFunctionsOnASingleLine: Inline +AllowShortIfStatementsOnASingleLine: Always +AllowShortLambdasOnASingleLine: All +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterReturnType: None +BreakTemplateDeclarations: Yes +BreakBeforeBraces: Custom +BraceWrapping: + AfterCaseLabel: false + AfterClass: false + AfterControlStatement: Never + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterUnion: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false +BreakBeforeBinaryOperators: None +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: BeforeColon +BreakInheritanceList: BeforeColon +ColumnLimit: 200 +CompactNamespaces: false +ContinuationIndentWidth: 4 +IndentCaseLabels: true +IndentPPDirectives: None +IndentWidth: 2 +InsertBraces: true +KeepEmptyLinesAtTheStartOfBlocks: true +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: false +PenaltyIndentedWhitespace: 1 +PointerAlignment: Left +ReferenceAlignment: Left +ReflowComments: false +SpaceAfterCStyleCast: true +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: false +SpacesInCStyleCastParentheses: false +SpacesInContainerLiterals: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: c++20 +TabWidth: 2 +UseTab: Never From 3884817a4647c54423275e2aded95b153e5dda8c Mon Sep 17 00:00:00 2001 From: Martin Zink Date: Wed, 9 Oct 2024 16:07:20 +0200 Subject: [PATCH 2/3] review changes --- .clang-format | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/.clang-format b/.clang-format index 2ce781e0aa..c35c1bec13 100644 --- a/.clang-format +++ b/.clang-format @@ -3,8 +3,6 @@ AccessModifierOffset: -1 AlignAfterOpenBracket: DontAlign AlignConsecutiveAssignments: None AlignOperands: DontAlign -AllowAllArgumentsOnNextLine: false -AllowAllConstructorInitializersOnNextLine: false AllowAllParametersOfDeclarationOnNextLine: true AllowShortBlocksOnASingleLine: Always AllowShortCaseLabelsOnASingleLine: true @@ -13,19 +11,7 @@ AllowShortIfStatementsOnASingleLine: Always AllowShortLambdasOnASingleLine: All AllowShortLoopsOnASingleLine: true AlwaysBreakAfterReturnType: None -BreakTemplateDeclarations: Yes -BreakBeforeBraces: Custom -BraceWrapping: - AfterCaseLabel: false - AfterClass: false - AfterControlStatement: Never - AfterEnum: false - AfterFunction: false - AfterNamespace: false - AfterUnion: false - BeforeCatch: false - BeforeElse: false - IndentBraces: false +BreakBeforeBraces: Attach BreakBeforeBinaryOperators: None BreakBeforeTernaryOperators: true BreakConstructorInitializers: BeforeColon @@ -37,7 +23,7 @@ IndentCaseLabels: true IndentPPDirectives: None IndentWidth: 2 InsertBraces: true -KeepEmptyLinesAtTheStartOfBlocks: true +KeepEmptyLinesAtTheStartOfBlocks: false MaxEmptyLinesToKeep: 1 NamespaceIndentation: None ObjCSpaceAfterProperty: false @@ -46,7 +32,7 @@ PenaltyIndentedWhitespace: 1 PointerAlignment: Left ReferenceAlignment: Left ReflowComments: false -SpaceAfterCStyleCast: true +SpaceAfterCStyleCast: false SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: false SpaceBeforeAssignmentOperators: true From 4c0129500fc2807d5f27958bcfe19f25853e812d Mon Sep 17 00:00:00 2001 From: Martin Zink Date: Thu, 10 Oct 2024 09:35:10 +0200 Subject: [PATCH 3/3] add AlwaysBreakTemplateDeclarations --- .clang-format | 1 + 1 file changed, 1 insertion(+) diff --git a/.clang-format b/.clang-format index c35c1bec13..2ca04dd4e9 100644 --- a/.clang-format +++ b/.clang-format @@ -11,6 +11,7 @@ AllowShortIfStatementsOnASingleLine: Always AllowShortLambdasOnASingleLine: All AllowShortLoopsOnASingleLine: true AlwaysBreakAfterReturnType: None +AlwaysBreakTemplateDeclarations: Yes BreakBeforeBraces: Attach BreakBeforeBinaryOperators: None BreakBeforeTernaryOperators: true