From 3eb689f3721bce66188a1209d9bab3558d86df34 Mon Sep 17 00:00:00 2001 From: Andy Ragusa Date: Wed, 3 Apr 2024 13:27:12 -0700 Subject: [PATCH] Explicitly setting clang-format version to 16. --- .clang-format | 124 +++++++++++++++++++++++------ .github/workflows/clang-format.yml | 2 +- clam-format | 96 +++++++++++----------- 3 files changed, 149 insertions(+), 73 deletions(-) diff --git a/.clang-format b/.clang-format index 87ebea09b2..5ae36afdd8 100644 --- a/.clang-format +++ b/.clang-format @@ -2,40 +2,65 @@ Language: Cpp AccessModifierOffset: -2 AlignAfterOpenBracket: Align -AlignConsecutiveMacros: false -AlignConsecutiveAssignments: true -AlignConsecutiveBitFields: false -AlignConsecutiveDeclarations: false +AlignArrayOfStructures: None +AlignConsecutiveAssignments: + Enabled: true + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + PadOperators: true +AlignConsecutiveBitFields: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + PadOperators: false +AlignConsecutiveDeclarations: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + PadOperators: false +AlignConsecutiveMacros: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + PadOperators: false AlignEscapedNewlines: Left AlignOperands: Align -AlignTrailingComments: true +AlignTrailingComments: + Kind: Always + OverEmptyLines: 0 AllowAllArgumentsOnNextLine: true -AllowAllConstructorInitializersOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: true -AllowShortEnumsOnASingleLine: true AllowShortBlocksOnASingleLine: Never AllowShortCaseLabelsOnASingleLine: false +AllowShortEnumsOnASingleLine: true AllowShortFunctionsOnASingleLine: Empty -AllowShortLambdasOnASingleLine: All AllowShortIfStatementsOnASingleLine: WithoutElse +AllowShortLambdasOnASingleLine: All AllowShortLoopsOnASingleLine: true AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: false AlwaysBreakTemplateDeclarations: MultiLine +AttributeMacros: + - __capability BinPackArguments: true BinPackParameters: true +BitFieldColonSpacing: Both BraceWrapping: AfterCaseLabel: false AfterClass: true AfterControlStatement: Never AfterEnum: false + AfterExternBlock: false AfterFunction: true AfterNamespace: true AfterObjCDeclaration: false AfterStruct: false AfterUnion: false - AfterExternBlock: false BeforeCatch: false BeforeElse: false BeforeLambdaBody: false @@ -44,55 +69,75 @@ BraceWrapping: SplitEmptyFunction: true SplitEmptyRecord: true SplitEmptyNamespace: true +BreakAfterAttributes: Never +BreakAfterJavaFieldAnnotations: false +BreakArrays: true BreakBeforeBinaryOperators: None +BreakBeforeConceptDeclarations: Always BreakBeforeBraces: Linux -BreakBeforeInheritanceComma: false -BreakInheritanceList: BeforeColon +BreakBeforeInlineASMColon: OnlyMultiline BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: false BreakConstructorInitializers: BeforeColon -BreakAfterJavaFieldAnnotations: false +BreakInheritanceList: BeforeColon BreakStringLiterals: true ColumnLimit: 0 CommentPragmas: '^ IWYU pragma:' CompactNamespaces: false -ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: true -DeriveLineEnding: true DerivePointerAlignment: true DisableFormat: false +EmptyLineAfterAccessModifier: Never +EmptyLineBeforeAccessModifier: LogicalBlock ExperimentalAutoDetectBinPacking: false FixNamespaceComments: true ForEachMacros: - foreach - Q_FOREACH - BOOST_FOREACH +IfMacros: + - KJ_IF_MAYBE IncludeBlocks: Preserve IncludeCategories: - Regex: '^"(llvm|llvm-c|clang|clang-c)/' Priority: 2 SortPriority: 0 + CaseSensitive: false - Regex: '^(<|"(gtest|gmock|isl|json)/)' Priority: 3 SortPriority: 0 + CaseSensitive: false - Regex: '.*' Priority: 1 SortPriority: 0 + CaseSensitive: false IncludeIsMainRegex: '(Test)?$' IncludeIsMainSourceRegex: '' -IndentCaseLabels: true +IndentAccessModifiers: false IndentCaseBlocks: false +IndentCaseLabels: true +IndentExternBlock: AfterExternBlock IndentGotoLabels: true IndentPPDirectives: None -IndentExternBlock: AfterExternBlock +IndentRequiresClause: true IndentWidth: 4 IndentWrappedFunctionNames: false +InsertBraces: false +InsertNewlineAtEOF: false InsertTrailingCommas: None +IntegerLiteralSeparator: + Binary: 0 + BinaryMinDigits: 0 + Decimal: 0 + DecimalMinDigits: 0 + Hex: 0 + HexMinDigits: 0 JavaScriptQuotes: Leave JavaScriptWrapImports: true KeepEmptyLinesAtTheStartOfBlocks: true +LambdaBodyIndentation: Signature +LineEnding: DeriveLF MacroBlockBegin: '' MacroBlockEnd: '' MaxEmptyLinesToKeep: 1 @@ -102,47 +147,78 @@ ObjCBlockIndentWidth: 2 ObjCBreakBeforeNestedBlockParam: true ObjCSpaceAfterProperty: false ObjCSpaceBeforeProtocolList: true +PackConstructorInitializers: BinPack PenaltyBreakAssignment: 2 PenaltyBreakBeforeFirstCallParameter: 19 PenaltyBreakComment: 300 PenaltyBreakFirstLessLess: 120 +PenaltyBreakOpenParenthesis: 0 PenaltyBreakString: 1000 PenaltyBreakTemplateDeclaration: 10 PenaltyExcessCharacter: 1000000 +PenaltyIndentedWhitespace: 0 PenaltyReturnTypeOnItsOwnLine: 60 PointerAlignment: Right +PPIndentWidth: -1 +QualifierAlignment: Leave +ReferenceAlignment: Pointer ReflowComments: true -SortIncludes: false -SortUsingDeclarations: true +RemoveBracesLLVM: false +RemoveSemicolon: false +RequiresClausePosition: OwnLine +RequiresExpressionIndentation: OuterScope +SeparateDefinitionBlocks: Leave +ShortNamespaceLines: 1 +SortIncludes: Never +SortJavaStaticImport: Before +SortUsingDeclarations: LexicographicNumeric SpaceAfterCStyleCast: false SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: true +SpaceAroundPointerQualifiers: Default SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false SpaceBeforeCpp11BracedList: false SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true SpaceBeforeParens: ControlStatements +SpaceBeforeParensOptions: + AfterControlStatements: true + AfterForeachMacros: true + AfterFunctionDefinitionName: false + AfterFunctionDeclarationName: false + AfterIfMacros: true + AfterOverloadedOperator: false + AfterRequiresInClause: false + AfterRequiresInExpression: false + BeforeNonEmptyParentheses: false SpaceBeforeRangeBasedForLoopColon: true +SpaceBeforeSquareBrackets: false SpaceInEmptyBlock: false SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 1 -SpacesInAngles: false +SpacesInAngles: Never SpacesInConditionalStatement: false SpacesInContainerLiterals: true SpacesInCStyleCastParentheses: false +SpacesInLineCommentPrefix: + Minimum: 1 + Maximum: -1 SpacesInParentheses: false SpacesInSquareBrackets: false -SpaceBeforeSquareBrackets: false Standard: Latest +StatementAttributeLikeMacros: + - Q_EMIT StatementMacros: - Q_UNUSED - QT_REQUIRE_VERSION TabWidth: 8 -UseCRLF: false UseTab: Never WhitespaceSensitiveMacros: - - STRINGIZE - - PP_STRINGIZE - BOOST_PP_STRINGIZE + - CF_SWIFT_NAME + - NS_SWIFT_NAME + - PP_STRINGIZE + - STRINGIZE ... diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index d9730b2a80..e71d432445 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -60,6 +60,6 @@ jobs: - name: Run clang-format style check for C/C++ programs. uses: jidicula/clang-format-action@v4.4.1 with: - clang-format-version: "14" + clang-format-version: "16" check-path: ${{ matrix.path['check'] }} exclude-regex: ${{ matrix.path['exclude'] }} diff --git a/clam-format b/clam-format index 9b8298390a..e3d8519418 100755 --- a/clam-format +++ b/clam-format @@ -1,54 +1,54 @@ #!/bin/bash -clang-format -style='{ Language: Cpp, UseTab: Never, IndentWidth: 4, AlignTrailingComments: true, AlignConsecutiveAssignments: true, AlignAfterOpenBracket: true, AlignEscapedNewlines: Left, AlignOperands: true, AllowShortFunctionsOnASingleLine: Empty, AllowShortIfStatementsOnASingleLine: true, AllowShortLoopsOnASingleLine: true, BreakBeforeBraces: Linux, BreakBeforeTernaryOperators: true, ColumnLimit: 0, FixNamespaceComments: true, SortIncludes: false, MaxEmptyLinesToKeep: 1, SpaceBeforeParens: ControlStatements, IndentCaseLabels: true, DerivePointerAlignment: true }' -dump-config > .clang-format +clang-format-16 -style='{ Language: Cpp, UseTab: Never, IndentWidth: 4, AlignTrailingComments: true, AlignConsecutiveAssignments: true, AlignAfterOpenBracket: true, AlignEscapedNewlines: Left, AlignOperands: true, AllowShortFunctionsOnASingleLine: Empty, AllowShortIfStatementsOnASingleLine: true, AllowShortLoopsOnASingleLine: true, BreakBeforeBraces: Linux, BreakBeforeTernaryOperators: true, ColumnLimit: 0, FixNamespaceComments: true, SortIncludes: false, MaxEmptyLinesToKeep: 1, SpaceBeforeParens: ControlStatements, IndentCaseLabels: true, DerivePointerAlignment: true }' -dump-config > .clang-format -clang-format -i -verbose clamav-milter/*.c -clang-format -i -verbose clamav-milter/*.h -clang-format -i -verbose clambc/*.c -clang-format -i -verbose clambc/*.h -clang-format -i -verbose clamconf/*.c -clang-format -i -verbose clamconf/*.h -clang-format -i -verbose clamd/*.c -clang-format -i -verbose clamd/*.h -clang-format -i -verbose clamdscan/*.c -clang-format -i -verbose clamdscan/*.h -clang-format -i -verbose clamdtop/*.c -clang-format -i -verbose clamdtop/*.h -clang-format -i -verbose clamscan/*.c -clang-format -i -verbose clamscan/*.h -clang-format -i -verbose clamsubmit/*.c -clang-format -i -verbose clamsubmit/*.h -clang-format -i -verbose examples/*.c -clang-format -i -verbose examples/*.h -clang-format -i -verbose examples/fileprop_analysis/*.c -clang-format -i -verbose examples/fileprop_analysis/old/*.c -clang-format -i -verbose freshclam/*.c -clang-format -i -verbose freshclam/*.h -clang-format -i -verbose libclamav/*.c -clang-format -i -verbose libclamav/*.h -clang-format -i -verbose libclamav/jsparse/*.c -clang-format -i -verbose libclamav/jsparse/*.h -clang-format -i -verbose libclamav/lzw/*.c -clang-format -i -verbose libclamav/lzw/*.h -clang-format -i -verbose libclamav/nsis/nulsft.* -clang-format -i -verbose libclamav/c++/*.cpp -clang-format -i -verbose libclamav/c++/*.h -clang-format -i -verbose libclamunrar_iface/*.cpp -clang-format -i -verbose libclamunrar_iface/*.h -clang-format -i -verbose libfreshclam/*.c -clang-format -i -verbose libfreshclam/*.h -clang-format -i -verbose common/*.c -clang-format -i -verbose common/*.h -clang-format -i -verbose sigtool/*.c -clang-format -i -verbose sigtool/*.h -clang-format -i -verbose clamonacc/*.c -clang-format -i -verbose clamonacc/*.h -clang-format -i -verbose clamonacc/*/*.c -clang-format -i -verbose clamonacc/*/*.h -clang-format -i -verbose unit_tests/*.c -clang-format -i -verbose unit_tests/*.h -clang-format -i -verbose win32/compat/*.c -clang-format -i -verbose win32/compat/*.h +clang-format-16 -i -verbose clamav-milter/*.c +clang-format-16 -i -verbose clamav-milter/*.h +clang-format-16 -i -verbose clambc/*.c +clang-format-16 -i -verbose clambc/*.h +clang-format-16 -i -verbose clamconf/*.c +clang-format-16 -i -verbose clamconf/*.h +clang-format-16 -i -verbose clamd/*.c +clang-format-16 -i -verbose clamd/*.h +clang-format-16 -i -verbose clamdscan/*.c +clang-format-16 -i -verbose clamdscan/*.h +clang-format-16 -i -verbose clamdtop/*.c +clang-format-16 -i -verbose clamdtop/*.h +clang-format-16 -i -verbose clamscan/*.c +clang-format-16 -i -verbose clamscan/*.h +clang-format-16 -i -verbose clamsubmit/*.c +clang-format-16 -i -verbose clamsubmit/*.h +clang-format-16 -i -verbose examples/*.c +clang-format-16 -i -verbose examples/*.h +clang-format-16 -i -verbose examples/fileprop_analysis/*.c +clang-format-16 -i -verbose examples/fileprop_analysis/old/*.c +clang-format-16 -i -verbose freshclam/*.c +clang-format-16 -i -verbose freshclam/*.h +clang-format-16 -i -verbose libclamav/*.c +clang-format-16 -i -verbose libclamav/*.h +clang-format-16 -i -verbose libclamav/jsparse/*.c +clang-format-16 -i -verbose libclamav/jsparse/*.h +clang-format-16 -i -verbose libclamav/lzw/*.c +clang-format-16 -i -verbose libclamav/lzw/*.h +clang-format-16 -i -verbose libclamav/nsis/nulsft.* +clang-format-16 -i -verbose libclamav/c++/*.cpp +clang-format-16 -i -verbose libclamav/c++/*.h +clang-format-16 -i -verbose libclamunrar_iface/*.cpp +clang-format-16 -i -verbose libclamunrar_iface/*.h +clang-format-16 -i -verbose libfreshclam/*.c +clang-format-16 -i -verbose libfreshclam/*.h +clang-format-16 -i -verbose common/*.c +clang-format-16 -i -verbose common/*.h +clang-format-16 -i -verbose sigtool/*.c +clang-format-16 -i -verbose sigtool/*.h +clang-format-16 -i -verbose clamonacc/*.c +clang-format-16 -i -verbose clamonacc/*.h +clang-format-16 -i -verbose clamonacc/*/*.c +clang-format-16 -i -verbose clamonacc/*/*.h +clang-format-16 -i -verbose unit_tests/*.c +clang-format-16 -i -verbose unit_tests/*.h +clang-format-16 -i -verbose win32/compat/*.c +clang-format-16 -i -verbose win32/compat/*.h # Undo changes to specific files that we don't really want to reformat git checkout libclamav/iana_cctld.h