Remove deprecated APIs

This commit is contained in:
Victor Zverovich
2025-09-13 09:55:57 -07:00
parent 556c4177b6
commit 9bb14ffc47
2 changed files with 20 additions and 23 deletions

View File

@@ -74,18 +74,17 @@
formatters (https://github.com/fmtlib/fmt/issues/4424, formatters (https://github.com/fmtlib/fmt/issues/4424,
https://github.com/fmtlib/fmt/pull/4434). Thanks @jeremy-rifkin. 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`, - `has_formatter`: use `is_formattable` instead,
`basic_format_args::formatter_type` and similar aliases in context types. - `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 - Deprecated wide overloads of `fmt::fprintf` and `fmt::sprintf`.
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.
- Improved diagnostics for the incorrect usage of `fmt::ptr` - Improved diagnostics for the incorrect usage of `fmt::ptr`
(https://github.com/fmtlib/fmt/pull/4453). Thanks @TobiSchluter. (https://github.com/fmtlib/fmt/pull/4453). Thanks @TobiSchluter.

View File

@@ -140,7 +140,7 @@ template <typename Variant, typename Char> class is_variant_formattable {
#if FMT_USE_RTTI #if FMT_USE_RTTI
template <typename Char, typename OutputIt> template <typename OutputIt>
auto write_demangled_name(OutputIt out, const std::type_info& ti) -> OutputIt { auto write_demangled_name(OutputIt out, const std::type_info& ti) -> OutputIt {
# ifdef FMT_HAS_ABI_CXA_DEMANGLE # ifdef FMT_HAS_ABI_CXA_DEMANGLE
int status = 0; int status = 0;
@@ -180,7 +180,7 @@ auto write_demangled_name(OutputIt out, const std::type_info& ti) -> OutputIt {
} else { } else {
demangled_name_view = string_view(ti.name()); demangled_name_view = string_view(ti.name());
} }
return detail::write_bytes<Char>(out, demangled_name_view); return detail::write_bytes<char>(out, demangled_name_view);
# elif FMT_MSC_VERSION # elif FMT_MSC_VERSION
const string_view demangled_name(ti.name()); const string_view demangled_name(ti.name());
for (size_t i = 0; i < demangled_name.size(); ++i) { 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; return out;
# else # else
return detail::write_bytes<Char>(out, string_view(ti.name())); return detail::write_bytes<char>(out, string_view(ti.name()));
# endif # endif
} }
@@ -541,31 +541,29 @@ template <> struct formatter<std::error_code> {
}; };
#if FMT_USE_RTTI #if FMT_USE_RTTI
template <typename Char> template <> struct formatter<std::type_info> {
struct formatter<std::type_info, Char // DEPRECATED! Mixing code unit types.
> {
public: public:
FMT_CONSTEXPR auto parse(parse_context<Char>& ctx) -> const Char* { FMT_CONSTEXPR auto parse(parse_context<>& ctx) -> const char* {
return ctx.begin(); return ctx.begin();
} }
template <typename Context> template <typename Context>
auto format(const std::type_info& ti, Context& ctx) const auto format(const std::type_info& ti, Context& ctx) const
-> decltype(ctx.out()) { -> decltype(ctx.out()) {
return detail::write_demangled_name<Char>(ctx.out(), ti); return detail::write_demangled_name(ctx.out(), ti);
} }
}; };
#endif // FMT_USE_RTTI #endif // FMT_USE_RTTI
template <typename T, typename Char> template <typename T>
struct formatter< struct formatter<
T, Char, // DEPRECATED! Mixing code unit types. T, char,
typename std::enable_if<std::is_base_of<std::exception, T>::value>::type> { typename std::enable_if<std::is_base_of<std::exception, T>::value>::type> {
private: private:
bool with_typename_ = false; bool with_typename_ = false;
public: public:
FMT_CONSTEXPR auto parse(parse_context<Char>& ctx) -> const Char* { FMT_CONSTEXPR auto parse(parse_context<>& ctx) -> const char* {
auto it = ctx.begin(); auto it = ctx.begin();
auto end = ctx.end(); auto end = ctx.end();
if (it == end || *it == '}') return it; if (it == end || *it == '}') return it;
@@ -582,12 +580,12 @@ struct formatter<
auto out = ctx.out(); auto out = ctx.out();
#if FMT_USE_RTTI #if FMT_USE_RTTI
if (with_typename_) { if (with_typename_) {
out = detail::write_demangled_name<Char>(out, typeid(ex)); out = detail::write_demangled_name(out, typeid(ex));
*out++ = ':'; *out++ = ':';
*out++ = ' '; *out++ = ' ';
} }
#endif #endif
return detail::write_bytes<Char>(out, string_view(ex.what())); return detail::write_bytes<char>(out, string_view(ex.what()));
} }
}; };