From: Jonathan Wakely Date: Sun, 7 Apr 2024 13:12:25 +0000 (+0100) Subject: libstdc++: Add deprecation warnings to types X-Git-Tag: basepoints/gcc-16~8017 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=577225a268ad203647746d4ae98620da0354d0a0;p=thirdparty%2Fgcc.git libstdc++: Add deprecation warnings to types libstdc++-v3/ChangeLog: * include/backward/backward_warning.h: Adjust comments to suggest as another alternative to . * include/backward/strstream (strstreambuf, istrstream) (ostrstream, strstream): Add deprecated attribute. --- 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: - , basic_stringbuf , strstreambuf - , basic_istringstream , istrstream - , basic_ostringstream , ostrstream - , basic_stringstream , strstream + , stringbuf + or , spanbuf , strstreambuf + , istringstream + or , ispanstream , istrstream + , ostringstream + or , ospanstream , ostrstream + , stringstream + or , spanstream , strstream , unordered_set , hash_set , unordered_multiset , hash_multiset , unordered_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 > @@ -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 @@ -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 @@ -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 @@ -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