Re: [PATCH] libstdc++: Implement C++20 features for

2020-11-05 Thread Jonathan Wakely via Gcc-patches

On 04/11/20 23:41 +, Jonathan Wakely wrote:

On 04/11/20 21:45 +, Jonathan Wakely wrote:

On 04/11/20 12:43 -0800, Thomas Rodgers wrote:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97719


On Nov 4, 2020, at 11:54 AM, Stephan Bergmann  wrote:

On 07/10/2020 18:55, Thomas Rodgers wrote:

From: Thomas Rodgers 
New ctors and ::view() accessor for -
* basic_stingbuf
* basic_istringstream
* basic_ostringstream
* basic_stringstreamm
New ::get_allocator() accessor for basic_stringbuf.

I found that this 
 
"libstdc++: Implement C++20 features for " changed the behavior of


$ cat test.cc
#include 
#include 
#include 
int main() {
std::stringstream s("a");
std::istreambuf_iterator i(s);
if (i != std::istreambuf_iterator()) std::cout << *i << '\n';
}
$ g++ -std=c++20 test.cc
$ ./a.out


from printing "a" to printing nothing.  (The `i != ...` comparison appears to change i 
from pointing at "a" to pointing to null, and returns false.)

I ran into this when building LibreOffice, and I hope test.cc is a faithfully 
minimized reproducer.  However, I know little about std::istreambuf_iterator, 
so it may well be that the code isn't even valid.



I'm testing this patch.


Tested powerpc64le-linux. Pushed now.


And this fixes some other bugs in the new constructors.

Tested powerpc64le-linux, pushed to trunk.

commit 432258be4f2cf4f0970f106db319e3dbab4ab13d
Author: Jonathan Wakely 
Date:   Thu Nov 5 12:16:13 2020

libstdc++: Fix new  constructors

- Add a missing 'explicit' to a basic_stringbuf constructor.
- Set up the get/put area pointers in the constructor from strings using
  different allocator types.
- Remove public basic_stringbuf::__sv_type alias.
- Do not construct temporary basic_string objects with a
  default-constructed allocator.

Also, change which basic_string constructor is used, as a minor
compile-time optimization. Constructing from a basic_string_view
requires more work from the compiler, so just use a pointer and length.

libstdc++-v3/ChangeLog:

* include/std/sstream (basic_stringbuf(const allocator_type&):
Add explicit.
(basic_stringbuf(const basic_string&, openmode, const A&)):
Call _M_stringbuf_init. Construct _M_string from pointer and length
to avoid constraint checks for string view.
(basic_stringbuf::view()): Make __sv_type alias local to the
function.
(basic_istringstream(const basic_string&, openmode, const A&)):
Pass string to _M_streambuf instead of constructing a temporary
with the wrong allocator.
(basic_ostringstream(const basic_string&, openmode, const A&)):
Likewise.
(basic_stringstream(const basic_string&, openmode, const A&)):
Likewise.
* src/c++20/sstream-inst.cc: Use string_view and wstring_view
typedefs in explicit instantiations.
* testsuite/27_io/basic_istringstream/cons/char/1.cc: Add more
tests for constructors.
* testsuite/27_io/basic_ostringstream/cons/char/1.cc: Likewise.
* testsuite/27_io/basic_stringbuf/cons/char/1.cc: Likewise.
* testsuite/27_io/basic_stringbuf/cons/char/2.cc: Likewise.
* testsuite/27_io/basic_stringbuf/cons/wchar_t/1.cc: Likewise.
* testsuite/27_io/basic_stringbuf/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/cons/char/1.cc: Likewise.

diff --git a/libstdc++-v3/include/std/sstream b/libstdc++-v3/include/std/sstream
index 276badfd9657..437e2ba2a5f8 100644
--- a/libstdc++-v3/include/std/sstream
+++ b/libstdc++-v3/include/std/sstream
@@ -166,8 +166,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
 #endif
 
 #if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI
-  using __sv_type = basic_string_view;
-
+  explicit
   basic_stringbuf(const allocator_type& __a)
   : basic_stringbuf(ios_base::in | std::ios_base::out, __a)
   { }
@@ -185,18 +184,18 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
   { _M_stringbuf_init(__mode); }
 
   template
-  basic_stringbuf(const basic_string<_CharT, _Traits, _SAlloc>& __s,
-		  const allocator_type& __a)
-  : basic_stringbuf(__s, ios_base::in | std::ios_base::out, __a)
-  { }
+	basic_stringbuf(const basic_string<_CharT, _Traits, _SAlloc>& __s,
+			const allocator_type& __a)
+	: basic_stringbuf(__s, ios_base::in | std::ios_base::out, __a)
+	{ }
 
   template
-  basic_stringbuf(const basic_string<_CharT, _Traits, _SAlloc>& __s,
-		  ios_base::openmode __mode,
-		  const allocator_type& __a)
-  : __streambuf_type(), _M_mode(__mode),
-  _M_string(static_cast<__sv_type>(__s), __a)
-  { }
+	basic_stringbuf(const basic_string<_CharT, _Traits, _SAlloc>& __s,
+			ios_base::openmode __mode,
+			const allocator_type& __a)
+	: 

Re: [PATCH] libstdc++: Implement C++20 features for

2020-11-04 Thread Jonathan Wakely via Gcc-patches

On 04/11/20 21:45 +, Jonathan Wakely wrote:

On 04/11/20 12:43 -0800, Thomas Rodgers wrote:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97719


On Nov 4, 2020, at 11:54 AM, Stephan Bergmann  wrote:

On 07/10/2020 18:55, Thomas Rodgers wrote:

From: Thomas Rodgers 
New ctors and ::view() accessor for -
 * basic_stingbuf
 * basic_istringstream
 * basic_ostringstream
 * basic_stringstreamm
New ::get_allocator() accessor for basic_stringbuf.

I found that this 
 
"libstdc++: Implement C++20 features for " changed the behavior of


$ cat test.cc
#include 
#include 
#include 
int main() {
std::stringstream s("a");
std::istreambuf_iterator i(s);
if (i != std::istreambuf_iterator()) std::cout << *i << '\n';
}
$ g++ -std=c++20 test.cc
$ ./a.out


from printing "a" to printing nothing.  (The `i != ...` comparison appears to change i 
from pointing at "a" to pointing to null, and returns false.)

I ran into this when building LibreOffice, and I hope test.cc is a faithfully 
minimized reproducer.  However, I know little about std::istreambuf_iterator, 
so it may well be that the code isn't even valid.



I'm testing this patch.


Tested powerpc64le-linux. Pushed now.



commit 1ca2fe0fc85403c6ea4e0775b5da051ff0eebc96
Author: Jonathan Wakely 
Date:   Wed Nov 4 21:44:05 2020

   libstdc++: Fix default mode of new basic_stringstream constructor [PR 97719]
   
   libstdc++-v3/ChangeLog:
   
   PR libstdc++/97719

   * include/std/sstream (basic_stringstream(string_type&&, openmode)):
   Fix default argument.
   * testsuite/27_io/basic_stringstream/cons/char/97719.cc: New test.

diff --git a/libstdc++-v3/include/std/sstream b/libstdc++-v3/include/std/sstream
index 33a00486606c..8acf1eb259ab 100644
--- a/libstdc++-v3/include/std/sstream
+++ b/libstdc++-v3/include/std/sstream
@@ -976,7 +976,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11

  explicit
  basic_stringstream(__string_type&& __str,
-ios_base::openmode __mode = ios_base::out
+ios_base::openmode __mode = ios_base::in
 | ios_base::out)
  : __iostream_type(), _M_stringbuf(std::move(__str), __mode)
  { this->init(std::__addressof(_M_stringbuf)); }
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringstream/cons/char/97719.cc 
b/libstdc++-v3/testsuite/27_io/basic_stringstream/cons/char/97719.cc
new file mode 100644
index ..fa523a803b6d
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringstream/cons/char/97719.cc
@@ -0,0 +1,40 @@
+// 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.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// .
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do run { target c++2a } }
+
+#include 
+#include 
+#include 
+
+void
+test01()
+{
+  // PR libstdc++/97719
+  std::string str = "a";
+  std::stringstream s(std::move(str));
+  std::istreambuf_iterator i(s);
+  VERIFY( i != std::istreambuf_iterator() );
+  VERIFY( *i == 'a' );
+}
+
+int
+main()
+{
+  test01();
+}




Re: [PATCH] libstdc++: Implement C++20 features for

2020-11-04 Thread Jonathan Wakely via Gcc-patches

On 04/11/20 12:43 -0800, Thomas Rodgers wrote:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97719


On Nov 4, 2020, at 11:54 AM, Stephan Bergmann  wrote:

On 07/10/2020 18:55, Thomas Rodgers wrote:

From: Thomas Rodgers 
New ctors and ::view() accessor for -
  * basic_stingbuf
  * basic_istringstream
  * basic_ostringstream
  * basic_stringstreamm
New ::get_allocator() accessor for basic_stringbuf.

I found that this 
 
"libstdc++: Implement C++20 features for " changed the behavior of


