From: Joel Rosdahl Date: Mon, 14 Aug 2023 16:34:36 +0000 (+0200) Subject: bump: Upgrade to fmt 10.1.0 X-Git-Tag: v4.9~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fda80e753a60ca7d4bf7282a162fef01e46c2795;p=thirdparty%2Fccache.git bump: Upgrade to fmt 10.1.0 --- diff --git a/LICENSE.adoc b/LICENSE.adoc index 06d94227b..e29082d7c 100644 --- a/LICENSE.adoc +++ b/LICENSE.adoc @@ -441,9 +441,7 @@ SOFTWARE. === src/third_party/fmt/*.h and src/third_party/format.cpp -This is a subset of https://fmt.dev[fmt] commit -8a4bec5cf53387356738a06ba0cf4fdf086241ae (version 10.0.0 plus recent -development) with the following license: +This is a subset of https://fmt.dev[fmt] 10.1.0 with the following license: ---- Formatting library for C++ diff --git a/src/third_party/fmt/core.h b/src/third_party/fmt/core.h index f6886cf41..bfdca5f11 100644 --- a/src/third_party/fmt/core.h +++ b/src/third_party/fmt/core.h @@ -13,11 +13,12 @@ #include // std::strlen #include #include +#include // std::addressof #include #include // The fmt library version in the form major * 10000 + minor * 100 + patch. -#define FMT_VERSION 100001 +#define FMT_VERSION 100100 #if defined(__clang__) && !defined(__ibmxl__) # define FMT_CLANG_VERSION (__clang_major__ * 100 + __clang_minor__) @@ -1281,9 +1282,9 @@ template class value { FMT_INLINE value(const named_arg_info* args, size_t size) : named_args{args, size} {} - template FMT_CONSTEXPR FMT_INLINE value(T& val) { + template FMT_CONSTEXPR20 FMT_INLINE value(T& val) { using value_type = remove_const_t; - custom.value = const_cast(&val); + custom.value = const_cast(std::addressof(val)); // Get the formatter type through the context to allow different contexts // have different extension points, e.g. `formatter` for `format` and // `printf_formatter` for `printf`. @@ -1660,6 +1661,7 @@ template class basic_format_arg { ``vis(value)`` will be called with the value of type ``double``. \endrst */ +// DEPRECATED! FMT_EXPORT template FMT_CONSTEXPR FMT_INLINE auto visit_format_arg( diff --git a/src/third_party/fmt/format.h b/src/third_party/fmt/format.h index dfd5d78ab..e5bd8b110 100644 --- a/src/third_party/fmt/format.h +++ b/src/third_party/fmt/format.h @@ -920,7 +920,7 @@ class basic_memory_buffer final : public detail::buffer { private: T store_[SIZE]; - // Don't inherit from Allocator avoid generating type_info for it. + // Don't inherit from Allocator to avoid generating type_info for it. FMT_NO_UNIQUE_ADDRESS Allocator alloc_; // Deallocate memory allocated by the buffer. @@ -3178,7 +3178,8 @@ FMT_CONSTEXPR20 inline void format_dragon(basic_fp value, } if (buf[0] == overflow) { buf[0] = '1'; - ++exp10; + if ((flags & dragon::fixed) != 0) buf.push_back('0'); + else ++exp10; } return; } diff --git a/src/third_party/fmt/std.h b/src/third_party/fmt/std.h index a71a59db9..b0e78e10d 100644 --- a/src/third_party/fmt/std.h +++ b/src/third_party/fmt/std.h @@ -8,6 +8,7 @@ #ifndef FMT_STD_H_ #define FMT_STD_H_ +#include #include #include #include @@ -15,6 +16,7 @@ #include #include #include +#include #include "format.h" #include "ostream.h" @@ -389,6 +391,50 @@ struct formatter< #endif } }; + +namespace detail { + +template +struct has_flip : std::false_type {}; + +template +struct has_flip().flip())>> + : std::true_type {}; + +template struct is_bit_reference_like { + static constexpr const bool value = + std::is_convertible::value && + std::is_nothrow_assignable::value && has_flip::value; +}; + +#ifdef _LIBCPP_VERSION + +// Workaround for libc++ incompatibility with C++ standard. +// According to the Standard, `bitset::operator[] const` returns bool. +template +struct is_bit_reference_like> { + static constexpr const bool value = true; +}; + +#endif + +} // namespace detail + +// We can't use std::vector::reference and +// std::bitset::reference because the compiler can't deduce Allocator and N +// in partial specialization. +FMT_EXPORT +template +struct formatter::value>> + : formatter { + template + FMT_CONSTEXPR auto format(const BitRef& v, FormatContext& ctx) const + -> decltype(ctx.out()) { + return formatter::format(v, ctx); + } +}; + FMT_END_NAMESPACE #endif // FMT_STD_H_