[libcxx-commits] [libcxx] 3ee9a50 - [libc++] Implement P0618R0 (Deprecating <codecvt>)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 30 07:47:55 PDT 2022


Author: Nikolas Klauser
Date: 2022-06-30T16:47:50+02:00
New Revision: 3ee9a50a146c585fc92f79e742c538261f98bd4e

URL: https://github.com/llvm/llvm-project/commit/3ee9a50a146c585fc92f79e742c538261f98bd4e
DIFF: https://github.com/llvm/llvm-project/commit/3ee9a50a146c585fc92f79e742c538261f98bd4e.diff

LOG: [libc++] Implement P0618R0 (Deprecating <codecvt>)

Reviewed By: ldionne, #libc

Spies: cfe-commits, llvm-commits, libcxx-commits

Differential Revision: https://reviews.llvm.org/D127313

Added: 
    libcxx/test/std/localization/locale.stdcvt/depr.verify.cpp
    libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/depr.verify.cpp
    libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/depr.verify.cpp

Modified: 
    libcxx/docs/ReleaseNotes.rst
    libcxx/docs/Status/Cxx17Papers.csv
    libcxx/include/codecvt
    libcxx/include/locale
    libcxx/src/locale.cpp
    libcxx/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp
    libcxx/test/std/localization/locale.stdcvt/codecvt_mode.pass.cpp
    libcxx/test/std/localization/locale.stdcvt/codecvt_utf16.pass.cpp
    libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_always_noconv.pass.cpp
    libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_encoding.pass.cpp
    libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_in.pass.cpp
    libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_length.pass.cpp
    libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_max_length.pass.cpp
    libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp
    libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_unshift.pass.cpp
    libcxx/test/std/localization/locale.stdcvt/codecvt_utf8.pass.cpp
    libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_always_noconv.pass.cpp
    libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_encoding.pass.cpp
    libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_in.pass.cpp
    libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_length.pass.cpp
    libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_max_length.pass.cpp
    libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp
    libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_unshift.pass.cpp
    libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_always_noconv.pass.cpp
    libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_encoding.pass.cpp
    libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_in.pass.cpp
    libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_length.pass.cpp
    libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_max_length.pass.cpp
    libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp
    libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_unshift.pass.cpp
    libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/ctor.pass.cpp
    libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/overflow.pass.cpp
    libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/pbackfail.pass.cpp
    libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/rdbuf.pass.cpp
    libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/seekoff.pass.cpp
    libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/state.pass.cpp
    libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/test.pass.cpp
    libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.pass.cpp
    libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp
    libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt.pass.cpp
    libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt_state.pass.cpp
    libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_copy.pass.cpp
    libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp
    libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/from_bytes.pass.cpp
    libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/state.pass.cpp
    libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/to_bytes.pass.cpp
    libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/types.pass.cpp
    libcxx/test/support/platform_support.h

Removed: 
    


################################################################################
diff  --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst
index dfc849c771fa8..c2917d4710df6 100644
--- a/libcxx/docs/ReleaseNotes.rst
+++ b/libcxx/docs/ReleaseNotes.rst
@@ -46,6 +46,7 @@ Implemented Papers
 - P0174R2 (Deprecating Vestigial Library Parts in C++17)
 - N4190 (Removing auto_ptr, random_shuffle(), And Old <functional> Stuff)
 - P0154R1 (Hardware inference size)
+- P0618R0 (Deprecating <codecvt>)
 
 - Marked the following papers as "Complete" (note that some of those might have
   been implemented in a previous release but not marked as such):
@@ -155,6 +156,10 @@ API Changes
   you have to define ``_LIBCPP_DISABLE_DEPRECATION_WARNINGS``. Note that this disables
   all deprecation warnings.
 
+- The contents of ``<codecvt>``, ``wstring_convert`` and ``wbuffer_convert`` have been marked as deprecated.
+  To disable deprecation warnings you have to define ``_LIBCPP_DISABLE_DEPRECATION_WARNINGS``. Note that this
+  disables all deprecation warnings.
+
 ABI Changes
 -----------
 

diff  --git a/libcxx/docs/Status/Cxx17Papers.csv b/libcxx/docs/Status/Cxx17Papers.csv
index 84904ac7a82c9..e08704552d2f3 100644
--- a/libcxx/docs/Status/Cxx17Papers.csv
+++ b/libcxx/docs/Status/Cxx17Papers.csv
@@ -106,7 +106,7 @@
 "`P0599R1 <https://wg21.link/P0599R1>`__","LWG","noexcept for hash functions","Kona","|Complete|","5.0"
 "`P0604R0 <https://wg21.link/P0604R0>`__","LWG","Resolving GB 55, US 84, US 85, US 86","Kona","|Complete|",""
 "`P0607R0 <https://wg21.link/P0607R0>`__","LWG","Inline Variables for the Standard Library","Kona","|In Progress| [#note-P0607]_","6.0"
-"`P0618R0 <https://wg21.link/P0618R0>`__","LWG","Deprecating <codecvt>","Kona","",""
+"`P0618R0 <https://wg21.link/P0618R0>`__","LWG","Deprecating <codecvt>","Kona","|Complete|","15.0"
 "`P0623R0 <https://wg21.link/P0623R0>`__","LWG","Final C++17 Parallel Algorithms Fixes","Kona","",""
 "","","","","",""
 "`P0682R1 <https://wg21.link/P0682R1>`__","LWG","Repairing elementary string conversions","Toronto","",""

