[PATCH 1/2] libstdc++: Deprecate __gnu_pbds extensions [PR127690]

Tomasz Kaminski tkaminsk@redhat.com
Thu Nov 12 16:41:50 GMT 2026


On Fri, Oct 30, 2026 at 1:48 AM Jonathan Wakely <jwakely@redhat.com> wrote:

> libstdc++-v3/ChangeLog:
>
>         PR libstdc++/127690
>         * include/ext/pb_ds/tag_and_trait.hpp: Add #warning and
>         @deprecated comment.
>         * scripts/testsuite_flags.in: Add macro to suppress new warning.
> ---
>
> We can do this for GCC 17 and then remove them for GCC 18.
>
LGTM.

>
> I will be forking this code to a separate repo (retaining the full git
> history from the GCC repo) and publishing it in a separate repo. Maybe
> on forge.sourceware.org.
>
> That will mean the code is still available, but it can be maintained
> independently of libstdc++ (and can be somebody else's problem).
>
>  libstdc++-v3/doc/html/manual/api.html            | 3 +++
>  libstdc++-v3/doc/xml/manual/evolution.xml        | 5 +++++
>  libstdc++-v3/include/ext/pb_ds/tag_and_trait.hpp | 9 ++++++++-
>  libstdc++-v3/scripts/testsuite_flags.in          | 3 ++-
>  4 files changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/libstdc++-v3/doc/html/manual/api.html
> b/libstdc++-v3/doc/html/manual/api.html
> index da86978b379c..60c87722ac5f 100644
> --- a/libstdc++-v3/doc/html/manual/api.html
> +++ b/libstdc++-v3/doc/html/manual/api.html
> @@ -524,4 +524,7 @@ construction from <code
> class="classname">std::promise</code> and
>  <code class="code">std::numeric_limits::has_denorm_loss</code>,
>  and <code class="code">enum std::float_denorm_style</code> and its
> enumerators
>  were deprecated for C++23.
> +</p><p>
> +Policy-based data structures in namespace <code
> class="code">__gnu_pbds</code>
> +were deprecated.
>  </p></div></div><div class="navfooter"><hr /><table width="100%"
> summary="Navigation footer"><tr><td width="40%" align="left"><a
> accesskey="p" href="abi.html">Prev</a> </td><td width="20%"
> align="center"><a accesskey="u" href="appendix_porting.html">Up</a></td><td
> width="40%" align="right"> <a accesskey="n"
> href="backwards.html">Next</a></td></tr><tr><td width="40%" align="left"
> valign="top">ABI Policy and Guidelines </td><td width="20%"
> align="center"><a accesskey="h" href="../index.html">Home</a></td><td
> width="40%" align="right" valign="top"> Backwards
> Compatibility</td></tr></table></div></body></html>
> \ No newline at end of file
> diff --git a/libstdc++-v3/doc/xml/manual/evolution.xml
> b/libstdc++-v3/doc/xml/manual/evolution.xml
> index f934504ce881..a864bdd1b925 100644
> --- a/libstdc++-v3/doc/xml/manual/evolution.xml
> +++ b/libstdc++-v3/doc/xml/manual/evolution.xml
> @@ -1178,6 +1178,11 @@ and <code>enum std::float_denorm_style</code> and
> its enumerators
>  were deprecated for C++23.
>  </para>
>
> +<para>
> +Policy-based data structures in namespace <code>__gnu_pbds</code>
> +were deprecated.
> +</para>
> +
>  </section>
>
>  </section>
> diff --git a/libstdc++-v3/include/ext/pb_ds/tag_and_trait.hpp
> b/libstdc++-v3/include/ext/pb_ds/tag_and_trait.hpp
> index bdfb9cd93b5e..292f480cf0a7 100644
> --- a/libstdc++-v3/include/ext/pb_ds/tag_and_trait.hpp
> +++ b/libstdc++-v3/include/ext/pb_ds/tag_and_trait.hpp
> @@ -45,6 +45,11 @@
>  #include <bits/c++config.h>
>  #include <ext/pb_ds/detail/type_utils.hpp>
>
> +#if defined(__DEPRECATED) &&
> !defined(_GLIBCXX_PBDS_NO_DEPRECATION_WARNING)
> +# warning "libstdc++ __gnu_pbds extensions are deprecated"
> +# warning "define _GLIBCXX_PBDS_NO_DEPRECATION_WARNING to silence this"
> +#endif
> +
>  /**
>   * @namespace __gnu_pbds
>   * @brief GNU extensions for policy-based data structures for public use.
> @@ -63,12 +68,14 @@ namespace __gnu_pbds
>     *  For details, see:
>     *  http://gcc.gnu.org/onlinedocs/libstdc++/ext/pb_ds/index.html
>     *
> +   *  @deprecated The policy-based data structures will be removed from
> GCC.
> +   *
>     *  @{
>     */
>
>    /**
>     *  @defgroup tags Tags
> -   *  @{
> +   *  @{
>     */
>    /// A trivial iterator tag. Signifies that the iterators has none of
>    /// std::iterators's movement abilities.
> diff --git a/libstdc++-v3/scripts/testsuite_flags.in
> b/libstdc++-v3/scripts/testsuite_flags.in
> index e445f20329b0..3acd09ed1527 100755
> --- a/libstdc++-v3/scripts/testsuite_flags.in
> +++ b/libstdc++-v3/scripts/testsuite_flags.in
> @@ -58,7 +58,8 @@ case ${query} in
>      --cxxflags)
>        CXXFLAGS_default="-fmessage-length=0 -fno-show-column"
>        CXXFLAGS_config="@SECTION_FLAGS@ @EXTRA_CXX_FLAGS@"
> -      echo ${CXXFLAGS_default} ${CXXFLAGS_config}
> +      CXXFLAGS_pbds="-D_GLIBCXX_PBDS_NO_DEPRECATION_WARNING"
> +      echo ${CXXFLAGS_default} ${CXXFLAGS_config} ${CXXFLAGS_pbds}
>        ;;
>      --cxxvtvflags)
>        CXXFLAGS_vtv="@VTV_CXXFLAGS@"
> --
> 2.56.0
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20261112/dd19a65e/attachment-0001.htm>


More information about the Libstdc++ mailing list