diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2014-09-22 14:34:09 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2014-09-22 14:34:09 +0100 |
commit | 9b81754858b271df999993ac7c195acfb4558387 (patch) | |
tree | 56471caae5e872ad7a27f4e39b5f246f4a5245c8 /libstdc++-v3/config | |
parent | 38278d8a9c97abd336ad3d565ecf7b18ad3d23ed (diff) | |
download | gcc-9b81754858b271df999993ac7c195acfb4558387.zip gcc-9b81754858b271df999993ac7c195acfb4558387.tar.gz gcc-9b81754858b271df999993ac7c195acfb4558387.tar.bz2 |
Make streams movable and swappable.
PR libstdc++/54316
PR libstdc++/53626
* config/abi/pre/gnu.ver: Add new exports.
* config/io/basic_file_stdio.h (__basic_file): Support moving and
swapping.
* include/bits/basic_ios.h (basic_ios::move, basic_ios::swap):
Likewise.
* include/bits/ios_base.h (ios_base::_M_move, ios_base::_M_swap):
Likewise.
* include/bits/fstream.tcc (basic_filebuf): Likewise.
* include/bits/move.h (__exchange): Define for C++11 mode.
* include/ext/stdio_filebuf.h (stdio_filebuf): Support moving and
swapping.
* include/ext/stdio_sync_filebuf.h (stdio_sync_filebuf): Likewise.
* include/std/fstream (basic_filebuf, basic_ifstream, basic_ofstream,
basic_fstream): Likewise.
* include/std/ios: Remove whitespace.
* include/std/istream (basic_istream, basic_iostream): Support moving
and swapping.
* include/std/ostream (basic_ostream): Likewise.
* include/std/sstream (basic_stringbuf, basic_istringstream,
basic_ostringstream, basic_stringstream): Likewise.
* include/std/streambuf (basic_streambuf): Do not default copy
constructor and assignment on first declaration.
* include/std/utility (exchange): Forward to __exchange.
* testsuite/27_io/basic_filebuf/cons/char/copy_neg.cc: New.
* src/c++11/Makefile.am: Add stream-related files.
* src/c++11/Makefile.in: Regenerate.
* src/c++11/ext11-inst.cc (stdio_filebuf, stdio_sync_filebuf):
New file for explicit instantiation definitions.
* src/c++11/ios.cc: Move from src/c++98 to here.
(ios_base::_M_move, ios_base::_M_swap): Define.
* src/c++11/ios-inst.cc: Move from src/c++98 to here.
* src/c++11/iostream-inst.cc: Likewise.
* src/c++11/istream-inst.cc: Likewise.
* src/c++11/ostream-inst.cc: Likewise.
* src/c++11/sstream-inst.cc: Likewise.
* src/c++11/streambuf-inst.cc: Likewise.
* src/c++98/Makefile.am: Remove stream-related files.
* src/c++98/Makefile.in: Regenerate.
* src/c++98/ext-inst.cc (stdio_filebuf): Remove explicit
instantiations.
* src/c++98/misc-inst.cc (stdio_sync_filebuf): Likewise.
* src/c++98/ios-inst.cc: Move to src/c++11/.
* src/c++98/ios.cc: Move to src/c++11/.
* src/c++98/iostream-inst.cc: Likewise.
* src/c++98/istream-inst.cc: Likewise.
* src/c++98/ostream-inst.cc: Likewise.
* src/c++98/sstream-inst.cc: Likewise.
* src/c++98/streambuf-inst.cc: Likewise.
* testsuite/27_io/basic_filebuf/cons/char/copy_neg.cc: New.
* testsuite/27_io/basic_fstream/cons/move.cc: New.
* testsuite/27_io/basic_fstream/assign/1.cc: New.
* testsuite/27_io/basic_ifstream/cons/move.cc: New.
* testsuite/27_io/basic_ifstream/assign/1.cc: New.
* testsuite/27_io/basic_istringstream/assign/1.cc: New.
* testsuite/27_io/basic_istringstream/cons/move.cc: New.
* testsuite/27_io/basic_ofstream/cons/move.cc: New.
* testsuite/27_io/basic_ofstream/assign/1.cc: New.
* testsuite/27_io/basic_ostringstream/assign/1.cc: New.
* testsuite/27_io/basic_ostringstream/cons/move.cc: New.
* testsuite/27_io/basic_stringstream/assign/1.cc: New.
* testsuite/27_io/basic_stringstream/cons/move.cc: New.
From-SVN: r215463
Diffstat (limited to 'libstdc++-v3/config')
-rw-r--r-- | libstdc++-v3/config/abi/pre/gnu.ver | 44 | ||||
-rw-r--r-- | libstdc++-v3/config/io/basic_file_stdio.h | 20 |
2 files changed, 63 insertions, 1 deletions
diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver index 41fac71..669e36d 100644 --- a/libstdc++-v3/config/abi/pre/gnu.ver +++ b/libstdc++-v3/config/abi/pre/gnu.ver @@ -989,7 +989,8 @@ GLIBCXX_3.4.10 { _ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EE6stosscEv; _ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EE4syncEv; - _ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EE[5-9C]*; + _ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EE[5-9]*; + _ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EEC[12]EP*; _ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EED[^2]*; } GLIBCXX_3.4.9; @@ -1375,6 +1376,47 @@ GLIBCXX_3.4.21 { # void std::thread::_M_start_thread(__shared_base_type, void(*)()) _ZNSt6thread15_M_start_threadESt10shared_ptrINS_10_Impl_baseEEPFvvE; + # Move/swap functions for iostreams + _ZNSt8ios_base7_M_swapERS_; + _ZNSt8ios_base7_M_moveERS_; + _ZNSt9basic_iosI[cw]St11char_traitsI[cw]EE4moveE[OR]S2_; + _ZNSt9basic_iosI[cw]St11char_traitsI[cw]EE4swapERS2_; + _ZNSt9basic_iosI[cw]St11char_traitsI[cw]EE9set_rdbuf*; + _ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EE4swapERS2_; + _ZNS[dio]4swapERS[dio]; + _ZNS[dio]aSEOS[dio]; + _ZNS[dio]C[12]EOS[dio]; + _ZNSt13basic_[io]streamIwSt11char_traitsIwEE4swapERS2_; + _ZNSt13basic_[io]streamIwSt11char_traitsIwEEaSEOS2_; + _ZNSt13basic_[io]streamIwSt11char_traitsIwEEC[12]EOS2_; + _ZNSt14basic_iostreamIwSt11char_traitsIwEE4swapERS2_; + _ZNSt14basic_iostreamIwSt11char_traitsIwEEaSEOS2_; + _ZNSt14basic_iostreamIwSt11char_traitsIwEEC[12]EOS2_; + _ZNSt13basic_filebufI[cw]St11char_traitsI[cw]EE4swapERS2_; + _ZNSt13basic_filebufI[cw]St11char_traitsI[cw]EEaSEOS2_; + _ZNSt13basic_filebufI[cw]St11char_traitsI[cw]EEC[12]EOS2_; + _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EE4swapERS2_; + _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EEaSEOS2_; + _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EEC[12]EOS2_; + _ZNSt14basic_[io]fstreamI[cw]St11char_traitsI[cw]EE4swapERS2_; + _ZNSt14basic_[io]fstreamI[cw]St11char_traitsI[cw]EEaSEOS2_; + _ZNSt14basic_[io]fstreamI[cw]St11char_traitsI[cw]EEC[12]EOS2_; + _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE4swapERS3_; + _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEaSEOS3_; + _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]EOS3_; + _ZNSt18basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE4swapERS3_; + _ZNSt18basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEaSEOS3_; + _ZNSt18basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]EOS3_; + _ZNSt19basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE4swapERS3_; + _ZNSt19basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEaSEOS3_; + _ZNSt19basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]EOS3_; + _ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EEaSEOS3_; + _ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EEC[12]EOS3_; + + # basic_ostream<C,T>::basic_ostream(basic_iostream<C,T>*) + _ZNSoC[12]EPSd; + _ZNSt13basic_ostreamIwSt11char_traitsIwEEC[12]EPSt14basic_iostreamIwS1_E; + } GLIBCXX_3.4.20; diff --git a/libstdc++-v3/config/io/basic_file_stdio.h b/libstdc++-v3/config/io/basic_file_stdio.h index b457ec5..f58164e 100644 --- a/libstdc++-v3/config/io/basic_file_stdio.h +++ b/libstdc++-v3/config/io/basic_file_stdio.h @@ -38,6 +38,7 @@ #include <bits/c++config.h> #include <bits/c++io.h> // for __c_lock and __c_file +#include <bits/move.h> // for swap #include <ios> namespace std _GLIBCXX_VISIBILITY(default) @@ -61,6 +62,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION public: __basic_file(__c_lock* __lock = 0) throw (); +#if __cplusplus >= 201103L + __basic_file(__basic_file&& __rv, __c_lock* __lock = 0) noexcept + : _M_cfile(__rv._M_cfile), _M_cfile_created(__rv._M_cfile_created) + { + __rv._M_cfile = nullptr; + __rv._M_cfile_created = false; + } + + __basic_file& operator=(const __basic_file&) = delete; + __basic_file& operator=(__basic_file&&) = delete; + + void + swap(__basic_file& __f) noexcept + { + std::swap(_M_cfile, __f._M_cfile); + std::swap(_M_cfile_created, __f._M_cfile_created); + } +#endif + __basic_file* open(const char* __name, ios_base::openmode __mode, int __prot = 0664); |