From 5b2c740ad814caa01bebc3fcd607f9113b7f011b Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 23 Apr 2021 11:16:19 -0700 Subject: [PATCH] Remove deprecated APIs --- include/fmt/core.h | 22 ---------------------- include/fmt/format-inl.h | 3 +-- include/fmt/format.h | 22 ---------------------- test/format-test.cc | 19 +++---------------- test/ostream-test.cc | 4 ---- 5 files changed, 4 insertions(+), 66 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 1fab00b5..05f69a1b 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -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 class basic_format_args { } }; -#ifdef FMT_ARM_ABI_COMPATIBILITY /** An alias to ``basic_format_args``. */ // Separate types would result in shorter symbols but break ABI compatibility // between clang and gcc on ARM (#1919). using format_args = basic_format_args; using wformat_args = basic_format_args; -#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 { - template - FMT_INLINE format_args(const Args&... args) : basic_format_args(args...) {} -}; -struct wformat_args : basic_format_args { - 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 diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index 17f5ebcf..c9c4a14d 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -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>(args)); + detail::vformat_to(buffer, format_str, args); #ifdef _WIN32 auto fd = _fileno(f); if (_isatty(fd)) { diff --git a/include/fmt/format.h b/include/fmt/format.h index dc51c9b1..95db108f 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -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(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; diff --git a/test/format-test.cc b/test/format-test.cc index 5af2e244..1145ac3a 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -652,10 +652,6 @@ TEST(FormatterTest, RightAlign) { EXPECT_EQ(" 0xface", format("{0:>8}", reinterpret_cast(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(1 << fmt::detail::num_bits()), - L'}', 0}; + wchar_t format_str[] = { + L'{', L':', + '+' | static_cast(1 << fmt::detail::num_bits()), 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", diff --git a/test/ostream-test.cc b/test/ostream-test.cc index b24fbf60..68094222 100644 --- a/test/ostream-test.cc +++ b/test/ostream-test.cc @@ -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,