public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Thomas Rodgers <rodgert@appliantology.com>
Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org, trodgers@redhat.com
Subject: Re: [PATCH] libstdc++: Add c++2a <syncstream>
Date: Thu, 15 Oct 2020 19:18:21 +0100	[thread overview]
Message-ID: <20201015181821.GI3402@redhat.com> (raw)
In-Reply-To: <20201015144606.1402141-1-rodgert@appliantology.com>

On 15/10/20 07:46 -0700, Thomas Rodgers wrote:
>From: Thomas Rodgers <trodgers@redhat.com>
>
>* Note: depends on a sufficiently C++20ified basic_stringbuf<>.
>
>libstdc++/Changelog:
>	libstdc++-v3/include/Makefile.am (std_headers): Add new header.
>	libstdc++-v3/include/Makefile.in: Regenerate.
>	libstdc++-v3/include/std/streambuf
>        (__detail::__streambuf_core_access): Define.
>        (basic_streambuf): Befriend __detail::__streambuf_core_access.
>	libstdc++-v3/include/std/syncstream: New header.
>	libstdc++-v3/include/std/version: Add __cpp_lib_syncbuf:
>	libstdc++-v3/testsuite/27_io/basic_syncbuf/1.cc: New test.
>	libstdc++-v3/testsuite/27_io/basic_syncbuf/2.cc: Likewise.
>	libstdc++-v3/testsuite/27_io/basic_syncbuf/basic_ops/1.cc:
>        Likewise.
>	libstdc++-v3/testsuite/27_io/basic_syncbuf/requirements/types.cc:
>        Likewise.
>	libstdc++-v3/testsuite/27_io/basic_syncbuf/sync_ops/1.cc:
>        Likewise.
>	libstdc++-v3/testsuite/27_io/basic_syncstream/1.cc: Likewise.
>	libstdc++-v3/testsuite/27_io/basic_syncstream/2.cc: Likewise.
>	libstdc++-v3/testsuite/27_io/basic_syncstream/basic_ops/1.cc:
>        Likewise.
>	libstdc++-v3/testsuite/27_io/basic_syncstream/requirements/types.cc:
>        Likewise.
>
>---
> libstdc++-v3/include/Makefile.am              |   1 +
> libstdc++-v3/include/Makefile.in              |   1 +
> libstdc++-v3/include/std/streambuf            |  81 +++++
> libstdc++-v3/include/std/syncstream           | 333 ++++++++++++++++++
> libstdc++-v3/include/std/version              |   4 +
> .../testsuite/27_io/basic_syncbuf/1.cc        |  28 ++
> .../testsuite/27_io/basic_syncbuf/2.cc        |  27 ++
> .../27_io/basic_syncbuf/basic_ops/1.cc        | 138 ++++++++
> .../27_io/basic_syncbuf/requirements/types.cc |  42 +++
> .../27_io/basic_syncbuf/sync_ops/1.cc         | 130 +++++++
> .../testsuite/27_io/basic_syncstream/1.cc     |  28 ++
> .../testsuite/27_io/basic_syncstream/2.cc     |  27 ++
> .../27_io/basic_syncstream/basic_ops/1.cc     | 135 +++++++
> .../basic_syncstream/requirements/types.cc    |  43 +++
> 14 files changed, 1018 insertions(+)
> create mode 100644 libstdc++-v3/include/std/syncstream
> create mode 100644 libstdc++-v3/testsuite/27_io/basic_syncbuf/1.cc
> create mode 100644 libstdc++-v3/testsuite/27_io/basic_syncbuf/2.cc
> create mode 100644 libstdc++-v3/testsuite/27_io/basic_syncbuf/basic_ops/1.cc
> create mode 100644 libstdc++-v3/testsuite/27_io/basic_syncbuf/requirements/types.cc
> create mode 100644 libstdc++-v3/testsuite/27_io/basic_syncbuf/sync_ops/1.cc
> create mode 100644 libstdc++-v3/testsuite/27_io/basic_syncstream/1.cc
> create mode 100644 libstdc++-v3/testsuite/27_io/basic_syncstream/2.cc
> create mode 100644 libstdc++-v3/testsuite/27_io/basic_syncstream/basic_ops/1.cc
> create mode 100644 libstdc++-v3/testsuite/27_io/basic_syncstream/requirements/types.cc
>
>diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
>index 28d273924ee..61aaff7a2f4 100644
>--- a/libstdc++-v3/include/Makefile.am
>+++ b/libstdc++-v3/include/Makefile.am
>@@ -73,6 +73,7 @@ std_headers = \
> 	${std_srcdir}/shared_mutex \
> 	${std_srcdir}/span \
> 	${std_srcdir}/sstream \
>+	${std_srcdir}/syncstream \
> 	${std_srcdir}/stack \
> 	${std_srcdir}/stdexcept \
> 	${std_srcdir}/stop_token \
>diff --git a/libstdc++-v3/include/std/streambuf b/libstdc++-v3/include/std/streambuf
>index cae35e75bda..d6053e4c1ed 100644
>--- a/libstdc++-v3/include/std/streambuf
>+++ b/libstdc++-v3/include/std/streambuf
>@@ -48,6 +48,84 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>
> #define _IsUnused __attribute__ ((__unused__))
>
>+  template<typename _CharT, typename _Traits>
>+    class basic_streambuf;
>+
>+#if __cplusplus > 201703L
>+  namespace __detail
>+  {
>+    struct __streambuf_core_access
>+    {
>+      template<typename _CharT, typename _Traits>
>+	static void
>+	_S_imbue(basic_streambuf<_CharT, _Traits>& __b, const locale& __loc)
>+	{ __b.imbue(__loc); }
>+
>+      template<typename _CharT, typename _Traits>
>+	static basic_streambuf<_CharT, _Traits>*
>+	_S_setbuf(basic_streambuf<_CharT, _Traits>& __b,
>+		  _CharT* __c, streamsize __n)
>+	{ return __b.setbuf(__c, __n); }
>+
>+      template<typename _CharT, typename _Traits>
>+	static typename _Traits::pos_type
>+	_S_seekoff(basic_streambuf<_CharT, _Traits>& __b,
>+		   typename _Traits::off_type __off, ios_base::seekdir __dir,
>+		   ios_base::openmode __mode)
>+	  { return __b.seekoff(__off, __dir, __mode); }
>+
>+      template<typename _CharT, typename _Traits>
>+	static typename _Traits::pos_type
>+	_S_seekpos(basic_streambuf<_CharT, _Traits>& __b,
>+		   typename _Traits::pos_type __pos, ios_base::openmode __mode)
>+	{ return __b.seekpos(__pos, __mode); }
>+
>+      template<typename _CharT, typename _Traits>
>+	static int
>+	_S_sync(basic_streambuf<_CharT, _Traits>& __b)
>+	{ return __b.sync(); }
>+
>+      template<typename _CharT, typename _Traits>
>+	static streamsize
>+	_S_showmanyc(basic_streambuf<_CharT, _Traits>& __b)
>+	{ return __b.showmanyc(); }
>+
>+      template<typename _CharT, typename _Traits>
>+	static streamsize
>+	_S_xsgetn(basic_streambuf<_CharT, _Traits>& __b, _CharT* __s, streamsize __n)
>+	{ return __b.xsgetn(__s, __n); }
>+
>+      template<typename _CharT, typename _Traits>
>+	static typename _Traits::int_type
>+	_S_underflow(basic_streambuf<_CharT, _Traits>& __b)
>+	{ return __b.underflow(); }
>+
>+      template<typename _CharT, typename _Traits>
>+	static typename _Traits::int_type
>+	_S_uflow(basic_streambuf<_CharT, _Traits>& __b)
>+	{ return __b.uflow(); }
>+
>+      template<typename _CharT, typename _Traits>
>+	static typename _Traits::int_type
>+	_S_pbackfail(basic_streambuf<_CharT, _Traits>& __b,
>+		     typename _Traits::int_type __c)
>+	{ return __b.pbackfail(__c); }
>+
>+      template<typename _CharT, typename _Traits>
>+	static streamsize
>+	_S_xsputn(basic_streambuf<_CharT, _Traits>& __b,
>+	       const typename _Traits::char_type* __s, streamsize __n)
>+	{ return __b.xsputn(__s, __n); }
>+
>+      template<typename _CharT, typename _Traits>
>+	typename _Traits::int_type
>+	_S_overflow(basic_streambuf<_CharT, _Traits>& __b,
>+		    typename _Traits::int_type __c)
>+	{ return __b.overflow(__c); }
>+    };
>+  }
>+#endif // C++20
>+
>   template<typename _CharT, typename _Traits>
>     streamsize
>     __copy_streambufs_eof(basic_streambuf<_CharT, _Traits>*,
>@@ -456,6 +534,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>       { return this->xsputn(__s, __n); }
>
>     protected:
>+#if __cplusplus > 201703L
>+      friend __detail::__streambuf_core_access;
>+#endif
>       /**
>        *  @brief  Base constructor.
>        *
>diff --git a/libstdc++-v3/include/std/syncstream b/libstdc++-v3/include/std/syncstream
>new file mode 100644
>index 00000000000..0a034ed03f4
>--- /dev/null
>+++ b/libstdc++-v3/include/std/syncstream
>@@ -0,0 +1,333 @@
>+// <syncstream> -*- C++ -*-
>+
>+// Copyright (C) 2020 Free Software Foundation, Inc.
>+//
>+// 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;

Two cases of "__a" above that should be just "a". That seems to have
come from <concepts> which I then copied to <ranges>. Oops. I'll take
care of fixing those.


  parent reply	other threads:[~2020-10-15 18:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-15 14:46 Thomas Rodgers
2020-10-15 18:13 ` Jonathan Wakely
2020-10-15 18:18 ` Jonathan Wakely [this message]
2020-10-15 19:29 ` Jonathan Wakely
2020-10-16  0:24   ` Thomas Rodgers
2020-10-21 16:53   ` Thomas Rodgers
2020-10-21 17:34     ` Jonathan Wakely
2020-10-21 19:39       ` Thomas Rodgers
2020-10-29 16:18     ` Jonathan Wakely
2020-10-29 21:12       ` Thomas Rodgers
2020-11-02 15:58         ` Thomas Rodgers
2020-11-02 16:10         ` Thomas Rodgers
2020-11-02 17:38           ` Jonathan Wakely
2020-11-02 18:43             ` Thomas Rodgers
2020-11-03 21:22               ` Christophe Lyon
2020-11-03 22:00                 ` Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201015181821.GI3402@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    --cc=rodgert@appliantology.com \
    --cc=trodgers@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).