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.
This commit is contained in:
Pratik Mankawde
2026-09-03 15:01:39 +01:00
parent 67d51cc9ed
commit 34cc9dea06
3 changed files with 4 additions and 7 deletions

View File

@@ -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
}

View File

@@ -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;
}
/**

View File

@@ -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;
/**