From 9bb14ffc4774f2eff6c50bfd889b61b3c157dd07 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sat, 13 Sep 2025 09:55:57 -0700 Subject: [PATCH] Remove deprecated APIs --- ChangeLog.md | 19 +++++++++---------- include/fmt/std.h | 24 +++++++++++------------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 5630368d..03e240bf 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -74,18 +74,17 @@ formatters (https://github.com/fmtlib/fmt/issues/4424, https://github.com/fmtlib/fmt/pull/4434). Thanks @jeremy-rifkin. -- Removed the deprecated `has_formatter` trait. Use `is_formattable` instead. +- Removed the following deprecated APIs: -- Removed the deprecated `basic_format_args::parse_context_type`, - `basic_format_args::formatter_type` and similar aliases in context types. + - `has_formatter`: use `is_formattable` instead, + - `basic_format_args::parse_context_type`, + `basic_format_args::formatter_type` and similar aliases in context types, + - wide stream overload of `fmt::printf`, + - wide stream overloads of `fmt::print` that take text styles, + - `is_*char` traits, + - `fmt::localtime`. -- Removed the deprecated wide stream overload of `fmt::printf` and deprecated - wide overloads of `fmt::fprintf` and `fmt::sprintf`. - -- Removed the deprecated wide stream overloads of `fmt::print` that take text - styles. - -- Removed legacy `is_*char` traits. +- Deprecated wide overloads of `fmt::fprintf` and `fmt::sprintf`. - Improved diagnostics for the incorrect usage of `fmt::ptr` (https://github.com/fmtlib/fmt/pull/4453). Thanks @TobiSchluter. diff --git a/include/fmt/std.h b/include/fmt/std.h index 90001ade..5cf10618 100644 --- a/include/fmt/std.h +++ b/include/fmt/std.h @@ -140,7 +140,7 @@ template class is_variant_formattable { #if FMT_USE_RTTI -template +template auto write_demangled_name(OutputIt out, const std::type_info& ti) -> OutputIt { # ifdef FMT_HAS_ABI_CXA_DEMANGLE int status = 0; @@ -180,7 +180,7 @@ auto write_demangled_name(OutputIt out, const std::type_info& ti) -> OutputIt { } else { demangled_name_view = string_view(ti.name()); } - return detail::write_bytes(out, demangled_name_view); + return detail::write_bytes(out, demangled_name_view); # elif FMT_MSC_VERSION const string_view demangled_name(ti.name()); for (size_t i = 0; i < demangled_name.size(); ++i) { @@ -202,7 +202,7 @@ auto write_demangled_name(OutputIt out, const std::type_info& ti) -> OutputIt { } return out; # else - return detail::write_bytes(out, string_view(ti.name())); + return detail::write_bytes(out, string_view(ti.name())); # endif } @@ -541,31 +541,29 @@ template <> struct formatter { }; #if FMT_USE_RTTI -template -struct formatter { +template <> struct formatter { public: - FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { + FMT_CONSTEXPR auto parse(parse_context<>& ctx) -> const char* { return ctx.begin(); } template auto format(const std::type_info& ti, Context& ctx) const -> decltype(ctx.out()) { - return detail::write_demangled_name(ctx.out(), ti); + return detail::write_demangled_name(ctx.out(), ti); } }; #endif // FMT_USE_RTTI -template +template struct formatter< - T, Char, // DEPRECATED! Mixing code unit types. + T, char, typename std::enable_if::value>::type> { private: bool with_typename_ = false; public: - FMT_CONSTEXPR auto parse(parse_context& ctx) -> const Char* { + FMT_CONSTEXPR auto parse(parse_context<>& ctx) -> const char* { auto it = ctx.begin(); auto end = ctx.end(); if (it == end || *it == '}') return it; @@ -582,12 +580,12 @@ struct formatter< auto out = ctx.out(); #if FMT_USE_RTTI if (with_typename_) { - out = detail::write_demangled_name(out, typeid(ex)); + out = detail::write_demangled_name(out, typeid(ex)); *out++ = ':'; *out++ = ' '; } #endif - return detail::write_bytes(out, string_view(ex.what())); + return detail::write_bytes(out, string_view(ex.what())); } };