[PATCH 2/2] libstdc++: Implement C++26 std::indirect [PR119152]
Daniel Krügler
daniel.kruegler@gmail.com
Thu May 22 12:22:56 GMT 2025
Am Do., 22. Mai 2025 um 11:48 Uhr schrieb Tomasz Kamiński <
tkaminsk@redhat.com>:
> From: Jonathan Wakely <jwakely@redhat.com>
>
> This papers implements C++27 std::indirect as specified
> in P3019 with ammendment to move assgiment from LWG 4251.
>
> PR libstdc++/119152
>
> libstdc++-v3/ChangeLog:
>
> * include/Makefile.am: Add new header.
> * include/Makefile.in: Regenerate.
> * include/bits/indirect.h: New file.
> * include/bits/version.def (indirect): Define.
> * include/bits/version.h: Regenerate.
> * include/std/memory: Include new header.
> * testsuite/std/memory/indirect/copy.cc
> * testsuite/std/memory/indirect/copy_alloc.cc
> * testsuite/std/memory/indirect/ctor.cc
> * testsuite/std/memory/indirect/incomplete.cc
> * testsuite/std/memory/indirect/invalid_neg.cc
> * testsuite/std/memory/indirect/move.cc
> * testsuite/std/memory/indirect/move_alloc.cc
> * testsuite/std/memory/indirect/relops.cc
>
> Co-Authored-By: Tomasz Kamiński <tkaminsk@redhat.com>
> Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
> ---
> Tested on x86_64-linux. OK for trunk?
>
> libstdc++-v3/include/Makefile.am | 1 +
> libstdc++-v3/include/Makefile.in | 1 +
> libstdc++-v3/include/bits/indirect.h | 459 ++++++++++++++++++
> libstdc++-v3/include/bits/version.def | 9 +
> libstdc++-v3/include/bits/version.h | 10 +
> libstdc++-v3/include/std/memory | 5 +
> .../testsuite/std/memory/indirect/copy.cc | 121 +++++
> .../std/memory/indirect/copy_alloc.cc | 228 +++++++++
> .../testsuite/std/memory/indirect/ctor.cc | 203 ++++++++
> .../std/memory/indirect/incomplete.cc | 38 ++
> .../std/memory/indirect/invalid_neg.cc | 28 ++
> .../testsuite/std/memory/indirect/move.cc | 144 ++++++
> .../std/memory/indirect/move_alloc.cc | 296 +++++++++++
> .../testsuite/std/memory/indirect/relops.cc | 82 ++++
> 14 files changed, 1625 insertions(+)
> create mode 100644 libstdc++-v3/include/bits/indirect.h
> create mode 100644 libstdc++-v3/testsuite/std/memory/indirect/copy.cc
> create mode 100644
> libstdc++-v3/testsuite/std/memory/indirect/copy_alloc.cc
> create mode 100644 libstdc++-v3/testsuite/std/memory/indirect/ctor.cc
> create mode 100644
> libstdc++-v3/testsuite/std/memory/indirect/incomplete.cc
> create mode 100644
> libstdc++-v3/testsuite/std/memory/indirect/invalid_neg.cc
> create mode 100644 libstdc++-v3/testsuite/std/memory/indirect/move.cc
> create mode 100644
> libstdc++-v3/testsuite/std/memory/indirect/move_alloc.cc
> create mode 100644 libstdc++-v3/testsuite/std/memory/indirect/relops.cc
>
> diff --git a/libstdc++-v3/include/Makefile.am
> b/libstdc++-v3/include/Makefile.am
> index 3e5b6c4142e..b67d470c27e 100644
> --- a/libstdc++-v3/include/Makefile.am
> +++ b/libstdc++-v3/include/Makefile.am
> @@ -210,6 +210,7 @@ bits_headers = \
> ${bits_srcdir}/gslice_array.h \
> ${bits_srcdir}/hashtable.h \
> ${bits_srcdir}/hashtable_policy.h \
> + ${bits_srcdir}/indirect.h \
> ${bits_srcdir}/indirect_array.h \
> ${bits_srcdir}/ios_base.h \
> ${bits_srcdir}/istream.tcc \
> diff --git a/libstdc++-v3/include/Makefile.in
> b/libstdc++-v3/include/Makefile.in
> index 3531162b5f7..6f7f2be68fd 100644
> --- a/libstdc++-v3/include/Makefile.in
> +++ b/libstdc++-v3/include/Makefile.in
> @@ -563,6 +563,7 @@ bits_freestanding = \
> @GLIBCXX_HOSTED_TRUE@ ${bits_srcdir}/gslice_array.h \
> @GLIBCXX_HOSTED_TRUE@ ${bits_srcdir}/hashtable.h \
> @GLIBCXX_HOSTED_TRUE@ ${bits_srcdir}/hashtable_policy.h \
> +@GLIBCXX_HOSTED_TRUE@ ${bits_srcdir}/indirect.h \
> @GLIBCXX_HOSTED_TRUE@ ${bits_srcdir}/indirect_array.h \
> @GLIBCXX_HOSTED_TRUE@ ${bits_srcdir}/ios_base.h \
> @GLIBCXX_HOSTED_TRUE@ ${bits_srcdir}/istream.tcc \
> diff --git a/libstdc++-v3/include/bits/indirect.h
> b/libstdc++-v3/include/bits/indirect.h
> new file mode 100644
> index 00000000000..32b2af9117d
> --- /dev/null
> +++ b/libstdc++-v3/include/bits/indirect.h
> @@ -0,0 +1,459 @@
> +// Vocabulary Types for Composite Class Design -*- C++ -*-
> +
> +// Copyright The GNU Toolchain Authors.
> +//
> +// This file is part of the GNU ISO C++ Library. This library is free
> +// software; you can redistribute it and/or modify it under the
> +// terms of the GNU General Public License as published by the
> +// Free Software Foundation; either version 3, or (at your option)
> +// any later version.
> +
> +// This library is distributed in the hope that it will be useful,
> +// but WITHOUT ANY WARRANTY; without even the implied warranty of
> +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +// GNU General Public License for more details.
> +
> +// Under Section 7 of GPL version 3, you are granted additional
> +// permissions described in the GCC Runtime Library Exception, version
> +// 3.1, as published by the Free Software Foundation.
> +
> +// You should have received a copy of the GNU General Public License and
> +// a copy of the GCC Runtime Library Exception along with this program;
> +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
> +// <http://www.gnu.org/licenses/>.
> +
> +/** @file include/bits/indirect.h
> + * This is an internal header file, included by other library headers.
> + * Do not attempt to use it directly. @headername{memory} XXX right
> header?
>
Is the trailing "XXX right header?" a spurious comment that should be
actually removed?
- Daniel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20250522/59575115/attachment-0001.htm>
More information about the Libstdc++
mailing list