$ cat test.cc
#include 
#include 
#include 
int main() {
 std::stringstream s("a");
 std::istreambuf_iterator i(s);
 if (i != std::istreambuf_iterator()) std::cout << *i << '\n';
}
$ g++ -std=c++20 test.cc
$ ./a.out


from printing "a" to printing nothing.  (The `i != ...` comparison appears to change i 
from pointing at "a" to pointing to null, and returns false.)

I ran into this when building LibreOffice, and I hope test.cc is a faithfully 
minimized reproducer.  However, I know little about std::istreambuf_iterator, 
so it may well be that the code isn't even valid.



I'm testing this patch.


commit 1ca2fe0fc85403c6ea4e0775b5da051ff0eebc96
Author: Jonathan Wakely 
Date:   Wed Nov 4 21:44:05 2020

libstdc++: Fix default mode of new basic_stringstream constructor [PR 97719]

libstdc++-v3/ChangeLog:

PR libstdc++/97719
* include/std/sstream (basic_stringstream(string_type&&, openmode)):
Fix default argument.
* testsuite/27_io/basic_stringstream/cons/char/97719.cc: New test.

diff --git a/libstdc++-v3/include/std/sstream b/libstdc++-v3/include/std/sstream
index 33a00486606c..8acf1eb259ab 100644
--- a/libstdc++-v3/include/std/sstream
+++ b/libstdc++-v3/include/std/sstream
@@ -976,7 +976,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
 
   explicit
   basic_stringstream(__string_type&& __str,
-	 ios_base::openmode __mode = ios_base::out
+	 ios_base::openmode __mode = ios_base::in
 		 | ios_base::out)
   : __iostream_type(), _M_stringbuf(std::move(__str), __mode)
   { this->init(std::__addressof(_M_stringbuf)); }
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringstream/cons/char/97719.cc b/libstdc++-v3/testsuite/27_io/basic_stringstream/cons/char/97719.cc
new file mode 100644
index ..fa523a803b6d
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_stringstream/cons/char/97719.cc
@@ -0,0 +1,40 @@
+// 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.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// .
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do run { target c++2a } }
+
+#include 
+#include 
+#include 
+
+void
+test01()
+{
+  // PR libstdc++/97719
+  std::string str = "a";
+  std::stringstream s(std::move(str));
+  std::istreambuf_iterator i(s);
+  VERIFY( i != std::istreambuf_iterator() );
+  VERIFY( *i == 'a' );
+}
+
+int
+main()
+{
+  test01();
+}


Re: [PATCH] libstdc++: Implement C++20 features for

2020-11-04 Thread Thomas Rodgers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97719

> On Nov 4, 2020, at 11:54 AM, Stephan Bergmann  wrote:
> 
> On 07/10/2020 18:55, Thomas Rodgers wrote:
>> From: Thomas Rodgers 
>> New ctors and ::view() accessor for -
>>   * basic_stingbuf
>>   * basic_istringstream
>>   * basic_ostringstream
>>   * basic_stringstreamm
>> New ::get_allocator() accessor for basic_stringbuf.
> I found that this 
> 
>  "libstdc++: Implement C++20 features for " changed the behavior of
> 
>> $ cat test.cc
>> #include 
>> #include 
>> #include 
>> int main() {
>>  std::stringstream s("a");
>>  std::istreambuf_iterator i(s);
>>  if (i != std::istreambuf_iterator()) std::cout << *i << '\n';
>> }
>> $ g++ -std=c++20 test.cc
>> $ ./a.out
> 
> from printing "a" to printing nothing.  (The `i != ...` comparison appears to 
> change i from pointing at "a" to pointing to null, and returns false.)
> 
> I ran into this when building LibreOffice, and I hope test.cc is a faithfully 
> minimized reproducer.  However, I know little about std::istreambuf_iterator, 
> so it may well be that the code isn't even valid.
> 



Re: [PATCH] libstdc++: Implement C++20 features for

2020-11-04 Thread Stephan Bergmann via Gcc-patches

On 07/10/2020 18:55, Thomas Rodgers wrote:

From: Thomas Rodgers 

New ctors and ::view() accessor for -
   * basic_stingbuf
   * basic_istringstream
   * basic_ostringstream
   * basic_stringstreamm

New ::get_allocator() accessor for basic_stringbuf.
I found that this 
 
"libstdc++: Implement C++20 features for " changed the behavior of



$ cat test.cc
#include 
#include 
#include 
int main() {
  std::stringstream s("a");
  std::istreambuf_iterator i(s);
  if (i != std::istreambuf_iterator()) std::cout << *i << '\n';
}

$ g++ -std=c++20 test.cc
$ ./a.out


from printing "a" to printing nothing.  (The `i != ...` comparison 
appears to change i from pointing at "a" to pointing to null, and 
returns false.)


I ran into this when building LibreOffice, and I hope test.cc is a 
faithfully minimized reproducer.  However, I know little about 
std::istreambuf_iterator, so it may well be that the code isn't even valid.




Re: [PATCH] libstdc++: Implement C++20 features for

2020-10-30 Thread Rainer Orth
Hi Jonathan,

> On 29/10/20 21:06 +0100, Rainer Orth wrote:
>>Tightening the patterns as in the attached patch at least allows
>>libstdc++.so.6 to link on i386-pc-solaris2.11; full bootstrap still
>>running.  However, I can't tell if this is really correct.
>
> I think we want this attached patch instead. It tightens them up to
> exactly the symbols we actually need to export and no more. This will
> avoid needing to tighten them again in the near future when the new
> overloads of str() are added.

that's even better of course.

Thanks.
Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [PATCH] libstdc++: Implement C++20 features for

2020-10-29 Thread Jonathan Wakely via Gcc-patches

On 29/10/20 21:41 +, Jonathan Wakely wrote:

On 29/10/20 21:06 +0100, Rainer Orth wrote:

Tightening the patterns as in the attached patch at least allows
libstdc++.so.6 to link on i386-pc-solaris2.11; full bootstrap still
running.  However, I can't tell if this is really correct.


I think we want this attached patch instead. It tightens them up to
exactly the symbols we actually need to export and no more. This will
avoid needing to tighten them again in the near future when the new
overloads of str() are added.





diff --git a/libstdc++-v3/config/abi/pre/gnu.ver 
b/libstdc++-v3/config/abi/pre/gnu.ver
index 80994b203df..4dddfd3d263 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -1791,11 +1791,11 @@ GLIBCXX_3.4.21 {

_ZNSt7__cxx1119basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]ESt13_Ios_Openmode;

_ZNSt7__cxx1119basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EED[012]Ev;

_ZNSt7__cxx1119basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE[a34]*;
-_ZNKSt7__cxx1115basic_stringbuf*;
+_ZNKSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE3strEv;
_ZNKSt7__cxx1118basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE3strEv;

_ZNKSt7__cxx1118basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE5rdbufEv;
-_ZNKSt7__cxx1119basic_istringstream*;
-_ZNKSt7__cxx1119basic_ostringstream*;
+
_ZNKSt7__cxx1119basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE3strEv;
+
_ZNKSt7__cxx1119basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE5rdbufEv;
_ZT[ISTV]NSt7__cxx1115basic_stringbuf*;
_ZT[ISTV]NSt7__cxx1118basic_stringstream*;
_ZT[ISTV]NSt7__cxx1119basic_istringstream*;



Pushed to trunk now.




Re: [PATCH] libstdc++: Implement C++20 features for

2020-10-29 Thread Jonathan Wakely via Gcc-patches

On 29/10/20 21:06 +0100, Rainer Orth wrote:

Tightening the patterns as in the attached patch at least allows
libstdc++.so.6 to link on i386-pc-solaris2.11; full bootstrap still
running.  However, I can't tell if this is really correct.


I think we want this attached patch instead. It tightens them up to
exactly the symbols we actually need to export and no more. This will
avoid needing to tighten them again in the near future when the new
overloads of str() are added.


diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index 80994b203df..4dddfd3d263 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -1791,11 +1791,11 @@ GLIBCXX_3.4.21 {
 _ZNSt7__cxx1119basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]ESt13_Ios_Openmode;
 _ZNSt7__cxx1119basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EED[012]Ev;
 _ZNSt7__cxx1119basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE[a34]*;
-_ZNKSt7__cxx1115basic_stringbuf*;
+_ZNKSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE3strEv;
 _ZNKSt7__cxx1118basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE3strEv;
 _ZNKSt7__cxx1118basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE5rdbufEv;
-_ZNKSt7__cxx1119basic_istringstream*;
-_ZNKSt7__cxx1119basic_ostringstream*;
+_ZNKSt7__cxx1119basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE3strEv;
+_ZNKSt7__cxx1119basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE5rdbufEv;
 _ZT[ISTV]NSt7__cxx1115basic_stringbuf*;
 _ZT[ISTV]NSt7__cxx1118basic_stringstream*;
 _ZT[ISTV]NSt7__cxx1119basic_istringstream*;


Re: [PATCH] libstdc++: Implement C++20 features for

2020-10-29 Thread Rainer Orth
Hi Jonathan,

> On > The patch that was committed broke the linker script. The attached
> patch restores the piece that got lost, and removes the duplicate
> patterns added for the new symbols. Pushed to trunk.

