new file mode 100644
@@ -0,0 +1 @@
+master
new file mode 100644
@@ -0,0 +1,2 @@
+From: Thomas Rodgers <trodgers@redhat.com>
+Subject: [PATCH] t/trodgers/c2a_sstream
@@ -49,7 +49,7 @@ AC_DEFUN([GLIBCXX_CONFIGURE], [
# Keep these sync'd with the list in Makefile.am. The first provides an
# expandable list at autoconf time; the second provides an expandable list
# (i.e., shell variable) at configure time.
- m4_define([glibcxx_SUBDIRS],[include libsupc++ src src/c++98 src/c++11 src/c++17 src/filesystem doc po testsuite python])
+ m4_define([glibcxx_SUBDIRS],[include libsupc++ src src/c++98 src/c++11 src/c++17 src/c++20 src/filesystem doc po testsuite python])
SUBDIRS='glibcxx_SUBDIRS'
# These need to be absolute paths, yet at the same time need to
@@ -2322,6 +2322,66 @@ GLIBCXX_3.4.29 {
# std::__atomic_futex_unsigned_base::_M_futex_wait_until_steady
_ZNSt28__atomic_futex_unsigned_base26_M_futex_wait_until_steady*;
+ # basic_stringbuf::basic_stringbuf(allocator const&)
+ _ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEEC1ERKS3_;
+ _ZNSt7__cxx1115basic_stringbufIwSt11char_traitsIwESaIwEEC1ERKS3_;
+
+ # basic_stringbuf::basic_stringbuf(ios_base::openmode, allocator const&)
+ _ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEEC1ESt13_Ios_OpenmodeRKS3;
+ _ZNSt7__cxx1115basic_stringbufIwSt11char_traitsIwESaIwEEC1ESt13_Ios_OpenmodeRKS3;
+
+ # basic_stringbuf::basic_stringbuf(basic_string&&, ios_base::openmode)
+ _ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEEC1EONS_12basic_stringIcS2_S3_EESt13_Ios_Openmode;
+ _ZNSt7__cxx1115basic_stringbufIwSt11char_traitsIwESaIwEEC1EONS_12basic_stringIwS2_S3_EESt13_Ios_Openmode;
+
+ # basic_stringbuf::basic_stringbuf(basic_stringbuf&&, allocator const&)
+ _ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEEC1EOS4_RKS3_;
+ _ZNSt7__cxx1115basic_stringbufIwSt11char_traitsIwESaIwEEC1EOS4_RKS3_;
+
+ # basic_stringbuf::get_allocator()
+ _ZNKSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEE13get_allocatorEv;
+ _ZNKSt7__cxx1115basic_stringbufIwSt11char_traitsIwESaIwEE13get_allocatorEv;
+
+ # basic_stringbuf::view()
+ _ZNKSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEE4viewEv;
+ _ZNKSt7__cxx1115basic_stringbufIwSt11char_traitsIwESaIwEE4viewEv;
+
+ # basic_istringstream::basic_istringstream(basic_string&&, ios_base::openmode)
+ _ZNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEC1EONS_12basic_stringIcS2_S3_EESt13_Ios_Openmode;
+ _ZNSt7__cxx1119basic_istringstreamIwSt11char_traitsIwESaIwEEC1EONS_12basic_stringIwS2_S3_EESt13_Ios_Openmode;
+
+ # basic_istringstream::basic_istringstream(ios_base::openmode, allocator const&)
+ _ZNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEC1ESt13_Ios_OpenmodeRKS3_;
+ _ZNSt7__cxx1119basic_istringstreamIwSt11char_traitsIwESaIwEEC1ESt13_Ios_OpenmodeRKS3_;
+
+ # basic_istringstream::view()
+ _ZNKSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEE4viewEv;
+ _ZNKSt7__cxx1119basic_istringstreamIwSt11char_traitsIwESaIwEE4viewEv;
+
+ # basic_ostringstream::basic_ostringstream(basic_string&&, ios_base::openmode)
+ _ZNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEC1EONS_12basic_stringIcS2_S3_EESt13_Ios_Openmode;
+ _ZNSt7__cxx1119basic_ostringstreamIwSt11char_traitsIwESaIwEEC1EONS_12basic_stringIwS2_S3_EESt13_Ios_Openmode;
+
+ # basic_ostringstream::basic_ostringstream(ios_base::openmode, allocator const&)
+ _ZNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEC1ESt13_Ios_OpenmodeRKS3_;
+ _ZNSt7__cxx1119basic_ostringstreamIwSt11char_traitsIwESaIwEEC1ESt13_Ios_OpenmodeRKS3_;
+
+ # basic_ostringstream::view()
+ _ZNKSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEE4viewEv;
+ _ZNKSt7__cxx1119basic_ostringstreamIwSt11char_traitsIwESaIwEE4viewEv;
+
+ # basic_stringstream::basic_stringstream(basic_string&&, ios_base::openmode)
+ _ZNSt7__cxx1119basic_stringstreamIcSt11char_traitsIcESaIcEEC1EONS_12basic_stringIcS2_S3_EESt13_Ios_Openmode;
+ _ZNSt7__cxx1119basic_stringstreamIwSt11char_traitsIwESaIwEEC1EONS_12basic_stringIwS2_S3_EESt13_Ios_Openmode;
+
+ # basic_stringstream::basic_stringstream(ios_base::openmode, allocator const&)
+ _ZNSt7__cxx1119basic_stringstreamIcSt11char_traitsIcESaIcEEC1ESt13_Ios_OpenmodeRKS3_;
+ _ZNSt7__cxx1119basic_stringstreamIwSt11char_traitsIwESaIwEEC1ESt13_Ios_OpenmodeRKS3_;
+
+ # basic_stringstream::view()
+ _ZNKSt7__cxx1119basic_stringstreamIcSt11char_traitsIcESaIcEE4viewEv;
+ _ZNKSt7__cxx1119basic_stringstreamIwSt11char_traitsIwESaIwEE4viewEv;
+
} GLIBCXX_3.4.28;
# Symbols in the support library (libsupc++) have their own tag.
@@ -5418,7 +5418,7 @@ $as_echo "$ac_cv_path_EGREP" >&6; }
# expandable list at autoconf time; the second provides an expandable list
# (i.e., shell variable) at configure time.
- SUBDIRS='include libsupc++ src src/c++98 src/c++11 src/c++17 src/filesystem doc po testsuite python'
+ SUBDIRS='include libsupc++ src src/c++98 src/c++11 src/c++17 src/c++20 src/filesystem doc po testsuite python'
# These need to be absolute paths, yet at the same time need to
# canonicalize only relative paths, because then amd will not unmount
@@ -78394,7 +78394,7 @@ ac_config_files="$ac_config_files doc/xsl/customization.xsl"
# append it here. Only modify Makefiles that have just been created.
#
# Also, get rid of this simulated-VPATH thing that automake does.
-ac_config_files="$ac_config_files include/Makefile libsupc++/Makefile src/Makefile src/c++98/Makefile src/c++11/Makefile src/c++17/Makefile src/filesystem/Makefile doc/Makefile po/Makefile testsuite/Makefile python/Makefile"
+ac_config_files="$ac_config_files include/Makefile libsupc++/Makefile src/Makefile src/c++98/Makefile src/c++11/Makefile src/c++17/Makefile src/c++20/Makefile src/filesystem/Makefile doc/Makefile po/Makefile testsuite/Makefile python/Makefile"
ac_config_commands="$ac_config_commands generate-headers"
@@ -79650,6 +79650,7 @@ do
"src/c++98/Makefile") CONFIG_FILES="$CONFIG_FILES src/c++98/Makefile" ;;
"src/c++11/Makefile") CONFIG_FILES="$CONFIG_FILES src/c++11/Makefile" ;;
"src/c++17/Makefile") CONFIG_FILES="$CONFIG_FILES src/c++17/Makefile" ;;
+ "src/c++20/Makefile") CONFIG_FILES="$CONFIG_FILES src/c++20/Makefile" ;;
"src/filesystem/Makefile") CONFIG_FILES="$CONFIG_FILES src/filesystem/Makefile" ;;
"doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
"po/Makefile") CONFIG_FILES="$CONFIG_FILES po/Makefile" ;;
@@ -81500,6 +81501,17 @@ _EOF
;;
"src/c++17/Makefile":F) cat > vpsed$$ << \_EOF
s!`test -f '$<' || echo '$(srcdir)/'`!!
+_EOF
+ sed -f vpsed$$ $ac_file > tmp$$
+ mv tmp$$ $ac_file
+ rm vpsed$$
+ echo 'MULTISUBDIR =' >> $ac_file
+ ml_norecursion=yes
+ . ${multi_basedir}/config-ml.in
+ { ml_norecursion=; unset ml_norecursion;}
+ ;;
+ "src/c++20/Makefile":F) cat > vpsed$$ << \_EOF
+s!`test -f '$<' || echo '$(srcdir)/'`!!
_EOF
sed -f vpsed$$ $ac_file > tmp$$
mv tmp$$ $ac_file
@@ -165,6 +165,56 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
}
#endif
+#if __cplusplus > 201703L
+ basic_stringbuf(const allocator_type& __a)
+ : basic_stringbuf(ios_base::in | std::ios_base::out, __a)
+ { }
+
+ basic_stringbuf(ios_base::openmode __mode,
+ const allocator_type& __a)
+ : __streambuf_type(), _M_mode(__mode), _M_string(__a)
+ { }
+
+ explicit
+ basic_stringbuf(__string_type&& __s,
+ ios_base::openmode __mode = ios_base::in
+ | ios_base::out )
+ : __streambuf_type(), _M_mode(__mode), _M_string(move(__s))
+ { }
+
+ template<typename _SAlloc>
+ basic_stringbuf(const basic_string<_CharT, _Traits, _SAlloc>& __s,
+ const allocator_type& __a )
+ : basic_stringbuf(__s, ios_base::in | std::ios_base::out, __a )
+ { }
+
+ using __sv_type = basic_string_view<char_type, traits_type>;
+
+ template<typename _SAlloc>
+ 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)
+ { }
+
+ template<typename _SAlloc>
+ explicit
+ basic_stringbuf(const basic_string<_CharT, _Traits, _SAlloc>& __s,
+ ios_base::openmode __mode = ios_base::in
+ | ios_base::out)
+ : basic_stringbuf(__s, __mode, allocator_type{})
+ { }
+
+ basic_stringbuf(basic_stringbuf&& __rhs, const allocator_type& __a)
+ : basic_stringbuf(std::move(__rhs), __a, __xfer_bufptrs(__rhs, this))
+ { __rhs._M_sync(const_cast<char_type*>(__rhs._M_string.data()), 0, 0); }
+
+ allocator_type get_allocator() const noexcept
+ { return _M_string.get_allocator(); }
+
+#endif
+
// Get and set:
/**
* @brief Copying out the string buffer.
@@ -207,6 +257,24 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
_M_stringbuf_init(_M_mode);
}
+#if __cplusplus > 201703L
+ __sv_type
+ view() const noexcept
+ {
+ if (this->pptr())
+ {
+ // The current egptr() may not be the actual string end.
+ if (this->pptr() > this->egptr())
+ return __sv_type(this->pbase(), this->pptr());
+ else
+ return __sv_type(this->pbase(), this->egptr());
+ }
+ else
+ return static_cast<__sv_type>(_M_string);
+ }
+
+#endif
+
protected:
// Common initialization code goes here.
void
@@ -369,6 +437,16 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
: __streambuf_type(static_cast<const __streambuf_type&>(__rhs)),
_M_mode(__rhs._M_mode), _M_string(std::move(__rhs._M_string))
{ }
+
+#if __cplusplus > 201703L
+ // The move constructor initializes an __xfer_bufptrs temporary then
+ // delegates to this constructor to performs moves during its lifetime.
+ basic_stringbuf(basic_stringbuf&& __rhs, const allocator_type& __a,
+ __xfer_bufptrs&&)
+ : __streambuf_type(static_cast<const __streambuf_type&>(__rhs)),
+ _M_mode(__rhs._M_mode), _M_string(std::move(__rhs._M_string), __a)
+ { }
+#endif
#endif
};
@@ -500,6 +578,40 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
}
#endif
+#if __cplusplus > 201703L
+ basic_istringstream(ios_base::openmode __mode, const allocator_type& __a)
+ : __istream_type(), _M_stringbuf(__mode | ios_base::in, __a)
+ { this->init(&_M_stringbuf); }
+
+ 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<typename _SAlloc>
+ 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<char_type, traits_type>;
+
+ template<typename _SAlloc>
+ basic_istringstream(const basic_string<_CharT, _Traits, _SAlloc>& __str,
+ ios_base::openmode __mode,
+ const allocator_type& __a)
+ : __istream_type(),
+ _M_stringbuf(__string_type(__str.data(), __str.size()),
+ __mode | ios_base::in, __a)
+ { this->init(&_M_stringbuf); }
+
+ template<typename _SAlloc>
+ explicit basic_istringstream(const basic_string<_CharT, _Traits, _SAlloc>& __str,
+ ios_base::openmode __mode = ios_base::in)
+ : basic_istringstream(__str, __mode, allocator_type())
+ { }
+#endif
+
// Members:
/**
* @brief Accessing the underlying buffer.
@@ -528,6 +640,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
void
str(const __string_type& __s)
{ _M_stringbuf.str(__s); }
+
+#if __cplusplus > 201703L
+ __sv_type
+ view() const noexcept
+ { return _M_stringbuf.view(); }
+#endif
};
@@ -658,6 +776,40 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
}
#endif
+#if __cplusplus > 201703L
+ basic_ostringstream(ios_base::openmode __mode, const allocator_type& __a)
+ : __ostream_type(), _M_stringbuf(__mode | ios_base::out, __a)
+ { this->init(&_M_stringbuf); }
+
+ explicit basic_ostringstream(__string_type&& __str,
+ ios_base::openmode __mode = ios_base::out )
+ : __ostream_type(), _M_stringbuf(std::move(__str), __mode | ios_base::out)
+ { this->init(&_M_stringbuf); }
+
+ template<typename _SAlloc>
+ basic_ostringstream(const basic_string<_CharT, _Traits, _SAlloc>& __str,
+ const allocator_type& __a)
+ : basic_ostringstream(__str, ios_base::out, __a)
+ { }
+
+ using __sv_type = basic_string_view<char_type, traits_type>;
+
+ template<typename _SAlloc>
+ basic_ostringstream(const basic_string<_CharT, _Traits, _SAlloc>& __str,
+ ios_base::openmode __mode,
+ const allocator_type& __a)
+ : __ostream_type(),
+ _M_stringbuf(__string_type(__str.data(), __str.size()),
+ __mode | ios_base::out, __a)
+ { this->init(&_M_stringbuf); }
+
+ template<typename _SAlloc>
+ explicit basic_ostringstream(const basic_string<_CharT, _Traits, _SAlloc>& __str,
+ ios_base::openmode __mode = ios_base::out)
+ : basic_ostringstream(__str, __mode, allocator_type())
+ { }
+#endif
+
// Members:
/**
* @brief Accessing the underlying buffer.
@@ -686,6 +838,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
void
str(const __string_type& __s)
{ _M_stringbuf.str(__s); }
+
+#if __cplusplus > 201703L
+ __sv_type
+ view() const noexcept
+ { return _M_stringbuf.view(); }
+#endif
};
@@ -812,6 +970,40 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
}
#endif
+#if __cplusplus > 201703L
+ basic_stringstream(ios_base::openmode __mode, const allocator_type& __a)
+ : __iostream_type(), _M_stringbuf(__mode, __a)
+ { this->init(&_M_stringbuf); }
+
+ explicit basic_stringstream(__string_type&& __str,
+ ios_base::openmode __mode = ios_base::out
+ | ios_base::out)
+ : __iostream_type(), _M_stringbuf(std::move(__str), __mode)
+ { this->init(&_M_stringbuf); }
+
+ template<typename _SAlloc>
+ basic_stringstream(const basic_string<_CharT, _Traits, _SAlloc>& __str,
+ const allocator_type& __a)
+ : basic_stringstream(__str, ios_base::in | ios_base::out, __a)
+ { }
+
+ using __sv_type = basic_string_view<char_type, traits_type>;
+
+ template<typename _SAlloc>
+ basic_stringstream(const basic_string<_CharT, _Traits, _SAlloc>& __str,
+ ios_base::openmode __mode, const allocator_type& __a)
+ : __iostream_type(),
+ _M_stringbuf(__string_type(__str.data(), __str.size()), __mode, __a)
+ { this->init(&_M_stringbuf); }
+
+ template<typename _SAlloc>
+ explicit basic_stringstream(const basic_string<_CharT, _Traits, _SAlloc>& __str,
+ ios_base::openmode __mode = ios_base::in
+ | ios_base::out)
+ : basic_stringstream(__str, __mode, allocator_type())
+ { }
+#endif
+
// Members:
/**
* @brief Accessing the underlying buffer.
@@ -840,6 +1032,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
void
str(const __string_type& __s)
{ _M_stringbuf.str(__s); }
+
+#if __cplusplus > 201703L
+ __sv_type
+ view() const noexcept
+ { return _M_stringbuf.view(); }
+#endif
};
#if __cplusplus >= 201103L
@@ -29,7 +29,7 @@ filesystem_dir =
endif
## Keep this list sync'd with acinclude.m4:GLIBCXX_CONFIGURE.
-SUBDIRS = c++98 c++11 c++17 $(filesystem_dir)
+SUBDIRS = c++98 c++11 c++17 c++20 $(filesystem_dir)
# Cross compiler support.
if VTV_CYGMIN
@@ -60,6 +60,7 @@ endif
vpath % $(top_srcdir)/src/c++98
vpath % $(top_srcdir)/src/c++11
vpath % $(top_srcdir)/src/c++17
+vpath % $(top_srcdir)/src/c++20
if ENABLE_FILESYSTEM_TS
vpath % $(top_srcdir)/src/filesystem
endif
@@ -95,14 +96,16 @@ libstdc___la_LIBADD = \
$(top_builddir)/libsupc++/libsupc++convenience.la \
$(top_builddir)/src/c++98/libc++98convenience.la \
$(top_builddir)/src/c++11/libc++11convenience.la \
- $(top_builddir)/src/c++17/libc++17convenience.la
+ $(top_builddir)/src/c++17/libc++17convenience.la \
+ $(top_builddir)/src/c++20/libc++20convenience.la
libstdc___la_DEPENDENCIES = \
${version_dep} \
$(top_builddir)/libsupc++/libsupc++convenience.la \
$(top_builddir)/src/c++98/libc++98convenience.la \
$(top_builddir)/src/c++11/libc++11convenience.la \
- $(top_builddir)/src/c++17/libc++17convenience.la
+ $(top_builddir)/src/c++17/libc++17convenience.la \
+ $(top_builddir)/src/c++20/libc++20convenience.la
libstdc___la_LDFLAGS = \
-version-info $(libtool_VERSION) ${version_arg} -lm
@@ -153,7 +156,8 @@ compatibility-condvar.o: compatibility-condvar.cc
# segregated in the sources with -D_GLIBCXX_SHARED.
#
# In the sub-directories of libsupc++, src/c++98, src/c++11, src/c++17,
-# only -prefer-pic objects are generated for the convenience libraries.
+# src/c++20, only -prefer-pic objects are generated for the convenience
+# libraries.
#
# In the main src directory, make shared and static objects just for
# the compat libraries. Shared objects are compiled with -prefer-pic
new file mode 100644
@@ -0,0 +1,105 @@
+## Makefile for the C++20 sources of the GNU C++ Standard library.
+##
+## Copyright (C) 1997-2020 Free Software Foundation, Inc.
+##
+## This file is part of the libstdc++ version 3 distribution.
+## Process this file with automake to produce Makefile.in.
+
+## 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
+## <http://www.gnu.org/licenses/>.
+
+include $(top_srcdir)/fragment.am
+
+# Convenience library for C++17 runtime.
+noinst_LTLIBRARIES = libc++20convenience.la
+
+headers =
+
+if ENABLE_EXTERN_TEMPLATE
+# XTEMPLATE_FLAGS = -fno-implicit-templates
+inst_sources = \
+ sstream-inst.cc
+else
+# XTEMPLATE_FLAGS =
+inst_sources =
+endif
+
+sources =
+
+vpath % $(top_srcdir)/src/c++20
+
+libc__20convenience_la_SOURCES = $(sources) $(inst_sources)
+
+# AM_CXXFLAGS needs to be in each subdirectory so that it can be
+# modified in a per-library or per-sub-library way. Need to manually
+# set this option because CONFIG_CXXFLAGS has to be after
+# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
+# as the occasion calls for it.
+AM_CXXFLAGS = \
+ -std=gnu++20 \
+ $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
+ $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \
+ $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) \
+ -fimplicit-templates
+
+AM_MAKEFLAGS = \
+ "gxx_include_dir=$(gxx_include_dir)"
+
+# Libtool notes
+
+# 1) In general, libtool expects an argument such as `--tag=CXX' when
+# using the C++ compiler, because that will enable the settings
+# detected when C++ support was being configured. However, when no
+# such flag is given in the command line, libtool attempts to figure
+# it out by matching the compiler name in each configuration section
+# against a prefix of the command line. The problem is that, if the
+# compiler name and its initial flags stored in the libtool
+# configuration file don't match those in the command line, libtool
+# can't decide which configuration to use, and it gives up. The
+# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
+# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
+# attempt to infer which configuration to use.
+#
+# The second tag argument, `--tag disable-shared` means that libtool
+# only compiles each source once, for static objects. In actuality,
+# glibcxx_lt_pic_flag and glibcxx_compiler_shared_flag are added to
+# the libtool command that is used create the object, which is
+# suitable for shared libraries. The `--tag disable-shared` must be
+# placed after --tag CXX lest things CXX undo the affect of
+# disable-shared.
+
+# 2) Need to explicitly set LTCXXCOMPILE so that EXTRA_CXX_FLAGS is
+# last. (That way, things like -O2 passed down from the toplevel can
+# be overridden by --enable-debug.)
+LTCXXCOMPILE = \
+ $(LIBTOOL) --tag CXX --tag disable-shared \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(EXTRA_CXX_FLAGS)
+
+LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
+
+# 3) We'd have a problem when building the shared libstdc++ object if
+# the rules automake generates would be used. We cannot allow g++ to
+# be used since this would add -lstdc++ to the link line which of
+# course is problematic at this point. So, we get the top-level
+# directory to configure libstdc++-v3 to use gcc as the C++
+# compilation driver.
+CXXLINK = \
+ $(LIBTOOL) --tag CXX --tag disable-shared \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXX) \
+ $(VTV_CXXLINKFLAGS) \
+ $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
new file mode 100644
new file mode 100644
@@ -0,0 +1,110 @@
+// Explicit instantiation file.
+
+// Copyright (C) 1997-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;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// 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.
+# define _GLIBCXX_USE_CXX11_ABI 1
+#endif
+#include <sstream>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+template basic_stringbuf<char>::basic_stringbuf(const allocator_type&);
+template basic_stringbuf<char>::basic_stringbuf(ios_base::openmode,
+ const allocator_type&);
+template basic_stringbuf<char>::basic_stringbuf(__string_type&&,
+ ios_base::openmode);
+template basic_stringbuf<char>::basic_stringbuf(basic_stringbuf&&,
+ const allocator_type&);
+template basic_stringbuf<char>::allocator_type
+ basic_stringbuf<char>::get_allocator() const noexcept;
+template basic_stringbuf<char>::__sv_type
+ basic_stringbuf<char>::view() const noexcept;
+
+
+template basic_istringstream<char>::basic_istringstream(ios_base::openmode,
+ const allocator_type&);
+template basic_istringstream<char>::basic_istringstream(__string_type&&,
+ ios_base::openmode);
+template basic_istringstream<char>::__sv_type
+ basic_istringstream<char>::view() const noexcept;
+
+template basic_ostringstream<char>::basic_ostringstream(ios_base::openmode,
+ const allocator_type&);
+template basic_ostringstream<char>::basic_ostringstream(__string_type&&,
+ ios_base::openmode);
+template basic_ostringstream<char>::__sv_type
+ basic_ostringstream<char>::view() const noexcept;
+
+template basic_stringstream<char>::basic_stringstream(ios_base::openmode,
+ const allocator_type&);
+template basic_stringstream<char>::basic_stringstream(__string_type&&,
+ ios_base::openmode);
+template basic_stringstream<char>::__sv_type
+ basic_stringstream<char>::view() const noexcept;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+template basic_stringbuf<wchar_t>::basic_stringbuf(const allocator_type&);
+template basic_stringbuf<wchar_t>::basic_stringbuf(ios_base::openmode,
+ const allocator_type&);
+template basic_stringbuf<wchar_t>::basic_stringbuf(__string_type&&,
+ ios_base::openmode);
+template basic_stringbuf<wchar_t>::basic_stringbuf(basic_stringbuf&&,
+ const allocator_type&);
+template basic_stringbuf<wchar_t>::allocator_type
+ basic_stringbuf<wchar_t>::get_allocator() const noexcept;
+template basic_stringbuf<wchar_t>::__sv_type
+ basic_stringbuf<wchar_t>::view() const noexcept;
+
+template basic_istringstream<wchar_t>::basic_istringstream(ios_base::openmode,
+ const allocator_type&);
+template basic_istringstream<wchar_t>::basic_istringstream(__string_type&&,
+ ios_base::openmode);
+template basic_istringstream<wchar_t>::__sv_type
+ basic_istringstream<wchar_t>::view() const noexcept;
+
+template basic_ostringstream<wchar_t>::basic_ostringstream(ios_base::openmode,
+ const allocator_type&);
+template basic_ostringstream<wchar_t>::basic_ostringstream(__string_type&&,
+ ios_base::openmode);
+template basic_ostringstream<wchar_t>::__sv_type
+ basic_ostringstream<wchar_t>::view() const noexcept;
+
+template basic_stringstream<wchar_t>::basic_stringstream(ios_base::openmode,
+ const allocator_type&);
+template basic_stringstream<wchar_t>::basic_stringstream(__string_type&&,
+ ios_base::openmode);
+template basic_stringstream<wchar_t>::__sv_type
+ basic_stringstream<wchar_t>::view() const noexcept;
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
new file mode 100644
@@ -0,0 +1,84 @@
+// 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
+// <http://www.gnu.org/licenses/>.
+
+// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons]
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do run { target c++2a } }
+
+#include <sstream>
+#include <string>
+#include <testsuite_allocator.h>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ std::istringstream::allocator_type a;
+ std::istringstream stm(std::ios_base::in, a);
+}
+
+auto const cstr = "This is a test";
+
+void
+test02()
+{
+ std::string s1(cstr);
+ std::istringstream stm(std::move(s1));
+ VERIFY( s1.empty() );
+
+ std::string s2(cstr);
+ VERIFY( stm.str() == s2 );
+}
+
+void
+test03()
+{
+ using alloc_type = __gnu_test::tracker_allocator<char>;
+ using str_type = std::basic_string<char, std::char_traits<char>, alloc_type>;
+
+ auto const mode = std::ios_base::in;
+ str_type s1(cstr);
+
+ {
+ std::istringstream::allocator_type a;
+ std::istringstream sbuf(s1, mode, a);
+ std::string s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+ }
+
+ {
+ std::istringstream sbuf(s1, mode);
+ std::string s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+ }
+
+ {
+ std::istringstream sbuf(s1);
+ std::string s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+ }
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ test03();
+ return 0;
+}
new file mode 100644
@@ -0,0 +1,84 @@
+// 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
+// <http://www.gnu.org/licenses/>.
+
+// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons]
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do run { target c++2a } }
+
+#include <sstream>
+#include <string>
+#include <testsuite_allocator.h>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ std::wistringstream::allocator_type a;
+ std::wistringstream stm(std::ios_base::in, a);
+}
+
+auto const cstr = L"This is a test";
+
+void
+test02()
+{
+ std::wstring s1(cstr);
+ std::wistringstream stm(std::move(s1));
+ VERIFY( s1.empty() );
+
+ std::wstring s2(cstr);
+ VERIFY( stm.str() == s2 );
+}
+
+void
+test03()
+{
+ using alloc_type = __gnu_test::tracker_allocator<wchar_t>;
+ using str_type = std::basic_string<wchar_t, std::char_traits<wchar_t>, alloc_type>;
+
+ auto const mode = std::ios_base::in;
+ str_type s1(cstr);
+
+ {
+ std::wistringstream::allocator_type a;
+ std::wistringstream sbuf(s1, mode, a);
+ std::wstring s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+ }
+
+ {
+ std::wistringstream sbuf(s1, mode);
+ std::wstring s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+ }
+
+ {
+ std::wistringstream sbuf(s1);
+ std::wstring s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+ }
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ test03();
+ return 0;
+}
new file mode 100644
@@ -0,0 +1,34 @@
+// 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
+// <http://www.gnu.org/licenses/>.
+
+// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons]
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do run { target c++2a } }
+
+#include <sstream>
+#include <string_view>
+#include <testsuite_hooks.h>
+
+int
+main()
+{
+ std::string s("This is a test");
+ std::istringstream stm(s);
+ VERIFY( stm.view() == s );
+ return 0;
+}
new file mode 100644
@@ -0,0 +1,35 @@
+// 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
+// <http://www.gnu.org/licenses/>.
+
+// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons]
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do run { target c++2a } }
+
+#include <sstream>
+#include <string_view>
+#include <testsuite_hooks.h>
+
+int
+main()
+{
+ std::wstring s(L"This is a test");
+ std::wistringstream stm(s);
+ VERIFY( stm.view() == s );
+ return 0;
+}
+
new file mode 100644
@@ -0,0 +1,84 @@
+// 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
+// <http://www.gnu.org/licenses/>.
+
+// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons]
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do run { target c++2a } }
+
+#include <sstream>
+#include <string>
+#include <testsuite_allocator.h>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ std::ostringstream::allocator_type a;
+ std::ostringstream stm(std::ios_base::in, a);
+}
+
+auto const cstr = "This is a test";
+
+void
+test02()
+{
+ std::string s1(cstr);
+ std::ostringstream stm(std::move(s1));
+ VERIFY( s1.empty() );
+
+ std::string s2(cstr);
+ VERIFY( stm.str() == s2 );
+}
+
+void
+test03()
+{
+ using alloc_type = __gnu_test::tracker_allocator<char>;
+ using str_type = std::basic_string<char, std::char_traits<char>, alloc_type>;
+
+ auto const mode = std::ios_base::out;
+ str_type s1(cstr);
+
+ {
+ std::ostringstream::allocator_type a;
+ std::ostringstream sbuf(s1, mode, a);
+ std::string s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+ }
+
+ {
+ std::ostringstream sbuf(s1, mode);
+ std::string s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+ }
+
+ {
+ std::ostringstream sbuf(s1);
+ std::string s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+ }
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ test03();
+ return 0;
+}
new file mode 100644
@@ -0,0 +1,84 @@
+// 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
+// <http://www.gnu.org/licenses/>.
+
+// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons]
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do run { target c++2a } }
+
+#include <sstream>
+#include <string>
+#include <testsuite_allocator.h>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ std::wostringstream::allocator_type a;
+ std::wostringstream stm(std::ios_base::out, a);
+}
+
+auto const cstr = L"This is a test";
+
+void
+test02()
+{
+ std::wstring s1(cstr);
+ std::wostringstream stm(std::move(s1));
+ VERIFY( s1.empty() );
+
+ std::wstring s2(cstr);
+ VERIFY( stm.str() == s2 );
+}
+
+void
+test03()
+{
+ using alloc_type = __gnu_test::tracker_allocator<wchar_t>;
+ using str_type = std::basic_string<wchar_t, std::char_traits<wchar_t>, alloc_type>;
+
+ auto const mode = std::ios_base::out;
+ str_type s1(cstr);
+
+ {
+ std::wostringstream::allocator_type a;
+ std::wostringstream sbuf(s1, mode, a);
+ std::wstring s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+ }
+
+ {
+ std::wostringstream sbuf(s1, mode);
+ std::wstring s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+ }
+
+ {
+ std::wostringstream sbuf(s1);
+ std::wstring s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+ }
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ test03();
+ return 0;
+}
new file mode 100644
@@ -0,0 +1,34 @@
+// 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
+// <http://www.gnu.org/licenses/>.
+
+// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons]
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do run { target c++2a } }
+
+#include <sstream>
+#include <string_view>
+#include <testsuite_hooks.h>
+
+int
+main()
+{
+ std::string s("This is a test");
+ std::ostringstream stm(s);
+ VERIFY( stm.view() == s );
+ return 0;
+}
new file mode 100644
@@ -0,0 +1,35 @@
+// 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
+// <http://www.gnu.org/licenses/>.
+
+// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons]
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do run { target c++2a } }
+
+#include <sstream>
+#include <string_view>
+#include <testsuite_hooks.h>
+
+int
+main()
+{
+ std::wstring s(L"This is a test");
+ std::wostringstream stm(s);
+ VERIFY( stm.view() == s );
+ return 0;
+}
+
new file mode 100644
@@ -0,0 +1,120 @@
+// 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
+// <http://www.gnu.org/licenses/>.
+
+// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons]
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do run { target c++2a } }
+
+#include <sstream>
+#include <string>
+#include <testsuite_allocator.h>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ {
+ using alloc_type = __gnu_test::uneq_allocator<char>;
+ using sbuf_t = std::basic_stringbuf<char, std::char_traits<char>,
+ alloc_type>;
+
+ alloc_type aa;
+ sbuf_t sbuf1(aa);
+ VERIFY( aa == sbuf1.get_allocator() );
+
+ alloc_type aaa(42);
+ sbuf_t sbuf2(aaa);
+ VERIFY( aaa == sbuf2.get_allocator() );
+
+ VERIFY( sbuf1.get_allocator() != sbuf2.get_allocator() );
+ }
+
+ std::stringbuf::allocator_type a;
+ {
+ std::stringbuf sbuf(std::ios_base::in, a);
+ }
+
+ {
+ std::stringbuf sbuf(a);
+ }
+}
+
+auto const cstr = "This is a test";
+
+void
+test02()
+{
+ std::string s1(cstr);
+ std::stringbuf sbuf(std::move(s1));
+ VERIFY( s1.empty() );
+
+ std::string s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+}
+
+void
+test03()
+{
+ using alloc_type = __gnu_test::tracker_allocator<char>;
+ using str_type = std::basic_string<char, std::char_traits<char>, alloc_type>;
+
+ auto const mode = std::ios_base::in | std::ios_base::out;
+ str_type s1(cstr);
+
+ {
+ std::stringbuf::allocator_type a;
+ std::stringbuf sbuf(s1, mode, a);
+ std::string s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+ }
+
+ {
+ std::stringbuf sbuf(s1, mode);
+ std::string s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+ }
+
+ {
+ std::stringbuf sbuf(s1);
+ std::string s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+ }
+}
+
+void
+test04()
+{
+ std::stringbuf sbuf1(cstr);
+
+ std::stringbuf::allocator_type a;
+ std::stringbuf sbuf2(std::move(sbuf1), a);
+ VERIFY( sbuf1.str().empty() );
+
+ std::string s(cstr);
+ VERIFY( sbuf2.str() == s );
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ test03();
+ test04();
+ return 0;
+}
new file mode 100644
@@ -0,0 +1,105 @@
+// 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
+// <http://www.gnu.org/licenses/>.
+
+// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons]
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do run { target c++2a } }
+
+#include <sstream>
+#include <string>
+#include <testsuite_allocator.h>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ std::wstringbuf::allocator_type a;
+ {
+ std::wstringbuf sbuf(std::ios_base::in, a);
+ }
+
+ {
+ std::wstringbuf sbuf(a);
+ }
+}
+
+auto const cstr = L"This is a test";
+
+void
+test02()
+{
+ std::wstring s1(cstr);
+ std::wstringbuf sbuf(std::move(s1));
+ VERIFY( s1.empty() );
+
+ std::wstring s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+}
+
+void
+test03()
+{
+ using alloc_type = __gnu_test::tracker_allocator<wchar_t>;
+ using str_type = std::basic_string<wchar_t, std::char_traits<wchar_t>, alloc_type>;
+
+ auto const mode = std::ios_base::in | std::ios_base::out;
+ str_type s1(cstr);
+
+ {
+ std::wstringbuf::allocator_type a;
+ std::wstringbuf sbuf(s1, mode, a);
+ std::wstring s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+ }
+
+ {
+ std::wstringbuf sbuf(s1, mode);
+ std::wstring s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+ }
+
+ {
+ std::wstringbuf sbuf(s1);
+ std::wstring s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+ }
+}
+
+void
+test04()
+{
+ std::wstringbuf sbuf1(cstr);
+
+ std::wstringbuf::allocator_type a;
+ std::wstringbuf sbuf2(std::move(sbuf1), a);
+ VERIFY( sbuf1.str().empty() );
+
+ std::wstring s(cstr);
+ VERIFY( sbuf2.str() == s );
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ test03();
+ test04();
+ return 0;
+}
+
new file mode 100644
@@ -0,0 +1,34 @@
+// 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
+// <http://www.gnu.org/licenses/>.
+
+// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons]
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do run { target c++2a } }
+
+#include <sstream>
+#include <string_view>
+#include <testsuite_hooks.h>
+
+int
+main()
+{
+ std::string s("This is a test");
+ std::stringbuf sbuf(s);
+ VERIFY( sbuf.view() == s );
+ return 0;
+}
new file mode 100644
@@ -0,0 +1,35 @@
+// 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
+// <http://www.gnu.org/licenses/>.
+
+// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons]
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do run { target c++2a } }
+
+#include <sstream>
+#include <string_view>
+#include <testsuite_hooks.h>
+
+int
+main()
+{
+ std::wstring s(L"This is a test");
+ std::wstringbuf sbuf(s);
+ VERIFY( sbuf.view() == s );
+ return 0;
+}
+
new file mode 100644
@@ -0,0 +1,84 @@
+// 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
+// <http://www.gnu.org/licenses/>.
+
+// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons]
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do run { target c++2a } }
+
+#include <sstream>
+#include <string>
+#include <testsuite_allocator.h>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ std::stringstream::allocator_type a;
+ std::stringstream stm(std::ios_base::in, a);
+}
+
+auto const cstr = "This is a test";
+
+void
+test02()
+{
+ std::string s1(cstr);
+ std::stringstream stm(std::move(s1));
+ VERIFY( s1.empty() );
+
+ std::string s2(cstr);
+ VERIFY( stm.str() == s2 );
+}
+
+void
+test03()
+{
+ using alloc_type = __gnu_test::tracker_allocator<char>;
+ using str_type = std::basic_string<char, std::char_traits<char>, alloc_type>;
+
+ auto const mode = std::ios_base::in | std::ios_base::out;
+ str_type s1(cstr);
+
+ {
+ std::stringstream::allocator_type a;
+ std::stringstream sbuf(s1, mode, a);
+ std::string s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+ }
+
+ {
+ std::stringstream sbuf(s1, mode);
+ std::string s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+ }
+
+ {
+ std::stringstream sbuf(s1);
+ std::string s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+ }
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ test03();
+ return 0;
+}
new file mode 100644
@@ -0,0 +1,84 @@
+// 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
+// <http://www.gnu.org/licenses/>.
+
+// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons]
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do run { target c++2a } }
+
+#include <sstream>
+#include <string>
+#include <testsuite_allocator.h>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ std::wistringstream::allocator_type a;
+ std::wistringstream stm(std::ios_base::in, a);
+}
+
+auto const cstr = L"This is a test";
+
+void
+test02()
+{
+ std::wstring s1(cstr);
+ std::wistringstream stm(std::move(s1));
+ VERIFY( s1.empty() );
+
+ std::wstring s2(cstr);
+ VERIFY( stm.str() == s2 );
+}
+
+void
+test03()
+{
+ using alloc_type = __gnu_test::tracker_allocator<wchar_t>;
+ using str_type = std::basic_string<wchar_t, std::char_traits<wchar_t>, alloc_type>;
+
+ auto const mode = std::ios_base::in;
+ str_type s1(cstr);
+
+ {
+ std::wistringstream::allocator_type a;
+ std::wistringstream sbuf(s1, mode, a);
+ std::wstring s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+ }
+
+ {
+ std::wistringstream sbuf(s1, mode);
+ std::wstring s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+ }
+
+ {
+ std::wistringstream sbuf(s1);
+ std::wstring s2(cstr);
+ VERIFY( sbuf.str() == s2 );
+ }
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ test03();
+ return 0;
+}
new file mode 100644
@@ -0,0 +1,34 @@
+// 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
+// <http://www.gnu.org/licenses/>.
+
+// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons]
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do run { target c++2a } }
+
+#include <sstream>
+#include <string_view>
+#include <testsuite_hooks.h>
+
+int
+main()
+{
+ std::string s("This is a test");
+ std::stringstream stm(s);
+ VERIFY( stm.view() == s );
+ return 0;
+}
new file mode 100644
@@ -0,0 +1,35 @@
+// 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
+// <http://www.gnu.org/licenses/>.
+
+// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons]
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do run { target c++2a } }
+
+#include <sstream>
+#include <string_view>
+#include <testsuite_hooks.h>
+
+int
+main()
+{
+ std::wstring s(L"This is a test");
+ std::wstringstream stm(s);
+ VERIFY( stm.view() == s );
+ return 0;
+}
+
From: Thomas Rodgers <trodgers@redhat.com> 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 + .../27_io/basic_ostringstream/cons/char/1.cc | 84 ++ .../basic_ostringstream/cons/wchar_t/1.cc | 84 ++ .../27_io/basic_ostringstream/view/char/1.cc | 34 + .../basic_ostringstream/view/wchar_t/1.cc | 35 + .../27_io/basic_stringbuf/cons/char/2.cc | 120 +++ .../27_io/basic_stringbuf/cons/wchar_t/2.cc | 105 +++ .../27_io/basic_stringbuf/view/char/1.cc | 34 + .../27_io/basic_stringbuf/view/wchar_t/1.cc | 35 + .../27_io/basic_stringstream/cons/char/1.cc | 84 ++ .../basic_stringstream/cons/wchar_t/1.cc | 84 ++ .../27_io/basic_stringstream/view/char/1.cc | 34 + .../basic_stringstream/view/wchar_t/1.cc | 35 + 27 files changed, 2248 insertions(+), 12 deletions(-) create mode 100644 .topdeps create mode 100644 .topmsg create mode 100644 libstdc++-v3/src/c++20/Makefile.am create mode 100644 libstdc++-v3/src/c++20/Makefile.in create mode 100644 libstdc++-v3/src/c++20/sstream-inst.cc create mode 100644 libstdc++-v3/testsuite/27_io/basic_istringstream/cons/char/1.cc create mode 100644 libstdc++-v3/testsuite/27_io/basic_istringstream/cons/wchar_t/1.cc create mode 100644 libstdc++-v3/testsuite/27_io/basic_istringstream/view/char/1.cc create mode 100644 libstdc++-v3/testsuite/27_io/basic_istringstream/view/wchar_t/1.cc create mode 100644 libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/char/1.cc create mode 100644 libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/wchar_t/1.cc create mode 100644 libstdc++-v3/testsuite/27_io/basic_ostringstream/view/char/1.cc create mode 100644 libstdc++-v3/testsuite/27_io/basic_ostringstream/view/wchar_t/1.cc create mode 100644 libstdc++-v3/testsuite/27_io/basic_stringbuf/cons/char/2.cc create mode 100644 libstdc++-v3/testsuite/27_io/basic_stringbuf/cons/wchar_t/2.cc create mode 100644 libstdc++-v3/testsuite/27_io/basic_stringbuf/view/char/1.cc create mode 100644 libstdc++-v3/testsuite/27_io/basic_stringbuf/view/wchar_t/1.cc create mode 100644 libstdc++-v3/testsuite/27_io/basic_stringstream/cons/char/1.cc create mode 100644 libstdc++-v3/testsuite/27_io/basic_stringstream/cons/wchar_t/1.cc create mode 100644 libstdc++-v3/testsuite/27_io/basic_stringstream/view/char/1.cc create mode 100644 libstdc++-v3/testsuite/27_io/basic_stringstream/view/wchar_t/1.cc