From 2117959900d687ebec6d63a36a563e0164936639 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 19 Mar 2026 12:59:54 +0000 Subject: [PATCH] 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 --- include/xrpl/basics/sanitizers.h | 8 ++++---- include/xrpl/beast/test/yield_to.h | 17 +++++++++++++---- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/include/xrpl/basics/sanitizers.h b/include/xrpl/basics/sanitizers.h index c1b8d4c431..8ce50ab45a 100644 --- a/include/xrpl/basics/sanitizers.h +++ b/include/xrpl/basics/sanitizers.h @@ -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 diff --git a/include/xrpl/beast/test/yield_to.h b/include/xrpl/beast/test/yield_to.h index 797da0be16..9800a7b400 100644 --- a/include/xrpl/beast/test/yield_to.h +++ b/include/xrpl/beast/test/yield_to.h @@ -4,8 +4,6 @@ #pragma once -#include - #include #include #include @@ -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.