Remove deprecated APIs

This commit is contained in:
Victor Zverovich 2022-05-21 12:08:40 -07:00
parent 621eb80bbb
commit 440512f08d
6 changed files with 7 additions and 71 deletions

View File

@ -585,7 +585,9 @@ struct error_handler {
constexpr error_handler(const error_handler&) = default;
// This function is intentionally not constexpr to give a compile-time error.
FMT_NORETURN FMT_API void on_error(const char* message);
FMT_NORETURN FMT_API void on_error(const char* message) {
throw_format_error(message);
}
};
FMT_END_DETAIL_NAMESPACE

View File

@ -2341,12 +2341,6 @@ FMT_FUNC void report_system_error(int error_code,
report_error(format_system_error, error_code, message);
}
// DEPRECATED!
// This function is defined here and not inline for ABI compatiblity.
FMT_FUNC void detail::error_handler::on_error(const char* message) {
throw_format_error(message);
}
FMT_FUNC std::string vformat(string_view fmt, format_args args) {
// Don't optimize the "{}" case to keep the binary size small and because it
// can be better optimized in fmt::format anyway.

View File

@ -132,13 +132,6 @@ FMT_END_NAMESPACE
# endif
#endif
// Workaround broken [[deprecated]] in the Intel, PGI and NVCC compilers.
#if FMT_ICC_VERSION || defined(__PGI) || FMT_NVCC
# define FMT_DEPRECATED_ALIAS
#else
# define FMT_DEPRECATED_ALIAS FMT_DEPRECATED
#endif
#ifndef FMT_USE_USER_DEFINED_LITERALS
// EDG based compilers (Intel, NVIDIA, Elbrus, etc), GCC and MSVC support UDLs.
# if (FMT_HAS_FEATURE(cxx_user_literals) || FMT_GCC_VERSION >= 407 || \
@ -935,27 +928,6 @@ class FMT_API format_error : public std::runtime_error {
~format_error() noexcept override FMT_MSC_DEFAULT;
};
/**
\rst
Constructs a `~fmt::format_arg_store` object that contains references
to arguments and can be implicitly converted to `~fmt::format_args`.
If ``fmt`` is a compile-time string then `make_args_checked` checks
its validity at compile time.
\endrst
*/
template <typename... Args, typename S, typename Char = char_t<S>>
FMT_DEPRECATED FMT_INLINE auto make_args_checked(
const S& fmt, const remove_reference_t<Args>&... args)
-> format_arg_store<buffer_context<Char>, remove_reference_t<Args>...> {
static_assert(
detail::count<(
std::is_base_of<detail::view, remove_reference_t<Args>>::value &&
std::is_reference<Args>::value)...>() == 0,
"passing views as lvalues is disallowed");
detail::check_format_string<Args...>(fmt);
return {args...};
}
namespace detail_exported {
#if FMT_USE_NONTYPE_TEMPLATE_PARAMETERS
template <typename Char, size_t N> struct fixed_string {
@ -3151,9 +3123,6 @@ struct join_view : detail::view {
: begin(b), end(e), sep(s) {}
};
template <typename It, typename Sentinel, typename Char>
using arg_join FMT_DEPRECATED_ALIAS = join_view<It, Sentinel, Char>;
template <typename It, typename Sentinel, typename Char>
struct formatter<join_view<It, Sentinel, Char>, Char> {
private:
@ -3424,14 +3393,6 @@ inline auto format(const Locale& loc, format_string<T...> fmt, T&&... args)
return vformat(loc, string_view(fmt), fmt::make_format_args(args...));
}
template <typename... T, size_t SIZE, typename Allocator>
FMT_DEPRECATED auto format_to(basic_memory_buffer<char, SIZE, Allocator>& buf,
format_string<T...> fmt, T&&... args)
-> appender {
detail::vformat_to(buf, string_view(fmt), fmt::make_format_args(args...));
return appender(buf);
}
template <typename OutputIt, typename Locale,
FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, char>::value&&
detail::is_locale<Locale>::value)>
@ -3454,10 +3415,6 @@ FMT_INLINE auto format_to(OutputIt out, const Locale& loc,
FMT_MODULE_EXPORT_END
FMT_END_NAMESPACE
#ifdef FMT_DEPRECATED_INCLUDE_XCHAR
# include "xchar.h"
#endif
#ifdef FMT_HEADER_ONLY
# define FMT_FUNC inline
# include "format-inl.h"

View File

@ -634,23 +634,6 @@ inline auto printf(const S& fmt, const T&... args) -> int {
fmt::make_format_args<basic_printf_context_t<char_t<S>>>(args...));
}
template <typename S, typename Char = char_t<S>>
FMT_DEPRECATED auto vfprintf(
std::basic_ostream<Char>& os, const S& fmt,
basic_format_args<basic_printf_context_t<type_identity_t<Char>>> args)
-> int {
basic_memory_buffer<Char> buffer;
vprintf(buffer, to_string_view(fmt), args);
os.write(buffer.data(), static_cast<std::streamsize>(buffer.size()));
return static_cast<int>(buffer.size());
}
template <typename S, typename... T, typename Char = char_t<S>>
FMT_DEPRECATED auto fprintf(std::basic_ostream<Char>& os, const S& fmt,
const T&... args) -> int {
return vfprintf(os, to_string_view(fmt),
fmt::make_format_args<basic_printf_context_t<Char>>(args...));
}
FMT_MODULE_EXPORT_END
FMT_END_NAMESPACE

View File

@ -30,8 +30,8 @@ void invoke_fmt(const uint8_t* data, size_t size) {
#if FMT_FUZZ_FORMAT_TO_STRING
std::string message = fmt::format(format_str.get(), *value);
#else
fmt::memory_buffer message;
fmt::format_to(message, format_str.get(), *value);
auto buf = fmt::memory_buffer();
fmt::format_to(std::back_inserter(buf), format_str.get(), *value);
#endif
} catch (std::exception&) {
}

View File

@ -27,8 +27,8 @@ void invoke_fmt(const uint8_t* data, size_t size) {
#if FMT_FUZZ_FORMAT_TO_STRING
std::string message = fmt::format(format_str, item1, item2);
#else
fmt::memory_buffer message;
fmt::format_to(message, format_str, item1, item2);
auto buf = fmt::memory_buffer();
fmt::format_to(std::back_inserter(buf), format_str, item1, item2);
#endif
}