Tested x86_64-linux. -- >8 --
These were deprecated in C++17 and std::wstring_convert is planned for removal in C++26. libstdc++-v3/ChangeLog: * include/bits/locale_conv.h (wstring_convert): Add deprecated attribute for C++17 and later. (wbuffer_convert): Likewise. * testsuite/22_locale/codecvt/codecvt_utf16/79980.cc: Disable deprecated warnings. * testsuite/22_locale/codecvt/codecvt_utf8/79980.cc: Likewise. * testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc: Likewise. * testsuite/22_locale/conversions/buffer/1.cc: Add dg-warning. * testsuite/22_locale/conversions/buffer/2.cc: Likewise. * testsuite/22_locale/conversions/buffer/3.cc: Likewise. * testsuite/22_locale/conversions/buffer/requirements/typedefs.cc: Likewise. * testsuite/22_locale/conversions/string/1.cc: Likewise. * testsuite/22_locale/conversions/string/2.cc: Likewise. * testsuite/22_locale/conversions/string/3.cc: Likewise. * testsuite/22_locale/conversions/string/66441.cc: Likewise. * testsuite/22_locale/conversions/string/requirements/typedefs-2.cc: Likewise. * testsuite/22_locale/conversions/string/requirements/typedefs.cc: Likewise. --- libstdc++-v3/include/bits/locale_conv.h | 5 +++-- .../testsuite/22_locale/codecvt/codecvt_utf16/79980.cc | 1 + .../testsuite/22_locale/codecvt/codecvt_utf8/79980.cc | 1 + .../testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc | 1 + libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc | 1 + libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc | 1 + libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc | 2 ++ .../22_locale/conversions/buffer/requirements/typedefs.cc | 2 +- libstdc++-v3/testsuite/22_locale/conversions/string/1.cc | 1 + libstdc++-v3/testsuite/22_locale/conversions/string/2.cc | 1 + libstdc++-v3/testsuite/22_locale/conversions/string/3.cc | 1 + libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc | 1 + .../22_locale/conversions/string/requirements/typedefs-2.cc | 1 + .../22_locale/conversions/string/requirements/typedefs.cc | 1 + 14 files changed, 17 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/include/bits/locale_conv.h b/libstdc++-v3/include/bits/locale_conv.h index 754c36b92b8..63dee1ac872 100644 --- a/libstdc++-v3/include/bits/locale_conv.h +++ b/libstdc++-v3/include/bits/locale_conv.h @@ -259,7 +259,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 template<typename _Codecvt, typename _Elem = wchar_t, typename _Wide_alloc = allocator<_Elem>, typename _Byte_alloc = allocator<char>> - class wstring_convert + class _GLIBCXX17_DEPRECATED wstring_convert { public: typedef basic_string<char, char_traits<char>, _Byte_alloc> byte_string; @@ -406,7 +406,8 @@ _GLIBCXX_END_NAMESPACE_CXX11 /// Buffer conversions template<typename _Codecvt, typename _Elem = wchar_t, typename _Tr = char_traits<_Elem>> - class wbuffer_convert : public basic_streambuf<_Elem, _Tr> + class _GLIBCXX17_DEPRECATED wbuffer_convert + : public basic_streambuf<_Elem, _Tr> { typedef basic_streambuf<_Elem, _Tr> _Wide_streambuf; diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc index 1c6711b56db..90cb844bba3 100644 --- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc +++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc @@ -16,6 +16,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do run { target c++11 } } +// { dg-additional-options "-Wno-deprecated-declarations" { target c++17 } } #include <locale> #include <codecvt> diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc index d6cd89ce420..66aadc1161d 100644 --- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc +++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc @@ -16,6 +16,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do run { target c++11 } } +// { dg-additional-options "-Wno-deprecated-declarations" { target c++17 } } #include <codecvt> #include <locale> diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc index d09aa41ee93..e6934818864 100644 --- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc +++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc @@ -16,6 +16,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do run { target c++11 } } +// { dg-additional-options "-Wno-deprecated-declarations" { target c++17 } } #include <locale> #include <codecvt> diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc index 6b1ea950213..63125665d72 100644 --- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc +++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc @@ -29,6 +29,7 @@ struct cvt : std::codecvt<Elem, char, std::mbstate_t> { }; template<typename Elem> using buf_conv = std::wbuffer_convert<cvt<Elem>, Elem>; +// { dg-warning "deprecated" "" { target c++17 } 31 } using std::string; using std::wstring; diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc index 42653a9c7b7..5b3da130359 100644 --- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc +++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc @@ -27,6 +27,7 @@ test01() struct Cvt : std::codecvt<char, char, std::mbstate_t> { }; std::stringstream ss; std::wbuffer_convert<Cvt, char> cvt(ss.rdbuf()); + // { dg-warning "deprecated" "" { target c++17 } 29 } auto p = ss.std::ios::rdbuf(&cvt); ss << "hello"; VERIFY( ss.flush().good() ); diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc index de2c1a41322..5dcb9c5ec75 100644 --- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc +++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc @@ -47,6 +47,7 @@ test01() // https://gcc.gnu.org/ml/libstdc++/2017-11/msg00022.html streambuf sb; std::wbuffer_convert<codecvt> conv(&sb); + // { dg-warning "deprecated" "" { target c++17 } 49 } VERIFY( sb.in_avail() == 0 ); wchar_t c = conv.sgetc(); VERIFY( c == L'a' ); @@ -61,6 +62,7 @@ test02() // https://gcc.gnu.org/ml/libstdc++/2017-11/msg00022.html streambuf sb; std::wbuffer_convert<codecvt, char16_t> conv(&sb); + // { dg-warning "deprecated" "" { target c++17 } 64 } VERIFY( sb.in_avail() == 0 ); char16_t c = conv.sgetc(); VERIFY( c == u'a' ); diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/requirements/typedefs.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/requirements/typedefs.cc index 2f4ca01b906..bdd3c578247 100644 --- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/requirements/typedefs.cc +++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/requirements/typedefs.cc @@ -27,7 +27,7 @@ void test01() // Check for required typedefs struct cvt_type : std::codecvt<wchar_t, char, mbstate_t> { }; typedef std::char_traits<wchar_t> traits_type; - typedef std::wbuffer_convert<cvt_type, wchar_t, traits_type> test_type; + typedef std::wbuffer_convert<cvt_type, wchar_t, traits_type> test_type; // { dg-warning "deprecated" "" { target c++17 } } typedef test_type::state_type state_type; static_assert( std::is_same<cvt_type::state_type, state_type>::value, diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc index b41bdc5ddfe..33b9bdc6b5e 100644 --- a/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc +++ b/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc @@ -29,6 +29,7 @@ struct cvt : std::codecvt<Elem, char, std::mbstate_t> { }; template<typename Elem> using str_conv = std::wstring_convert<cvt<Elem>, Elem>; +// { dg-warning "deprecated" "" { target c++17 } 31 } using std::string; using std::wstring; diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc index ac97ff4156a..c2b6496b9ae 100644 --- a/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc +++ b/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc @@ -28,6 +28,7 @@ struct cvt : std::codecvt<Elem, char, std::mbstate_t> { }; template<typename Elem> using str_conv = std::wstring_convert<cvt<Elem>, Elem>; +// { dg-warning "deprecated" "" { target c++17 } 30 } using std::string; using std::u16string; diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/3.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/3.cc index 5570ab621aa..5a669e78ce1 100644 --- a/libstdc++-v3/testsuite/22_locale/conversions/string/3.cc +++ b/libstdc++-v3/testsuite/22_locale/conversions/string/3.cc @@ -28,6 +28,7 @@ struct cvt : std::codecvt<Elem, char, std::mbstate_t> { }; template<typename Elem> using str_conv = std::wstring_convert<cvt<Elem>, Elem>; +// { dg-warning "deprecated" "" { target c++17 } 30 } using std::string; using std::u16string; diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc index 104d2f77584..f27204a5630 100644 --- a/libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc +++ b/libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc @@ -29,6 +29,7 @@ test01() // convert from UCS-4 to UTF16BE with BOM. using cvt = std::codecvt_utf16<char32_t, 0x10FFFF, std::generate_header>; std::wstring_convert<cvt, char32_t> conv; + // { dg-warning "deprecated" "" { target c++17 } 31 } auto to = conv.to_bytes(U"ab\u00e7"); VERIFY( to.length() == 8 ); diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs-2.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs-2.cc index 487f890e94e..5026b8c68b1 100644 --- a/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs-2.cc +++ b/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs-2.cc @@ -33,6 +33,7 @@ template<typename C> struct cvt : std::codecvt<wchar_t, char, std::mbstate_t> { }; using wconv = std::wstring_convert<cvt, wchar_t, alloc<wchar_t>, alloc<char>>; +// { dg-warning "deprecated" "" { target c++17 } 35 } static_assert( std::is_same<wconv::byte_string, Str<char>>::value, "byte string is std::string" ); diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs.cc index d7f5e441738..9405df4c3ad 100644 --- a/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs.cc +++ b/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs.cc @@ -26,6 +26,7 @@ void test01() // Check for required typedefs typedef std::codecvt<wchar_t, char, mbstate_t> codecvt_type; typedef std::wstring_convert<codecvt_type> test_type; + // { dg-warning "deprecated" "" { target c++17 } 28 } typedef test_type::byte_string byte_string; typedef test_type::wide_string wide_string; typedef test_type::state_type state_type; -- 2.45.2