]> gcc.gnu.org Git - gcc.git/commitdiff
libstdc++: Add deprecation warnings to <strstream> types
authorJonathan Wakely <jwakely@redhat.com>
Sun, 7 Apr 2024 13:12:25 +0000 (14:12 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 21 Jun 2024 09:19:35 +0000 (10:19 +0100)
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.

libstdc++-v3/include/backward/backward_warning.h
libstdc++-v3/include/backward/strstream

index 3f3330327d4ec25d3b9040d586d0f608ac620b20..834fc5680cc6069d74642106f8c03ff45278c1dc 100644 (file)
   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
index 152e93767f61fdd7229d1742be018479cdd3c9d5..5e4211433857a8e2ccdb19c9099c5e76a05bb48f 100644 (file)
@@ -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
This page took 0.067916 seconds and 5 git commands to generate.