diff  --git a/libcxx/include/codecvt b/libcxx/include/codecvt
index d3a9486929f4e..3e5110a008e4d 100644
--- a/libcxx/include/codecvt
+++ b/libcxx/include/codecvt
@@ -65,7 +65,7 @@ class codecvt_utf8_utf16
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-enum codecvt_mode
+enum _LIBCPP_DEPRECATED_IN_CXX17 codecvt_mode
 {
     consume_header = 4,
     generate_header = 2,
@@ -82,17 +82,21 @@ class _LIBCPP_TYPE_VIS __codecvt_utf8<wchar_t>
     : public codecvt<wchar_t, char, mbstate_t>
 {
     unsigned long _Maxcode_;
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
     codecvt_mode _Mode_;
+_LIBCPP_SUPPRESS_DEPRECATED_POP
 public:
     typedef wchar_t   intern_type;
     typedef char      extern_type;
     typedef mbstate_t state_type;
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
     _LIBCPP_INLINE_VISIBILITY
     explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode,
                             codecvt_mode _Mode)
         : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
           _Mode_(_Mode) {}
+_LIBCPP_SUPPRESS_DEPRECATED_POP
 protected:
     virtual result
         do_out(state_type& __st,
@@ -189,9 +193,10 @@ protected:
     virtual int do_max_length() const _NOEXCEPT;
 };
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <class _Elem, unsigned long _Maxcode = 0x10ffff,
           codecvt_mode _Mode = (codecvt_mode)0>
-class _LIBCPP_TEMPLATE_VIS codecvt_utf8
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 codecvt_utf8
     : public __codecvt_utf8<_Elem>
 {
 public:
@@ -202,6 +207,7 @@ public:
     _LIBCPP_INLINE_VISIBILITY
     ~codecvt_utf8() {}
 };
+_LIBCPP_SUPPRESS_DEPRECATED_POP
 
 // codecvt_utf16
 
@@ -213,17 +219,21 @@ class _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, false>
     : public codecvt<wchar_t, char, mbstate_t>
 {
     unsigned long _Maxcode_;
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
     codecvt_mode _Mode_;
+_LIBCPP_SUPPRESS_DEPRECATED_POP
 public:
     typedef wchar_t   intern_type;
     typedef char      extern_type;
     typedef mbstate_t state_type;
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
     _LIBCPP_INLINE_VISIBILITY
     explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
                             codecvt_mode _Mode)
         : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
           _Mode_(_Mode) {}
+_LIBCPP_SUPPRESS_DEPRECATED_POP
 protected:
     virtual result
         do_out(state_type& __st,
@@ -248,17 +258,21 @@ class _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, true>
     : public codecvt<wchar_t, char, mbstate_t>
 {
     unsigned long _Maxcode_;
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
     codecvt_mode _Mode_;
+_LIBCPP_SUPPRESS_DEPRECATED_POP
 public:
     typedef wchar_t   intern_type;
     typedef char      extern_type;
     typedef mbstate_t state_type;
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
     _LIBCPP_INLINE_VISIBILITY
     explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
                             codecvt_mode _Mode)
         : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
           _Mode_(_Mode) {}
+_LIBCPP_SUPPRESS_DEPRECATED_POP
 protected:
     virtual result
         do_out(state_type& __st,
@@ -431,9 +445,10 @@ protected:
     virtual int do_max_length() const _NOEXCEPT;
 };
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <class _Elem, unsigned long _Maxcode = 0x10ffff,
           codecvt_mode _Mode = (codecvt_mode)0>
-class _LIBCPP_TEMPLATE_VIS codecvt_utf16
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 codecvt_utf16
     : public __codecvt_utf16<_Elem, _Mode & little_endian>
 {
 public:
@@ -444,6 +459,7 @@ public:
     _LIBCPP_INLINE_VISIBILITY
     ~codecvt_utf16() {}
 };
+_LIBCPP_SUPPRESS_DEPRECATED_POP
 
 // codecvt_utf8_utf16
 
@@ -455,17 +471,21 @@ class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<wchar_t>
     : public codecvt<wchar_t, char, mbstate_t>
 {
     unsigned long _Maxcode_;
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
     codecvt_mode _Mode_;
+_LIBCPP_SUPPRESS_DEPRECATED_POP
 public:
     typedef wchar_t   intern_type;
     typedef char      extern_type;
     typedef mbstate_t state_type;
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
     _LIBCPP_INLINE_VISIBILITY
     explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode,
                             codecvt_mode _Mode)
         : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
           _Mode_(_Mode) {}
+_LIBCPP_SUPPRESS_DEPRECATED_POP
 protected:
     virtual result
         do_out(state_type& __st,
@@ -562,9 +582,10 @@ protected:
     virtual int do_max_length() const _NOEXCEPT;
 };
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <class _Elem, unsigned long _Maxcode = 0x10ffff,
           codecvt_mode _Mode = (codecvt_mode)0>
-class _LIBCPP_TEMPLATE_VIS codecvt_utf8_utf16
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 codecvt_utf8_utf16
     : public __codecvt_utf8_utf16<_Elem>
 {
 public:
@@ -575,6 +596,7 @@ public:
     _LIBCPP_INLINE_VISIBILITY
     ~codecvt_utf8_utf16() {}
 };
+_LIBCPP_SUPPRESS_DEPRECATED_POP
 
 _LIBCPP_END_NAMESPACE_STD
 

diff  --git a/libcxx/include/locale b/libcxx/include/locale
index 7f6f1e5097453..b01c66d0430f6 100644
--- a/libcxx/include/locale
+++ b/libcxx/include/locale
@@ -3618,7 +3618,7 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<wchar_t>;
 template<class _Codecvt, class _Elem = wchar_t,
          class _Wide_alloc = allocator<_Elem>,
          class _Byte_alloc = allocator<char> >
-class _LIBCPP_TEMPLATE_VIS wstring_convert
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 wstring_convert
 {
 public:
     typedef basic_string<char, char_traits<char>, _Byte_alloc>   byte_string;
@@ -3685,6 +3685,7 @@ public:
     state_type state() const {return __cvtstate_;}
 };
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
 inline
 wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
@@ -3692,6 +3693,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
         : __cvtptr_(__pcvt), __cvtstate_(), __cvtcount_(0)
 {
 }
+_LIBCPP_SUPPRESS_DEPRECATED_POP
 
 template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
 inline
@@ -3726,6 +3728,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
 
 #endif // _LIBCPP_CXX03_LANG
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
 wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::~wstring_convert()
 {
@@ -3737,6 +3740,7 @@ typename wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::wide_string
 wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
     from_bytes(const char* __frm, const char* __frm_end)
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
     __cvtcount_ = 0;
     if (__cvtptr_ != nullptr)
     {
@@ -3883,7 +3887,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
 }
 
 template <class _Codecvt, class _Elem = wchar_t, class _Tr = char_traits<_Elem> >
-class _LIBCPP_TEMPLATE_VIS wbuffer_convert
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 wbuffer_convert
     : public basic_streambuf<_Elem, _Tr>
 {
 public:
@@ -3960,6 +3964,7 @@ private:
     wbuffer_convert* __close();
 };
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <class _Codecvt, class _Elem, class _Tr>
 wbuffer_convert<_Codecvt, _Elem, _Tr>::
     wbuffer_convert(streambuf* __bytebuf, _Codecvt* __pcvt, state_type __state)
@@ -3995,6 +4000,7 @@ template <class _Codecvt, class _Elem, class _Tr>
 typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type
 wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow()
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
     if (__cv_ == 0 || __bufptr_ == 0)
         return traits_type::eof();
     bool __initial = __read_mode();
@@ -4059,10 +4065,12 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow()
     return __c;
 }
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <class _Codecvt, class _Elem, class _Tr>
 typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type
 wbuffer_convert<_Codecvt, _Elem, _Tr>::pbackfail(int_type __c)
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
     if (__cv_ != 0 && __bufptr_ != 0 && this->eback() < this->gptr())
     {
         if (traits_type::eq_int_type(__c, traits_type::eof()))
@@ -4080,10 +4088,12 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::pbackfail(int_type __c)
     return traits_type::eof();
 }
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <class _Codecvt, class _Elem, class _Tr>
 typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type
 wbuffer_convert<_Codecvt, _Elem, _Tr>::overflow(int_type __c)
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
     if (__cv_ == 0 || __bufptr_ == 0)
         return traits_type::eof();
     __write_mode();
@@ -4142,10 +4152,12 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::overflow(int_type __c)
     return traits_type::not_eof(__c);
 }
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <class _Codecvt, class _Elem, class _Tr>
 basic_streambuf<_Elem, _Tr>*
 wbuffer_convert<_Codecvt, _Elem, _Tr>::setbuf(char_type* __s, streamsize __n)
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
     this->setg(0, 0, 0);
     this->setp(0, 0);
     if (__owns_eb_)
@@ -4195,6 +4207,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::setbuf(char_type* __s, streamsize __n)
     return this;
 }
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <class _Codecvt, class _Elem, class _Tr>
 typename wbuffer_convert<_Codecvt, _Elem, _Tr>::pos_type
 wbuffer_convert<_Codecvt, _Elem, _Tr>::seekoff(off_type __off, ios_base::seekdir __way,
@@ -4226,6 +4239,7 @@ template <class _Codecvt, class _Elem, class _Tr>
 int
 wbuffer_convert<_Codecvt, _Elem, _Tr>::sync()
 {
+_LIBCPP_SUPPRESS_DEPRECATED_POP
     if (__cv_ == 0 || __bufptr_ == 0)
         return 0;
     if (__cm_ & ios_base::out)
@@ -4294,6 +4308,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::sync()
     return 0;
 }
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <class _Codecvt, class _Elem, class _Tr>
 bool
 wbuffer_convert<_Codecvt, _Elem, _Tr>::__read_mode()
@@ -4348,6 +4363,8 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::__close()
     return __rt;
 }
 
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+
 _LIBCPP_END_NAMESPACE_STD
 
 _LIBCPP_POP_MACROS