even this fixed version broke Solaris bootstrap:

ld: fatal: libstdc++-symbols.ver-sun: 7318: symbol 
'_ZNKSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEE13get_allocatorEv': 
symbol version conflict
ld: fatal: libstdc++-symbols.ver-sun: 7319: symbol 
'_ZNKSt7__cxx1115basic_stringbufIwSt11char_traitsIwESaIwEE13get_allocatorEv': 
symbol version conflict

  matched by


##_ZNKSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE13get_allocatorEv
 (glob)
_ZNKSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEE13get_allocatorEv;
_ZNKSt7__cxx1115basic_stringbufIwSt11char_traitsIwESaIwEE13get_allocatorEv;

  and


##_ZNKSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE[0-35-9]* 
(glob)

  which matches

_ZNKSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEE13get_allocatorEv;
_ZNKSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEE3strEv;
_ZNKSt7__cxx1115basic_stringbufIwSt11char_traitsIwESaIwEE13get_allocatorEv;
_ZNKSt7__cxx1115basic_stringbufIwSt11char_traitsIwESaIwEE3strEv;

ld: fatal: libstdc++-symbols.ver-sun: 7321: symbol 
'_ZNKSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEE4viewEv': symbol 
version conflict
ld: fatal: libstdc++-symbols.ver-sun: 7322: symbol 
'_ZNKSt7__cxx1115basic_stringbufIwSt11char_traitsIwESaIwEE4viewEv': symbol 
version conflict

  matched by

##_ZNKSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE4viewEv 
(glob)
_ZNKSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEE4viewEv;
_ZNKSt7__cxx1115basic_stringbufIwSt11char_traitsIwESaIwEE4viewEv;

  and

##_ZNKSt7__cxx1115basic_stringbuf* (glob)

  which matches

_ZNKSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEE13get_allocatorEv;
_ZNKSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEE3strEv;
_ZNKSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEE4viewEv;
_ZNKSt7__cxx1115basic_stringbufIwSt11char_traitsIwESaIwEE13get_allocatorEv;
_ZNKSt7__cxx1115basic_stringbufIwSt11char_traitsIwESaIwEE3strEv;
_ZNKSt7__cxx1115basic_stringbufIwSt11char_traitsIwESaIwEE4viewEv;

ld: fatal: libstdc++-symbols.ver-sun: 7342: symbol 
'_ZNKSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEE4viewEv': symbol 
version conflict
ld: fatal: libstdc++-symbols.ver-sun: 7343: symbol 
'_ZNKSt7__cxx1119basic_istringstreamIwSt11char_traitsIwESaIwEE4viewEv': symbol 
version conflict

  matched by


##_ZNKSt7__cxx1119basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE4viewEv
 (glob)
_ZNKSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEE4viewEv;
_ZNKSt7__cxx1119basic_istringstreamIwSt11char_traitsIwESaIwEE4viewEv;
_ZNKSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEE4viewEv;
_ZNKSt7__cxx1119basic_ostringstreamIwSt11char_traitsIwESaIwEE4viewEv;

  and

##_ZNKSt7__cxx1119basic_istringstream* (glob)
##_ZNKSt7__cxx1119basic_ostringstream* (glob)

  which match

_ZNKSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEE3strEv;
_ZNKSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEE4viewEv;
_ZNKSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEE5rdbufEv;
_ZNKSt7__cxx1119basic_istringstreamIwSt11char_traitsIwESaIwEE3strEv;
_ZNKSt7__cxx1119basic_istringstreamIwSt11char_traitsIwESaIwEE4viewEv;
_ZNKSt7__cxx1119basic_istringstreamIwSt11char_traitsIwESaIwEE5rdbufEv;
_ZNKSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEE3strEv;
_ZNKSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEE4viewEv;
_ZNKSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEE5rdbufEv;
_ZNKSt7__cxx1119basic_ostringstreamIwSt11char_traitsIwESaIwEE3strEv;
_ZNKSt7__cxx1119basic_ostringstreamIwSt11char_traitsIwESaIwEE4viewEv;
_ZNKSt7__cxx1119basic_ostringstreamIwSt11char_traitsIwESaIwEE5rdbufEv;

Tightening the patterns as in the attached patch at least allows
libstdc++.so.6 to link on i386-pc-solaris2.11; full bootstrap still
running.  However, I can't tell if this is really correct.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -1791,11 +1791,11 @@ GLIBCXX_3.4.21 {
 _ZNSt7__cxx1119basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]ESt13_Ios_Openmode;
 _ZNSt7__cxx1119basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EED[012]Ev;
 _ZNSt7__cxx1119basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE[a34]*;
-_ZNKSt7__cxx1115basic_stringbuf*;
+_ZNKSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE[0235-9]*;
 

Re: [PATCH] libstdc++: Implement C++20 features for

2020-10-28 Thread Jonathan Wakely via Gcc-patches

On 28/10/20 23:59 +, Jonathan Wakely wrote:

On 26/10/20 21:09 +, Jonathan Wakely wrote:

On 26/10/20 13:47 -0700, Thomas Rodgers wrote:

From: Thomas Rodgers 

New ctors and ::view() accessor for -
* basic_stingbuf
* basic_istringstream
* basic_ostringstream
* basic_stringstreamm

New ::get_allocator() accessor for basic_stringbuf.

libstdc++-v3/ChangeLog:
* acinclude.m4 (glibcxx_SUBDIRS): Add src/c++20.
 * config/abi/pre/gnu.ver: Update GLIBCXX_3.4.29 for the addition of -
basic_stringbuf::basic_stringbuf(allocator const&),
basic_stringbuf::basic_stringbuf(openmode, allocator const&),
basic_stringbuf::basic_stringbuf(basic_string&&, openmode),
basic_stringbuf::basic_stringbuf(basic_stringbuf&&, allocator const&),
basic_stringbuf::get_allocator(),
basic_stringbuf::view(),
basic_istringstream::basic_istringstream(basic_string&&, openmode),
basic_istringstream::basic_istringstream(openmode, allocator const&),
basic_istringstream::view(),
basic_ostringstream::basic_ostringstream(basic_string&&, openmode),
basic_ostringstream::basic_ostringstream(openmode, allocator const&),
basic_ostringstream::view(),
basic_stringstream::basic_stringstream(basic_string&&, openmode),
basic_stringstream::basic_stringstream(openmode, allocator const&),
basic_stringstream::view().


As discussed on IRC< please don't name every one of these functions
for the linker script changes, it's just redundant noise. They're
already listed below in the include/std/sstream changes.

Look at past changelog entries for the gnu.ver file.


* configure: Regenerate.
* include/std/sstream:
(basic_stringbuf::basic_stringbuf(allocator const&)): New constructor.
(basic_stringbuf::basic_stringbuf(openmode, allocator const&)): 
Likewise.
(basic_stringbuf::basic_stringbuf(basic_string&&, openmode)): Likewise.
(basic_stringbuf::basic_stringbuf(basic_stringbuf&&, allocator 
const&)): Likewise.


New line before the Likewise.


There are a few formatting changes mentioned below. OK for trunk with
those changes. Thanks. Go ahead and commit the  patch
after this one too.


The patch that was committed broke the linker script. The attached
patch restores the piece that got lost, and removes the duplicate
patterns added for the new symbols. Pushed to trunk.

This fixes all the failures related to exception_ptr. I'm still seeing
four new failures which weren't there before:

FAIL: 24_iterators/istream_iterator/sentinel.cc execution test
FAIL: 24_iterators/istreambuf_iterator/sentinel.cc execution test
FAIL: 27_io/basic_istream/extractors_character/char/lwg2499.cc execution test
FAIL: std/ranges/istream_view.cc execution test

I'm not sure what's happening there. It looks like some symbols I
added recently are not present now. I'm investigating.


The attached patch fixes the failing tests. Not fully tested, but
pushed to trunk.






Also, it looks like the get_allocator() members of the streams are not
exported (only basic_stringbuf::get_allocator() is).





commit f4f9364d2074e027490c1b08956ac1cbd9617575
Author: Jonathan Wakely 
Date:   Wed Oct 28 23:10:21 2020

   libstdc++: Fix linker script
   
   libstdc++-v3/ChangeLog:
   
   * config/abi/pre/gnu.ver (GLIBCXX_3.4.29): Remove duplicate

   patterns.
   (CXXABI_1.3.13): Restore missing piece.

diff --git a/libstdc++-v3/config/abi/pre/gnu.ver 
b/libstdc++-v3/config/abi/pre/gnu.ver
index 2648c813616..80994b203df 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -2335,51 +2335,6 @@ GLIBCXX_3.4.29 {
# std::__throw_bad_array_new_length()
_ZSt28__throw_bad_array_new_lengthv;

-# basic_stringbuf::basic_stringbuf(allocator const&)
-_ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC1ERKS3_;
-
-# basic_stringbuf::basic_stringbuf(ios_base::openmode, allocator const&)
-
_ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC1ESt13_Ios_OpenmodeRKS3;
-
-# basic_stringbuf::basic_stringbuf(basic_string&&, ios_base::openmode)
-
_ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC1EONS_12basic_stringI[cw]S2_S3_EESt13_Ios_Openmode;
-
-# basic_stringbuf::basic_stringbuf(basic_stringbuf&&, allocator const&)
-_ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaIcEEC1EOS4_RKS3_;
-
-# basic_stringbuf::get_allocator()
-
_ZNKSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE13get_allocatorEv;
-
-# basic_stringbuf::view()
-_ZNKSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE4viewEv;
-
-# basic_istringstream::basic_istringstream(basic_string&&, 
ios_base::openmode)
-
_ZNSt7__cxx1119basic_istringstreamI[cw]St11char_traitsI[cw]ESaIcEEC1EONS_12basic_stringI[cw]S2_S3_EESt13_Ios_Openmode;
-
-# 

