Remove deprecated APIs

This commit is contained in:
Victor Zverovich 2021-04-23 11:16:19 -07:00
parent b9ab5c8836
commit 5b2c740ad8
5 changed files with 4 additions and 66 deletions

View File

@ -370,10 +370,6 @@ enum char8_type : unsigned char {};
#endif
} // namespace detail
#ifdef FMT_USE_INTERNAL
namespace internal = detail; // DEPRECATED
#endif
/**
An implementation of ``std::basic_string_view`` for pre-C++17. It provides a
subset of the API. ``fmt::basic_string_view`` is used for format strings even
@ -1784,23 +1780,11 @@ template <typename Context> class basic_format_args {
}
};
#ifdef FMT_ARM_ABI_COMPATIBILITY
/** An alias to ``basic_format_args<format_context>``. */
// Separate types would result in shorter symbols but break ABI compatibility
// between clang and gcc on ARM (#1919).
using format_args = basic_format_args<format_context>;
using wformat_args = basic_format_args<wformat_context>;
#else
// DEPRECATED! These are kept for ABI compatibility.
// It is a separate type rather than an alias to make symbols readable.
struct format_args : basic_format_args<format_context> {
template <typename... Args>
FMT_INLINE format_args(const Args&... args) : basic_format_args(args...) {}
};
struct wformat_args : basic_format_args<wformat_context> {
using basic_format_args::basic_format_args;
};
#endif
FMT_MODULE_EXPORT_END
namespace detail {
@ -1985,9 +1969,3 @@ FMT_END_NAMESPACE
# include "format.h"
#endif
#endif // FMT_CORE_H_
// Define FMT_DYNAMIC_ARGS to make core.h provide dynamic_format_arg_store
// DEPRECATED! Include fmt/args.h directly instead.
#ifdef FMT_DYNAMIC_ARGS
#include "args.h"
#endif

View File

@ -2689,8 +2689,7 @@ extern "C" __declspec(dllimport) int __stdcall WriteConsoleW( //
FMT_FUNC void vprint(std::FILE* f, string_view format_str, format_args args) {
memory_buffer buffer;
detail::vformat_to(buffer, format_str,
basic_format_args<buffer_context<char>>(args));
detail::vformat_to(buffer, format_str, args);
#ifdef _WIN32
auto fd = _fileno(f);
if (_isatty(fd)) {

View File

@ -263,11 +263,6 @@ inline int ctzll(uint64_t x) {
FMT_END_NAMESPACE
#endif
// Enable the deprecated numeric alignment.
#ifndef FMT_DEPRECATED_NUMERIC_ALIGN
# define FMT_DEPRECATED_NUMERIC_ALIGN 0
#endif
FMT_BEGIN_NAMESPACE
namespace detail {
@ -1410,11 +1405,6 @@ FMT_CONSTEXPR float_specs parse_float_type_spec(
case 'a':
result.format = float_format::hex;
break;
#ifdef FMT_DEPRECATED_N_SPECIFIER
case 'n':
result.locale = true;
break;
#endif
default:
eh.on_error("invalid type specifier");
break;
@ -1432,9 +1422,6 @@ FMT_CONSTEXPR void check_int_type_spec(char spec, ErrorHandler&& eh) {
case 'b':
case 'B':
case 'o':
#ifdef FMT_DEPRECATED_N_SPECIFIER
case 'n':
#endif
case 'c':
break;
default:
@ -1721,10 +1708,6 @@ FMT_CONSTEXPR OutputIt write_int(OutputIt out, T value,
return format_uint<3, Char>(it, abs_value, num_digits);
});
}
#ifdef FMT_DEPRECATED_N_SPECIFIER
case 'n':
return write_int_localized(out, abs_value, prefix, specs, loc);
#endif
case 'c':
return write_char(out, static_cast<Char>(abs_value), specs);
default:
@ -2807,11 +2790,6 @@ FMT_CONSTEXPR const Char* parse_align(const Char* begin, const Char* end,
case '>':
align = align::right;
break;
#if FMT_DEPRECATED_NUMERIC_ALIGN
case '=':
align = align::numeric;
break;
#endif
case '^':
align = align::center;
break;

View File

@ -652,10 +652,6 @@ TEST(FormatterTest, RightAlign) {
EXPECT_EQ(" 0xface", format("{0:>8}", reinterpret_cast<void*>(0xface)));
}
#if FMT_DEPRECATED_NUMERIC_ALIGN
TEST(FormatterTest, NumericAlign) { EXPECT_EQ("0042", format("{0:=4}", 42)); }
#endif
TEST(FormatterTest, CenterAlign) {
EXPECT_EQ(" 42 ", format("{0:^5}", 42));
EXPECT_EQ(" 42 ", format("{0:^5o}", 042));
@ -770,9 +766,9 @@ TEST(FormatterTest, SpaceSign) {
}
TEST(FormatterTest, SignNotTruncated) {
wchar_t format_str[] = {L'{', L':',
'+' | static_cast<wchar_t>(1 << fmt::detail::num_bits<char>()),
L'}', 0};
wchar_t format_str[] = {
L'{', L':',
'+' | static_cast<wchar_t>(1 << fmt::detail::num_bits<char>()), L'}', 0};
EXPECT_THROW(format(format_str, 42), format_error);
}
@ -1976,10 +1972,6 @@ TEST(FormatTest, DynamicFormatter) {
"cannot switch from manual to automatic argument indexing");
EXPECT_THROW_MSG(format(+"{:{0}}", num), format_error,
"cannot switch from automatic to manual argument indexing");
#if FMT_DEPRECATED_NUMERIC_ALIGN
EXPECT_THROW_MSG(format(+"{:=}", str), format_error,
"format specifier requires numeric argument");
#endif
EXPECT_THROW_MSG(format(+"{:+}", str), format_error,
"format specifier requires numeric argument");
EXPECT_THROW_MSG(format(+"{:-}", str), format_error,
@ -2450,11 +2442,6 @@ TEST(FormatTest, FormatStringErrors) {
EXPECT_ERROR("{:10000000000}", "number is too big", int);
EXPECT_ERROR("{:.10000000000}", "number is too big", int);
EXPECT_ERROR_NOARGS("{:x}", "argument not found");
# if FMT_DEPRECATED_NUMERIC_ALIGN
EXPECT_ERROR("{0:=5", "unknown format specifier", int);
EXPECT_ERROR("{:=}", "format specifier requires numeric argument",
const char*);
# endif
EXPECT_ERROR("{:+}", "format specifier requires numeric argument",
const char*);
EXPECT_ERROR("{:-}", "format specifier requires numeric argument",

View File

@ -76,10 +76,6 @@ TEST(OStreamTest, Format) {
TEST(OStreamTest, FormatSpecs) {
EXPECT_EQ("def ", format("{0:<5}", TestString("def")));
EXPECT_EQ(" def", format("{0:>5}", TestString("def")));
#if FMT_DEPRECATED_NUMERIC_ALIGN
EXPECT_THROW_MSG(format(+"{0:=5}", TestString("def")), format_error,
"format specifier requires numeric argument");
#endif
EXPECT_EQ(" def ", format("{0:^5}", TestString("def")));
EXPECT_EQ("def**", format("{0:*<5}", TestString("def")));
EXPECT_THROW_MSG(format(+"{0:+}", TestString()), format_error,