From a731c73fd5dae3bb942fbf57cb63762b2b998c29 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 23 Nov 2025 09:03:02 -0800 Subject: [PATCH] Make FMT_USE_FULL_CACHE_DRAGONBOX depend on __OPTIMIZE_SIZE__ by default Thanks to Matthias Kretz for the idea. --- include/fmt/format-inl.h | 8 ++++++++ include/fmt/format.h | 4 ---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index 945cb912..331c034a 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -30,6 +30,14 @@ # define FMT_FUNC #endif +#if defined(FMT_USE_FULL_CACHE_DRAGONBOX) +// Use the provided definition. +#elif defined(__OPTIMIZE_SIZE__) +# define FMT_USE_FULL_CACHE_DRAGONBOX 0 +#else +# define FMT_USE_FULL_CACHE_DRAGONBOX 1 +#endif + FMT_BEGIN_NAMESPACE #ifndef FMT_CUSTOM_ASSERT_FAIL diff --git a/include/fmt/format.h b/include/fmt/format.h index 039a7a37..2e57c71e 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -736,10 +736,6 @@ using fast_float_t = conditional_t; template using is_double_double = bool_constant::digits == 106>; -#ifndef FMT_USE_FULL_CACHE_DRAGONBOX -# define FMT_USE_FULL_CACHE_DRAGONBOX 0 -#endif - // An allocator that uses malloc/free to allow removing dependency on the C++ // standard libary runtime. std::decay is used for back_inserter to be found by // ADL when applied to memory_buffer.