From 351e230be2ef4ab02df0e4a415e957b758616004 Mon Sep 17 00:00:00 2001 From: Enrico Seiler Date: Wed, 5 Jun 2024 17:05:11 +0200 Subject: [PATCH] [INFRA] clang-format-18 --- .clang-format | 173 +++++++++++++----- .github/workflows/ci_lint.yml | 2 +- include/hibf/cereal/concepts.hpp | 4 +- include/hibf/cereal/path.hpp | 4 +- include/hibf/config.hpp | 6 +- .../hierarchical_interleaved_bloom_filter.hpp | 6 +- include/hibf/interleaved_bloom_filter.hpp | 8 +- include/hibf/misc/bit_vector.hpp | 8 +- src/config.cpp | 6 +- src/sketch/hyperloglog.cpp | 6 +- test/include/hibf/test/cereal.hpp | 8 +- .../hibf/test/iterator_test_template.hpp | 6 +- .../bit_vector_serialisation_benchmark.cpp | 6 +- test/unit/hibf/path_test.cpp | 4 +- 14 files changed, 164 insertions(+), 83 deletions(-) diff --git a/.clang-format b/.clang-format index 7beb9e77..bc5e8f3e 100644 --- a/.clang-format +++ b/.clang-format @@ -3,47 +3,82 @@ # SPDX-License-Identifier: CC0-1.0 # Format all files in include folder, including std module, excluding contrib module -# find . -iname "*.[ch]pp" -not -path "./include/hibf/contrib/*" -not -path "./submodules/*" -not -path "./build/*" | xargs clang-format-15 --style=file -i -# Staged files: git diff --name-only HEAD --diff-filter=ACMRT | grep -E "(\.cpp|\.hpp)$" | xargs clang-format-15 --style=file -i +# find . -iname "*.[ch]pp" -not -path "./include/hibf/contrib/*" -not -path "./submodules/*" -not -path "./build/*" | xargs clang-format-18 --style=file -i +# Staged files: git diff --name-only HEAD --diff-filter=ACMRT | grep -E "(\.cpp|\.hpp)$" | xargs clang-format-18 --style=file -i --- Language: Cpp AccessModifierOffset: -4 AlignAfterOpenBracket: Align AlignArrayOfStructures: None -AlignConsecutiveMacros: None -AlignConsecutiveAssignments: None -AlignConsecutiveBitFields: None -AlignConsecutiveDeclarations: None +AlignConsecutiveAssignments: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: true +AlignConsecutiveBitFields: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: true +AlignConsecutiveDeclarations: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: true +AlignConsecutiveMacros: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: true +AlignConsecutiveShortCaseStatements: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCaseColons: false AlignEscapedNewlines: Right AlignOperands: AlignAfterOperator -AlignTrailingComments: true +AlignTrailingComments: + Kind: Always + OverEmptyLines: 0 AllowAllArgumentsOnNextLine: false AllowAllParametersOfDeclarationOnNextLine: false -AllowShortEnumsOnASingleLine: true +AllowBreakBeforeNoexceptSpecifier: Never AllowShortBlocksOnASingleLine: Never AllowShortCaseLabelsOnASingleLine: false +AllowShortCompoundRequirementOnASingleLine: true +AllowShortEnumsOnASingleLine: false AllowShortFunctionsOnASingleLine: None -AllowShortLambdasOnASingleLine: Empty AllowShortIfStatementsOnASingleLine: Never +AllowShortLambdasOnASingleLine: Empty AllowShortLoopsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: false AlwaysBreakTemplateDeclarations: Yes AttributeMacros: + - __capability BinPackArguments: false BinPackParameters: false +BitFieldColonSpacing: Both BraceWrapping: AfterCaseLabel: true AfterClass: true AfterControlStatement: Always AfterEnum: true + AfterExternBlock: true AfterFunction: true AfterNamespace: true AfterObjCDeclaration: false AfterStruct: true AfterUnion: true - AfterExternBlock: true BeforeCatch: true BeforeElse: true BeforeLambdaBody: true @@ -52,69 +87,93 @@ BraceWrapping: SplitEmptyFunction: false SplitEmptyRecord: false SplitEmptyNamespace: false +BreakAdjacentStringLiterals: true +BreakAfterAttributes: Never +BreakAfterJavaFieldAnnotations: false +BreakArrays: true BreakBeforeBinaryOperators: NonAssignment -BreakBeforeConceptDeclarations: true +BreakBeforeConceptDeclarations: Always BreakBeforeBraces: Custom -BreakBeforeInheritanceComma: false -BreakInheritanceList: AfterColon +BreakBeforeInlineASMColon: OnlyMultiline BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: false BreakConstructorInitializers: AfterColon -BreakAfterJavaFieldAnnotations: false +BreakInheritanceList: AfterColon BreakStringLiterals: true ColumnLimit: 120 CommentPragmas: '^ IWYU pragma:' -QualifierAlignment: Custom -QualifierOrder: ['static', 'inline', 'constexpr', 'volatile', 'type', 'const'] CompactNamespaces: false ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: true -DeriveLineEnding: true DerivePointerAlignment: false DisableFormat: false EmptyLineAfterAccessModifier: Never EmptyLineBeforeAccessModifier: Always ExperimentalAutoDetectBinPacking: false -PackConstructorInitializers: CurrentLine -BasedOnStyle: '' -ConstructorInitializerAllOnOneLineOrOnePerLine: false -AllowAllConstructorInitializersOnNextLine: true FixNamespaceComments: true ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH IfMacros: + - KJ_IF_MAYBE IncludeBlocks: Regroup IncludeCategories: - - Regex: ')' Priority: 2 - - Regex: '(<[[:alnum:]._]+>|)' - Priority: 3 + SortPriority: 0 + CaseSensitive: false - Regex: '' + Priority: 5 + SortPriority: 0 + CaseSensitive: false - Regex: '.*' Priority: 7 + SortPriority: 0 + CaseSensitive: false IncludeIsMainRegex: '(Test)?$' IncludeIsMainSourceRegex: '' IndentAccessModifiers: false -IndentCaseLabels: false IndentCaseBlocks: false +IndentCaseLabels: false +IndentExternBlock: AfterExternBlock IndentGotoLabels: true IndentPPDirectives: AfterHash -IndentExternBlock: AfterExternBlock -IndentRequiresClause : true +IndentRequiresClause: true IndentWidth: 4 IndentWrappedFunctionNames: false +InsertBraces: false +InsertNewlineAtEOF: true InsertTrailingCommas: None +IntegerLiteralSeparator: + Binary: 0 + BinaryMinDigits: 0 + Decimal: 0 + DecimalMinDigits: 0 + Hex: 0 + HexMinDigits: 0 JavaScriptQuotes: Leave JavaScriptWrapImports: true KeepEmptyLinesAtTheStartOfBlocks: true +KeepEmptyLinesAtEOF: false LambdaBodyIndentation: Signature +LineEnding: LF MacroBlockBegin: '' MacroBlockEnd: '' MaxEmptyLinesToKeep: 1 @@ -124,35 +183,51 @@ ObjCBlockIndentWidth: 2 ObjCBreakBeforeNestedBlockParam: true ObjCSpaceAfterProperty: false ObjCSpaceBeforeProtocolList: true +PackConstructorInitializers: CurrentLine PenaltyBreakAssignment: 2 PenaltyBreakBeforeFirstCallParameter: 19 PenaltyBreakComment: 300 PenaltyBreakFirstLessLess: 120 PenaltyBreakOpenParenthesis: 0 +PenaltyBreakScopeResolution: 500 PenaltyBreakString: 1000 PenaltyBreakTemplateDeclaration: 10 PenaltyExcessCharacter: 1000000 -PenaltyReturnTypeOnItsOwnLine: 60 PenaltyIndentedWhitespace: 0 +PenaltyReturnTypeOnItsOwnLine: 60 PointerAlignment: Middle PPIndentWidth: -1 +QualifierAlignment: Custom +QualifierOrder: + - static + - inline + - constexpr + - volatile + - type + - const ReferenceAlignment: Pointer ReflowComments: false RemoveBracesLLVM: false -RequiresClausePosition : OwnLine +RemoveParentheses: Leave +RemoveSemicolon: false +RequiresClausePosition: OwnLine +RequiresExpressionIndentation: Keyword SeparateDefinitionBlocks: Leave ShortNamespaceLines: 1 -SortIncludes: true +SkipMacroDefinitionBody: false +SortIncludes: CaseInsensitive SortJavaStaticImport: Before -SortUsingDeclarations: true +SortUsingDeclarations: LexicographicNumeric SpaceAfterCStyleCast: false SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: true +SpaceAroundPointerQualifiers: Default SpaceBeforeAssignmentOperators: true SpaceBeforeCaseColon: false SpaceBeforeCpp11BracedList: false SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true +SpaceBeforeJsonColon: false SpaceBeforeParens: Custom SpaceBeforeParensOptions: AfterControlStatements: true @@ -161,31 +236,39 @@ SpaceBeforeParensOptions: AfterFunctionDeclarationName: false AfterIfMacros: true AfterOverloadedOperator: false - AfterRequiresInClause : true - AfterRequiresInExpression : true + AfterPlacementOperator: true + AfterRequiresInClause: true + AfterRequiresInExpression: true BeforeNonEmptyParentheses: false -SpaceAroundPointerQualifiers: Default SpaceBeforeRangeBasedForLoopColon: true +SpaceBeforeSquareBrackets: false SpaceInEmptyBlock: false -SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 1 SpacesInAngles: Never -SpacesInConditionalStatement: false SpacesInContainerLiterals: false -SpacesInCStyleCastParentheses: false SpacesInLineCommentPrefix: Minimum: 1 Maximum: -1 -SpacesInParentheses: false +SpacesInParens: Never +SpacesInParensOptions: + InCStyleCasts: false + InConditionalStatements: false + InEmptyParentheses: false + Other: false SpacesInSquareBrackets: false -SpaceBeforeSquareBrackets: false -BitFieldColonSpacing: Both Standard: c++20 StatementAttributeLikeMacros: + - Q_EMIT StatementMacros: + - Q_UNUSED + - QT_REQUIRE_VERSION TabWidth: 4 -UseCRLF: false UseTab: Never +VerilogBreakBetweenInstancePorts: true WhitespaceSensitiveMacros: - HIBF_DEPRECATED_HEADER + - CF_SWIFT_NAME + - NS_SWIFT_NAME + - PP_STRINGIZE + - STRINGIZE ... diff --git a/.github/workflows/ci_lint.yml b/.github/workflows/ci_lint.yml index 646a0b69..7568d0de 100644 --- a/.github/workflows/ci_lint.yml +++ b/.github/workflows/ci_lint.yml @@ -82,7 +82,7 @@ jobs: - name: Run lint uses: seqan/actions/lint@main with: - clang_format: 15 + clang_format: 18 token: ${{ secrets.SEQAN_ACTIONS_PAT }} gpg_key: ${{ secrets.SEQAN_ACTIONS_GPG_KEY }} gpg_passphrase: ${{ secrets.SEQAN_ACTIONS_GPG_PASSPHRASE }} diff --git a/include/hibf/cereal/concepts.hpp b/include/hibf/cereal/concepts.hpp index 62998509..65a97342 100644 --- a/include/hibf/cereal/concepts.hpp +++ b/include/hibf/cereal/concepts.hpp @@ -4,11 +4,11 @@ #pragma once -#include - #include // for InputArchiveBase, OutputArchiveBase #include // for InputArchiveBase, OutputArchiveBase +#include + namespace seqan::hibf { diff --git a/include/hibf/cereal/path.hpp b/include/hibf/cereal/path.hpp index a4d62945..d3e21489 100644 --- a/include/hibf/cereal/path.hpp +++ b/include/hibf/cereal/path.hpp @@ -7,11 +7,11 @@ #include // for path #include // for string -#include - #include // for CEREAL_LOAD_FUNCTION_NAME, CEREAL_SAVE_FUNCTION_NAME #include // IWYU pragma: keep +#include + namespace cereal { diff --git a/include/hibf/config.hpp b/include/hibf/config.hpp index a3a1cd35..8a19ba81 100644 --- a/include/hibf/config.hpp +++ b/include/hibf/config.hpp @@ -9,12 +9,12 @@ #include // for function #include // for istream, ostream -#include // for insert_iterator -#include - #include // for access #include // for make_nvp, CEREAL_NVP +#include // for insert_iterator +#include + namespace seqan::hibf { diff --git a/include/hibf/hierarchical_interleaved_bloom_filter.hpp b/include/hibf/hierarchical_interleaved_bloom_filter.hpp index a9a470aa..ede835ba 100644 --- a/include/hibf/hierarchical_interleaved_bloom_filter.hpp +++ b/include/hibf/hierarchical_interleaved_bloom_filter.hpp @@ -14,6 +14,9 @@ #include // for forward_range, range, range_value_t #include // for vector, operator== +#include // for CEREAL_SERIALIZE_FUNCTION_NAME +#include // IWYU pragma: keep + #include // for cereal_archive #include // for config #include // for interleaved_bloom_filter @@ -22,9 +25,6 @@ #include // for concurrent_timer #include // for HIBF_CONSTEXPR_VECTOR -#include // for CEREAL_SERIALIZE_FUNCTION_NAME -#include // IWYU pragma: keep - namespace seqan::hibf { diff --git a/include/hibf/interleaved_bloom_filter.hpp b/include/hibf/interleaved_bloom_filter.hpp index 78fa3fc1..f5be675e 100644 --- a/include/hibf/interleaved_bloom_filter.hpp +++ b/include/hibf/interleaved_bloom_filter.hpp @@ -20,6 +20,9 @@ #include // for remove_cvref_t #include // for operator==, vector +#include // for CEREAL_SERIALIZE_FUNCTION_NAME +#include // for base_class + #include // for cereal_archive #include // for config #include // for aligned_allocator @@ -28,9 +31,6 @@ #include // for next_multiple_of_64 #include // for HIBF_HAS_AVX512 -#include // for CEREAL_SERIALIZE_FUNCTION_NAME -#include // for base_class - namespace seqan::hibf { /*!\brief A strong type that represents the number of bins for the seqan::hibf::interleaved_bloom_filter. @@ -544,7 +544,7 @@ class interleaved_bloom_filter::counting_agent_type result_buffer(next_multiple_of_64(ibf.bin_count())) // Ensure large enough capacity. { result_buffer.resize(ibf.bin_count()); // Resize to actual requested size. - // Silences llvm's ASAN container-overflow warning. + // Silences llvm's ASAN container-overflow warning. # if defined(_LIBCPP_VERSION) && !defined(_LIBCPP_HAS_NO_ASAN) __sanitizer_annotate_contiguous_container(result_buffer.data(), result_buffer.data() + result_buffer.capacity(), diff --git a/include/hibf/misc/bit_vector.hpp b/include/hibf/misc/bit_vector.hpp index 7aa94c3d..a957ff8f 100644 --- a/include/hibf/misc/bit_vector.hpp +++ b/include/hibf/misc/bit_vector.hpp @@ -40,14 +40,14 @@ #include // for swap #include // for vector -#include // for cereal_archive -#include // for aligned_allocator -#include // for HIBF_CONSTEXPR_VECTOR - #include // for CEREAL_SERIALIZE_FUNCTION_NAME #include // for CEREAL_SERIALIZE_FUNCTION_NAME #include // for specialization, specialize +#include // for cereal_archive +#include // for aligned_allocator +#include // for HIBF_CONSTEXPR_VECTOR + namespace seqan::hibf { diff --git a/src/config.cpp b/src/config.cpp index 0821d320..1e27d498 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -10,13 +10,13 @@ #include // for char_traits, string #include // for operator==, basic_string_view +#include // for JSONInputArchive, JSONOutputArchive +#include // for make_nvp, InputArchive, OutputArchive + #include // for config #include // for meta_header, meta_hibf_config_end, meta_hibf_config_start #include // for next_multiple_of_64 -#include // for JSONInputArchive, JSONOutputArchive -#include // for make_nvp, InputArchive, OutputArchive - namespace seqan::hibf { diff --git a/src/sketch/hyperloglog.cpp b/src/sketch/hyperloglog.cpp index b4280d90..459b0d83 100644 --- a/src/sketch/hyperloglog.cpp +++ b/src/sketch/hyperloglog.cpp @@ -16,12 +16,12 @@ #include // for swap #include // for vector -#include // for aligned_allocator -#include // for hyperloglog - #include // for simde__m256i, simde_mm256_add_ps, simde_mm256_set1_ps, simde_m... #include // for simde_mm256_max_epu8 +#include // for aligned_allocator +#include // for hyperloglog + namespace seqan::hibf::sketch { diff --git a/test/include/hibf/test/cereal.hpp b/test/include/hibf/test/cereal.hpp index 466716c0..714066f3 100644 --- a/test/include/hibf/test/cereal.hpp +++ b/test/include/hibf/test/cereal.hpp @@ -14,15 +14,15 @@ #include // for basic_ios, ios, basic_ifstream, basic_ofstream, ifstream, ofs... #include // for remove_cvref_t -#include // for cereal_input_archive, cereal_output_archive -#include // for sandboxed_path, operator/ -#include // for tmp_directory - #include // for BinaryInputArchive, BinaryOutputArchive #include // for JSONInputArchive, JSONOutputArchive #include // for PortableBinaryInputArchive, PortableBinaryOutputArchive #include // for XMLInputArchive, XMLOutputArchive +#include // for cereal_input_archive, cereal_output_archive +#include // for sandboxed_path, operator/ +#include // for tmp_directory + namespace seqan::hibf::test { diff --git a/test/include/hibf/test/iterator_test_template.hpp b/test/include/hibf/test/iterator_test_template.hpp index ab8a1d22..af8818c8 100644 --- a/test/include/hibf/test/iterator_test_template.hpp +++ b/test/include/hibf/test/iterator_test_template.hpp @@ -54,7 +54,7 @@ concept has_expect_equal_member_function = requires (t & a) { { t::expect_eq(*std::ranges::begin(a.test_range), *std::ranges::begin(a.expected_range)) - } -> std::same_as; + } -> std::same_as; }; // Delegates to the test fixture member function `expect_eq` if available and falls back to EXPECT_EQ otherwise. @@ -83,9 +83,7 @@ concept iterator_is_equality_comparable = requires requires (std::ranges::iterator_t & it) { // we don't assume anything about the return type, this will be done in the tests - { - it == it - }; + { it == it }; }; }; diff --git a/test/performance/ibf/bit_vector_serialisation_benchmark.cpp b/test/performance/ibf/bit_vector_serialisation_benchmark.cpp index 59491c8e..0539924e 100644 --- a/test/performance/ibf/bit_vector_serialisation_benchmark.cpp +++ b/test/performance/ibf/bit_vector_serialisation_benchmark.cpp @@ -13,13 +13,13 @@ #include // for logic_error #include // for allocator, to_string, basic_string +#include // for BinaryInputArchive, BinaryOutputArchive +#include // for InputArchive, OutputArchive + #include // for bit_vector #include // for sandboxed_path, operator/ #include // for tmp_directory -#include // for BinaryInputArchive, BinaryOutputArchive -#include // for InputArchive, OutputArchive - seqan::hibf::bit_vector generate_bit_vector(size_t const size_in_bits, size_t const seed = 0u) { std::mt19937_64 engine{seed}; diff --git a/test/unit/hibf/path_test.cpp b/test/unit/hibf/path_test.cpp index b66dc495..51866ff1 100644 --- a/test/unit/hibf/path_test.cpp +++ b/test/unit/hibf/path_test.cpp @@ -7,11 +7,11 @@ #include // for path #include // for move +#include // for specialization + #include // IWYU pragma: keep #include // for test_serialisation -#include // for specialization - TEST(path_test, serialisation) { std::filesystem::path path{"/some/random/path.txt"};