From c9b69b00c5ead51a39a09d5239b5ce1aeb8ab9fd Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 27 Dec 2024 12:03:23 -0500 Subject: [PATCH] bugfix update to version 11.1.1 --- src/fmt/base.h | 26 +++++++++++++++++++++----- src/fmt/format.h | 14 -------------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/fmt/base.h b/src/fmt/base.h index 088bbce748..7bc25cb01b 100644 --- a/src/fmt/base.h +++ b/src/fmt/base.h @@ -21,7 +21,7 @@ #endif // The fmt library version in the form major * 10000 + minor * 100 + patch. -#define FMT_VERSION 110100 +#define FMT_VERSION 110101 // Detect compiler versions. #if defined(__clang__) && !defined(__ibmxl__) @@ -164,6 +164,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__) @@ -2616,10 +2630,11 @@ template class basic_format_args { }; // A formatting context. -class context : private detail::locale_ref { +class context { private: appender out_; format_args args_; + FMT_NO_UNIQUE_ADDRESS detail::locale_ref loc_; public: /// The character type for the output. @@ -2635,7 +2650,7 @@ class context : private detail::locale_ref { /// in the object so make sure they have appropriate lifetimes. FMT_CONSTEXPR context(iterator out, format_args args, detail::locale_ref loc = {}) - : locale_ref(loc), out_(out), args_(args) {} + : out_(out), args_(args), loc_(loc) {} context(context&&) = default; context(const context&) = delete; void operator=(const context&) = delete; @@ -2654,7 +2669,7 @@ class context : private detail::locale_ref { // Advances the begin iterator to `it`. FMT_CONSTEXPR void advance_to(iterator) {} - FMT_CONSTEXPR auto locale() const -> detail::locale_ref { return *this; } + FMT_CONSTEXPR auto locale() const -> detail::locale_ref { return loc_; } }; template struct runtime_format_string { @@ -2671,7 +2686,8 @@ template struct runtime_format_string { */ inline auto runtime(string_view s) -> runtime_format_string<> { return {{s}}; } -/// A compile-time format string. +/// A compile-time format string. Use `format_string` in the public API to +/// prevent type deduction. template struct fstring { private: static constexpr int num_static_named_args = diff --git a/src/fmt/format.h b/src/fmt/format.h index 9ee6d683e5..d1b83d1867 100644 --- a/src/fmt/format.h +++ b/src/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