Pushed to trunk now.

On Thu, 20 Jun 2024 at 16:38, Jonathan Wakely <jwak...@redhat.com> wrote:
>
> Tested x86_64-linux.
>
> -- >8 --
>
> 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.
> ---
>  .../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
> --
> 2.45.2
>

Reply via email to