Re: [PATCH] libstdc++: Implement C++20 features for

2020-10-28 Thread Jonathan Wakely via Gcc-patches

On 26/10/20 21:09 +, Jonathan Wakely wrote:

On 26/10/20 13:47 -0700, Thomas Rodgers wrote:

From: Thomas Rodgers 

New ctors and ::view() accessor for -
* basic_stingbuf
* basic_istringstream
* basic_ostringstream
* basic_stringstreamm

New ::get_allocator() accessor for basic_stringbuf.

libstdc++-v3/ChangeLog:
* acinclude.m4 (glibcxx_SUBDIRS): Add src/c++20.
  * config/abi/pre/gnu.ver: Update GLIBCXX_3.4.29 for the addition of -
basic_stringbuf::basic_stringbuf(allocator const&),
basic_stringbuf::basic_stringbuf(openmode, allocator const&),
basic_stringbuf::basic_stringbuf(basic_string&&, openmode),
basic_stringbuf::basic_stringbuf(basic_stringbuf&&, allocator const&),
basic_stringbuf::get_allocator(),
basic_stringbuf::view(),
basic_istringstream::basic_istringstream(basic_string&&, openmode),
basic_istringstream::basic_istringstream(openmode, allocator const&),
basic_istringstream::view(),
basic_ostringstream::basic_ostringstream(basic_string&&, openmode),
basic_ostringstream::basic_ostringstream(openmode, allocator const&),
basic_ostringstream::view(),
basic_stringstream::basic_stringstream(basic_string&&, openmode),
basic_stringstream::basic_stringstream(openmode, allocator const&),
basic_stringstream::view().


As discussed on IRC< please don't name every one of these functions
for the linker script changes, it's just redundant noise. They're
already listed below in the include/std/sstream changes.

Look at past changelog entries for the gnu.ver file.


* configure: Regenerate.
* include/std/sstream:
(basic_stringbuf::basic_stringbuf(allocator const&)): New constructor.
(basic_stringbuf::basic_stringbuf(openmode, allocator const&)): 
Likewise.
(basic_stringbuf::basic_stringbuf(basic_string&&, openmode)): Likewise.
(basic_stringbuf::basic_stringbuf(basic_stringbuf&&, allocator 
const&)): Likewise.


New line before the Likewise.


There are a few formatting changes mentioned below. OK for trunk with
those changes. Thanks. Go ahead and commit the  patch
after this one too.


The patch that was committed broke the linker script. The attached
patch restores the piece that got lost, and removes the duplicate
patterns added for the new symbols. Pushed to trunk.

This fixes all the failures related to exception_ptr. I'm still seeing
four new failures which weren't there before:

FAIL: 24_iterators/istream_iterator/sentinel.cc execution test
FAIL: 24_iterators/istreambuf_iterator/sentinel.cc execution test
FAIL: 27_io/basic_istream/extractors_character/char/lwg2499.cc execution test
FAIL: std/ranges/istream_view.cc execution test

I'm not sure what's happening there. It looks like some symbols I
added recently are not present now. I'm investigating.

Also, it looks like the get_allocator() members of the streams are not
exported (only basic_stringbuf::get_allocator() is).


commit f4f9364d2074e027490c1b08956ac1cbd9617575
Author: Jonathan Wakely 
Date:   Wed Oct 28 23:10:21 2020

libstdc++: Fix linker script

libstdc++-v3/ChangeLog:

* config/abi/pre/gnu.ver (GLIBCXX_3.4.29): Remove duplicate
patterns.
(CXXABI_1.3.13): Restore missing piece.

diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index 2648c813616..80994b203df 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -2335,51 +2335,6 @@ GLIBCXX_3.4.29 {
 # std::__throw_bad_array_new_length()
 _ZSt28__throw_bad_array_new_lengthv;
 
-# basic_stringbuf::basic_stringbuf(allocator const&)
-_ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC1ERKS3_;
-
-# basic_stringbuf::basic_stringbuf(ios_base::openmode, allocator const&)
-_ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC1ESt13_Ios_OpenmodeRKS3;
-
-# basic_stringbuf::basic_stringbuf(basic_string&&, ios_base::openmode)
-_ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC1EONS_12basic_stringI[cw]S2_S3_EESt13_Ios_Openmode;
-
-# basic_stringbuf::basic_stringbuf(basic_stringbuf&&, allocator const&)
-_ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaIcEEC1EOS4_RKS3_;
-
-# basic_stringbuf::get_allocator()
-_ZNKSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE13get_allocatorEv;
-
-# basic_stringbuf::view()
-_ZNKSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE4viewEv;
-
-# basic_istringstream::basic_istringstream(basic_string&&, ios_base::openmode)
-_ZNSt7__cxx1119basic_istringstreamI[cw]St11char_traitsI[cw]ESaIcEEC1EONS_12basic_stringI[cw]S2_S3_EESt13_Ios_Openmode;
-
-# basic_istringstream::basic_istringstream(ios_base::openmode, allocator const&)
-_ZNSt7__cxx1119basic_istringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC1ESt13_Ios_OpenmodeRKS3_;
-
-# 

Re: [PATCH] libstdc++: Implement C++20 features for

2020-10-26 Thread Jonathan Wakely via Gcc-patches

On 26/10/20 13:47 -0700, Thomas Rodgers wrote:

From: Thomas Rodgers 

New ctors and ::view() accessor for -
 * basic_stingbuf
 * basic_istringstream
 * basic_ostringstream
 * basic_stringstreamm

New ::get_allocator() accessor for basic_stringbuf.

libstdc++-v3/ChangeLog:
* acinclude.m4 (glibcxx_SUBDIRS): Add src/c++20.
   * config/abi/pre/gnu.ver: Update GLIBCXX_3.4.29 for the addition of -
basic_stringbuf::basic_stringbuf(allocator const&),
basic_stringbuf::basic_stringbuf(openmode, allocator const&),
basic_stringbuf::basic_stringbuf(basic_string&&, openmode),
basic_stringbuf::basic_stringbuf(basic_stringbuf&&, allocator const&),
basic_stringbuf::get_allocator(),
basic_stringbuf::view(),
basic_istringstream::basic_istringstream(basic_string&&, openmode),
basic_istringstream::basic_istringstream(openmode, allocator const&),
basic_istringstream::view(),
basic_ostringstream::basic_ostringstream(basic_string&&, openmode),
basic_ostringstream::basic_ostringstream(openmode, allocator const&),
basic_ostringstream::view(),
basic_stringstream::basic_stringstream(basic_string&&, openmode),
basic_stringstream::basic_stringstream(openmode, allocator const&),
basic_stringstream::view().


As discussed on IRC< please don't name every one of these functions
for the linker script changes, it's just redundant noise. They're
already listed below in the include/std/sstream changes.

Look at past changelog entries for the gnu.ver file.


* configure: Regenerate.
* include/std/sstream:
(basic_stringbuf::basic_stringbuf(allocator const&)): New constructor.
(basic_stringbuf::basic_stringbuf(openmode, allocator const&)): 
Likewise.
(basic_stringbuf::basic_stringbuf(basic_string&&, openmode)): Likewise.
(basic_stringbuf::basic_stringbuf(basic_stringbuf&&, allocator 
const&)): Likewise.


New line before the Likewise.


There are a few formatting changes mentioned below. OK for trunk with
those changes. Thanks. Go ahead and commit the  patch
after this one too.



(basic_stringbuf::get_allocator()): New method.
(basic_stringbuf::view()): Likewise.
(basic_istringstream::basic_istringstream(basic_string&&, openmode)):
New constructor.
(basic_istringstream::basic_istringstream(openmode, allocator const&)):
Likewise
(basic_istringstream::view()): New method.
(basic_ostringstream::basic_ostringstream(basic_string&&, openmode)):
New constructor.
(basic_ostringstream::basic_ostringstream(openmode, allocator const&)):
Likewise
(basic_ostringstream::view()): New method.
(basic_stringstream::basic_stringstream(basic_string&&, openmode)):
New constructor.
(basic_stringstream::basic_stringstream(openmode, allocator const&)):
Likewise
(basic_stringstream::view()): New method.
* src/Makefile.in: Add c++20 directory.
* src/Makefile.am: Regenerate.
* src/c++20/Makefile.am: Add makefile for new sub-directory.
* src/c++20/Makefile.in: Generate.
* src/c++20/sstream-inst.cc: New file defining explicit
instantiations for basic_stringbuf, basic_istringstream,
basic_ostringstream, and basic_stringstream member functions
added in C++20.
* testsuite/27_io/basic_stringbuf/cons/char/2.cc: New test.
* testsuite/27_io/basic_stringbuf/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_stringbuf/view/char/2.cc: Likewise.
* testsuite/27_io/basic_stringbuf/view/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/cons/char/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/view/char/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/view/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_ostringstream/cons/char/2.cc: Likewise.
* testsuite/27_io/basic_ostringstream/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_ostringstream/view/char/2.cc: Likewise.
* testsuite/27_io/basic_ostringstream/view/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/cons/char/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/view/char/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/view/wchar_t/2.cc: Likewise.
---
libstdc++-v3/acinclude.m4 |   2 +-
libstdc++-v3/config/abi/pre/gnu.ver   |  45 ++
libstdc++-v3/configure|  16 +-
libstdc++-v3/include/std/sstream  | 190 +
libstdc++-v3/src/Makefile.am  |  12 +-
libstdc++-v3/src/Makefile.in  |  14 +-
libstdc++-v3/src/c++20/Makefile.am| 105 +++

[PATCH] libstdc++: Implement C++20 features for

2020-10-26 Thread Thomas Rodgers
From: Thomas Rodgers 

New ctors and ::view() accessor for -
  * basic_stingbuf
  * basic_istringstream
  * basic_ostringstream
  * basic_stringstreamm

New ::get_allocator() accessor for basic_stringbuf.

libstdc++-v3/ChangeLog:
* acinclude.m4 (glibcxx_SUBDIRS): Add src/c++20.
* config/abi/pre/gnu.ver: Update GLIBCXX_3.4.29 for the addition of -
basic_stringbuf::basic_stringbuf(allocator const&),
basic_stringbuf::basic_stringbuf(openmode, allocator const&),
basic_stringbuf::basic_stringbuf(basic_string&&, openmode),
basic_stringbuf::basic_stringbuf(basic_stringbuf&&, allocator const&),
basic_stringbuf::get_allocator(),
basic_stringbuf::view(),
basic_istringstream::basic_istringstream(basic_string&&, openmode),
basic_istringstream::basic_istringstream(openmode, allocator const&),
basic_istringstream::view(),
basic_ostringstream::basic_ostringstream(basic_string&&, openmode),
basic_ostringstream::basic_ostringstream(openmode, allocator const&),
basic_ostringstream::view(),
basic_stringstream::basic_stringstream(basic_string&&, openmode),
basic_stringstream::basic_stringstream(openmode, allocator const&),
basic_stringstream::view().
* configure: Regenerate.
* include/std/sstream:
(basic_stringbuf::basic_stringbuf(allocator const&)): New constructor.
(basic_stringbuf::basic_stringbuf(openmode, allocator const&)): 
Likewise.
(basic_stringbuf::basic_stringbuf(basic_string&&, openmode)): Likewise.
(basic_stringbuf::basic_stringbuf(basic_stringbuf&&, allocator 
const&)): Likewise.
(basic_stringbuf::get_allocator()): New method.
(basic_stringbuf::view()): Likewise.
(basic_istringstream::basic_istringstream(basic_string&&, openmode)):
New constructor.
(basic_istringstream::basic_istringstream(openmode, allocator const&)):
Likewise
(basic_istringstream::view()): New method.
(basic_ostringstream::basic_ostringstream(basic_string&&, openmode)):
New constructor.
(basic_ostringstream::basic_ostringstream(openmode, allocator const&)):
Likewise
(basic_ostringstream::view()): New method.
(basic_stringstream::basic_stringstream(basic_string&&, openmode)):
New constructor.
(basic_stringstream::basic_stringstream(openmode, allocator const&)):
Likewise
(basic_stringstream::view()): New method.
* src/Makefile.in: Add c++20 directory.
* src/Makefile.am: Regenerate.
* src/c++20/Makefile.am: Add makefile for new sub-directory.
* src/c++20/Makefile.in: Generate.
* src/c++20/sstream-inst.cc: New file defining explicit
instantiations for basic_stringbuf, basic_istringstream,
basic_ostringstream, and basic_stringstream member functions
added in C++20.
* testsuite/27_io/basic_stringbuf/cons/char/2.cc: New test.
* testsuite/27_io/basic_stringbuf/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_stringbuf/view/char/2.cc: Likewise.
* testsuite/27_io/basic_stringbuf/view/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/cons/char/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/view/char/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/view/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_ostringstream/cons/char/2.cc: Likewise.
* testsuite/27_io/basic_ostringstream/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_ostringstream/view/char/2.cc: Likewise.
* testsuite/27_io/basic_ostringstream/view/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/cons/char/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/view/char/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/view/wchar_t/2.cc: Likewise.
---
 libstdc++-v3/acinclude.m4 |   2 +-
 libstdc++-v3/config/abi/pre/gnu.ver   |  45 ++
 libstdc++-v3/configure|  16 +-
 libstdc++-v3/include/std/sstream  | 190 +
 libstdc++-v3/src/Makefile.am  |  12 +-
 libstdc++-v3/src/Makefile.in  |  14 +-
 libstdc++-v3/src/c++20/Makefile.am| 105 +++
 libstdc++-v3/src/c++20/Makefile.in| 735 ++
 libstdc++-v3/src/c++20/sstream-inst.cc| 108 +++
 .../27_io/basic_istringstream/cons/char/1.cc  |  85 ++
 .../basic_istringstream/cons/wchar_t/1.cc |  85 ++
 .../27_io/basic_istringstream/view/char/1.cc  |  35 +
 .../basic_istringstream/view/wchar_t/1.cc |  35 +
 .../27_io/basic_ostringstream/cons/char/1.cc  |  85 ++
 .../basic_ostringstream/cons/wchar_t/1.cc |  85 ++
 

Re: [PATCH] libstdc++: Implement C++20 features for

2020-10-13 Thread Jonathan Wakely via Gcc-patches

On 09/10/20 16:28 -0700, Thomas Rodgers via Libstdc++ wrote:


Jonathan Wakely writes:


On 07/10/20 18:15 -0700, Thomas Rodgers wrote:

@@ -500,6 +576,40 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
  }
#endif

+#if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI
+  basic_istringstream(ios_base::openmode __mode, const allocator_type& __a)
+  : __istream_type(), _M_stringbuf(__mode | ios_base::in, __a)
+  { this->init(&_M_stringbuf); }


All these & operators need to be std::__addressof(_M_stringbuf)
instead. _M_stringbuf potentially depends on program-defined types
(the traits and allocator classes) which means user namespaces are
considered for ADL and they could define a operator& that gets used.



+
+  explicit basic_istringstream(__string_type&& __str,
+  ios_base::openmode __mode = ios_base::in )
+  : __istream_type(), _M_stringbuf(std::move(__str), __mode | ios_base::in)
+  { this->init(&_M_stringbuf); }
+
+  template
+   basic_istringstream(const basic_string<_CharT, _Traits, _SAlloc>& __str,
+   const allocator_type& __a)
+   : basic_istringstream(__str, ios_base::in, __a)
+   { }
+
+  using __sv_type = basic_string_view;


This typedef seems to only be used once. Might as well just use
basic_string_view directly in the return type
of view().

Similarly in basic_ostringstream and basic_stringstream.


diff --git a/libstdc++-v3/src/c++20/Makefile.in 
b/libstdc++-v3/src/c++20/Makefile.in
new file mode 100644
index 000..0e2de19ae59
diff --git a/libstdc++-v3/src/c++20/sstream-inst.cc 
b/libstdc++-v3/src/c++20/sstream-inst.cc
new file mode 100644
index 000..c419176ae8e
--- /dev/null
+++ b/libstdc++-v3/src/c++20/sstream-inst.cc
@@ -0,0 +1,111 @@
+// Explicit instantiation file.
+
+// Copyright (C) 1997-2020 Free Software Foundation, Inc.


Just 2020 here.


+//
+// 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
+// .
+
+//
+// ISO C++ 14882:
+//
+
+#ifndef _GLIBCXX_USE_CXX11_ABI
+// Instantiations in this file use the new SSO std::string ABI unless included
+// by another file which defines _GLIBCXX_USE_CXX11_ABI=0.


This copy comment is misleading now if we're not actually going
to include it from another file to generate the old ABI symbols.

I think just define it unconditionally and add a comment saying that
these new symbols are only defines for the SSO string ABI.


+# define _GLIBCXX_USE_CXX11_ABI 1
+#endif
+#include 
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+template basic_stringbuf::basic_stringbuf(const allocator_type&);
+template basic_stringbuf::basic_stringbuf(ios_base::openmode,
+const allocator_type&);
+template basic_stringbuf::basic_stringbuf(__string_type&&,
+ios_base::openmode);
+template basic_stringbuf::basic_stringbuf(basic_stringbuf&&,
+const allocator_type&);
+template basic_stringbuf::allocator_type
+basic_stringbuf::get_allocator() const noexcept;
+template basic_stringbuf::__sv_type


Looks like this would be a bit simpler if it just used string_view
here, not basic_stringbuf::__sv_type, and wstring_view below
for the wchar_t specializations.

And you could use allocator instead of
basic_stringbuf::allocator_type.

