From: Joel Rosdahl Date: Tue, 29 Aug 2023 19:08:59 +0000 (+0200) Subject: bump: Upgrade to fmt 10.1.1 X-Git-Tag: v4.9~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=45430c9a19a5f4ab51b5d21d38c0532ba61f3f75;p=thirdparty%2Fccache.git bump: Upgrade to fmt 10.1.1 --- diff --git a/LICENSE.adoc b/LICENSE.adoc index cb136513f..01cac3dfc 100644 --- a/LICENSE.adoc +++ b/LICENSE.adoc @@ -441,7 +441,7 @@ SOFTWARE. === src/third_party/fmt/*.h and src/third_party/format.cpp -This is a subset of https://fmt.dev[fmt] 10.1.0 with the following license: +This is a subset of https://fmt.dev[fmt] 10.1.1 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 bfdca5f11..1fe13888a 100644 --- a/src/third_party/fmt/core.h +++ b/src/third_party/fmt/core.h @@ -1420,9 +1420,8 @@ template struct arg_mapper { FMT_ENABLE_IF( std::is_pointer::value || std::is_member_pointer::value || std::is_function::type>::value || - (std::is_convertible::value && - !std::is_convertible::value && - !has_formatter::value))> + (std::is_array::value && + !std::is_convertible::value))> FMT_CONSTEXPR auto map(const T&) -> unformattable_pointer { return {}; } @@ -1662,7 +1661,6 @@ template class basic_format_arg { \endrst */ // DEPRECATED! -FMT_EXPORT template FMT_CONSTEXPR FMT_INLINE auto visit_format_arg( Visitor&& vis, const basic_format_arg& arg) -> decltype(vis(0)) { diff --git a/src/third_party/fmt/format.h b/src/third_party/fmt/format.h index e5bd8b110..87a34b972 100644 --- a/src/third_party/fmt/format.h +++ b/src/third_party/fmt/format.h @@ -83,7 +83,8 @@ # if FMT_CPLUSPLUS >= 202002L # if FMT_HAS_CPP_ATTRIBUTE(no_unique_address) # define FMT_NO_UNIQUE_ADDRESS [[no_unique_address]] -# elif FMT_MSC_VERSION >= 1929 // VS2019 v16.10 and later +// 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 # endif @@ -368,8 +369,6 @@ class uint128_fallback { private: uint64_t lo_, hi_; - friend uint128_fallback umul128(uint64_t x, uint64_t y) noexcept; - public: constexpr uint128_fallback(uint64_t hi, uint64_t lo) : lo_(lo), hi_(hi) {} constexpr uint128_fallback(uint64_t value = 0) : lo_(value), hi_(0) {} @@ -1038,6 +1037,7 @@ namespace detail { FMT_API bool write_console(std::FILE* f, string_view text); FMT_API void print(std::FILE*, string_view); } // namespace detail + FMT_BEGIN_EXPORT // Suppress a misleading warning in older versions of clang. @@ -1387,8 +1387,8 @@ FMT_CONSTEXPR auto format_uint(Char* buffer, UInt value, int num_digits, } template -inline auto format_uint(It out, UInt value, int num_digits, bool upper = false) - -> It { +FMT_CONSTEXPR inline auto format_uint(It out, UInt value, int num_digits, + bool upper = false) -> It { if (auto ptr = to_pointer(out, to_unsigned(num_digits))) { format_uint(ptr, value, num_digits, upper); return out; @@ -1453,7 +1453,7 @@ template class to_utf8 { ++p; if (p == s.end() || (c & 0xfc00) != 0xd800 || (*p & 0xfc00) != 0xdc00) { if (policy == to_utf8_error_policy::abort) return false; - buf.append(string_view("�")); + buf.append(string_view("\xEF\xBF\xBD")); --p; } else { c = (c << 10) + static_cast(*p) - 0x35fdc00; @@ -1486,9 +1486,9 @@ inline uint128_fallback umul128(uint64_t x, uint64_t y) noexcept { auto p = static_cast(x) * static_cast(y); return {static_cast(p >> 64), static_cast(p)}; #elif defined(_MSC_VER) && defined(_M_X64) - auto result = uint128_fallback(); - result.lo_ = _umul128(x, y, &result.hi_); - return result; + auto hi = uint64_t(); + auto lo = _umul128(x, y, &hi); + return {hi, lo}; #else const uint64_t mask = static_cast(max_value()); @@ -4287,7 +4287,8 @@ auto join(Range&& range, string_view sep) std::string answer = fmt::to_string(42); \endrst */ -template ::value)> +template ::value && + !detail::has_format_as::value)> inline auto to_string(const T& value) -> std::string { auto buffer = memory_buffer(); detail::write(appender(buffer), value); @@ -4312,6 +4313,14 @@ FMT_NODISCARD auto to_string(const basic_memory_buffer& buf) return std::basic_string(buf.data(), size); } +template ::value && + detail::has_format_as::value)> +inline auto to_string(const T& value) -> std::string { + return to_string(format_as(value)); +} + +FMT_END_EXPORT + namespace detail { template @@ -4383,6 +4392,8 @@ void vformat_to(buffer& buf, basic_string_view fmt, detail::parse_format_string(fmt, format_handler(out, fmt, args, loc)); } +FMT_BEGIN_EXPORT + #ifndef FMT_HEADER_ONLY extern template FMT_API void vformat_to(buffer&, string_view, typename vformat_args<>::type, diff --git a/src/third_party/fmt/std.h b/src/third_party/fmt/std.h index b0e78e10d..b4e055c28 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 @@ -435,6 +436,30 @@ struct formatter +struct formatter, Char, + enable_if_t::value>> + : formatter { + template + auto format(const std::atomic& v, FormatContext& ctx) const + -> decltype(ctx.out()) { + return formatter::format(v.load(), ctx); + } +}; + +#ifdef __cpp_lib_atomic_flag_test +FMT_EXPORT +template +struct formatter + : formatter { + template + auto format(const std::atomic_flag& v, FormatContext& ctx) const + -> decltype(ctx.out()) { + return formatter::format(v.test(), ctx); + } +}; +#endif // __cpp_lib_atomic_flag_test +FMT_END_NAMESPACE #endif // FMT_STD_H_