From 06b7087c9fea02e9be807648da15e5a3aa6077b1 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 17 Sep 2026 13:45:06 +0100 Subject: [PATCH] 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. --- src/xrpld/app/misc/SHAMapStoreImp.cpp | 8 +++----- src/xrpld/app/misc/SHAMapStoreImp.h | 6 ++++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/xrpld/app/misc/SHAMapStoreImp.cpp b/src/xrpld/app/misc/SHAMapStoreImp.cpp index 6f454a1f04..f1557fec79 100644 --- a/src/xrpld/app/misc/SHAMapStoreImp.cpp +++ b/src/xrpld/app/misc/SHAMapStoreImp.cpp @@ -29,12 +29,10 @@ #include #include #include -#include -#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 // IWYU pragma: keep #include -#endif #include #include diff --git a/src/xrpld/app/misc/SHAMapStoreImp.h b/src/xrpld/app/misc/SHAMapStoreImp.h index 5d03b26ce6..07e6685962 100644 --- a/src/xrpld/app/misc/SHAMapStoreImp.h +++ b/src/xrpld/app/misc/SHAMapStoreImp.h @@ -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_; };