From feb72126b438e670e7f6474b9f211b6114ed68ba Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Thu, 26 Dec 2024 13:54:06 -0800 Subject: [PATCH] Readd FMT_NO_UNIQUE_ADDRESS --- include/fmt/base.h | 16 +++++++++++++++- include/fmt/format.h | 14 -------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/fmt/base.h b/include/fmt/base.h index ab2fcf6f6db5..fc65a36c96a8 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -161,6 +161,20 @@ # define FMT_CATCH(x) if (false) #endif +#ifdef FMT_NO_UNIQUE_ADDRESS +// Use the provided definition. +#elif FMT_CPLUSPLUS < 202002L +// Not supported. +#elif FMT_HAS_CPP_ATTRIBUTE(no_unique_address) +# define FMT_NO_UNIQUE_ADDRESS [[no_unique_address]] +// VS2019 v16.10 and later except clang-cl (https://reviews.llvm.org/D110485). +#elif FMT_MSC_VERSION >= 1929 && !FMT_CLANG_VERSION +# define FMT_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]] +#endif +#ifndef FMT_NO_UNIQUE_ADDRESS +# define FMT_NO_UNIQUE_ADDRESS +#endif + #if FMT_HAS_CPP17_ATTRIBUTE(fallthrough) # define FMT_FALLTHROUGH [[fallthrough]] #elif defined(__clang__) @@ -2608,7 +2622,7 @@ class context { private: appender out_; format_args args_; - detail::locale_ref loc_; // DEPRECATED! Should be replaced with a base class. + FMT_NO_UNIQUE_ADDRESS detail::locale_ref loc_; public: /// The character type for the output. diff --git a/include/fmt/format.h b/include/fmt/format.h index 9ee6d683e58c..d1b83d18673e 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -151,20 +151,6 @@ FMT_END_NAMESPACE # endif // FMT_USE_EXCEPTIONS #endif // FMT_THROW -#ifdef FMT_NO_UNIQUE_ADDRESS -// Use the provided definition. -#elif FMT_CPLUSPLUS < 202002L -// Not supported. -#elif FMT_HAS_CPP_ATTRIBUTE(no_unique_address) -# define FMT_NO_UNIQUE_ADDRESS [[no_unique_address]] -// VS2019 v16.10 and later except clang-cl (https://reviews.llvm.org/D110485). -#elif FMT_MSC_VERSION >= 1929 && !FMT_CLANG_VERSION -# define FMT_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]] -#endif -#ifndef FMT_NO_UNIQUE_ADDRESS -# define FMT_NO_UNIQUE_ADDRESS -#endif - // Defining FMT_REDUCE_INT_INSTANTIATIONS to 1, will reduce the number of // integer formatter template instantiations to just one by only using the // largest integer type. This results in a reduction in binary size but will