commit 204cfaf2c746c6351731072fc4b155c89db908db Author: Jonathan Wakely Date: Thu Feb 2 13:54:21 2017 +0000 PR libstdc++/60936 reduce coupling between objects in libstdc++.a Move explicit instantiation definitions for string I/O functions into their own files so that iostream and locale definitions are not needed for uses of strings without I/O. Move functions for throwing C++11 exceptions into the individual files defining the exception types, so that using any of the functions from functexcept.cc doesn't pull in large pieces of the C++11 library. Finally, avoid using __int_to_char in snprintf_lite.cc to avoid pulling in locale-inst.cc for one function. PR libstdc++/60936 * src/c++11/Makefile.am: Add new files. * src/c++11/Makefile.in: Regenerate. * src/c++11/cow-string-inst.cc [!_GLIBCXX_USE_CXX11_ABI] (operator<<, operator>>, getline): Move explicit instantiations to ... * src/c++11/cow-string-io-inst.cc: ... new file. * src/c++11/cow-wstring-inst.cc [!_GLIBCXX_USE_CXX11_ABI] (operator<<, operator>>, getline): Move explicit instantiations to ... * src/c++11/cow-wstring-io-inst.cc: ... new file. * src/c++11/functexcept.cc (__throw_ios_failure, __throw_system_error) (__throw_future_error, __throw_bad_function_call): (__throw_regex_error): Move functions for C++11 exceptions to the files that define the exception types. * src/c++11/functional.cc (__throw_bad_function_call): Move here. * src/c++11/future.cc (__throw_future_error): Likewise. * src/c++11/ios.cc (__throw_ios_failure): Likewise. * src/c++11/regex.cc (__throw_regex_error): Likewise. * src/c++11/snprintf_lite.cc (__concat_size_t): Print decimal representation directly instead of calling __int_to_char. * src/c++11/sso_string.cc (__sso_string): New file for definition of __sso_string type. * src/c++11/string-io-inst.cc [_GLIBCXX_USE_CXX11_ABI]: New file for explicit instantiations of narrow string I/O functions. * src/c++11/system_error.cc (__throw_system_error): Move here. (__sso_string): Move to new file. * src/c++11/wstring-io-inst.cc [_GLIBCXX_USE_CXX11_ABI]: New file for explicit instantiations of wide string I/O functions. * src/c++98/misc-inst.cc [_GLIBCXX_USE_CXX11_ABI] (operator<<) (operator>>, getline): Remove explicit instantiations from here. diff --git a/libstdc++-v3/src/c++11/Makefile.am b/libstdc++-v3/src/c++11/Makefile.am index 4b945c0..cf73d4d 100644 --- a/libstdc++-v3/src/c++11/Makefile.am +++ b/libstdc++-v3/src/c++11/Makefile.am @@ -82,9 +82,12 @@ extra_string_inst_sources = \ cow-fstream-inst.cc \ cow-sstream-inst.cc \ cow-string-inst.cc \ + cow-string-io-inst.cc \ cow-wstring-inst.cc \ + cow-wstring-io-inst.cc \ cxx11-locale-inst.cc \ - cxx11-wlocale-inst.cc + cxx11-wlocale-inst.cc \ + sso_string.cc else extra_string_inst_sources = endif @@ -103,8 +106,10 @@ inst_sources = \ sstream-inst.cc \ streambuf-inst.cc \ string-inst.cc \ + string-io-inst.cc \ wlocale-inst.cc \ - wstring-inst.cc + wstring-inst.cc \ + wstring-io-inst.cc else # XTEMPLATE_FLAGS = inst_sources = diff --git a/libstdc++-v3/src/c++11/cow-string-inst.cc b/libstdc++-v3/src/c++11/cow-string-inst.cc index 6f2e5c4..6d1362f 100644 --- a/libstdc++-v3/src/c++11/cow-string-inst.cc +++ b/libstdc++-v3/src/c++11/cow-string-inst.cc @@ -29,35 +29,10 @@ #define _GLIBCXX_USE_CXX11_ABI 0 #include "string-inst.cc" -#include -#include - #if ! _GLIBCXX_USE_DUAL_ABI # error This file should not be compiled for this configuration. #endif -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // These came from c++98/misc-inst.cc, repeat them for COW string - // string related to iostreams. - template - basic_istream& - operator>>(basic_istream&, string&); - template - basic_ostream& - operator<<(basic_ostream&, const string&); - template - basic_istream& - getline(basic_istream&, string&, char); - template - basic_istream& - getline(basic_istream&, string&); - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - #ifdef _GLIBCXX_USE_C99_STDINT_TR1 #include #if defined __i386__ || defined __x86_64__ diff --git a/libstdc++-v3/src/c++11/cow-string-io-inst.cc b/libstdc++-v3/src/c++11/cow-string-io-inst.cc new file mode 100644 index 0000000..caafd2e --- /dev/null +++ b/libstdc++-v3/src/c++11/cow-string-io-inst.cc @@ -0,0 +1,59 @@ +// Reference-counted COW string instantiations for I/O -*- C++ -*- + +// Copyright (C) 2014-2017 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: 21 Strings library +// + +#define _GLIBCXX_USE_CXX11_ABI 0 +#include +#include + +#if ! _GLIBCXX_USE_DUAL_ABI +# error This file should not be compiled for this configuration. +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // The equivalent SSO string instantiations are in c++98/misc-inst.cc, + // repeat them for COW string + + // string related to iostreams. + template + basic_istream& + operator>>(basic_istream&, string&); + template + basic_ostream& + operator<<(basic_ostream&, const string&); + template + basic_istream& + getline(basic_istream&, string&, char); + template + basic_istream& + getline(basic_istream&, string&); + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace diff --git a/libstdc++-v3/src/c++11/cow-wstring-inst.cc b/libstdc++-v3/src/c++11/cow-wstring-inst.cc index 5e4b7ba..3686478 100644 --- a/libstdc++-v3/src/c++11/cow-wstring-inst.cc +++ b/libstdc++-v3/src/c++11/cow-wstring-inst.cc @@ -33,32 +33,8 @@ #define C wchar_t #include "string-inst.cc" -#include -#include - #if ! _GLIBCXX_USE_DUAL_ABI # error This file should not be compiled for this configuration. #endif -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // XXX these came from c++98/misc-inst.cc, repeat them for COW string - // string related to iostreams - template - basic_istream& - operator>>(basic_istream&, wstring&); - template - basic_ostream& - operator<<(basic_ostream&, const wstring&); - template - basic_istream& - getline(basic_istream&, wstring&, wchar_t); - template - basic_istream& - getline(basic_istream&, wstring&); - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace #endif diff --git a/libstdc++-v3/src/c++11/cow-wstring-io-inst.cc b/libstdc++-v3/src/c++11/cow-wstring-io-inst.cc new file mode 100644 index 0000000..b174d20 --- /dev/null +++ b/libstdc++-v3/src/c++11/cow-wstring-io-inst.cc @@ -0,0 +1,63 @@ +// Reference-counted COW wide string instantiations for I/O -*- C++ -*- + +// Copyright (C) 2014-2017 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: 21 Strings library +// + +#define _GLIBCXX_USE_CXX11_ABI 0 +#include + +#ifdef _GLIBCXX_USE_WCHAR_T +#include +#include + +#if ! _GLIBCXX_USE_DUAL_ABI +# error This file should not be compiled for this configuration. +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // The equivalent SSO wstring instantiations are in c++98/misc-inst.cc, + // repeat them for COW wstring + + // string related to iostreams + template + basic_istream& + operator>>(basic_istream&, wstring&); + template + basic_ostream& + operator<<(basic_ostream&, const wstring&); + template + basic_istream& + getline(basic_istream&, wstring&, wchar_t); + template + basic_istream& + getline(basic_istream&, wstring&); + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace +#endif diff --git a/libstdc++-v3/src/c++11/functexcept.cc b/libstdc++-v3/src/c++11/functexcept.cc index 6281534..d2c154c 100644 --- a/libstdc++-v3/src/c++11/functexcept.cc +++ b/libstdc++-v3/src/c++11/functexcept.cc @@ -20,21 +20,12 @@ // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // . -// Determines the version of ios_base::failure thrown by __throw_ios_failure. -// If !_GLIBCXX_USE_DUAL_ABI this will get undefined automatically. -#define _GLIBCXX_USE_CXX11_ABI 1 - #include #include #include #include #include #include -#include -#include -#include -#include -#include #include #ifdef _GLIBCXX_USE_NLS @@ -122,27 +113,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __throw_underflow_error(const char* __s __attribute__((unused))) { _GLIBCXX_THROW_OR_ABORT(underflow_error(_(__s))); } - void - __throw_ios_failure(const char* __s __attribute__((unused))) - { _GLIBCXX_THROW_OR_ABORT(ios_base::failure(_(__s))); } - - void - __throw_system_error(int __i __attribute__((unused))) - { _GLIBCXX_THROW_OR_ABORT(system_error(error_code(__i, - generic_category()))); } - - void - __throw_future_error(int __i __attribute__((unused))) - { _GLIBCXX_THROW_OR_ABORT(future_error(make_error_code(future_errc(__i)))); } - - void - __throw_bad_function_call() - { _GLIBCXX_THROW_OR_ABORT(bad_function_call()); } - - void - __throw_regex_error(regex_constants::error_type __ecode - __attribute__((unused))) - { _GLIBCXX_THROW_OR_ABORT(regex_error(__ecode)); } - _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/src/c++11/functional.cc b/libstdc++-v3/src/c++11/functional.cc index 4c304bc..8ac87b9 100644 --- a/libstdc++-v3/src/c++11/functional.cc +++ b/libstdc++-v3/src/c++11/functional.cc @@ -23,11 +23,16 @@ // . #include +#include namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION + void + __throw_bad_function_call() + { _GLIBCXX_THROW_OR_ABORT(bad_function_call()); } + bad_function_call::~bad_function_call() noexcept = default; const char* diff --git a/libstdc++-v3/src/c++11/future.cc b/libstdc++-v3/src/c++11/future.cc index e138567..d25ea4a 100644 --- a/libstdc++-v3/src/c++11/future.cc +++ b/libstdc++-v3/src/c++11/future.cc @@ -23,6 +23,7 @@ // . #include +#include namespace { @@ -70,6 +71,10 @@ namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION + void + __throw_future_error(int __i __attribute__((unused))) + { _GLIBCXX_THROW_OR_ABORT(future_error(make_error_code(future_errc(__i)))); } + const error_category& future_category() noexcept { return __future_category_instance(); } diff --git a/libstdc++-v3/src/c++11/ios.cc b/libstdc++-v3/src/c++11/ios.cc index ef0da96..9061989 100644 --- a/libstdc++-v3/src/c++11/ios.cc +++ b/libstdc++-v3/src/c++11/ios.cc @@ -26,13 +26,29 @@ // ISO C++ 14882: 27.4 Iostreams base classes // +// Determines the version of ios_base::failure thrown by __throw_ios_failure. +// If !_GLIBCXX_USE_DUAL_ABI this will get undefined automatically. +#define _GLIBCXX_USE_CXX11_ABI 1 + #include #include +#include + +#ifdef _GLIBCXX_USE_NLS +# include +# define _(msgid) gettext (msgid) +#else +# define _(msgid) (msgid) +#endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION + void + __throw_ios_failure(const char* __s __attribute__((unused))) + { _GLIBCXX_THROW_OR_ABORT(ios_base::failure(_(__s))); } + // Definitions for static const members of ios_base. const ios_base::fmtflags ios_base::boolalpha; const ios_base::fmtflags ios_base::dec; diff --git a/libstdc++-v3/src/c++11/regex.cc b/libstdc++-v3/src/c++11/regex.cc index 122572f..cd2e489 100644 --- a/libstdc++-v3/src/c++11/regex.cc +++ b/libstdc++-v3/src/c++11/regex.cc @@ -24,11 +24,17 @@ #include #include +#include namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION + void + __throw_regex_error(regex_constants::error_type __ecode + __attribute__((unused))) + { _GLIBCXX_THROW_OR_ABORT(regex_error(__ecode)); } + regex_error::regex_error(regex_constants::error_type __ecode) : std::runtime_error("regex_error"), _M_code(__ecode) { } diff --git a/libstdc++-v3/src/c++11/snprintf_lite.cc b/libstdc++-v3/src/c++11/snprintf_lite.cc index d97b31e..6144ecf 100644 --- a/libstdc++-v3/src/c++11/snprintf_lite.cc +++ b/libstdc++-v3/src/c++11/snprintf_lite.cc @@ -71,19 +71,17 @@ namespace __gnu_cxx { // Returns number of characters appended, or -1 if BUFSIZE is too small. int __concat_size_t(char *__buf, size_t __bufsize, size_t __val) { - // __int_to_char is explicitly instantiated and available only for - // some, but not all, types. See locale-inst.cc. -#ifdef _GLIBCXX_USE_LONG_LONG - unsigned long long __val2 = __val; -#else - unsigned long __val2 = __val; -#endif // Long enough for decimal representation. - int __ilen = 3 * sizeof(__val2); + int __ilen = 3 * sizeof(__val); char *__cs = static_cast(__builtin_alloca(__ilen)); - size_t __len = std::__int_to_char(__cs + __ilen, __val2, - std::__num_base::_S_atoms_out, - std::ios_base::dec, true); + char* __out = __cs + __ilen; + do + { + *--__out = "0123456789"[__val % 10]; + __val /= 10; + } + while (__val != 0); + size_t __len = __out - __cs; if (__bufsize < __len) return -1; diff --git a/libstdc++-v3/src/c++11/sso_string.cc b/libstdc++-v3/src/c++11/sso_string.cc new file mode 100644 index 0000000..a59db1a --- /dev/null +++ b/libstdc++-v3/src/c++11/sso_string.cc @@ -0,0 +1,107 @@ +// Helper for accessing __cxx11::string from the ABI -*- C++ -*- + +// Copyright (C) 2014-2017 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 +// . + + +#define _GLIBCXX_USE_CXX11_ABI 1 +#define __sso_string __sso_stringxxx +#include +#include +#undef __sso_string + +#if ! _GLIBCXX_USE_DUAL_ABI +# error This file should not be compiled for this configuration. +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wabi-tag" + // Redefine __sso_string so that we can define and export its members + // in terms of the SSO std::string. + struct __sso_string + { + struct __str + { + const char* _M_p; + size_t _M_string_length; + char _M_local_buf[16]; + }; + + union { + __str _M_s; + char _M_bytes[sizeof(_M_s)]; + std::string _M_str; + }; + + __sso_string(); + __sso_string(const std::string& s); + __sso_string(const char*, size_t n); + __sso_string(const __sso_string&) noexcept; + __sso_string& operator=(const __sso_string&) noexcept; + ~__sso_string(); + __sso_string(__sso_string&&) noexcept; + __sso_string& operator=(__sso_string&&) noexcept; + }; +#pragma GCC diagnostic pop + + __sso_string::__sso_string() : _M_str() { } + +#if _GLIBCXX_USE_CXX11_ABI + static_assert(sizeof(__sso_string) == sizeof(std::string), + "sizeof(std::string) has changed"); + static_assert(alignof(__sso_string) == alignof(std::string), + "alignof(std::string) has changed"); + + // This constructor is defined in src/c++11/cow-stdexcept.cc for COW strings + __sso_string::__sso_string(const std::string& s) : _M_str(s) { } +#endif + + __sso_string::__sso_string(const char* s, size_t n) : _M_str(s, n) { } + + __sso_string::__sso_string(const __sso_string& s) noexcept + : _M_str(s._M_str) { } + + __sso_string& + __sso_string::operator=(const __sso_string& s) noexcept + { + _M_str = s._M_str; + return *this; + } + + __sso_string::~__sso_string() { _M_str.~basic_string(); } + + __sso_string::__sso_string(__sso_string&& s) noexcept + : _M_str(std::move(s._M_str)) { } + + __sso_string& + __sso_string::operator=(__sso_string&& s) noexcept + { + _M_str = std::move(s._M_str); + return *this; + } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace diff --git a/libstdc++-v3/src/c++11/string-io-inst.cc b/libstdc++-v3/src/c++11/string-io-inst.cc new file mode 100644 index 0000000..7c063d4 --- /dev/null +++ b/libstdc++-v3/src/c++11/string-io-inst.cc @@ -0,0 +1,53 @@ +// SSO string instantiations for I/O -*- C++ -*- + +// Copyright (C) 1997-2017 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: +// + +#define _GLIBCXX_USE_CXX11_ABI 1 +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // string related to iostreams + template + basic_istream& + operator>>(basic_istream&, string&); + template + basic_ostream& + operator<<(basic_ostream&, const string&); + template + basic_istream& + getline(basic_istream&, string&, char); + template + basic_istream& + getline(basic_istream&, string&); + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace diff --git a/libstdc++-v3/src/c++11/system_error.cc b/libstdc++-v3/src/c++11/system_error.cc index c5065dd..61dbc3f 100644 --- a/libstdc++-v3/src/c++11/system_error.cc +++ b/libstdc++-v3/src/c++11/system_error.cc @@ -75,6 +75,12 @@ namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION + void + __throw_system_error(int __i __attribute__((unused))) + { + _GLIBCXX_THROW_OR_ABORT(system_error(error_code(__i, generic_category()))); + } + error_category::~error_category() noexcept = default; const error_category& @@ -112,73 +118,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } #endif -#if _GLIBCXX_USE_DUAL_ABI -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wabi-tag" - // Redefine __sso_string so that we can define and export its members - // in terms of the SSO std::string. - struct __sso_string - { - struct __str - { - const char* _M_p; - size_t _M_string_length; - char _M_local_buf[16]; - }; - - union { - __str _M_s; - char _M_bytes[sizeof(_M_s)]; - std::string _M_str; - }; - - __sso_string(); - __sso_string(const std::string& s); - __sso_string(const char*, size_t n); - __sso_string(const __sso_string&) noexcept; - __sso_string& operator=(const __sso_string&) noexcept; - ~__sso_string(); - __sso_string(__sso_string&&) noexcept; - __sso_string& operator=(__sso_string&&) noexcept; - }; -#pragma GCC diagnostic pop - - __sso_string::__sso_string() : _M_str() { } - -#if _GLIBCXX_USE_CXX11_ABI - static_assert(sizeof(__sso_string) == sizeof(std::string), - "sizeof(std::string) has changed"); - static_assert(alignof(__sso_string) == alignof(std::string), - "alignof(std::string) has changed"); - - // This constructor is defined in src/c++11/cow-stdexcept.cc for COW strings - __sso_string::__sso_string(const std::string& s) : _M_str(s) { } -#endif - - __sso_string::__sso_string(const char* s, size_t n) : _M_str(s, n) { } - - __sso_string::__sso_string(const __sso_string& s) noexcept - : _M_str(s._M_str) { } - - __sso_string& - __sso_string::operator=(const __sso_string& s) noexcept - { - _M_str = s._M_str; - return *this; - } - - __sso_string::~__sso_string() { _M_str.~basic_string(); } - - __sso_string::__sso_string(__sso_string&& s) noexcept - : _M_str(std::move(s._M_str)) { } - - __sso_string& - __sso_string::operator=(__sso_string&& s) noexcept - { - _M_str = std::move(s._M_str); - return *this; - } -#endif // _GLIBCXX_USE_DUAL_ABI - _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/src/c++11/wstring-io-inst.cc b/libstdc++-v3/src/c++11/wstring-io-inst.cc new file mode 100644 index 0000000..0fae821 --- /dev/null +++ b/libstdc++-v3/src/c++11/wstring-io-inst.cc @@ -0,0 +1,55 @@ +// SSO string instantiations for I/O -*- C++ -*- + +// Copyright (C) 1997-2017 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: +// + +#define _GLIBCXX_USE_CXX11_ABI 1 +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // string related to iostreams +#ifdef _GLIBCXX_USE_WCHAR_T + template + basic_istream& + operator>>(basic_istream&, wstring&); + template + basic_ostream& + operator<<(basic_ostream&, const wstring&); + template + basic_istream& + getline(basic_istream&, wstring&, wchar_t); + template + basic_istream& + getline(basic_istream&, wstring&); +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace diff --git a/libstdc++-v3/src/c++98/misc-inst.cc b/libstdc++-v3/src/c++98/misc-inst.cc index 91c02bf..a0c5912 100644 --- a/libstdc++-v3/src/c++98/misc-inst.cc +++ b/libstdc++-v3/src/c++98/misc-inst.cc @@ -36,34 +36,6 @@ namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION - // string related to iostreams - template - basic_istream& - operator>>(basic_istream&, string&); - template - basic_ostream& - operator<<(basic_ostream&, const string&); - template - basic_istream& - getline(basic_istream&, string&, char); - template - basic_istream& - getline(basic_istream&, string&); -#ifdef _GLIBCXX_USE_WCHAR_T - template - basic_istream& - operator>>(basic_istream&, wstring&); - template - basic_ostream& - operator<<(basic_ostream&, const wstring&); - template - basic_istream& - getline(basic_istream&, wstring&, wchar_t); - template - basic_istream& - getline(basic_istream&, wstring&); -#endif - #if _GLIBCXX_USE_CXX11_ABI // C++98 members that are not instantiated by src/c++11/string-inst.cc // because they changed in C++11 to take const_iterator parameters.