That looks a little cleaner to me, but it's a matter of opinion.

That would be necessary anyway for the basic_*stringstream types if
they don't have the __sv_type any more.



diff --git a/libstdc++-v3/testsuite/27_io/basic_istringstream/cons/char/1.cc 
b/libstdc++-v3/testsuite/27_io/basic_istringstream/cons/char/1.cc
new file mode 100644
index 000..d93141fc232
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istringstream/cons/char/1.cc
@@ -0,0 +1,85 @@
+// 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 

Re: [PATCH] libstdc++: Implement C++20 features for

2020-10-09 Thread Thomas Rodgers via Gcc-patches


Jonathan Wakely writes:

> On 07/10/20 18:15 -0700, Thomas Rodgers wrote:
>>@@ -500,6 +576,40 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
>>   }
>> #endif
>>
>>+#if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI
>>+  basic_istringstream(ios_base::openmode __mode, const allocator_type& 
>>__a)
>>+  : __istream_type(), _M_stringbuf(__mode | ios_base::in, __a)
>>+  { this->init(&_M_stringbuf); }
>
> All these & operators need to be std::__addressof(_M_stringbuf)
> instead. _M_stringbuf potentially depends on program-defined types
> (the traits and allocator classes) which means user namespaces are
> considered for ADL and they could define a operator& that gets used.
>
>
>>+
>>+  explicit basic_istringstream(__string_type&& __str,
>>+ios_base::openmode __mode = ios_base::in )
>>+  : __istream_type(), _M_stringbuf(std::move(__str), __mode | 
>>ios_base::in)
>>+  { this->init(&_M_stringbuf); }
>>+
>>+  template
>>+ basic_istringstream(const basic_string<_CharT, _Traits, _SAlloc>& __str,
>>+ const allocator_type& __a)
>>+ : basic_istringstream(__str, ios_base::in, __a)
>>+ { }
>>+
>>+  using __sv_type = basic_string_view;
>
> This typedef seems to only be used once. Might as well just use
> basic_string_view directly in the return type
> of view().
>
> Similarly in basic_ostringstream and basic_stringstream.
>
>>diff --git a/libstdc++-v3/src/c++20/Makefile.in 
>>b/libstdc++-v3/src/c++20/Makefile.in
>>new file mode 100644
>>index 000..0e2de19ae59
>>diff --git a/libstdc++-v3/src/c++20/sstream-inst.cc 
>>b/libstdc++-v3/src/c++20/sstream-inst.cc
>>new file mode 100644
>>index 000..c419176ae8e
>>--- /dev/null
>>+++ b/libstdc++-v3/src/c++20/sstream-inst.cc
>>@@ -0,0 +1,111 @@
>>+// Explicit instantiation file.
>>+
>>+// Copyright (C) 1997-2020 Free Software Foundation, Inc.
>
> Just 2020 here.
>
>>+//
>>+// 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
>>+// .
>>+
>>+//
>>+// ISO C++ 14882:
>>+//
>>+
>>+#ifndef _GLIBCXX_USE_CXX11_ABI
>>+// Instantiations in this file use the new SSO std::string ABI unless 
>>included
>>+// by another file which defines _GLIBCXX_USE_CXX11_ABI=0.
>
> This copy comment is misleading now if we're not actually going
> to include it from another file to generate the old ABI symbols.
>
> I think just define it unconditionally and add a comment saying that
> these new symbols are only defines for the SSO string ABI.
>
>>+# define _GLIBCXX_USE_CXX11_ABI 1
>>+#endif
>>+#include 
>>+
>>+namespace std _GLIBCXX_VISIBILITY(default)
>>+{
>>+_GLIBCXX_BEGIN_NAMESPACE_VERSION
>>+
>>+template basic_stringbuf::basic_stringbuf(const allocator_type&);
>>+template basic_stringbuf::basic_stringbuf(ios_base::openmode,
>>+  const allocator_type&);
>>+template basic_stringbuf::basic_stringbuf(__string_type&&,
>>+  ios_base::openmode);
>>+template basic_stringbuf::basic_stringbuf(basic_stringbuf&&,
>>+  const allocator_type&);
>>+template basic_stringbuf::allocator_type
>>+basic_stringbuf::get_allocator() const noexcept;
>>+template basic_stringbuf::__sv_type
>
> Looks like this would be a bit simpler if it just used string_view
> here, not basic_stringbuf::__sv_type, and wstring_view below
> for the wchar_t specializations.
>
> And you could use allocator instead of
> basic_stringbuf::allocator_type.
>
> That looks a little cleaner to me, but it's a matter of opinion.
>
> That would be necessary anyway for the basic_*stringstream types if
> they don't have the __sv_type any more.
>
>
>>diff --git a/libstdc++-v3/testsuite/27_io/basic_istringstream/cons/char/1.cc 
>>b/libstdc++-v3/testsuite/27_io/basic_istringstream/cons/char/1.cc
>>new file mode 100644
>>index 000..d93141fc232
>>--- /dev/null
>>+++ b/libstdc++-v3/testsuite/27_io/basic_istringstream/cons/char/1.cc
>>@@ -0,0 +1,85 @@
>>+// Copyright (C) 2020 

Re: [PATCH] libstdc++: Implement C++20 features for

2020-10-08 Thread Jonathan Wakely via Gcc-patches

On 07/10/20 18:15 -0700, Thomas Rodgers wrote:

@@ -500,6 +576,40 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
  }
#endif

+#if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI
+  basic_istringstream(ios_base::openmode __mode, const allocator_type& __a)
+  : __istream_type(), _M_stringbuf(__mode | ios_base::in, __a)
+  { this->init(&_M_stringbuf); }


All these & operators need to be std::__addressof(_M_stringbuf)
instead. _M_stringbuf potentially depends on program-defined types
(the traits and allocator classes) which means user namespaces are
considered for ADL and they could define a operator& that gets used.



+
+  explicit basic_istringstream(__string_type&& __str,
+  ios_base::openmode __mode = ios_base::in )
+  : __istream_type(), _M_stringbuf(std::move(__str), __mode | ios_base::in)
+  { this->init(&_M_stringbuf); }
+
+  template
+   basic_istringstream(const basic_string<_CharT, _Traits, _SAlloc>& __str,
+   const allocator_type& __a)
+   : basic_istringstream(__str, ios_base::in, __a)
+   { }
+
+  using __sv_type = basic_string_view;


This typedef seems to only be used once. Might as well just use
basic_string_view directly in the return type
of view().

Similarly in basic_ostringstream and basic_stringstream.


diff --git a/libstdc++-v3/src/c++20/Makefile.in 
b/libstdc++-v3/src/c++20/Makefile.in
new file mode 100644
index 000..0e2de19ae59
diff --git a/libstdc++-v3/src/c++20/sstream-inst.cc 
b/libstdc++-v3/src/c++20/sstream-inst.cc
new file mode 100644
index 000..c419176ae8e
--- /dev/null
+++ b/libstdc++-v3/src/c++20/sstream-inst.cc
@@ -0,0 +1,111 @@
+// Explicit instantiation file.
+
+// Copyright (C) 1997-2020 Free Software Foundation, Inc.


Just 2020 here.


+//
+// 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
+// .
+
+//
+// ISO C++ 14882:
+//
+
+#ifndef _GLIBCXX_USE_CXX11_ABI
+// Instantiations in this file use the new SSO std::string ABI unless included
+// by another file which defines _GLIBCXX_USE_CXX11_ABI=0.


This copy comment is misleading now if we're not actually going
to include it from another file to generate the old ABI symbols.

I think just define it unconditionally and add a comment saying that
these new symbols are only defines for the SSO string ABI.


+# define _GLIBCXX_USE_CXX11_ABI 1
+#endif
+#include 
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+template basic_stringbuf::basic_stringbuf(const allocator_type&);
+template basic_stringbuf::basic_stringbuf(ios_base::openmode,
+const allocator_type&);
+template basic_stringbuf::basic_stringbuf(__string_type&&,
+ios_base::openmode);
+template basic_stringbuf::basic_stringbuf(basic_stringbuf&&,
+const allocator_type&);
+template basic_stringbuf::allocator_type
+basic_stringbuf::get_allocator() const noexcept;
+template basic_stringbuf::__sv_type


Looks like this would be a bit simpler if it just used string_view
here, not basic_stringbuf::__sv_type, and wstring_view below
for the wchar_t specializations.

And you could use allocator instead of
basic_stringbuf::allocator_type.

That looks a little cleaner to me, but it's a matter of opinion.

That would be necessary anyway for the basic_*stringstream types if
they don't have the __sv_type any more.



diff --git a/libstdc++-v3/testsuite/27_io/basic_istringstream/cons/char/1.cc 
b/libstdc++-v3/testsuite/27_io/basic_istringstream/cons/char/1.cc
new file mode 100644
index 000..d93141fc232
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istringstream/cons/char/1.cc
@@ -0,0 +1,85 @@
+// 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 

[PATCH] libstdc++: Implement C++20 features for

2020-10-07 Thread Thomas Rodgers
From: Thomas Rodgers 

