diff --git a/include/fmt/os.h b/include/fmt/os.h index 65d018e8..297612fc 100644 --- a/include/fmt/os.h +++ b/include/fmt/os.h @@ -502,7 +502,7 @@ class locale { // Converts string to floating-point number and advances str past the end // of the parsed input. - double strtod(const char*& str) const { + FMT_DEPRECATED double strtod(const char*& str) const { char* end = nullptr; double result = strtod_l(str, &end, locale_); str = end; diff --git a/test/os-test.cc b/test/os-test.cc index 01ab7036..5b5ef76e 100644 --- a/test/os-test.cc +++ b/test/os-test.cc @@ -548,13 +548,4 @@ TEST(file_test, fdopen) { int read_fd = read_end.descriptor(); EXPECT_EQ(read_fd, FMT_POSIX(fileno(read_end.fdopen("r").get()))); } - -# ifdef FMT_LOCALE -TEST(locale_test, strtod) { - fmt::locale loc; - const char *start = "4.2", *ptr = start; - EXPECT_EQ(4.2, loc.strtod(ptr)); - EXPECT_EQ(start + 3, ptr); -} -# endif #endif // FMT_USE_FCNTL diff --git a/test/posix-mock-test.cc b/test/posix-mock-test.cc index 191d7aef..255e216c 100644 --- a/test/posix-mock-test.cc +++ b/test/posix-mock-test.cc @@ -467,9 +467,6 @@ struct locale_mock { MOCK_METHOD3(newlocale, locale_type(int category_mask, const char* locale, locale_type base)); MOCK_METHOD1(freelocale, void(locale_type locale)); - - MOCK_METHOD3(strtod_l, - double(const char* nptr, char** endptr, locale_type locale)); } * locale_mock::instance; # ifdef _MSC_VER @@ -487,10 +484,6 @@ _locale_t _create_locale(int category, const char* locale) { void _free_locale(_locale_t locale) { locale_mock::instance->freelocale(locale); } - -double _strtod_l(const char* nptr, char** endptr, _locale_t locale) { - return locale_mock::instance->strtod_l(nptr, endptr, locale); -} # ifdef __clang__ # pragma clang diagnostic pop # endif @@ -516,11 +509,6 @@ FreeLocaleResult freelocale(locale_type locale) FMT_LOCALE_THROW { return FreeLocaleResult(); } -double strtod_l(const char* nptr, char** endptr, - locale_type locale) FMT_LOCALE_THROW { - return locale_mock::instance->strtod_l(nptr, endptr, locale); -} - # undef FMT_LOCALE_THROW # ifndef _WIN32 @@ -549,18 +537,4 @@ TEST(locale_test, locale) { EXPECT_EQ(impl, loc.get()); } -TEST(locale_test, strtod) { - scoped_mock mock; - EXPECT_CALL(mock, newlocale(_, _, _)) - .WillOnce(Return(reinterpret_cast(42))); - EXPECT_CALL(mock, freelocale(_)); - fmt::locale loc; - const char* str = "4.2"; - char end = 'x'; - EXPECT_CALL(mock, strtod_l(str, _, loc.get())) - .WillOnce(testing::DoAll(testing::SetArgPointee<1>(&end), Return(777))); - EXPECT_EQ(777, loc.strtod(str)); - EXPECT_EQ(&end, str); -} - #endif // FMT_LOCALE