From: Thomas Rodgers Date: Wed, 28 Oct 2020 18:52:17 +0000 (-0700) Subject: libstdc++: Implement C++20 features for X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a0e4d7b44c544c84cffc7ff9c64b6f1af14fb08d;p=gcc.git libstdc++: Implement C++20 features for 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 (GLIBCXX_3.4.29): New symbols. * 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/1.cc: Likewise. * testsuite/27_io/basic_stringbuf/view/wchar_t/1.cc: Likewise. * testsuite/27_io/basic_istringstream/cons/char/1.cc: Likewise. * testsuite/27_io/basic_istringstream/cons/wchar_t/1.cc: Likewise. * testsuite/27_io/basic_istringstream/view/char/1.cc: Likewise. * testsuite/27_io/basic_istringstream/view/wchar_t/1.cc: Likewise. * testsuite/27_io/basic_ostringstream/cons/char/1.cc: Likewise. * testsuite/27_io/basic_ostringstream/cons/wchar_t/1.cc: Likewise. * testsuite/27_io/basic_ostringstream/view/char/1.cc: Likewise. * testsuite/27_io/basic_ostringstream/view/wchar_t/1.cc: Likewise. * testsuite/27_io/basic_stringstream/cons/char/1.cc: Likewise. * testsuite/27_io/basic_stringstream/cons/wchar_t/1.cc: Likewise. * testsuite/27_io/basic_stringstream/view/char/1.cc: Likewise. * testsuite/27_io/basic_stringstream/view/wchar_t/1.cc: Likewise. --- diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 133125ec4fa..b9452dd74cd 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -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 diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver index a7f437aef7b..2648c813616 100644 --- a/libstdc++-v3/config/abi/pre/gnu.ver +++ b/libstdc++-v3/config/abi/pre/gnu.ver @@ -1769,21 +1769,31 @@ GLIBCXX_3.4.21 { # ABI-tagged stringstreams # _ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]*; - _ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]E[ORS]*; + _ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]EOS4_; + _ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]EOSa*; + _ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]ERKNS_12basic_stringI[cw]S2_S3_EESt13_Ios_Openmode; + _ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]ESt13_Ios_Openmode; _ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EED[012]Ev; _ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]*__xfer_bufptrs*; _ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE[a1346789]*; # _ZNSt7__cxx1118basic_stringstreamI[cw]St11char_traitsI[cw]*; - _ZNSt7__cxx1118basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]E[ORS]*; + _ZNSt7__cxx1118basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]EOS4_; + _ZNSt7__cxx1118basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]EOSa*; + _ZNSt7__cxx1118basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]ERKNS_12basic_stringI[cw]S2_S3_EESt13_Ios_Openmode; + _ZNSt7__cxx1118basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]ESt13_Ios_Openmode; _ZNSt7__cxx1118basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EED[012]Ev; _ZNSt7__cxx1118basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE[a34]*; # _ZNSt7__cxx1119basic_istringstreamI[cw]St11char_traitsI[cw]*; # _ZNSt7__cxx1119basic_ostringstreamI[cw]St11char_traitsI[cw]*; - _ZNSt7__cxx1119basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]E[ORS]*; + _ZNSt7__cxx1119basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]EOS4_; + _ZNSt7__cxx1119basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]EOSa*; + _ZNSt7__cxx1119basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]ERKNS_12basic_stringI[cw]S2_S3_EESt13_Ios_Openmode; + _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__cxx1118basic_stringstream*; + _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*; _ZT[ISTV]NSt7__cxx1115basic_stringbuf*; @@ -2325,6 +2335,87 @@ 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_; + + # basic_istringstream::view() + _ZNKSt7__cxx1119basic_istringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE4viewEv; + + # basic_ostringstream::basic_ostringstream(basic_string&&, ios_base::openmode) + _ZNSt7__cxx1119basic_ostringstreamI[cw]St11char_traitsI[cw]ESaIcEEC1EONS_12basic_stringI[cw]S2_S3_EESt13_Ios_Openmode; + + # basic_ostringstream::basic_ostringstream(ios_base::openmode, allocator const&) + _ZNSt7__cxx1119basic_ostringstreamI[cw]St11char_traitsI[cw]ESaIcEEC1ESt13_Ios_OpenmodeRKS3_; + + # basic_ostringstream::view() + _ZNKSt7__cxx1119basic_ostringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE4viewEv; + + # basic_stringstream::basic_stringstream(basic_string&&, ios_base::openmode) + _ZNSt7__cxx1119basic_stringstreamI[cw]St11char_traitsI[cw]ESaIcEEC1EONS_12basic_stringI[cw]S2_S3_EESt13_Ios_Openmode; + + # basic_stringstream::basic_stringstream(ios_base::openmode, allocator const&) + _ZNSt7__cxx1119basic_stringstreamI[cw]St11char_traitsI[cw]ESaIcEEC1ESt13_Ios_OpenmodeRKS3_; + + # basic_stringstream::view() + _ZNKSt7__cxx1119basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE4viewEv; + + # basic_stringbuf::basic_stringbuf(allocator const&) + _ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]ERKS3_; + + # basic_stringbuf::basic_stringbuf(ios_base::openmode, allocator const&) + _ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]ESt13_Ios_OpenmodeRKS3_; + + # basic_stringbuf::basic_stringbuf(basic_string&&, ios_base::openmode) + _ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]EONS_12basic_stringI[cw]S2_S3_EESt13_Ios_Openmode; + + # basic_stringbuf::basic_stringbuf(basic_stringbuf&&, allocator const&) + _ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]EOS4_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_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]EONS_12basic_stringI[cw]S2_S3_EESt13_Ios_Openmode; + + # basic_[io]stringstream::basic_[io]stringstream(ios_base::openmode, allocator const&) + _ZNSt7__cxx1119basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]ESt13_Ios_OpenmodeRKS3_; + + # basic_istringstream::view() + _ZNKSt7__cxx1119basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE4viewEv; + + # basic_stringstream::basic_stringstream(basic_string&&, ios_base::openmode) + _ZNSt7__cxx1118basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]EONS_12basic_stringI[cw]S2_S3_EESt13_Ios_Openmode; + + # basic_stringstream::basic_stringstream(ios_base::openmode, allocator const&) + _ZNSt7__cxx1118basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]ESt13_Ios_OpenmodeRKS3_; + + # basic_stringstream::view() + _ZNKSt7__cxx1118basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE4viewEv; + } GLIBCXX_3.4.28; # Symbols in the support library (libsupc++) have their own tag. @@ -2625,15 +2716,6 @@ CXXABI_1.3.12 { } CXXABI_1.3.11; -CXXABI_1.3.13 { - - # std::exception_ptr::_M_addref() - _ZNSt15__exception_ptr13exception_ptr9_M_addrefEv; - # std::exception_ptr::_M_release() - _ZNSt15__exception_ptr13exception_ptr10_M_releaseEv; - -} CXXABI_1.3.12; - # Symbols in the support library (libsupc++) supporting transactional memory. CXXABI_TM_1 { diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 0213c3c6bc4..efdec6e68b9 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -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 diff --git a/libstdc++-v3/include/std/sstream b/libstdc++-v3/include/std/sstream index 06960e30bf2..f03f3abd6fc 100644 --- a/libstdc++-v3/include/std/sstream +++ b/libstdc++-v3/include/std/sstream @@ -165,6 +165,55 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 } #endif +#if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI + using __sv_type = basic_string_view; + + 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 + 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) + { } + + template + 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(__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. @@ -208,6 +257,23 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 _M_stringbuf_init(_M_mode); } +#if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI + __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 @@ -370,6 +436,16 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 : __streambuf_type(static_cast(__rhs)), _M_mode(__rhs._M_mode), _M_string(std::move(__rhs._M_string)) { } + +#if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI + // 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(__rhs)), + _M_mode(__rhs._M_mode), _M_string(std::move(__rhs._M_string), __a) + { } +#endif #endif }; @@ -501,6 +577,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(std::__addressof(_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(std::__addressof(_M_stringbuf)); } + + template + basic_istringstream(const basic_string<_CharT, _Traits, _SAlloc>& __str, + const allocator_type& __a) + : basic_istringstream(__str, ios_base::in, __a) + { } + + template + 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(std::__addressof(_M_stringbuf)); } + + template + 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. @@ -529,6 +639,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 void str(const __string_type& __s) { _M_stringbuf.str(__s); } + +#if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI + basic_string_view + view() const noexcept + { return _M_stringbuf.view(); } +#endif }; @@ -659,6 +775,40 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 } #endif +#if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI + basic_ostringstream(ios_base::openmode __mode, const allocator_type& __a) + : __ostream_type(), _M_stringbuf(__mode | ios_base::out, __a) + { this->init(std::__addressof(_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(std::__addressof(_M_stringbuf)); } + + template + basic_ostringstream(const basic_string<_CharT, _Traits, _SAlloc>& __str, + const allocator_type& __a) + : basic_ostringstream(__str, ios_base::out, __a) + { } + + template + 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(std::__addressof(_M_stringbuf)); } + + template + 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. @@ -687,6 +837,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 void str(const __string_type& __s) { _M_stringbuf.str(__s); } + +#if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI + basic_string_view + view() const noexcept + { return _M_stringbuf.view(); } +#endif }; @@ -813,6 +969,40 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 } #endif +#if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI + 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(std::__addressof(_M_stringbuf)); } + + template + basic_stringstream(const basic_string<_CharT, _Traits, _SAlloc>& __str, + const allocator_type& __a) + : basic_stringstream(__str, ios_base::in | ios_base::out, __a) + { } + + template + 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(std::__addressof(_M_stringbuf)); } + + template + 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. @@ -841,6 +1031,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 void str(const __string_type& __s) { _M_stringbuf.str(__s); } + +#if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI + basic_string_view + view() const noexcept + { return _M_stringbuf.view(); } +#endif }; #if __cplusplus >= 201103L diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am index a139adc81b3..9a6807ae8c6 100644 --- a/libstdc++-v3/src/Makefile.am +++ b/libstdc++-v3/src/Makefile.am @@ -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 diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in index 5dc74bb03a3..e51e6164055 100644 --- a/libstdc++-v3/src/Makefile.in +++ b/libstdc++-v3/src/Makefile.in @@ -234,7 +234,7 @@ am__define_uniq_tagged_files = \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags -DIST_SUBDIRS = c++98 c++11 c++17 filesystem +DIST_SUBDIRS = c++98 c++11 c++17 c++20 filesystem ABI_TWEAKS_SRCDIR = @ABI_TWEAKS_SRCDIR@ ACLOCAL = @ACLOCAL@ ALLOCATOR_H = @ALLOCATOR_H@ @@ -464,7 +464,7 @@ WARN_CXXFLAGS = \ AM_CPPFLAGS = $(GLIBCXX_INCLUDES) $(CPPFLAGS) @ENABLE_FILESYSTEM_TS_FALSE@filesystem_dir = @ENABLE_FILESYSTEM_TS_TRUE@filesystem_dir = filesystem -SUBDIRS = c++98 c++11 c++17 $(filesystem_dir) +SUBDIRS = c++98 c++11 c++17 c++20 $(filesystem_dir) @VTV_CYGMIN_FALSE@toolexeclib_LTLIBRARIES = libstdc++.la # Cross compiler support. @@ -505,14 +505,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 @@ -528,7 +530,8 @@ libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) # 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 @@ -957,6 +960,7 @@ uninstall-am: uninstall-toolexeclibLTLIBRARIES vpath % $(top_srcdir)/src/c++98 vpath % $(top_srcdir)/src/c++11 vpath % $(top_srcdir)/src/c++17 +vpath % $(top_srcdir)/src/c++20 @ENABLE_FILESYSTEM_TS_TRUE@vpath % $(top_srcdir)/src/filesystem # Use special rules for compatibility-ldbl.cc compilation, as we need to diff --git a/libstdc++-v3/src/c++20/Makefile.am b/libstdc++-v3/src/c++20/Makefile.am new file mode 100644 index 00000000000..423a79f3686 --- /dev/null +++ b/libstdc++-v3/src/c++20/Makefile.am @@ -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 +## . + +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 $@ diff --git a/libstdc++-v3/src/c++20/Makefile.in b/libstdc++-v3/src/c++20/Makefile.in new file mode 100644 index 00000000000..0e2de19ae59 --- /dev/null +++ b/libstdc++-v3/src/c++20/Makefile.in @@ -0,0 +1,735 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = src/c++20 +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ + $(top_srcdir)/../config/enable.m4 \ + $(top_srcdir)/../config/futex.m4 \ + $(top_srcdir)/../config/hwcaps.m4 \ + $(top_srcdir)/../config/iconv.m4 \ + $(top_srcdir)/../config/lead-dot.m4 \ + $(top_srcdir)/../config/lib-ld.m4 \ + $(top_srcdir)/../config/lib-link.m4 \ + $(top_srcdir)/../config/lib-prefix.m4 \ + $(top_srcdir)/../config/lthostflags.m4 \ + $(top_srcdir)/../config/multi.m4 \ + $(top_srcdir)/../config/no-executables.m4 \ + $(top_srcdir)/../config/override.m4 \ + $(top_srcdir)/../config/stdint.m4 \ + $(top_srcdir)/../config/toolexeclibdir.m4 \ + $(top_srcdir)/../config/unwind_ipinfo.m4 \ + $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \ + $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \ + $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/crossconfig.m4 \ + $(top_srcdir)/linkage.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/../config/gc++filt.m4 \ + $(top_srcdir)/../config/tls.m4 $(top_srcdir)/../config/gthr.m4 \ + $(top_srcdir)/../config/cet.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libc__20convenience_la_LIBADD = +am__objects_1 = +@ENABLE_EXTERN_TEMPLATE_TRUE@am__objects_2 = sstream-inst.lo +am_libc__20convenience_la_OBJECTS = $(am__objects_1) $(am__objects_2) +libc__20convenience_la_OBJECTS = $(am_libc__20convenience_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = +am__depfiles_maybe = +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(libc__20convenience_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +ABI_TWEAKS_SRCDIR = @ABI_TWEAKS_SRCDIR@ +ACLOCAL = @ACLOCAL@ +ALLOCATOR_H = @ALLOCATOR_H@ +ALLOCATOR_NAME = @ALLOCATOR_NAME@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +ATOMICITY_SRCDIR = @ATOMICITY_SRCDIR@ +ATOMIC_FLAGS = @ATOMIC_FLAGS@ +ATOMIC_WORD_SRCDIR = @ATOMIC_WORD_SRCDIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASIC_FILE_CC = @BASIC_FILE_CC@ +BASIC_FILE_H = @BASIC_FILE_H@ +CC = @CC@ +CCODECVT_CC = @CCODECVT_CC@ +CCOLLATE_CC = @CCOLLATE_CC@ +CCTYPE_CC = @CCTYPE_CC@ +CFLAGS = @CFLAGS@ +CLOCALE_CC = @CLOCALE_CC@ +CLOCALE_H = @CLOCALE_H@ +CLOCALE_INTERNAL_H = @CLOCALE_INTERNAL_H@ +CMESSAGES_CC = @CMESSAGES_CC@ +CMESSAGES_H = @CMESSAGES_H@ +CMONEY_CC = @CMONEY_CC@ +CNUMERIC_CC = @CNUMERIC_CC@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPU_DEFINES_SRCDIR = @CPU_DEFINES_SRCDIR@ +CPU_OPT_BITS_RANDOM = @CPU_OPT_BITS_RANDOM@ +CPU_OPT_EXT_RANDOM = @CPU_OPT_EXT_RANDOM@ +CSTDIO_H = @CSTDIO_H@ +CTIME_CC = @CTIME_CC@ +CTIME_H = @CTIME_H@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXFILT = @CXXFILT@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +C_INCLUDE_DIR = @C_INCLUDE_DIR@ +DBLATEX = @DBLATEX@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DEFS = @DEFS@ +DOT = @DOT@ +DOXYGEN = @DOXYGEN@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ERROR_CONSTANTS_SRCDIR = @ERROR_CONSTANTS_SRCDIR@ +EXEEXT = @EXEEXT@ +EXTRA_CFLAGS = @EXTRA_CFLAGS@ +EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@ +FGREP = @FGREP@ +GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@ +GLIBCXX_LIBS = @GLIBCXX_LIBS@ +GREP = @GREP@ +HWCAP_CFLAGS = @HWCAP_CFLAGS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LONG_DOUBLE_COMPAT_FLAGS = @LONG_DOUBLE_COMPAT_FLAGS@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@ +OPT_LDFLAGS = @OPT_LDFLAGS@ +OS_INC_SRCDIR = @OS_INC_SRCDIR@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PDFLATEX = @PDFLATEX@ +RANLIB = @RANLIB@ +SECTION_FLAGS = @SECTION_FLAGS@ +SECTION_LDFLAGS = @SECTION_LDFLAGS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SYMVER_FILE = @SYMVER_FILE@ +TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VTV_CXXFLAGS = @VTV_CXXFLAGS@ +VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ +VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ +WARN_FLAGS = @WARN_FLAGS@ +XMLCATALOG = @XMLCATALOG@ +XMLLINT = @XMLLINT@ +XSLTPROC = @XSLTPROC@ +XSL_STYLE_DIR = @XSL_STYLE_DIR@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ +baseline_dir = @baseline_dir@ +baseline_subdir_switch = @baseline_subdir_switch@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +check_msgfmt = @check_msgfmt@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +enable_shared = @enable_shared@ +enable_static = @enable_static@ +exec_prefix = @exec_prefix@ +get_gcc_base_ver = @get_gcc_base_ver@ +glibcxx_MOFILES = @glibcxx_MOFILES@ +glibcxx_PCHFLAGS = @glibcxx_PCHFLAGS@ +glibcxx_POFILES = @glibcxx_POFILES@ +glibcxx_builddir = @glibcxx_builddir@ +glibcxx_compiler_pic_flag = @glibcxx_compiler_pic_flag@ +glibcxx_compiler_shared_flag = @glibcxx_compiler_shared_flag@ +glibcxx_cxx98_abi = @glibcxx_cxx98_abi@ +glibcxx_localedir = @glibcxx_localedir@ +glibcxx_lt_pic_flag = @glibcxx_lt_pic_flag@ +glibcxx_prefixdir = @glibcxx_prefixdir@ +glibcxx_srcdir = @glibcxx_srcdir@ +glibcxx_toolexecdir = @glibcxx_toolexecdir@ +glibcxx_toolexeclibdir = @glibcxx_toolexeclibdir@ +gxx_include_dir = @gxx_include_dir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libtool_VERSION = @libtool_VERSION@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_host_flags = @lt_host_flags@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +multi_basedir = @multi_basedir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +port_specific_symbol_files = @port_specific_symbol_files@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +python_mod_dir = @python_mod_dir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +thread_header = @thread_header@ +tmake_file = @tmake_file@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +toplevel_builddir = @toplevel_builddir@ +toplevel_srcdir = @toplevel_srcdir@ + +# May be used by various substitution variables. +gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER) +MAINT_CHARSET = latin1 +mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs +PWD_COMMAND = $${PWDCMD-pwd} +STAMP = echo timestamp > +toolexecdir = $(glibcxx_toolexecdir) +toolexeclibdir = $(glibcxx_toolexeclibdir) +@ENABLE_WERROR_FALSE@WERROR_FLAG = +@ENABLE_WERROR_TRUE@WERROR_FLAG = -Werror +@ENABLE_EXTERN_TEMPLATE_FALSE@XTEMPLATE_FLAGS = +@ENABLE_EXTERN_TEMPLATE_TRUE@XTEMPLATE_FLAGS = -fno-implicit-templates + +# These bits are all figured out from configure. Look in acinclude.m4 +# or configure.ac to see how they are set. See GLIBCXX_EXPORT_FLAGS. +CONFIG_CXXFLAGS = \ + $(SECTION_FLAGS) $(HWCAP_CFLAGS) -frandom-seed=$@ + +WARN_CXXFLAGS = \ + $(WARN_FLAGS) $(WERROR_FLAG) -fdiagnostics-show-location=once + + +# -I/-D flags to pass when compiling. +AM_CPPFLAGS = $(GLIBCXX_INCLUDES) $(CPPFLAGS) + +# Convenience library for C++17 runtime. +noinst_LTLIBRARIES = libc++20convenience.la +headers = +# XTEMPLATE_FLAGS = +@ENABLE_EXTERN_TEMPLATE_FALSE@inst_sources = + +# XTEMPLATE_FLAGS = -fno-implicit-templates +@ENABLE_EXTERN_TEMPLATE_TRUE@inst_sources = \ +@ENABLE_EXTERN_TEMPLATE_TRUE@ sstream-inst.cc + +sources = +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 $@ + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/fragment.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign --ignore-deps src/c++20/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign --ignore-deps src/c++20/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/fragment.am $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libc++20convenience.la: $(libc__20convenience_la_OBJECTS) $(libc__20convenience_la_DEPENDENCIES) $(EXTRA_libc__20convenience_la_DEPENDENCIES) + $(AM_V_CXXLD)$(CXXLINK) $(libc__20convenience_la_OBJECTS) $(libc__20convenience_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +.cc.o: + $(AM_V_CXX)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: + $(AM_V_CXX)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: + $(AM_V_CXX)$(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags dvi dvi-am html html-am info \ + info-am install install-am install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am + +.PRECIOUS: Makefile + + +vpath % $(top_srcdir)/src/c++20 + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: 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 00000000000..e04560d28c8 --- /dev/null +++ b/libstdc++-v3/src/c++20/sstream-inst.cc @@ -0,0 +1,108 @@ +// Explicit instantiation file. + +// Copyright (C) 2020 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +// +// ISO C++ 14882: +// + +// Instantiations in this file are only for the new SSO std::string ABI +#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 +basic_stringbuf::view() const noexcept; + +template basic_istringstream::basic_istringstream(ios_base::openmode, + const allocator_type&); +template basic_istringstream::basic_istringstream(__string_type&&, + ios_base::openmode); +template string_view +basic_istringstream::view() const noexcept; + +template basic_ostringstream::basic_ostringstream(ios_base::openmode, + const allocator_type&); +template basic_ostringstream::basic_ostringstream(__string_type&&, + ios_base::openmode); +template string_view +basic_ostringstream::view() const noexcept; + +template basic_stringstream::basic_stringstream(ios_base::openmode, + const allocator_type&); +template basic_stringstream::basic_stringstream(__string_type&&, + ios_base::openmode); +template string_view +basic_stringstream::view() const noexcept; + +#ifdef _GLIBCXX_USE_WCHAR_T +using wsv_type = basic_string_view; + +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_istringstream::__stringbuf_type::__sv_type +basic_stringbuf::view() const noexcept; + +template basic_istringstream::basic_istringstream(ios_base::openmode, + const allocator_type&); +template basic_istringstream::basic_istringstream(__string_type&&, + ios_base::openmode); +template wstring_view +basic_istringstream::view() const noexcept; + +template basic_ostringstream::basic_ostringstream(ios_base::openmode, + const allocator_type&); +template basic_ostringstream::basic_ostringstream(__string_type&&, + ios_base::openmode); +template wstring_view +basic_ostringstream::view() const noexcept; + +template basic_stringstream::basic_stringstream(ios_base::openmode, + const allocator_type&); +template basic_stringstream::basic_stringstream(__string_type&&, + ios_base::openmode); +template wstring_view +basic_stringstream::view() const noexcept; +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} 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 00000000000..496aa6963e0 --- /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 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 +// . + +// C++20 29.8.2.2 basic_stringbuf constructors [stringbuf.cons + +// { dg-options "-std=gnu++2a" } +// { dg-do run { target c++2a } } +// { dg-require-effective-target cxx11-abi } + +#include +#include +#include +#include + +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; + using str_type = std::basic_string, 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; +} diff --git a/libstdc++-v3/testsuite/27_io/basic_istringstream/cons/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_istringstream/cons/wchar_t/1.cc new file mode 100644 index 00000000000..26a3a86c46e --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_istringstream/cons/wchar_t/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 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 +// . + +// C++20 29.8.2.2 basic_stringbuf constructors [stringbuf.cons + +// { dg-options "-std=gnu++2a" } +// { dg-do run { target c++2a } } +// { dg-require-effective-target cxx11-abi } + +#include +#include +#include +#include + +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; + using str_type = std::basic_string, 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; +} diff --git a/libstdc++-v3/testsuite/27_io/basic_istringstream/view/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_istringstream/view/char/1.cc new file mode 100644 index 00000000000..091de5f7a79 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_istringstream/view/char/1.cc @@ -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 +// . + +// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons] + +// { dg-options "-std=gnu++2a" } +// { dg-do run { target c++2a } } +// { dg-require-effective-target cxx11-abi } + +#include +#include +#include + +int +main() +{ + std::string s("This is a test"); + std::istringstream stm(s); + VERIFY( stm.view() == s ); + return 0; +} diff --git a/libstdc++-v3/testsuite/27_io/basic_istringstream/view/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_istringstream/view/wchar_t/1.cc new file mode 100644 index 00000000000..f6599643bd9 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_istringstream/view/wchar_t/1.cc @@ -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 +// . + +// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons] + +// { dg-options "-std=gnu++2a" } +// { dg-do run { target c++2a } } +// { dg-require-effective-target cxx11-abi } + +#include +#include +#include + +int +main() +{ + std::wstring s(L"This is a test"); + std::wistringstream stm(s); + VERIFY( stm.view() == s ); + return 0; +} diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/char/1.cc new file mode 100644 index 00000000000..cba69f80931 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/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 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 +// . + +// C++20 29.8.2.2 basic_stringbuf constructors [stringbuf.cons + +// { dg-options "-std=gnu++2a" } +// { dg-do run { target c++2a } } +// { dg-require-effective-target cxx11-abi } + +#include +#include +#include +#include + +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; + using str_type = std::basic_string, 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; +} diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/wchar_t/1.cc new file mode 100644 index 00000000000..9021186d2c8 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/wchar_t/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 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 +// . + +// C++20 29.8.2.2 basic_stringbuf constructors [stringbuf.cons + +// { dg-options "-std=gnu++2a" } +// { dg-do run { target c++2a } } +// { dg-require-effective-target cxx11-abi } + +#include +#include +#include +#include + +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; + using str_type = std::basic_string, 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; +} diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/view/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/view/char/1.cc new file mode 100644 index 00000000000..a366363abb5 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/view/char/1.cc @@ -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 +// . + +// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons] + +// { dg-options "-std=gnu++2a" } +// { dg-do run { target c++2a } } +// { dg-require-effective-target cxx11-abi } + +#include +#include +#include + +int +main() +{ + std::string s("This is a test"); + std::ostringstream stm(s); + VERIFY( stm.view() == s ); + return 0; +} diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/view/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/view/wchar_t/1.cc new file mode 100644 index 00000000000..1ebf7c505e3 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/view/wchar_t/1.cc @@ -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 +// . + +// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons] + +// { dg-options "-std=gnu++2a" } +// { dg-do run { target c++2a } } +// { dg-require-effective-target cxx11-abi } + +#include +#include +#include + +int +main() +{ + std::wstring s(L"This is a test"); + std::wostringstream stm(s); + VERIFY( stm.view() == s ); + return 0; +} diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/cons/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/cons/char/2.cc new file mode 100644 index 00000000000..ce669358c85 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/cons/char/2.cc @@ -0,0 +1,121 @@ +// 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 +// . + +// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons] + +// { dg-options "-std=gnu++2a" } +// { dg-do run { target c++2a } } +// { dg-require-effective-target cxx11-abi } + +#include +#include +#include +#include + +void +test01() +{ + { + using alloc_type = __gnu_test::uneq_allocator; + using sbuf_t = std::basic_stringbuf, + 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; + using str_type = std::basic_string, 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; +} diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/cons/wchar_t/2.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/cons/wchar_t/2.cc new file mode 100644 index 00000000000..e05acc42165 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/cons/wchar_t/2.cc @@ -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 +// . + +// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons] + +// { dg-options "-std=gnu++2a" } +// { dg-do run { target c++2a } } +// { dg-require-effective-target cxx11-abi } + +#include +#include +#include +#include + +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; + using str_type = std::basic_string, 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; +} diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/view/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/view/char/1.cc new file mode 100644 index 00000000000..8f8c62daa21 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/view/char/1.cc @@ -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 +// . + +// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons] + +// { dg-options "-std=gnu++2a" } +// { dg-do run { target c++2a } } +// { dg-require-effective-target cxx11-abi } + +#include +#include +#include + +int +main() +{ + std::string s("This is a test"); + std::stringbuf sbuf(s); + VERIFY( sbuf.view() == s ); + return 0; +} diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/view/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/view/wchar_t/1.cc new file mode 100644 index 00000000000..0d23d7d8e66 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/view/wchar_t/1.cc @@ -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 +// . + +// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons] + +// { dg-options "-std=gnu++2a" } +// { dg-do run { target c++2a } } +// { dg-require-effective-target cxx11-abi } + +#include +#include +#include + +int +main() +{ + std::wstring s(L"This is a test"); + std::wstringbuf sbuf(s); + VERIFY( sbuf.view() == s ); + return 0; +} diff --git a/libstdc++-v3/testsuite/27_io/basic_stringstream/cons/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringstream/cons/char/1.cc new file mode 100644 index 00000000000..83a3374b3cd --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_stringstream/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 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 +// . + +// C++20 29.8.2.2 basic_stringbuf constructors [stringbuf.cons + +// { dg-options "-std=gnu++2a" } +// { dg-do run { target c++2a } } +// { dg-require-effective-target cxx11-abi } + +#include +#include +#include +#include + +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; + using str_type = std::basic_string, 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; +} diff --git a/libstdc++-v3/testsuite/27_io/basic_stringstream/cons/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringstream/cons/wchar_t/1.cc new file mode 100644 index 00000000000..26a3a86c46e --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_stringstream/cons/wchar_t/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 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 +// . + +// C++20 29.8.2.2 basic_stringbuf constructors [stringbuf.cons + +// { dg-options "-std=gnu++2a" } +// { dg-do run { target c++2a } } +// { dg-require-effective-target cxx11-abi } + +#include +#include +#include +#include + +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; + using str_type = std::basic_string, 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; +} diff --git a/libstdc++-v3/testsuite/27_io/basic_stringstream/view/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringstream/view/char/1.cc new file mode 100644 index 00000000000..f47035cf148 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_stringstream/view/char/1.cc @@ -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 +// . + +// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons] + +// { dg-options "-std=gnu++2a" } +// { dg-do run { target c++2a } } +// { dg-require-effective-target cxx11-abi } + +#include +#include +#include + +int +main() +{ + std::string s("This is a test"); + std::stringstream stm(s); + VERIFY( stm.view() == s ); + return 0; +} diff --git a/libstdc++-v3/testsuite/27_io/basic_stringstream/view/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringstream/view/wchar_t/1.cc new file mode 100644 index 00000000000..d707cfed243 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_stringstream/view/wchar_t/1.cc @@ -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 +// . + +// 27.7.1.1 basic_stringbuf constructors [lib.stringbuf.cons] + +// { dg-options "-std=gnu++2a" } +// { dg-do run { target c++2a } } +// { dg-require-effective-target cxx11-abi } + +#include +#include +#include + +int +main() +{ + std::wstring s(L"This is a test"); + std::wstringstream stm(s); + VERIFY( stm.view() == s ); + return 0; +}