New ctors and ::view() accessor for -
  * basic_stingbuf
  * basic_istringstream
  * basic_ostringstream
  * basic_stringstreamm

New ::get_allocator() accessor for basic_stringbuf.

libstdc++-v3/ChangeLog:
* acinclude.m4 (glibcxx_SUBDIRS): Add src/c++20.
* config/abi/pre/gnu.ver: Update GLIBCXX_3.4.29 for the addition of -
basic_stringbuf::basic_stringbuf(allocator const&),
basic_stringbuf::basic_stringbuf(openmode, allocator const&),
basic_stringbuf::basic_stringbuf(basic_string&&, openmode),
basic_stringbuf::basic_stringbuf(basic_stringbuf&&, allocator const&),
basic_stringbuf::get_allocator(),
basic_stringbuf::view(),
basic_istringstream::basic_istringstream(basic_string&&, openmode),
basic_istringstream::basic_istringstream(openmode, allocator const&),
basic_istringstream::view(),
basic_ostringstream::basic_ostringstream(basic_string&&, openmode),
basic_ostringstream::basic_ostringstream(openmode, allocator const&),
basic_ostringstream::view(),
basic_stringstream::basic_stringstream(basic_string&&, openmode),
basic_stringstream::basic_stringstream(openmode, allocator const&),
basic_stringstream::view().
* configure: Regenerate.
* include/std/sstream:
(basic_stringbuf::basic_stringbuf(allocator const&)): New constructor.
(basic_stringbuf::basic_stringbuf(openmode, allocator const&)): 
Likewise.
(basic_stringbuf::basic_stringbuf(basic_string&&, openmode)): Likewise.
(basic_stringbuf::basic_stringbuf(basic_stringbuf&&, allocator 
const&)): Likewise.
(basic_stringbuf::get_allocator()): New method.
(basic_stringbuf::view()): Likewise.
(basic_istringstream::basic_istringstream(basic_string&&, openmode)):
New constructor.
(basic_istringstream::basic_istringstream(openmode, allocator const&)):
Likewise
(basic_istringstream::view()): New method.
(basic_ostringstream::basic_ostringstream(basic_string&&, openmode)):
New constructor.
(basic_ostringstream::basic_ostringstream(openmode, allocator const&)):
Likewise
(basic_ostringstream::view()): New method.
(basic_stringstream::basic_stringstream(basic_string&&, openmode)):
New constructor.
(basic_stringstream::basic_stringstream(openmode, allocator const&)):
Likewise
(basic_stringstream::view()): New method.
* src/Makefile.in: Add c++20 directory.
* src/Makefile.am: Regenerate.
* src/c++20/Makefile.am: Add makefile for new sub-directory.
* src/c++20/Makefile.in: Generate.
* src/c++20/sstream-inst.cc: New file defining explicit
instantiations for basic_stringbuf, basic_istringstream,
basic_ostringstream, and basic_stringstream member functions
added in C++20.
* testsuite/27_io/basic_stringbuf/cons/char/2.cc: New test.
* testsuite/27_io/basic_stringbuf/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_stringbuf/view/char/2.cc: Likewise.
* testsuite/27_io/basic_stringbuf/view/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/cons/char/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/view/char/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/view/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_ostringstream/cons/char/2.cc: Likewise.
* testsuite/27_io/basic_ostringstream/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_ostringstream/view/char/2.cc: Likewise.
* testsuite/27_io/basic_ostringstream/view/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/cons/char/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/view/char/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/view/wchar_t/2.cc: Likewise.
---
 libstdc++-v3/acinclude.m4 |   2 +-
 libstdc++-v3/config/abi/pre/gnu.ver   |  45 ++
 libstdc++-v3/configure|  16 +-
 libstdc++-v3/include/std/sstream  | 196 +
 libstdc++-v3/src/Makefile.am  |  12 +-
 libstdc++-v3/src/Makefile.in  |  14 +-
 libstdc++-v3/src/c++20/Makefile.am| 105 +++
 libstdc++-v3/src/c++20/Makefile.in| 735 ++
 libstdc++-v3/src/c++20/sstream-inst.cc| 111 +++
 .../27_io/basic_istringstream/cons/char/1.cc  |  85 ++
 .../basic_istringstream/cons/wchar_t/1.cc |  85 ++
 .../27_io/basic_istringstream/view/char/1.cc  |  35 +
 .../basic_istringstream/view/wchar_t/1.cc |  35 +
 .../27_io/basic_ostringstream/cons/char/1.cc  |  85 ++
 .../basic_ostringstream/cons/wchar_t/1.cc |  85 ++
 

[PATCH] libstdc++: Implement C++20 features for

2020-10-07 Thread Thomas Rodgers
From: Thomas Rodgers 

New ctors and ::view() accessor for -
  * basic_stingbuf
  * basic_istringstream
  * basic_ostringstream
  * basic_stringstreamm

New ::get_allocator() accessor for basic_stringbuf.

libstdc++-v3/ChangeLog:
* acinclude.m4 (glibcxx_SUBDIRS): Add src/c++20.
* config/abi/pre/gnu.ver: Update GLIBCXX_3.4.29 for the addition of -
basic_stringbuf::basic_stringbuf(allocator const&),
basic_stringbuf::basic_stringbuf(openmode, allocator const&),
basic_stringbuf::basic_stringbuf(basic_string&&, openmode),
basic_stringbuf::basic_stringbuf(basic_stringbuf&&, allocator const&),
basic_stringbuf::get_allocator(),
basic_stringbuf::view(),
basic_istringstream::basic_istringstream(basic_string&&, openmode),
basic_istringstream::basic_istringstream(openmode, allocator const&),
basic_istringstream::view(),
basic_ostringstream::basic_ostringstream(basic_string&&, openmode),
basic_ostringstream::basic_ostringstream(openmode, allocator const&),
basic_ostringstream::view(),
basic_stringstream::basic_stringstream(basic_string&&, openmode),
basic_stringstream::basic_stringstream(openmode, allocator const&),
basic_stringstream::view().
* configure: Regenerate.
* include/std/sstream:
(basic_stringbuf::basic_stringbuf(allocator const&)): New constructor.
(basic_stringbuf::basic_stringbuf(openmode, allocator const&)): 
Likewise.
(basic_stringbuf::basic_stringbuf(basic_string&&, openmode)): Likewise.
(basic_stringbuf::basic_stringbuf(basic_stringbuf&&, allocator 
const&)): Likewise.
(basic_stringbuf::get_allocator()): New method.
(basic_stringbuf::view()): Likewise.
(basic_istringstream::basic_istringstream(basic_string&&, openmode)):
New constructor.
(basic_istringstream::basic_istringstream(openmode, allocator const&)):
Likewise
(basic_istringstream::view()): New method.
(basic_ostringstream::basic_ostringstream(basic_string&&, openmode)):
New constructor.
(basic_ostringstream::basic_ostringstream(openmode, allocator const&)):
Likewise
(basic_ostringstream::view()): New method.
(basic_stringstream::basic_stringstream(basic_string&&, openmode)):
New constructor.
(basic_stringstream::basic_stringstream(openmode, allocator const&)):
Likewise
(basic_stringstream::view()): New method.
* src/Makefile.in: Add c++20 directory.
* src/Makefile.am: Regenerate.
* src/c++20/Makefile.am: Add makefile for new sub-directory.
* src/c++20/Makefile.in: Generate.
* src/c++20/sstream-inst.cc: New file defining explicit
instantiations for basic_stringbuf, basic_istringstream,
basic_ostringstream, and basic_stringstream member functions
added in C++20.
* testsuite/27_io/basic_stringbuf/cons/char/2.cc: New test.
* testsuite/27_io/basic_stringbuf/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_stringbuf/view/char/2.cc: Likewise.
* testsuite/27_io/basic_stringbuf/view/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/cons/char/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/view/char/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/view/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_ostringstream/cons/char/2.cc: Likewise.
* testsuite/27_io/basic_ostringstream/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_ostringstream/view/char/2.cc: Likewise.
* testsuite/27_io/basic_ostringstream/view/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/cons/char/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/view/char/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/view/wchar_t/2.cc: Likewise.
---
 .topdeps  |   1 +
 .topmsg   |   2 +
 libstdc++-v3/acinclude.m4 |   2 +-
 libstdc++-v3/config/abi/pre/gnu.ver   |  45 ++
 libstdc++-v3/configure|  16 +-
 libstdc++-v3/include/std/sstream  | 196 +
 libstdc++-v3/src/Makefile.am  |  12 +-
 libstdc++-v3/src/Makefile.in  |  14 +-
 libstdc++-v3/src/c++20/Makefile.am| 105 +++
 libstdc++-v3/src/c++20/Makefile.in| 735 ++
 libstdc++-v3/src/c++20/sstream-inst.cc| 110 +++
 .../27_io/basic_istringstream/cons/char/1.cc  |  85 ++
 .../basic_istringstream/cons/wchar_t/1.cc |  85 ++
 .../27_io/basic_istringstream/view/char/1.cc  |  35 +
 .../basic_istringstream/view/wchar_t/1.cc |  36 +
 

Re: [PATCH] libstdc++: Implement C++20 features for

2020-10-07 Thread Jonathan Wakely via Gcc-patches

