fix(nodestore): keep the rotation-phase code building with telemetry off

RotationPhase reads owner_ and stage_ only inside the metric macro in its
destructor. With -DXRPL_ENABLE_TELEMETRY=0 that macro expands to nothing,
so clang reports both as unused private fields and -Werror makes it an
error. Mark them [[maybe_unused]].

The rotation-phase label constants reach RotationPhase as ordinary
constructor arguments, not as macro arguments, so MetricNames.h is needed
in both builds and no longer sits under the telemetry guard.
This commit is contained in:
Pratik Mankawde
2026-09-17 13:45:06 +01:00
parent f7037c8dc3
commit 06b7087c9f
2 changed files with 7 additions and 7 deletions

View File

@@ -29,12 +29,10 @@
#include <xrpl/server/State.h>
#include <xrpl/shamap/SHAMapMissingNode.h>
#include <xrpl/shamap/SHAMapTreeNode.h>
#include <xrpl/telemetry/MetricMacros.h>
#ifdef XRPL_ENABLE_TELEMETRY
// The metric-name constants are named only as macro arguments, which the
// macros drop when telemetry is compiled out.
// MetricNames.h is unguarded because the rotation-phase label constants are
// passed to RotationPhase as ordinary constructor arguments, in both builds.
#include <xrpl/telemetry/MetricMacros.h> // IWYU pragma: keep
#include <xrpl/telemetry/MetricNames.h>
#endif
#include <xrpl/telemetry/SpanGuard.h>
#include <xrpl/telemetry/SpanNames.h>

View File

@@ -253,8 +253,10 @@ private:
}
private:
SHAMapStoreImp& owner_;
char const* stage_;
// Read only inside the metric macro in the destructor, so a
// -DXRPL_ENABLE_TELEMETRY=0 build sees no use at all.
[[maybe_unused]] SHAMapStoreImp& owner_;
[[maybe_unused]] char const* stage_;
std::chrono::steady_clock::time_point start_ = std::chrono::steady_clock::now();
telemetry::ScopedSpanGuard span_;
};