fix: Resolve CI levelization and rename check failures

- Revert yield_to.h to use inline preprocessor blocks instead of
  including sanitizers.h, avoiding a levelization loop between
  xrpl.basics and xrpl.beast.
- Restructure XRPL_SANITIZER_ACTIVE fallback in sanitizers.h to avoid
  the #ifndef/#define pattern that the rename check misdetects as an
  include guard.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Pratik Mankawde
2026-03-19 12:59:54 +00:00
parent 9dd2ca1e4a
commit 2117959900
2 changed files with 17 additions and 8 deletions

View File

@@ -18,9 +18,9 @@
#elif defined(__has_feature)
#if __has_feature(thread_sanitizer) || __has_feature(address_sanitizer)
#define XRPL_SANITIZER_ACTIVE 1
#endif
#endif
#ifndef XRPL_SANITIZER_ACTIVE
#else
#define XRPL_SANITIZER_ACTIVE 0
#endif
#else
#define XRPL_SANITIZER_ACTIVE 0
#endif

View File

@@ -4,8 +4,6 @@
#pragma once
#include <xrpl/basics/sanitizers.h>
#include <boost/asio/executor_work_guard.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/spawn.hpp>
@@ -23,8 +21,19 @@ namespace test {
// Sanitizers significantly increase stack frame sizes
// (TSAN ~3-5x, ASAN ~2-3x), requiring larger coroutine stacks.
inline constexpr std::size_t yieldStackSize =
XRPL_SANITIZER_ACTIVE ? 4 * 1024 * 1024 : 2 * 1024 * 1024;
// Note: This duplicates the detection logic from xrpl/basics/sanitizers.h
// because xrpl.beast cannot depend on xrpl.basics (levelization constraint).
#if defined(__SANITIZE_THREAD__) || defined(__SANITIZE_ADDRESS__)
inline constexpr std::size_t yieldStackSize = 4 * 1024 * 1024;
#elif defined(__has_feature)
#if __has_feature(thread_sanitizer) || __has_feature(address_sanitizer)
inline constexpr std::size_t yieldStackSize = 4 * 1024 * 1024;
#else
inline constexpr std::size_t yieldStackSize = 2 * 1024 * 1024;
#endif
#else
inline constexpr std::size_t yieldStackSize = 2 * 1024 * 1024;
#endif
/** Mix-in to support tests using asio coroutines.