diff  --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp
index fd0e17a7007b4..6b454274e130e 100644
--- a/libcxx/src/locale.cpp
+++ b/libcxx/src/locale.cpp
@@ -1831,6 +1831,7 @@ codecvt<wchar_t, char, mbstate_t>::do_max_length() const noexcept
 // 040000 - 0FFFFF  D8C0 - DBBF, DC00 - DFFF  F1 - F3, 80 - BF, 80 - BF, 80 - BF   786432
 // 100000 - 10FFFF  DBC0 - DBFF, DC00 - DFFF  F4 - F4, 80 - 8F, 80 - BF, 80 - BF    65536
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 static
 codecvt_base::result
 utf16_to_utf8(const uint16_t* frm, const uint16_t* frm_end, const uint16_t*& frm_nxt,
@@ -3204,6 +3205,8 @@ utf16le_to_ucs2_length(const uint8_t* frm, const uint8_t* frm_end,
     return static_cast<int>(frm_nxt - frm);
 }
 
+_LIBCPP_SUPPRESS_DEPRECATED_POP
+
 // template <> class codecvt<char16_t, char, mbstate_t>
 
 locale::id codecvt<char16_t, char, mbstate_t>::id;
@@ -3611,6 +3614,7 @@ __codecvt_utf8<wchar_t>::do_length(state_type&,
 #endif
 }
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 int
 __codecvt_utf8<wchar_t>::do_max_length() const noexcept
 {
@@ -3693,6 +3697,7 @@ __codecvt_utf8<char16_t>::do_length(state_type&,
     return utf8_to_ucs2_length(_frm, _frm_end, mx, _Maxcode_, _Mode_);
 }
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 int
 __codecvt_utf8<char16_t>::do_max_length() const noexcept
 {
@@ -3700,6 +3705,7 @@ __codecvt_utf8<char16_t>::do_max_length() const noexcept
         return 6;
     return 3;
 }
+_LIBCPP_SUPPRESS_DEPRECATED_POP
 
 // __codecvt_utf8<char32_t>
 
@@ -3768,6 +3774,7 @@ __codecvt_utf8<char32_t>::do_length(state_type&,
     return utf8_to_ucs4_length(_frm, _frm_end, mx, _Maxcode_, _Mode_);
 }
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 int
 __codecvt_utf8<char32_t>::do_max_length() const noexcept
 {
@@ -3775,6 +3782,7 @@ __codecvt_utf8<char32_t>::do_max_length() const noexcept
         return 7;
     return 4;
 }
+_LIBCPP_SUPPRESS_DEPRECATED_POP
 
 // __codecvt_utf16<wchar_t, false>
 
@@ -4053,6 +4061,7 @@ __codecvt_utf16<char16_t, false>::do_length(state_type&,
     return utf16be_to_ucs2_length(_frm, _frm_end, mx, _Maxcode_, _Mode_);
 }
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 int
 __codecvt_utf16<char16_t, false>::do_max_length() const noexcept
 {
@@ -4060,6 +4069,7 @@ __codecvt_utf16<char16_t, false>::do_max_length() const noexcept
         return 4;
     return 2;
 }
+_LIBCPP_SUPPRESS_DEPRECATED_POP
 
 // __codecvt_utf16<char16_t, true>
 
@@ -4128,6 +4138,7 @@ __codecvt_utf16<char16_t, true>::do_length(state_type&,
     return utf16le_to_ucs2_length(_frm, _frm_end, mx, _Maxcode_, _Mode_);
 }
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 int
 __codecvt_utf16<char16_t, true>::do_max_length() const noexcept
 {
@@ -4135,6 +4146,7 @@ __codecvt_utf16<char16_t, true>::do_max_length() const noexcept
         return 4;
     return 2;
 }
+_LIBCPP_SUPPRESS_DEPRECATED_POP
 
 // __codecvt_utf16<char32_t, false>
 
@@ -4203,6 +4215,7 @@ __codecvt_utf16<char32_t, false>::do_length(state_type&,
     return utf16be_to_ucs4_length(_frm, _frm_end, mx, _Maxcode_, _Mode_);
 }
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 int
 __codecvt_utf16<char32_t, false>::do_max_length() const noexcept
 {
@@ -4210,6 +4223,7 @@ __codecvt_utf16<char32_t, false>::do_max_length() const noexcept
         return 6;
     return 4;
 }
+_LIBCPP_SUPPRESS_DEPRECATED_POP
 
 // __codecvt_utf16<char32_t, true>
 
@@ -4278,6 +4292,7 @@ __codecvt_utf16<char32_t, true>::do_length(state_type&,
     return utf16le_to_ucs4_length(_frm, _frm_end, mx, _Maxcode_, _Mode_);
 }
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 int
 __codecvt_utf16<char32_t, true>::do_max_length() const noexcept
 {
@@ -4285,6 +4300,7 @@ __codecvt_utf16<char32_t, true>::do_max_length() const noexcept
         return 6;
     return 4;
 }
+_LIBCPP_SUPPRESS_DEPRECATED_POP
 
 // __codecvt_utf8_utf16<wchar_t>
 
@@ -4442,6 +4458,7 @@ __codecvt_utf8_utf16<char16_t>::do_length(state_type&,
     return utf8_to_utf16_length(_frm, _frm_end, mx, _Maxcode_, _Mode_);
 }
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 int
 __codecvt_utf8_utf16<char16_t>::do_max_length() const noexcept
 {
@@ -4449,6 +4466,7 @@ __codecvt_utf8_utf16<char16_t>::do_max_length() const noexcept
         return 7;
     return 4;
 }
+_LIBCPP_SUPPRESS_DEPRECATED_POP
 
 // __codecvt_utf8_utf16<char32_t>
 
@@ -4517,6 +4535,7 @@ __codecvt_utf8_utf16<char32_t>::do_length(state_type&,
     return utf8_to_utf16_length(_frm, _frm_end, mx, _Maxcode_, _Mode_);
 }
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 int
 __codecvt_utf8_utf16<char32_t>::do_max_length() const noexcept
 {
@@ -4524,6 +4543,7 @@ __codecvt_utf8_utf16<char32_t>::do_max_length() const noexcept
         return 7;
     return 4;
 }
+_LIBCPP_SUPPRESS_DEPRECATED_POP
 
 // __narrow_to_utf8<16>
 

diff  --git a/libcxx/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp b/libcxx/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp
index b0e9956f553fc..61e92089e4659 100644
--- a/libcxx/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp
+++ b/libcxx/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp
@@ -10,6 +10,8 @@
 
 // UNSUPPORTED: c++03
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // <locale>
 
 // wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>

diff  --git a/libcxx/test/std/localization/locale.stdcvt/codecvt_mode.pass.cpp b/libcxx/test/std/localization/locale.stdcvt/codecvt_mode.pass.cpp
index 09a83047e7196..b7020ac0f161a 100644
--- a/libcxx/test/std/localization/locale.stdcvt/codecvt_mode.pass.cpp
+++ b/libcxx/test/std/localization/locale.stdcvt/codecvt_mode.pass.cpp
@@ -8,6 +8,8 @@
 
 // <codecvt>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // enum codecvt_mode
 // {
 //     consume_header = 4,

diff  --git a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16.pass.cpp b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16.pass.cpp
index 2a7161092a130..c38f11df5ac4d 100644
--- a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16.pass.cpp
+++ b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16.pass.cpp
@@ -8,6 +8,8 @@
 
 // <codecvt>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // template <class Elem, unsigned long Maxcode = 0x10ffff,
 //           codecvt_mode Mode = (codecvt_mode)0>
 // class codecvt_utf16

diff  --git a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_always_noconv.pass.cpp b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_always_noconv.pass.cpp
index e9a1e7a4bc7f9..f91706c77d25d 100644
--- a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_always_noconv.pass.cpp
+++ b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_always_noconv.pass.cpp
@@ -8,6 +8,8 @@
 
 // <codecvt>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // template <class Elem, unsigned long Maxcode = 0x10ffff,
 //           codecvt_mode Mode = (codecvt_mode)0>
 // class codecvt_utf16

diff  --git a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_encoding.pass.cpp b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_encoding.pass.cpp
index 2407644243fc4..12bfa096924b6 100644
--- a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_encoding.pass.cpp
+++ b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_encoding.pass.cpp
@@ -8,6 +8,8 @@
 
 // <codecvt>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // template <class Elem, unsigned long Maxcode = 0x10ffff,
 //           codecvt_mode Mode = (codecvt_mode)0>
 // class codecvt_utf16

diff  --git a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_in.pass.cpp b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_in.pass.cpp
index 139a4b284625c..8d4f48e8f54dd 100644
--- a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_in.pass.cpp
+++ b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_in.pass.cpp
@@ -8,6 +8,8 @@
 
 // <codecvt>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // template <class Elem, unsigned long Maxcode = 0x10ffff,
 //           codecvt_mode Mode = (codecvt_mode)0>
 // class codecvt_utf16

diff  --git a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_length.pass.cpp b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_length.pass.cpp
index b6040f77571b9..53172e7d630ba 100644
--- a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_length.pass.cpp
+++ b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_length.pass.cpp
@@ -8,6 +8,8 @@
 
 // <codecvt>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // template <class Elem, unsigned long Maxcode = 0x10ffff,
 //           codecvt_mode Mode = (codecvt_mode)0>
 // class codecvt_utf16

diff  --git a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_max_length.pass.cpp b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_max_length.pass.cpp
index 6f31d744130e0..ac3daf40987b2 100644
--- a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_max_length.pass.cpp
+++ b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_max_length.pass.cpp
@@ -8,6 +8,8 @@
 
 // <codecvt>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // template <class Elem, unsigned long Maxcode = 0x10ffff,
 //           codecvt_mode Mode = (codecvt_mode)0>
 // class codecvt_utf16

diff  --git a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp
index da94fb6683f3e..2a6936aee10ca 100644
--- a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp
+++ b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp
@@ -8,6 +8,8 @@
 
 // <codecvt>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // template <class Elem, unsigned long Maxcode = 0x10ffff,
 //           codecvt_mode Mode = (codecvt_mode)0>
 // class codecvt_utf16

diff  --git a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_unshift.pass.cpp b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_unshift.pass.cpp
index 0a7adaf24c34c..55cbf5a7d0717 100644
--- a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_unshift.pass.cpp
+++ b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_unshift.pass.cpp
@@ -8,6 +8,8 @@
 
 // <codecvt>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // template <class Elem, unsigned long Maxcode = 0x10ffff,
 //           codecvt_mode Mode = (codecvt_mode)0>
 // class codecvt_utf16

diff  --git a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8.pass.cpp b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8.pass.cpp
index 271117b8b9710..1f06de27d9aec 100644
--- a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8.pass.cpp
+++ b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8.pass.cpp
@@ -8,6 +8,8 @@
 
 // <codecvt>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // template <class Elem, unsigned long Maxcode = 0x10ffff,
 //           codecvt_mode Mode = (codecvt_mode)0>
 // class codecvt_utf8

diff  --git a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_always_noconv.pass.cpp b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_always_noconv.pass.cpp
index 23f29df1f09e7..f25c8e4545105 100644
--- a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_always_noconv.pass.cpp
+++ b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_always_noconv.pass.cpp
@@ -8,6 +8,8 @@
 
 // <codecvt>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // template <class Elem, unsigned long Maxcode = 0x10ffff,
 //           codecvt_mode Mode = (codecvt_mode)0>
 // class codecvt_utf8

diff  --git a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_encoding.pass.cpp b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_encoding.pass.cpp
index eddf665f0d357..55c1c5e52f766 100644
--- a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_encoding.pass.cpp
+++ b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_encoding.pass.cpp
@@ -8,6 +8,8 @@
 
 // <codecvt>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // template <class Elem, unsigned long Maxcode = 0x10ffff,
 //           codecvt_mode Mode = (codecvt_mode)0>
 // class codecvt_utf8

diff  --git a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_in.pass.cpp b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_in.pass.cpp
index 9f162d5461bc6..9abd0868f40a7 100644
--- a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_in.pass.cpp
+++ b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_in.pass.cpp
@@ -8,6 +8,8 @@
 
 // <codecvt>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // template <class Elem, unsigned long Maxcode = 0x10ffff,
 //           codecvt_mode Mode = (codecvt_mode)0>
 // class codecvt_utf8

diff  --git a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_length.pass.cpp b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_length.pass.cpp
index bd4aa1d098ef5..37cc10aa90b7a 100644
--- a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_length.pass.cpp
+++ b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_length.pass.cpp
@@ -8,6 +8,8 @@
 
 // <codecvt>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // template <class Elem, unsigned long Maxcode = 0x10ffff,
 //           codecvt_mode Mode = (codecvt_mode)0>
 // class codecvt_utf8

diff  --git a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_max_length.pass.cpp b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_max_length.pass.cpp
index 8afb5bc3adddc..6279dceeb2eb5 100644
--- a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_max_length.pass.cpp
+++ b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_max_length.pass.cpp
@@ -8,6 +8,8 @@
 
 // <codecvt>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // template <class Elem, unsigned long Maxcode = 0x10ffff,
 //           codecvt_mode Mode = (codecvt_mode)0>
 // class codecvt_utf8

diff  --git a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp
index 99dc2192c873f..7d124c982e5ec 100644
--- a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp
+++ b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp
@@ -8,6 +8,8 @@
 
 // <codecvt>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // template <class Elem, unsigned long Maxcode = 0x10ffff,
 //           codecvt_mode Mode = (codecvt_mode)0>
 // class codecvt_utf8

diff  --git a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_unshift.pass.cpp b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_unshift.pass.cpp
index 239dbfc06dd42..9ab9629978224 100644
--- a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_unshift.pass.cpp
+++ b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_unshift.pass.cpp
@@ -8,6 +8,8 @@
 
 // <codecvt>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // template <class Elem, unsigned long Maxcode = 0x10ffff,
 //           codecvt_mode Mode = (codecvt_mode)0>
 // class codecvt_utf8

diff  --git a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_always_noconv.pass.cpp b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_always_noconv.pass.cpp
index 7aa5591bca903..97d7ef2301702 100644
--- a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_always_noconv.pass.cpp
+++ b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_always_noconv.pass.cpp
@@ -8,6 +8,8 @@
 
 // <codecvt>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // template <class Elem, unsigned long Maxcode = 0x10ffff,
 //           codecvt_mode Mode = (codecvt_mode)0>
 // class codecvt_utf8_utf16

diff  --git a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_encoding.pass.cpp b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_encoding.pass.cpp
index 3e8aa3afc1e43..f0514b51cedb7 100644
--- a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_encoding.pass.cpp
+++ b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_encoding.pass.cpp
@@ -8,6 +8,8 @@
 
 // <codecvt>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // template <class Elem, unsigned long Maxcode = 0x10ffff,
 //           codecvt_mode Mode = (codecvt_mode)0>
 // class codecvt_utf8_utf16

diff  --git a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_in.pass.cpp b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_in.pass.cpp
index 8b235339983b0..d7776b3a2d899 100644
--- a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_in.pass.cpp
+++ b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_in.pass.cpp
@@ -8,6 +8,8 @@
 
 // <codecvt>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // template <class Elem, unsigned long Maxcode = 0x10ffff,
 //           codecvt_mode Mode = (codecvt_mode)0>
 // class codecvt_utf8_utf16

diff  --git a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_length.pass.cpp b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_length.pass.cpp
index 3847fad4cb5dd..03f813719acdc 100644
--- a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_length.pass.cpp
+++ b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_length.pass.cpp
@@ -8,6 +8,8 @@
 
 // <codecvt>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // template <class Elem, unsigned long Maxcode = 0x10ffff,
 //           codecvt_mode Mode = (codecvt_mode)0>
 // class codecvt_utf8_utf16

diff  --git a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_max_length.pass.cpp b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_max_length.pass.cpp
index f7f7ce3251096..c59e8e8035017 100644
--- a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_max_length.pass.cpp
+++ b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_max_length.pass.cpp
@@ -8,6 +8,8 @@
 
 // <codecvt>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // template <class Elem, unsigned long Maxcode = 0x10ffff,
 //           codecvt_mode Mode = (codecvt_mode)0>
 // class codecvt_utf8_utf16

diff  --git a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp
index 895db46c5ecd0..c208dc33b0f2a 100644
--- a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp
+++ b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp
@@ -8,6 +8,8 @@
 
 // <codecvt>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // template <class Elem, unsigned long Maxcode = 0x10ffff,
 //           codecvt_mode Mode = (codecvt_mode)0>
 // class codecvt_utf8_utf16

diff  --git a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_unshift.pass.cpp b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_unshift.pass.cpp
index c36239749934b..6db92c5b6a075 100644
--- a/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_unshift.pass.cpp
+++ b/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_unshift.pass.cpp
@@ -8,6 +8,8 @@
 
 // <codecvt>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // template <class Elem, unsigned long Maxcode = 0x10ffff,
 //           codecvt_mode Mode = (codecvt_mode)0>
 // class codecvt_utf8_utf16

diff  --git a/libcxx/test/std/localization/locale.stdcvt/depr.verify.cpp b/libcxx/test/std/localization/locale.stdcvt/depr.verify.cpp
new file mode 100644
index 0000000000000..194b2095ce912
--- /dev/null
+++ b/libcxx/test/std/localization/locale.stdcvt/depr.verify.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14
+// UNSUPPORTED: no-wide-characters
+
+// <codecvt>
+
+// ensure that codecvt content is marked as deprecated
+
+#include <codecvt>
+
+std::codecvt_mode c1; // expected-warning {{'codecvt_mode' is deprecated}}
+std::codecvt_utf8<wchar_t> c2; // expected-warning {{'codecvt_utf8<wchar_t, 1114111, 0>' is deprecated}}
+std::codecvt_utf16<wchar_t> c3; // expected-warning {{'codecvt_utf16<wchar_t, 1114111, 0>' is deprecated}}
+std::codecvt_utf8_utf16<wchar_t> c4; // expected-warning {{'codecvt_utf8_utf16<wchar_t, 1114111, 0>' is deprecated}}

diff  --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/ctor.pass.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/ctor.pass.cpp
index 8d1ab9eead3a2..5846e4e72a843 100644
--- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/ctor.pass.cpp
+++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/ctor.pass.cpp
@@ -8,6 +8,8 @@
 
 // <locale>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // wbuffer_convert<Codecvt, Elem, Tr>
 
 // wbuffer_convert(streambuf* bytebuf = 0, Codecvt* pcvt = new Codecvt,

diff  --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/depr.verify.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/depr.verify.cpp
new file mode 100644
index 0000000000000..823ff63fdc6bf
--- /dev/null
+++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/depr.verify.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14
+
+// XFAIL: no-wide-characters
+
+// <codecvt>
+
+// ensure that wbuffer_convert is marked as deprecated
+
+#include <codecvt>
+#include <locale>
+
+std::wbuffer_convert<std::codecvt_utf8<wchar_t>> c1; // expected-warning {{'wbuffer_convert<std::codecvt_utf8<wchar_t, 1114111, 0>>' is deprecated}}
+// expected-warning at -1 {{'codecvt_utf8<wchar_t, 1114111, 0>' is deprecated}}

diff  --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/overflow.pass.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/overflow.pass.cpp
index 881e7b3501add..a971f0f752719 100644
--- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/overflow.pass.cpp
+++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/overflow.pass.cpp
@@ -8,6 +8,8 @@
 
 // <locale>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // wbuffer_convert<Codecvt, Elem, Tr>
 
 // int_type overflow(int_type c = traits::eof());

diff  --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/pbackfail.pass.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/pbackfail.pass.cpp
index 95d410b31bbf4..94191a098246b 100644
--- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/pbackfail.pass.cpp
+++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/pbackfail.pass.cpp
@@ -10,6 +10,8 @@
 
 // <locale>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // wbuffer_convert<Codecvt, Elem, Tr>
 
 // int_type pbackfail(int_type c = traits::eof());

diff  --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/rdbuf.pass.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/rdbuf.pass.cpp
index 3d5d3b3e3c8c1..c9c134592bf6b 100644
--- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/rdbuf.pass.cpp
+++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/rdbuf.pass.cpp
@@ -8,6 +8,8 @@
 
 // <locale>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // wbuffer_convert<Codecvt, Elem, Tr>
 
 // streambuf *rdbuf(streambuf *bytebuf);

diff  --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/seekoff.pass.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/seekoff.pass.cpp
index e0246144da2f0..2d800b57e7b75 100644
--- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/seekoff.pass.cpp
+++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/seekoff.pass.cpp
@@ -8,6 +8,8 @@
 
 // <locale>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // wbuffer_convert<Codecvt, Elem, Tr>
 
 // pos_type seekoff(off_type off, ios_base::seekdir way,

diff  --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/state.pass.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/state.pass.cpp
index 6dca17ca76e8f..57058d148feec 100644
--- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/state.pass.cpp
+++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/state.pass.cpp
@@ -8,6 +8,8 @@
 
 // <locale>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // wbuffer_convert<Codecvt, Elem, Tr>
 
 // state_type state() const;

diff  --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/test.pass.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/test.pass.cpp
index c201d20c6cfc7..244670d488aa5 100644
--- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/test.pass.cpp
+++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/test.pass.cpp
@@ -8,6 +8,8 @@
 
 // <locale>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // wbuffer_convert<Codecvt, Elem, Tr>
 
 // XFAIL: no-wide-characters

diff  --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.pass.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.pass.cpp
index 23ceedf9437c0..409a1b4639afc 100644
--- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.pass.cpp
+++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.pass.cpp
@@ -10,6 +10,8 @@
 
 // <locale>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // wbuffer_convert<Codecvt, Elem, Tr>
 
 // int_type underflow();

diff  --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp
index 5d5504ac10512..e1b1f69e81deb 100644
--- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp
+++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp
@@ -8,6 +8,8 @@
 
 // <locale>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
 
 // size_t converted() const;

diff  --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt.pass.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt.pass.cpp
index 6c62c551ff36c..8c0321049663d 100644
--- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt.pass.cpp
+++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt.pass.cpp
@@ -8,6 +8,8 @@
 
 // <locale>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
 
 // wstring_convert(Codecvt* pcvt = new Codecvt);          // before C++14

diff  --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt_state.pass.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt_state.pass.cpp
index 96f7b3b52d548..5032a301506d4 100644
--- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt_state.pass.cpp
+++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt_state.pass.cpp
@@ -8,6 +8,8 @@
 
 // <locale>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
 
 // wstring_convert(Codecvt* pcvt, state_type state);

diff  --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_copy.pass.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_copy.pass.cpp
index 2ca8862c79e12..4125869bfa3b8 100644
--- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_copy.pass.cpp
+++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_copy.pass.cpp
@@ -12,6 +12,8 @@
 
 // <locale>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
 
 // wstring_convert(wstring_convert const&) = delete;

diff  --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp
index 59d73e84e3f8d..f9e5ee3cd68a3 100644
--- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp
+++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp
@@ -8,6 +8,8 @@
 
 // <locale>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
 
 // wstring_convert(const byte_string& byte_err,

diff  --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/depr.verify.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/depr.verify.cpp
new file mode 100644
index 0000000000000..00fea5d0b1634
--- /dev/null
+++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/depr.verify.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14
+// UNSUPPORTED: no-wide-characters
+
+// <codecvt>
+
+// ensure that wstring_convert is marked as deprecated
+
+#include <codecvt>
+#include <locale>
+
+std::wstring_convert<std::codecvt_utf8<wchar_t>> c1; // expected-warning {{'wstring_convert<std::codecvt_utf8<wchar_t, 1114111, 0>>' is deprecated}}
+// expected-warning at -1 {{'codecvt_utf8<wchar_t, 1114111, 0>' is deprecated}}

diff  --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/from_bytes.pass.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/from_bytes.pass.cpp
index cfd9de68b2ac3..157b7454153bd 100644
--- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/from_bytes.pass.cpp
+++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/from_bytes.pass.cpp
@@ -8,6 +8,8 @@
 
 // <locale>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
 
 // wide_string from_bytes(char byte);

diff  --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/state.pass.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/state.pass.cpp
index 5ddfc64725151..3bf3736a7bcef 100644
--- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/state.pass.cpp
+++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/state.pass.cpp
@@ -8,6 +8,8 @@
 
 // <locale>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
 
 // state_type state() const;

diff  --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/to_bytes.pass.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/to_bytes.pass.cpp
index 247376976a454..52c5897634d04 100644
--- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/to_bytes.pass.cpp
+++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/to_bytes.pass.cpp
@@ -8,6 +8,8 @@
 
 // <locale>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
 
 // byte_string to_bytes(Elem wchar);

diff  --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/types.pass.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/types.pass.cpp
index 82cb9dcfda521..0ea13e2ce3836 100644
--- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/types.pass.cpp
+++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/types.pass.cpp
@@ -8,6 +8,8 @@
 
 // <locale>
 
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 // template<class Codecvt, class Elem = wchar_t,
 //          class Wide_alloc = allocator<Elem>,
 //          class Byte_alloc = allocator<char>>

diff  --git a/libcxx/test/support/platform_support.h b/libcxx/test/support/platform_support.h
index 1ceb7b1637320..7429b03f4eea9 100644
--- a/libcxx/test/support/platform_support.h
+++ b/libcxx/test/support/platform_support.h
@@ -14,6 +14,8 @@
 #ifndef PLATFORM_SUPPORT_H
 #define PLATFORM_SUPPORT_H
 
+#include "test_macros.h"
+
 // locale names
 #define LOCALE_en_US           "en_US"
 #define LOCALE_en_US_UTF_8     "en_US.UTF-8"
@@ -88,6 +90,7 @@ std::string get_temp_file_name()
 #endif
 }
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 #ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
 inline
 std::wstring get_wide_temp_file_name()
@@ -96,6 +99,7 @@ std::wstring get_wide_temp_file_name()
         get_temp_file_name());
 }
 #endif // _LIBCPP_HAS_OPEN_WITH_WCHAR
+_LIBCPP_SUPPRESS_DEPRECATED_POP
 
 #if defined(_CS_GNU_LIBC_VERSION)
 inline bool glibc_version_less_than(char const* version) {


        


More information about the libcxx-commits mailing list