[libc++] Deprecate the classes in strstream.

These have been deprecated since their initial version in libc++. It
seems they were never properly marked as deprecated.

Discovered while working on D151223.

Reviewed By: #libc, ldionne, philnik

Differential Revision: https://reviews.llvm.org/D151474
This commit is contained in:
Mark de Wever 2023-05-25 20:02:50 +02:00
parent 8c5ad4a0e2
commit 66c7388c83
49 changed files with 159 additions and 10 deletions

View File

@ -105,6 +105,9 @@ Deprecations and Removals
- The ``_LIBCPP_ABI_OLD_LOGNORMAL_DISTRIBUTION`` macro has been removed.
- The classes ``strstreambuf`` , ``istrstream``, ``ostrstream``, and ``strstream`` have been deprecated.
They have been deprecated in the Standard since C++98, but were never marked as deprecated in libc++.
Upcoming Deprecations and Removals
----------------------------------

View File

@ -141,7 +141,7 @@ private:
_LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_TYPE_VIS strstreambuf
class _LIBCPP_DEPRECATED _LIBCPP_TYPE_VIS strstreambuf
: public streambuf
{
public:
@ -237,7 +237,7 @@ strstreambuf::operator=(strstreambuf&& __rhs)
#endif // _LIBCPP_CXX03_LANG
class _LIBCPP_TYPE_VIS istrstream
class _LIBCPP_DEPRECATED _LIBCPP_TYPE_VIS istrstream
: public istream
{
public:
@ -290,7 +290,7 @@ private:
strstreambuf __sb_;
};
class _LIBCPP_TYPE_VIS ostrstream
class _LIBCPP_DEPRECATED _LIBCPP_TYPE_VIS ostrstream
: public ostream
{
public:
@ -343,7 +343,7 @@ private:
strstreambuf __sb_; // exposition only
};
class _LIBCPP_TYPE_VIS strstream
class _LIBCPP_DEPRECATED _LIBCPP_TYPE_VIS strstream
: public iostream
{
public:

View File

@ -6,6 +6,10 @@
//
//===----------------------------------------------------------------------===//
// REQUIRES: c++03 || c++11 || c++14
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <ios>
//
// class ios_base
@ -22,10 +26,8 @@
int main(int, char**)
{
#if TEST_STD_VER <= 14
std::strstream::io_state b = std::strstream::eofbit;
assert(b == std::ios::eofbit);
#endif
return 0;
}

View File

@ -6,6 +6,10 @@
//
//===----------------------------------------------------------------------===//
// REQUIRES: c++03 || c++11 || c++14
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <ios>
//
// class ios_base
@ -22,10 +26,8 @@
int main(int, char**)
{
#if TEST_STD_VER <= 14
std::strstream::open_mode b = std::strstream::app;
assert(b == std::ios::app);
#endif
return 0;
}

View File

@ -6,6 +6,10 @@
//
//===----------------------------------------------------------------------===//
// REQUIRES: c++03 || c++11 || c++14
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <ios>
//
// class ios_base
@ -22,10 +26,8 @@
int main(int, char**)
{
#if TEST_STD_VER <= 14
std::strstream::seek_dir b = std::strstream::cur;
assert(b == std::ios::cur);
#endif
return 0;
}

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class istrstream

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class istrstream

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class istrstream

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class istrstream

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class istrstream

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class istrstream

View File

@ -0,0 +1,15 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
// <strstream>
// check that istrstream is marked deprecated
#include <strstream>
std::istrstream s("abc"); // expected-warning {{'istrstream' is deprecated}}

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class istrstream

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class ostrstream

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class ostrstream

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class ostrstream

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class ostrstream

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class ostrstream

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class ostrstream

View File

@ -0,0 +1,15 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
// <strstream>
// check that ostrstream is marked deprecated
#include <strstream>
std::ostrstream s; // expected-warning {{'ostrstream' is deprecated}}

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class ostrstream

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstream

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstream

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstream

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstream

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstream

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstream

View File

@ -0,0 +1,15 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
// <strstream>
// check that strstream is marked deprecated
#include <strstream>
std::strstream s; // expected-warning {{'strstream' is deprecated}}

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstream

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstreambuf

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstreambuf

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstreambuf

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstreambuf

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstreambuf

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstreambuf

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstreambuf

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstreambuf

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstreambuf

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstreambuf

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstreambuf

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstreambuf

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstreambuf

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstreambuf

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstreambuf

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstreambuf

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstreambuf

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstreambuf

View File

@ -0,0 +1,15 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
// <strstream>
// check that strstreambuf is marked deprecated
#include <strstream>
std::strstreambuf s; // expected-warning {{'strstreambuf' is deprecated}}

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
// <strstream>
// class strstreambuf