From 36ec74415adb287848bc53c63f20b7c9f4c12ec3 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 29 Jun 2026 11:57:24 +0100 Subject: [PATCH] chore: Update tidy with new v22 checks (#3119) --- .clang-tidy | 306 +++++++++--------- .github/workflows/clang-tidy.yml | 8 +- .../util/async/ExecutionContextBenchmarks.cpp | 2 +- src/data/BackendInterface.hpp | 2 +- src/data/cassandra/impl/AsyncExecutor.hpp | 2 +- src/data/cassandra/impl/ExecutionStrategy.hpp | 16 +- src/rpc/RPCHelpers.hpp | 3 +- src/rpc/common/Concepts.hpp | 4 +- src/util/Random.hpp | 2 +- src/util/Taggable.hpp | 2 +- src/util/async/Operation.hpp | 4 +- .../async/context/BasicExecutionContext.hpp | 8 +- src/util/async/context/impl/Strand.hpp | 12 +- src/util/async/context/impl/Utils.hpp | 4 +- src/util/log/Logger.hpp | 7 +- tests/unit/util/log/LogServiceInitTests.cpp | 7 - 16 files changed, 193 insertions(+), 196 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 1b751a9b5..aa6a3c1db 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,159 +1,161 @@ --- Checks: "-*, - bugprone-argument-comment, - bugprone-assert-side-effect, - bugprone-bad-signal-to-kill-thread, - bugprone-bool-pointer-implicit-conversion, - bugprone-capturing-this-in-member-variable, - bugprone-casting-through-void, - bugprone-chained-comparison, - bugprone-compare-pointer-to-member-virtual-function, - bugprone-copy-constructor-init, - bugprone-crtp-constructor-accessibility, - bugprone-dangling-handle, - bugprone-dynamic-static-initializers, - bugprone-empty-catch, - bugprone-fold-init-type, - bugprone-forward-declaration-namespace, - bugprone-inaccurate-erase, - bugprone-inc-dec-in-conditions, - bugprone-incorrect-enable-if, - bugprone-incorrect-roundings, - bugprone-infinite-loop, - bugprone-integer-division, - bugprone-lambda-function-name, - bugprone-macro-parentheses, - bugprone-macro-repeated-side-effects, - bugprone-misleading-setter-of-reference, - bugprone-misplaced-operator-in-strlen-in-alloc, - bugprone-misplaced-pointer-arithmetic-in-alloc, - bugprone-misplaced-widening-cast, - bugprone-move-forwarding-reference, - bugprone-multi-level-implicit-pointer-conversion, - bugprone-multiple-new-in-one-expression, - bugprone-multiple-statement-macro, - bugprone-no-escape, - bugprone-non-zero-enum-to-bool-conversion, - bugprone-optional-value-conversion, - bugprone-parent-virtual-call, - bugprone-pointer-arithmetic-on-polymorphic-object, - bugprone-posix-return, - bugprone-redundant-branch-condition, - bugprone-reserved-identifier, - bugprone-return-const-ref-from-parameter, - bugprone-shared-ptr-array-mismatch, - bugprone-signal-handler, - bugprone-signed-char-misuse, - bugprone-sizeof-container, - bugprone-sizeof-expression, - bugprone-spuriously-wake-up-functions, - bugprone-standalone-empty, - bugprone-string-constructor, - bugprone-string-integer-assignment, - bugprone-string-literal-with-embedded-nul, - bugprone-stringview-nullptr, - bugprone-suspicious-enum-usage, - bugprone-suspicious-include, - bugprone-suspicious-memory-comparison, - bugprone-suspicious-memset-usage, - bugprone-suspicious-missing-comma, - bugprone-suspicious-realloc-usage, - bugprone-suspicious-semicolon, - bugprone-suspicious-string-compare, - bugprone-suspicious-stringview-data-usage, - bugprone-swapped-arguments, - bugprone-switch-missing-default-case, - bugprone-terminating-continue, - bugprone-throw-keyword-missing, - bugprone-too-small-loop-variable, - bugprone-unchecked-optional-access, - bugprone-undefined-memory-manipulation, - bugprone-undelegated-constructor, - bugprone-unhandled-exception-at-new, - bugprone-unhandled-self-assignment, - bugprone-unique-ptr-array-mismatch, - bugprone-unsafe-functions, - bugprone-unused-local-non-trivial-variable, - bugprone-unused-raii, - bugprone-unused-return-value, - bugprone-use-after-move, - bugprone-virtual-near-miss, - cppcoreguidelines-init-variables, - cppcoreguidelines-misleading-capture-default-by-value, - cppcoreguidelines-no-suspend-with-lock, - cppcoreguidelines-pro-type-member-init, - cppcoreguidelines-pro-type-static-cast-downcast, - cppcoreguidelines-rvalue-reference-param-not-moved, - cppcoreguidelines-use-default-member-init, - cppcoreguidelines-use-enum-class, - cppcoreguidelines-virtual-class-destructor, - hicpp-ignored-remove-result, + bugprone-*, + -bugprone-assignment-in-if-condition, + -bugprone-bitwise-pointer-cast, + -bugprone-branch-clone, + -bugprone-command-processor, + -bugprone-copy-constructor-mutates-argument, + -bugprone-default-operator-new-on-overaligned-type, + -bugprone-easily-swappable-parameters, + -bugprone-exception-copy-constructor-throws, + -bugprone-exception-escape, + -bugprone-float-loop-counter, + -bugprone-forwarding-reference-overload, + -bugprone-implicit-widening-of-multiplication-result, + -bugprone-incorrect-enable-shared-from-this, + -bugprone-narrowing-conversions, + -bugprone-nondeterministic-pointer-iteration-order, + -bugprone-not-null-terminated-result, + -bugprone-random-generator-seed, + -bugprone-raw-memory-call-on-non-trivial-type, + -bugprone-std-namespace-modification, + -bugprone-tagged-union-member-count, + -bugprone-throwing-static-initialization, + -bugprone-unchecked-string-to-number-conversion, + -bugprone-unintended-char-ostream-output, + + cppcoreguidelines-*, + -cppcoreguidelines-avoid-c-arrays, + -cppcoreguidelines-avoid-capturing-lambda-coroutines, + -cppcoreguidelines-avoid-const-or-ref-data-members, + -cppcoreguidelines-avoid-do-while, + -cppcoreguidelines-avoid-goto, + -cppcoreguidelines-avoid-magic-numbers, + -cppcoreguidelines-avoid-non-const-global-variables, + -cppcoreguidelines-avoid-reference-coroutine-parameters, + -cppcoreguidelines-c-copy-assignment-signature, + -cppcoreguidelines-explicit-virtual-functions, + -cppcoreguidelines-interfaces-global-init, + -cppcoreguidelines-macro-to-enum, + -cppcoreguidelines-macro-usage, + -cppcoreguidelines-missing-std-forward, + -cppcoreguidelines-narrowing-conversions, + -cppcoreguidelines-no-malloc, + -cppcoreguidelines-noexcept-destructor, + -cppcoreguidelines-noexcept-move-operations, + -cppcoreguidelines-noexcept-swap, + -cppcoreguidelines-non-private-member-variables-in-classes, + -cppcoreguidelines-owning-memory, + -cppcoreguidelines-prefer-member-initializer, + -cppcoreguidelines-pro-bounds-array-to-pointer-decay, + -cppcoreguidelines-pro-bounds-avoid-unchecked-container-access, + -cppcoreguidelines-pro-bounds-constant-array-index, + -cppcoreguidelines-pro-bounds-pointer-arithmetic, + -cppcoreguidelines-pro-type-const-cast, + -cppcoreguidelines-pro-type-cstyle-cast, + -cppcoreguidelines-pro-type-reinterpret-cast, + -cppcoreguidelines-pro-type-union-access, + -cppcoreguidelines-pro-type-vararg, + -cppcoreguidelines-slicing, + -cppcoreguidelines-special-member-functions, + llvm-namespace-comment, - misc-const-correctness, - misc-definitions-in-headers, - misc-header-include-cycle, - misc-include-cleaner, - misc-misplaced-const, - misc-redundant-expression, - misc-static-assert, - misc-throw-by-value-catch-by-reference, - misc-unused-alias-decls, - misc-unused-using-decls, - modernize-concat-nested-namespaces, - modernize-deprecated-headers, - modernize-make-shared, - modernize-make-unique, - modernize-pass-by-value, - modernize-type-traits, - modernize-use-designated-initializers, - modernize-use-emplace, - modernize-use-equals-default, - modernize-use-equals-delete, - modernize-use-nodiscard, - modernize-use-override, - modernize-use-ranges, - modernize-use-scoped-lock, - modernize-use-starts-ends-with, - modernize-use-std-numbers, - modernize-use-using, - performance-faster-string-find, - performance-for-range-copy, - performance-implicit-conversion-in-loop, - performance-inefficient-vector-operation, - performance-move-const-arg, - performance-move-constructor-init, - performance-no-automatic-move, - performance-trivially-destructible, - readability-ambiguous-smartptr-reset-call, - readability-avoid-nested-conditional-operator, - readability-avoid-return-with-void-value, - readability-braces-around-statements, - readability-const-return-type, - readability-container-contains, - readability-container-size-empty, - readability-convert-member-functions-to-static, - readability-duplicate-include, - readability-else-after-return, - readability-enum-initial-value, - readability-identifier-naming, - readability-implicit-bool-conversion, - readability-inconsistent-declaration-parameter-name, - readability-make-member-function-const, - readability-math-missing-parentheses, - readability-misleading-indentation, - readability-non-const-parameter, - readability-redundant-casting, - readability-redundant-declaration, - readability-redundant-inline-specifier, - readability-redundant-member-init, - readability-redundant-string-init, - readability-reference-to-constructed-temporary, - readability-simplify-boolean-expr, - readability-static-accessed-through-instance, - readability-static-definition-in-anonymous-namespace, - readability-suspicious-call-argument, - readability-use-std-min-max + + misc-*, + -misc-anonymous-namespace-in-header, + -misc-confusable-identifiers, + -misc-coroutine-hostile-raii, + -misc-misleading-bidirectional, + -misc-misleading-identifier, + -misc-multiple-inheritance, + -misc-new-delete-overloads, + -misc-no-recursion, + -misc-non-copyable-objects, + -misc-non-private-member-variables-in-classes, + -misc-override-with-different-visibility, + -misc-predictable-rand, + -misc-unconventional-assign-operator, + -misc-uniqueptr-reset-release, + -misc-unused-parameters, + -misc-use-anonymous-namespace, + -misc-use-internal-linkage, + + modernize-*, + -modernize-avoid-bind, + -modernize-avoid-c-arrays, + -modernize-avoid-c-style-cast, + -modernize-avoid-setjmp-longjmp, + -modernize-avoid-variadic-functions, + -modernize-deprecated-ios-base-aliases, + -modernize-loop-convert, + -modernize-macro-to-enum, + -modernize-min-max-use-initializer-list, + -modernize-raw-string-literal, + -modernize-redundant-void-arg, + -modernize-replace-auto-ptr, + -modernize-replace-disallow-copy-and-assign-macro, + -modernize-replace-random-shuffle, + -modernize-return-braced-init-list, + -modernize-shrink-to-fit, + -modernize-unary-static-assert, + -modernize-use-auto, + -modernize-use-bool-literals, + -modernize-use-constraints, + -modernize-use-default-member-init, + -modernize-use-integer-sign-comparison, + -modernize-use-noexcept, + -modernize-use-nullptr, + -modernize-use-std-format, + -modernize-use-std-print, + -modernize-use-trailing-return-type, + -modernize-use-transparent-functors, + -modernize-use-uncaught-exceptions, + + performance-*, + -performance-avoid-endl, + -performance-enum-size, + -performance-inefficient-algorithm, + -performance-inefficient-string-concatenation, + -performance-no-int-to-ptr, + -performance-noexcept-destructor, + -performance-noexcept-move-constructor, + -performance-noexcept-swap, + -performance-type-promotion-in-math-fn, + -performance-unnecessary-copy-initialization, + -performance-unnecessary-value-param, + + readability-*, + -readability-avoid-const-params-in-decls, + -readability-avoid-unconditional-preprocessor-if, + -readability-container-data-pointer, + -readability-delete-null-pointer, + -readability-function-cognitive-complexity, + -readability-function-size, + -readability-identifier-length, + -readability-isolate-declaration, + -readability-magic-numbers, + -readability-misplaced-array-index, + -readability-named-parameter, + -readability-operators-representation, + -readability-qualified-auto, + -readability-redundant-access-specifiers, + -readability-redundant-control-flow, + -readability-redundant-function-ptr-dereference, + -readability-redundant-preprocessor, + -readability-redundant-smartptr-get, + -readability-redundant-string-cstr, + -readability-simplify-subscript-expr, + -readability-string-compare, + -readability-uniqueptr-delete-release, + -readability-uppercase-literal-suffix, + -readability-use-anyofallof, + -readability-use-concise-preprocessor-directives " +# --- +# bugprone-narrowing-conversions, # This will break a lot of code but we should enable it in the future because it can eliminate a lot of bugs +# misc-override-with-different-visibility, # Will be addressed in a future PR, but for now it generates too many warnings +# --- CheckOptions: bugprone-unsafe-functions.ReportMoreUnsafeFunctions: true diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index ca282ee4d..de10bbb53 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -44,12 +44,12 @@ jobs: if: ${{ github.event_name == 'pull_request' }} permissions: contents: read - uses: XRPLF/actions/.github/workflows/determine-tidy-files.yml@224f3c48d3014d082a1129237b8291ff0b0a331f + uses: XRPLF/actions/.github/workflows/determine-tidy-files.yml@d041ac9f1fa9f07a4ba335eb4c1c82233fb3fef6 run-clang-tidy: name: Run clang tidy needs: [determine-files] - if: ${{ always() && !cancelled() && (github.event_name != 'pull_request' || needs.determine-files.outputs.cpp_changed_files != '' || needs.determine-files.outputs.clang_tidy_config_changed == 'true') }} + if: ${{ needs.determine-files.outputs.cpp_changed_files != '' || needs.determine-files.outputs.need_full_run == 'true' }} runs-on: heavy container: image: ghcr.io/xrplf/xrpld/nix-ubuntu:sha-cb2642b @@ -63,7 +63,7 @@ jobs: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - name: Prepare runner - uses: XRPLF/actions/prepare-runner@90f11ee655d1687824fb8793db770477d52afbab + uses: XRPLF/actions/prepare-runner@9355d190fd7d4de80fadfd161e6edddc9702cd9f with: enable_ccache: false @@ -98,7 +98,7 @@ jobs: continue-on-error: true id: run_clang_tidy env: - TARGETS: ${{ (needs.determine-files.outputs.clang_tidy_config_changed != 'true' && github.event_name == 'pull_request') && needs.determine-files.outputs.cpp_changed_files || 'benchmarks src tests' }} + TARGETS: ${{ needs.determine-files.outputs.need_full_run != 'true' && needs.determine-files.outputs.cpp_changed_files || 'benchmarks src tests' }} run: | set -o pipefail run-clang-tidy -j ${{ steps.nproc.outputs.nproc }} -p "${BUILD_DIR}" -quiet -fix -allow-no-checks ${TARGETS} 2>&1 | tee "${OUTPUT_FILE}" diff --git a/benchmarks/util/async/ExecutionContextBenchmarks.cpp b/benchmarks/util/async/ExecutionContextBenchmarks.cpp index 90e052649..6410de603 100644 --- a/benchmarks/util/async/ExecutionContextBenchmarks.cpp +++ b/benchmarks/util/async/ExecutionContextBenchmarks.cpp @@ -82,7 +82,7 @@ public: void run(std::size_t numThreads) { - using OpType = typename CtxType::template StoppableOperation; + using OpType = CtxType::template StoppableOperation; CtxType ctx{numThreads}; std::vector operations; diff --git a/src/data/BackendInterface.hpp b/src/data/BackendInterface.hpp index 0038a3b14..52b28cd13 100644 --- a/src/data/BackendInterface.hpp +++ b/src/data/BackendInterface.hpp @@ -87,7 +87,7 @@ synchronous(FnType&& func) { boost::asio::io_context ctx; - using R = typename boost::result_of::type; + using R = boost::result_of::type; if constexpr (!std::is_same_v) { R res; util::spawn(ctx, [_ = boost::asio::make_work_guard(ctx), &func, &res](auto yield) { diff --git a/src/data/cassandra/impl/AsyncExecutor.hpp b/src/data/cassandra/impl/AsyncExecutor.hpp index 7748811fa..53e0e860e 100644 --- a/src/data/cassandra/impl/AsyncExecutor.hpp +++ b/src/data/cassandra/impl/AsyncExecutor.hpp @@ -35,7 +35,7 @@ template < SomeRetryPolicy RetryPolicyType = ExponentialBackoffRetryPolicy> class AsyncExecutor : public std::enable_shared_from_this< AsyncExecutor> { - using FutureWithCallbackType = typename HandleType::FutureWithCallbackType; + using FutureWithCallbackType = HandleType::FutureWithCallbackType; using CallbackType = std::function; using RetryCallbackType = std::function; diff --git a/src/data/cassandra/impl/ExecutionStrategy.hpp b/src/data/cassandra/impl/ExecutionStrategy.hpp index 8251287aa..0051674ea 100644 --- a/src/data/cassandra/impl/ExecutionStrategy.hpp +++ b/src/data/cassandra/impl/ExecutionStrategy.hpp @@ -65,15 +65,15 @@ class DefaultExecutionStrategy { std::reference_wrapper handle_; std::thread thread_; - typename BackendCountersType::PtrType counters_; + BackendCountersType::PtrType counters_; public: - using ResultOrErrorType = typename HandleType::ResultOrErrorType; - using StatementType = typename HandleType::StatementType; - using PreparedStatementType = typename HandleType::PreparedStatementType; - using FutureType = typename HandleType::FutureType; - using FutureWithCallbackType = typename HandleType::FutureWithCallbackType; - using ResultType = typename HandleType::ResultType; + using ResultOrErrorType = HandleType::ResultOrErrorType; + using StatementType = HandleType::StatementType; + using PreparedStatementType = HandleType::PreparedStatementType; + using FutureType = HandleType::FutureType; + using FutureWithCallbackType = HandleType::FutureWithCallbackType; + using ResultType = HandleType::ResultType; using CompletionTokenType = boost::asio::yield_context; /** @@ -83,7 +83,7 @@ public: DefaultExecutionStrategy( Settings const& settings, HandleType const& handle, - typename BackendCountersType::PtrType counters = BackendCountersType::make() + BackendCountersType::PtrType counters = BackendCountersType::make() ) : maxWriteRequestsOutstanding_{settings.maxWriteRequestsOutstanding} , maxReadRequestsOutstanding_{settings.maxReadRequestsOutstanding} diff --git a/src/rpc/RPCHelpers.hpp b/src/rpc/RPCHelpers.hpp index db7183fb4..b8d0c5767 100644 --- a/src/rpc/RPCHelpers.hpp +++ b/src/rpc/RPCHelpers.hpp @@ -775,8 +775,9 @@ logDuration( LOG(log.error()) << tag << msg; } else if (seconds > 1) { LOG(log.warn()) << tag << msg; - } else + } else { LOG(log.info()) << tag << msg; + } } /** diff --git a/src/rpc/common/Concepts.hpp b/src/rpc/common/Concepts.hpp index 9f6dc3855..c455b2ded 100644 --- a/src/rpc/common/Concepts.hpp +++ b/src/rpc/common/Concepts.hpp @@ -51,7 +51,7 @@ concept SomeProcessor = (SomeRequirement or SomeModifier); */ template concept SomeContextProcessWithInput = - requires(T a, typename T::Input const& in, typename T::Output out, Context const& ctx) { + requires(T a, T::Input const& in, T::Output out, Context const& ctx) { { a.process(in, ctx) } -> std::same_as>; }; @@ -59,7 +59,7 @@ concept SomeContextProcessWithInput = * @brief A process function that expects no Input but does take a Context. */ template -concept SomeContextProcessWithoutInput = requires(T a, typename T::Output out, Context const& ctx) { +concept SomeContextProcessWithoutInput = requires(T a, T::Output out, Context const& ctx) { { a.process(ctx) } -> std::same_as>; }; diff --git a/src/util/Random.hpp b/src/util/Random.hpp index dc34b0100..4b8fc99c2 100644 --- a/src/util/Random.hpp +++ b/src/util/Random.hpp @@ -14,7 +14,7 @@ class RandomGeneratorInterface { public: virtual ~RandomGeneratorInterface() = default; - using SeedType = typename std::mt19937_64::result_type; + using SeedType = std::mt19937_64::result_type; /** * @brief Generate a random number between min and max diff --git a/src/util/Taggable.hpp b/src/util/Taggable.hpp index ba178b298..1402a6681 100644 --- a/src/util/Taggable.hpp +++ b/src/util/Taggable.hpp @@ -100,7 +100,7 @@ public: template class TagDecorator final : public BaseTagDecorator { using ParentType = std::optional>; - using TagType = typename Generator::TagType; + using TagType = Generator::TagType; ParentType parent_ = std::nullopt; TagType tag_ = Generator::next(); diff --git a/src/util/async/Operation.hpp b/src/util/async/Operation.hpp index 38afaab17..a52499f70 100644 --- a/src/util/async/Operation.hpp +++ b/src/util/async/Operation.hpp @@ -28,7 +28,7 @@ protected: std::future future_; public: - using DataType = typename OutcomeType::DataType; + using DataType = OutcomeType::DataType; explicit BasicOperation(OutcomeType* outcome) : future_{outcome->getStdFuture()} { @@ -77,7 +77,7 @@ struct BasicScheduledOperation : util::MoveTracker { }; std::shared_ptr state = std::make_shared(); - typename CtxType::Timer timer; + CtxType::Timer timer; BasicScheduledOperation(auto& executor, auto delay, auto&& fn) : timer( diff --git a/src/util/async/context/BasicExecutionContext.hpp b/src/util/async/context/BasicExecutionContext.hpp index 13c031fed..c2470e7d5 100644 --- a/src/util/async/context/BasicExecutionContext.hpp +++ b/src/util/async/context/BasicExecutionContext.hpp @@ -125,14 +125,14 @@ public: using ContextHolderType = ContextType; - using ExecutorType = typename ContextHolderType::Executor; + using ExecutorType = ContextHolderType::Executor; template using ValueType = std::expected; using StopSource = StopSourceType; - using StopToken = typename StopSourceType::Token; + using StopToken = StopSourceType::Token; template using StoppableOperation = StoppableOperation, StopSourceType>; @@ -147,7 +147,7 @@ public: TimerContextProvider, ErrorHandlerType>; - using Timer = typename ContextHolderType::Timer; + using Timer = ContextHolderType::Timer; // note: scheduled operations are always stoppable template @@ -425,7 +425,7 @@ public: * * @return Reference to the underlying executor */ - typename ContextType::Executor& + ContextType::Executor& getExecutor() { return context_.getExecutor(); diff --git a/src/util/async/context/impl/Strand.hpp b/src/util/async/context/impl/Strand.hpp index 88a75c129..75c359c39 100644 --- a/src/util/async/context/impl/Strand.hpp +++ b/src/util/async/context/impl/Strand.hpp @@ -23,17 +23,17 @@ template < typename ErrorHandlerType = impl::DefaultErrorHandler> class BasicStrand { std::reference_wrapper parentContext_; - typename ParentContextType::ContextHolderType::Strand context_; + ParentContextType::ContextHolderType::Strand context_; friend AssociatedExecutorExtractor; public: static constexpr bool kIsNoexcept = noexcept(ErrorHandlerType::wrap([](auto&) { throw 0; })); - using ContextHolderType = typename ParentContextType::ContextHolderType::Strand; - using ExecutorType = typename ContextHolderType::Executor; - using StopToken = typename StopSourceType::Token; - using Timer = typename ParentContextType::ContextHolderType::Timer; // timers are associated - // with the parent context + using ContextHolderType = ParentContextType::ContextHolderType::Strand; + using ExecutorType = ContextHolderType::Executor; + using StopToken = StopSourceType::Token; + using Timer = ParentContextType::ContextHolderType::Timer; // timers are associated + // with the parent context using RepeatedOperation = RepeatingOperation; BasicStrand(ParentContextType& parent, auto&& strand) diff --git a/src/util/async/context/impl/Utils.hpp b/src/util/async/context/impl/Utils.hpp index 58307ce2a..e1998397b 100644 --- a/src/util/async/context/impl/Utils.hpp +++ b/src/util/async/context/impl/Utils.hpp @@ -16,7 +16,7 @@ namespace util::async::impl { inline constexpr struct AssociatedExecutorExtractor { template - [[nodiscard]] typename CtxType::ExecutorType& + [[nodiscard]] CtxType::ExecutorType& operator()(CtxType& ctx) const noexcept { return ctx.context_.getExecutor(); @@ -31,7 +31,7 @@ getTimeoutHandleIfNeeded( SomeStopSource auto& stopSource ) { - using TimerType = typename CtxType::Timer; + using TimerType = CtxType::Timer; std::optional timer; if (timeout) { timer.emplace(extractAssociatedExecutor(ctx), *timeout, [&stopSource](auto cancelled) { diff --git a/src/util/log/Logger.hpp b/src/util/log/Logger.hpp index 09ebd42a5..32c814380 100644 --- a/src/util/log/Logger.hpp +++ b/src/util/log/Logger.hpp @@ -47,9 +47,10 @@ class ClioConfigDefinition; * Note: Currently this introduces potential shadowing (unlikely). */ #ifndef COVERAGE_ENABLED -#define LOG(x) \ - if (auto clio_pump__ = x; not clio_pump__) { \ - } else \ +#define LOG(x) \ + if (auto clio_pump__ = x; not clio_pump__) \ + ; \ + else \ clio_pump__ #else #define LOG(x) x diff --git a/tests/unit/util/log/LogServiceInitTests.cpp b/tests/unit/util/log/LogServiceInitTests.cpp index 931f45920..1ea0523ee 100644 --- a/tests/unit/util/log/LogServiceInitTests.cpp +++ b/tests/unit/util/log/LogServiceInitTests.cpp @@ -1,4 +1,3 @@ -#include "util/LoggerBuffer.hpp" #include "util/LoggerFixtures.hpp" #include "util/config/Array.hpp" #include "util/config/ConfigConstraints.hpp" @@ -70,12 +69,6 @@ protected: {"log.tag_style", ConfigValue{ConfigType::String}.defaultValue("none")}, }; - - std::string - getLoggerString() - { - return buffer_.getStrAndReset(); - } }; TEST_F(LogServiceInitTests, DefaultLogLevel)