[gcc r15-1536] libstdc++: Add deprecation warnings to <strstream> types
Jonathan Wakely
redi@gcc.gnu.org
Fri Jun 21 09:21:02 GMT 2024
https://gcc.gnu.org/g:577225a268ad203647746d4ae98620da0354d0a0
commit r15-1536-g577225a268ad203647746d4ae98620da0354d0a0
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Sun Apr 7 14:12:25 2024 +0100
libstdc++: Add deprecation warnings to <strstream> types
libstdc++-v3/ChangeLog:
* include/backward/backward_warning.h: Adjust comments to
suggest <spanstream> as another alternative to <strstream>.
* include/backward/strstream (strstreambuf, istrstream)
(ostrstream, strstream): Add deprecated attribute.
Diff:
---
libstdc++-v3/include/backward/backward_warning.h | 12 ++++++++----
libstdc++-v3/include/backward/strstream | 20 ++++++++++++++++----
2 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/libstdc++-v3/include/backward/backward_warning.h b/libstdc++-v3/include/backward/backward_warning.h
index 3f3330327d4..834fc5680cc 100644
--- a/libstdc++-v3/include/backward/backward_warning.h
+++ b/libstdc++-v3/include/backward/backward_warning.h
@@ -40,10 +40,14 @@
A list of valid replacements is as follows:
Use: Instead of:
- <sstream>, basic_stringbuf <strstream>, strstreambuf
- <sstream>, basic_istringstream <strstream>, istrstream
- <sstream>, basic_ostringstream <strstream>, ostrstream
- <sstream>, basic_stringstream <strstream>, strstream
+ <sstream>, stringbuf
+ or <spanstream>, spanbuf <strstream>, strstreambuf
+ <sstream>, istringstream
+ or <spanstream>, ispanstream <strstream>, istrstream
+ <sstream>, ostringstream
+ or <spanstream>, ospanstream <strstream>, ostrstream
+ <sstream>, stringstream
+ or <spanstream>, spanstream <strstream>, strstream
<unordered_set>, unordered_set <ext/hash_set>, hash_set
<unordered_set>, unordered_multiset <ext/hash_set>, hash_multiset
<unordered_map>, unordered_map <ext/hash_map>, hash_map
diff --git a/libstdc++-v3/include/backward/strstream b/libstdc++-v3/include/backward/strstream
index 152e93767f6..5e421143385 100644
--- a/libstdc++-v3/include/backward/strstream
+++ b/libstdc++-v3/include/backward/strstream
@@ -57,6 +57,12 @@ namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+#if __glibcxx_spanstream
+# define _GLIBCXX_STRSTREAM_DEPR(A, B) _GLIBCXX_DEPRECATED_SUGGEST(A "' or '" B)
+#else
+# define _GLIBCXX_STRSTREAM_DEPR(A, B) _GLIBCXX_DEPRECATED_SUGGEST(A)
+#endif
+
// Class strstreambuf, a streambuf class that manages an array of char.
// Note that this class is not a template.
class strstreambuf : public basic_streambuf<char, char_traits<char> >
@@ -151,7 +157,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
bool _M_dynamic : 1;
bool _M_frozen : 1;
bool _M_constant : 1;
- };
+ } _GLIBCXX_STRSTREAM_DEPR("std::stringbuf", "std::spanbuf");
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// Class istrstream, an istream that manages a strstreambuf.
class istrstream : public basic_istream<char>
@@ -176,7 +185,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
private:
strstreambuf _M_buf;
- };
+ } _GLIBCXX_STRSTREAM_DEPR("std::istringstream", "std::ispanstream");
// Class ostrstream
class ostrstream : public basic_ostream<char>
@@ -201,7 +210,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
private:
strstreambuf _M_buf;
- };
+ } _GLIBCXX_STRSTREAM_DEPR("std::ostringstream", "std::ospanstream");
// Class strstream
class strstream : public basic_iostream<char>
@@ -231,7 +240,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
private:
strstreambuf _M_buf;
- };
+ } _GLIBCXX_STRSTREAM_DEPR("std::stringstream", "std::spanstream");
+
+#undef _GLIBCXX_STRSTREAM_DEPR
+#pragma GCC diagnostic pop
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
More information about the Gcc-cvs
mailing list