On 07/10/20 09:55 -0700, Thomas Rodgers wrote:

From: Thomas Rodgers 

New ctors and ::view() accessor for -
 * basic_stingbuf
 * basic_istringstream
 * basic_ostringstream
 * basic_stringstreamm

New ::get_allocator() accessor for basic_stringbuf.

libstdc++-v3/ChangeLog:
* acinclude.m4 (glibcxx_SUBDIRS): Add src/c++20.
   * config/abi/pre/gnu.ver: Update GLIBCXX_3.4.29 for the addition of -
basic_stringbuf::basic_stringbuf(allocator const&),
basic_stringbuf::basic_stringbuf(openmode, allocator const&),
basic_stringbuf::basic_stringbuf(basic_string&&, openmode),
basic_stringbuf::basic_stringbuf(basic_stringbuf&&, allocator const&),
basic_stringbuf::get_allocator(),
basic_stringbuf::view(),
basic_istringstream::basic_istringstream(basic_string&&, openmode),
basic_istringstream::basic_istringstream(openmode, allocator const&),
basic_istringstream::view(),
basic_ostringstream::basic_ostringstream(basic_string&&, openmode),
basic_ostringstream::basic_ostringstream(openmode, allocator const&),
basic_ostringstream::view(),
basic_stringstream::basic_stringstream(basic_string&&, openmode),
basic_stringstream::basic_stringstream(openmode, allocator const&),
basic_stringstream::view().
* configure: Regenerate.
* include/std/sstream:
(basic_stringbuf::basic_stringbuf(allocator const&)): New constructor.
(basic_stringbuf::basic_stringbuf(openmode, allocator const&)): 
Likewise.
(basic_stringbuf::basic_stringbuf(basic_string&&, openmode)): Likewise.
(basic_stringbuf::basic_stringbuf(basic_stringbuf&&, allocator 
const&)): Likewise.
(basic_stringbuf::get_allocator()): New method.
(basic_stringbuf::view()): Likewise.
(basic_istringstream::basic_istringstream(basic_string&&, openmode)):
New constructor.
(basic_istringstream::basic_istringstream(openmode, allocator const&)):
Likewise
(basic_istringstream::view()): New method.
(basic_ostringstream::basic_ostringstream(basic_string&&, openmode)):
New constructor.
(basic_ostringstream::basic_ostringstream(openmode, allocator const&)):
Likewise
(basic_ostringstream::view()): New method.
(basic_stringstream::basic_stringstream(basic_string&&, openmode)):
New constructor.
(basic_stringstream::basic_stringstream(openmode, allocator const&)):
Likewise
(basic_stringstream::view()): New method.
* src/Makefile.in: Add c++20 directory.
* src/Makefile.am: Regenerate.
* src/c++20/Makefile.am: Add makefile for new sub-directory.
* src/c++20/Makefile.in: Generate.
* src/c++20/sstream-inst.cc: New file defining explicit
instantiations for basic_stringbuf, basic_istringstream,
basic_ostringstream, and basic_stringstream member functions
added in C++20.
* testsuite/27_io/basic_stringbuf/cons/char/2.cc: New test.
* testsuite/27_io/basic_stringbuf/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_stringbuf/view/char/2.cc: Likewise.
* testsuite/27_io/basic_stringbuf/view/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/cons/char/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/view/char/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/view/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_ostringstream/cons/char/2.cc: Likewise.
* testsuite/27_io/basic_ostringstream/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_ostringstream/view/char/2.cc: Likewise.
* testsuite/27_io/basic_ostringstream/view/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/cons/char/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/view/char/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/view/wchar_t/2.cc: Likewise.
---
.topdeps  |   1 +
.topmsg   |   2 +
libstdc++-v3/acinclude.m4 |   2 +-
libstdc++-v3/config/abi/pre/gnu.ver   |  60 ++
libstdc++-v3/configure|  16 +-
libstdc++-v3/include/std/sstream  | 198 +
libstdc++-v3/src/Makefile.am  |  12 +-
libstdc++-v3/src/Makefile.in  |  14 +-
libstdc++-v3/src/c++20/Makefile.am| 105 +++
libstdc++-v3/src/c++20/Makefile.in| 735 ++
libstdc++-v3/src/c++20/sstream-inst.cc| 110 +++
.../27_io/basic_istringstream/cons/char/1.cc  |  84 ++
.../basic_istringstream/cons/wchar_t/1.cc |  84 ++
.../27_io/basic_istringstream/view/char/1.cc  |  34 +
.../basic_istringstream/view/wchar_t/1.cc |  35 +

[PATCH] libstdc++: Implement C++20 features for

2020-10-07 Thread Thomas Rodgers
From: Thomas Rodgers 

New ctors and ::view() accessor for -
  * basic_stingbuf
  * basic_istringstream
  * basic_ostringstream
  * basic_stringstreamm

New ::get_allocator() accessor for basic_stringbuf.

libstdc++-v3/ChangeLog:
* acinclude.m4 (glibcxx_SUBDIRS): Add src/c++20.
* config/abi/pre/gnu.ver: Update GLIBCXX_3.4.29 for the addition of -
basic_stringbuf::basic_stringbuf(allocator const&),
basic_stringbuf::basic_stringbuf(openmode, allocator const&),
basic_stringbuf::basic_stringbuf(basic_string&&, openmode),
basic_stringbuf::basic_stringbuf(basic_stringbuf&&, allocator const&),
basic_stringbuf::get_allocator(),
basic_stringbuf::view(),
basic_istringstream::basic_istringstream(basic_string&&, openmode),
basic_istringstream::basic_istringstream(openmode, allocator const&),
basic_istringstream::view(),
basic_ostringstream::basic_ostringstream(basic_string&&, openmode),
basic_ostringstream::basic_ostringstream(openmode, allocator const&),
basic_ostringstream::view(),
basic_stringstream::basic_stringstream(basic_string&&, openmode),
basic_stringstream::basic_stringstream(openmode, allocator const&),
basic_stringstream::view().
* configure: Regenerate.
* include/std/sstream:
(basic_stringbuf::basic_stringbuf(allocator const&)): New constructor.
(basic_stringbuf::basic_stringbuf(openmode, allocator const&)): 
Likewise.
(basic_stringbuf::basic_stringbuf(basic_string&&, openmode)): Likewise.
(basic_stringbuf::basic_stringbuf(basic_stringbuf&&, allocator 
const&)): Likewise.
(basic_stringbuf::get_allocator()): New method.
(basic_stringbuf::view()): Likewise.
(basic_istringstream::basic_istringstream(basic_string&&, openmode)):
New constructor.
(basic_istringstream::basic_istringstream(openmode, allocator const&)):
Likewise
(basic_istringstream::view()): New method.
(basic_ostringstream::basic_ostringstream(basic_string&&, openmode)):
New constructor.
(basic_ostringstream::basic_ostringstream(openmode, allocator const&)):
Likewise
(basic_ostringstream::view()): New method.
(basic_stringstream::basic_stringstream(basic_string&&, openmode)):
New constructor.
(basic_stringstream::basic_stringstream(openmode, allocator const&)):
Likewise
(basic_stringstream::view()): New method.
* src/Makefile.in: Add c++20 directory.
* src/Makefile.am: Regenerate.
* src/c++20/Makefile.am: Add makefile for new sub-directory.
* src/c++20/Makefile.in: Generate.
* src/c++20/sstream-inst.cc: New file defining explicit
instantiations for basic_stringbuf, basic_istringstream,
basic_ostringstream, and basic_stringstream member functions
added in C++20.
* testsuite/27_io/basic_stringbuf/cons/char/2.cc: New test.
* testsuite/27_io/basic_stringbuf/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_stringbuf/view/char/2.cc: Likewise.
* testsuite/27_io/basic_stringbuf/view/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/cons/char/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/view/char/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/view/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_ostringstream/cons/char/2.cc: Likewise.
* testsuite/27_io/basic_ostringstream/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_ostringstream/view/char/2.cc: Likewise.
* testsuite/27_io/basic_ostringstream/view/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/cons/char/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/view/char/2.cc: Likewise.
* testsuite/27_io/basic_stringstream/view/wchar_t/2.cc: Likewise.
---
 .topdeps  |   1 +
 .topmsg   |   2 +
 libstdc++-v3/acinclude.m4 |   2 +-
 libstdc++-v3/config/abi/pre/gnu.ver   |  60 ++
 libstdc++-v3/configure|  16 +-
 libstdc++-v3/include/std/sstream  | 198 +
 libstdc++-v3/src/Makefile.am  |  12 +-
 libstdc++-v3/src/Makefile.in  |  14 +-
 libstdc++-v3/src/c++20/Makefile.am| 105 +++
 libstdc++-v3/src/c++20/Makefile.in| 735 ++
 libstdc++-v3/src/c++20/sstream-inst.cc| 110 +++
 .../27_io/basic_istringstream/cons/char/1.cc  |  84 ++
 .../basic_istringstream/cons/wchar_t/1.cc |  84 ++
 .../27_io/basic_istringstream/view/char/1.cc  |  34 +
 .../basic_istringstream/view/wchar_t/1.cc |  35 +