From 34cc9dea06e6f974594e8e0cf25e9c5ebadd3700 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 3 Sep 2026 15:01:39 +0100 Subject: [PATCH] refactor(telemetry): replace unused-parameter casts with maybe_unused setNodeId() and Counter::add() silenced an unused parameter with a (void) cast in their telemetry-disabled arm. The attribute is this codebase's idiom: it appears 105 times across 40 files on develop. Parameter names stay, because the enabled arm uses them and the @param lines name them. totalAgreementsEver() and totalMissedEver() are pure accessors and gain [[nodiscard]]; no caller discards either. --- include/xrpl/telemetry/Recording.h | 4 +--- include/xrpl/telemetry/Telemetry.h | 3 +-- src/xrpld/telemetry/ValidationTracker.h | 4 ++-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/include/xrpl/telemetry/Recording.h b/include/xrpl/telemetry/Recording.h index 9b8f4b251c..6567728872 100644 --- a/include/xrpl/telemetry/Recording.h +++ b/include/xrpl/telemetry/Recording.h @@ -174,12 +174,10 @@ public: * @param n How much to add; defaults to 1. */ void - add(T const n = 1) noexcept + add([[maybe_unused]] T const n = 1) noexcept { #ifdef XRPL_ENABLE_TELEMETRY value_.fetch_add(n, std::memory_order_relaxed); -#else - (void)n; #endif } diff --git a/include/xrpl/telemetry/Telemetry.h b/include/xrpl/telemetry/Telemetry.h index bb95298c98..2d95ad003f 100644 --- a/include/xrpl/telemetry/Telemetry.h +++ b/include/xrpl/telemetry/Telemetry.h @@ -336,10 +336,9 @@ public: * @param id The node's base58-encoded public key. */ virtual void - setNodeId(std::string const& id) + setNodeId([[maybe_unused]] std::string const& id) { // Default no-op for NullTelemetry implementations. - (void)id; } /** diff --git a/src/xrpld/telemetry/ValidationTracker.h b/src/xrpld/telemetry/ValidationTracker.h index 973ab0fe4d..57f5163ec4 100644 --- a/src/xrpld/telemetry/ValidationTracker.h +++ b/src/xrpld/telemetry/ValidationTracker.h @@ -226,7 +226,7 @@ public: * counter validation_agreements_total. See the counting-semantics * note in detail/ValidationTracker.cpp. */ - uint64_t + [[nodiscard]] uint64_t totalAgreementsEver() const; /** @@ -238,7 +238,7 @@ public: * counter validation_missed_total. See the counting-semantics note * in detail/ValidationTracker.cpp. */ - uint64_t + [[nodiscard]] uint64_t totalMissedEver() const; /**