New std::string implementation.

* acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_CXX11_ABI): Remove.
	(GLIBCXX_ENABLE_LIBSTDCXX_DUAL_ABI, GLIBCXX_DEFAULT_ABI): Add.
	* configure.ac: Use new macros.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* doc/Makefile.in: Regenerate.
	* libsupc++/Makefile.in: Regenerate.
	* po/Makefile.in: Regenerate.
	* src/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.
	* include/Makefile.am: Set _GLIBCXX_USE_DUAL_ABI.
	* include/Makefile.in: Regenerate.
	* config/abi/pre/gnu.ver: Export symbols related to new std::string.
	Tighten old patterns to not match new symbols.
	* config/locale/generic/monetary_members.cc: Guard some definitions
	to not compile with new ABI.
	* config/locale/gnu/monetary_members.cc: Likewise.
	* config/locale/gnu/numeric_members.cc: Prevent double-free.
	* config/os/gnu-linux/ldbl-extra.ver: Add new __gnu_cxx_ldbl128
	exports. Tighten old patterns.
	* doc/xml/manual/configure.xml: Document new configure options.
	* doc/html/*: Regenerate.
	* include/bits/basic_string.h (__cxx11::basic_string): Define new
	non-reference-counted implementation in inline namespace __cxx11.
	(stoi, stol, stoll, stof, stod, stold, to_string): Conditionally use
	inline namespace.
	(literals::string_literals::operator"): Conditionally use abi-tag.
	* include/bits/basic_string.tcc (__cxx11::basic_string): Define.
	* include/bits/c++config: Define _GLIBCXX_USE_DUAL_ABI and
	LDBL_CXX11_ABI namespace macros.
	* include/bits/locale_classes.h (locale::name()): Use abi_tag when
	new ABI is in use.
	(locale::_S_twinned_facets): New static member.
	(locale::facet::__shim): Declare new type.
	(locale::_facet::_M_sso_shim, locale::_facet::_M_cow_shim): New
	functions for creating shims.
	(locale::_Impl::_M_facet_unchecked): New member function for use
	during construction.
	(locale::_Impl::_M_init_extra): New member functions to create second
	version of some facets.
	(collate, collate_byname): Use abi_tag when new ABI is in use.
	* include/bits/locale_facets.h: Add _GLIBCXX_NUM_CXX11_FACETS macro.
	(numpunct, numpunct_byname): Use __cxx11 namespace.
	(num_get::_M_extract_float, num_get::_M_extract_int): Use abi_tag
	when new ABI is in use.
	(num_get::__do_get, num_put::__do_put): Do not declare long double
	compat functions for new ABI.
	* include/bits/locale_facets.tcc (num_get, num_put): Use abi_tag on
	definitions.
	(numpunct, numpunct_byname): Qualify explicit instantiations.
	* include/bits/locale_facets_nonio.h (time_get, time_get_byname,
	moneypunct, moneypunct_byname, money_get, money_put, messages,
	messages_byname): Use new inline namespace macros.
	(money_get::__do_get, money_put::__do_put): Do not declare long
	double compat functions for new ABI.
	* include/bits/locale_facets_nonio.tcc (money_get, money_put): Use
	new namespace macros.
	(money_get::__do_get, money_put::__do_put): Do not define for new ABI.
	* include/bits/localefwd.h (numpunct, numpunct_byname, collate,
	collate_byname, time_get, time_get_byname, moneypunct,
	moneypunct_byname, money_get, money_put, messages, messages_byname):
	Use new namespace macros.
	* include/bits/regex.h: Use inline namespace macros.
	* include/bits/stl_list.h (_List_base, list): Use inline namespace
	instead of abi-tag.
	* include/bits/stringfwd.h (basic_string): Use namespace macros.
	* include/std/iosfwd (basic_stringbuf, basic_istringstream,
	basic_ostringstream, basic_stringstream): Likewise.
	* include/std/sstream: Likewise.
	(basic_stringbuf::__xfer_bufptrs): Update streambuf pointers on move.
	* include/std/stdexcept (__cow_string, __sso_string): New types for
	indirectly using std::string with either ABI.
	(logic_error, runtime_error): Replace std::string member with
	__cow_string when new ABI is in use. Declare non-inline copy
	constructor and assignment operator. Declare const char* constructors.
	(domain_error, invalid_argument, length_error, out_of_range,
	range_error, overflow_error, underflow_error): Declare const char*
	constructors.
	* include/std/system_error (error_category): Replace with new
	definition in inline namespace _V2.
	(error_code::message, error_condition::message): Use abi_tag on
	functions returning std::string.
	* python/libstdcxx/v6/printers.py (StdStringPrinter): Handle new ABI.
	* src/c++11/Makefile.am: Add new files.
	* src/c++11/Makefile.in: Regenerate.
	* src/c++11/compatibility-c++0x.cc: Compile with old std::string ABI.
	Define old error_category symbols.
	* src/c++11/cow-fstream-inst.cc: New. Instantiate fstream members
	using old std::string ABI.
	* src/c++11/cow-locale_init.cc (locale::_Impl::_M_init_extra): Define.
	* src/c++11/cow-shim_facets.cc: Define shim facets using old ABI.
	* src/c++11/cow-sstream-inst.cc: Instantiate stringstreams using old
	std::string ABI.
	* src/c++11/cow-stdexcept.cc: Define new constructors and assignment
	operators.
	(__cow_string, error_category::_M_message): Define.
	* src/c++11/cow-string-inst.cc: Explicit instantiations using old
	std::string. Include src/c++98/istream-string.cc.
	* src/c++11/cow-wstring-inst.cc: Explicit instantiations using old
	std::wstring.
	* src/c++11/cxx11-hash_tr1.cc: Explicit instantiations using new
	string.
	* src/c++11/cxx11-ios_failure.cc: Add sanity check.
	* src/c++11/cxx11-locale-inst.cc: Instantiate facets using new
	std::string.
	* src/c++11/cxx11-shim_facets.cc: Define shim facets using new ABI.
	* src/c++11/cxx11-stdexcept.cc: Define constructors taking new
	std::string.
	* src/c++11/cxx11-wlocale-inst.cc: Instantiate facets using
	new std::wstring.
	* src/c++11/fstream-inst.cc: Compile with new ABI.
	* src/c++11/functexcept.cc: Compile with old ABI.
	* src/c++11/random.cc: Compile with new ABI.
	* src/c++11/sstream-inst.cc: Compile with new ABI.
	* src/c++11/string-inst.cc: Explicit instantiations for new string.
	* src/c++11/system_error.cc (__sso_string, error_category::_M_message):
	Define.
	* src/c++11/wstring-inst.cc: Compile with new ABI.
	* src/c++98/Makefile.am: Compile some host files twice for old and
	new std::string. Add new files.
	* src/c++98/Makefile.in: Regenerate.
	* src/c++98/compatibility-ldbl.cc: Compile with old ABI.
	* src/c++98/compatibility.cc: Likewise.
	* src/c++98/concept-inst.cc: Likewise.
	* src/c++98/hash_tr1.cc: Likewise.
	* src/c++98/istream-string.cc: New file defining functions that
	work with istream and std::string moved from ...
	* src/c++98/istream.cc: ... here.
	* src/c++98/cow-istream-string.cc: Recompile istream-string.cc with
	old ABI.
	* src/c++98/locale-inst.cc: Adjust facet instantiations to work for
	either ABI.
	* src/c++98/locale.cc (locale::_M_install_facet,
	locale::_M_install_cache): Handle twinned facets.
	* src/c++98/locale-facets.cc: Compile with old std::string ABI.
	(__verify_grouping): Define new overload and old std::string version.
	* src/c++98/locale_init.cc: Initialize twinned facets.
	* src/c++98/localename.cc: Likewise.
	* src/c++98/misc-inst.cc: Instantiate C++98-only std::string members.
	(__verify_grouping): Define new std::string version.
	* src/c++98/stdexcept.cc: Compile with old std::string ABI.
	* src/c++98/wlocale-inst.cc: Likewise.
	* testsuite/18_support/50594.cc: Adjust to work with SSO strings.
	* testsuite/21_strings/basic_string/capacity/1.cc: Likewise.
	* testsuite/21_strings/basic_string/capacity/char/1.cc: Likewise.
	* testsuite/21_strings/basic_string/capacity/char/18654.cc: Likewise.
	* testsuite/21_strings/basic_string/capacity/char/2.cc: Likewise.
	* testsuite/21_strings/basic_string/capacity/wchar_t/1.cc: Likewise.
	* testsuite/21_strings/basic_string/capacity/wchar_t/18654.cc:
	Likewise.
	* testsuite/21_strings/headers/string/synopsis.cc: Use inline
	namespace macros.
	* testsuite/23_containers/headers/list/synopsis.cc: Likewise.
	* testsuite/27_io/basic_ios/copyfmt/char/1.cc: Set dg-options so
	correct exception type can be caught.
	* testsuite/27_io/basic_ios/exceptions/char/1.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_arithmetic/char/
	exceptions_failbit.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
	exceptions_failbit.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_other/char/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_other/wchar_t/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_istream/sentry/char/12297.cc: Likewise.
	* testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc: Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/char/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/wchar_t/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/ios_base/storage/2.cc: Likewise.
	* testsuite/27_io/ios_base/failure/cxx11.cc: Disable for old ABI.
	* testsuite/ext/profile/mutex_extensions_neg.cc: Adjust dg-error.
	* testsuite/libstdc++-prettyprinters/libfundts.cc: Use old ABI.
	* testsuite/libstdc++-prettyprinters/simple.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/simple11.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/whatis.cc: Likewise.
	* testsuite/util/exception/safety.h: Adjust member function types
	for new std::string.
	* testsuite/util/testsuite_abi.cc: Add new version and ignore
	__float128 symbols in __cxx11 namespace.

From-SVN: r218964
This commit is contained in:
Jonathan Wakely 2014-12-19 18:16:39 +00:00 committed by Jonathan Wakely
parent 5dcfa0b651
commit 34a2b7558b
107 changed files with 6685 additions and 446 deletions

View File

@ -1,3 +1,187 @@
2014-12-19 Jonathan Wakely <jwakely@redhat.com>
* acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_CXX11_ABI): Remove.
(GLIBCXX_ENABLE_LIBSTDCXX_DUAL_ABI, GLIBCXX_DEFAULT_ABI): Add.
* configure.ac: Use new macros.
* configure: Regenerate.
* Makefile.in: Regenerate.
* doc/Makefile.in: Regenerate.
* libsupc++/Makefile.in: Regenerate.
* po/Makefile.in: Regenerate.
* src/Makefile.in: Regenerate.
* testsuite/Makefile.in: Regenerate.
* include/Makefile.am: Set _GLIBCXX_USE_DUAL_ABI.
* include/Makefile.in: Regenerate.
* config/abi/pre/gnu.ver: Export symbols related to new std::string.
Tighten old patterns to not match new symbols.
* config/locale/generic/monetary_members.cc: Guard some definitions
to not compile with new ABI.
* config/locale/gnu/monetary_members.cc: Likewise.
* config/locale/gnu/numeric_members.cc: Prevent double-free.
* config/os/gnu-linux/ldbl-extra.ver: Add new __gnu_cxx_ldbl128
exports. Tighten old patterns.
* doc/xml/manual/configure.xml: Document new configure options.
* doc/html/*: Regenerate.
* include/bits/basic_string.h (__cxx11::basic_string): Define new
non-reference-counted implementation in inline namespace __cxx11.
(stoi, stol, stoll, stof, stod, stold, to_string): Conditionally use
inline namespace.
(literals::string_literals::operator"): Conditionally use abi-tag.
* include/bits/basic_string.tcc (__cxx11::basic_string): Define.
* include/bits/c++config: Define _GLIBCXX_USE_DUAL_ABI and
LDBL_CXX11_ABI namespace macros.
* include/bits/locale_classes.h (locale::name()): Use abi_tag when
new ABI is in use.
(locale::_S_twinned_facets): New static member.
(locale::facet::__shim): Declare new type.
(locale::_facet::_M_sso_shim, locale::_facet::_M_cow_shim): New
functions for creating shims.
(locale::_Impl::_M_facet_unchecked): New member function for use
during construction.
(locale::_Impl::_M_init_extra): New member functions to create second
version of some facets.
(collate, collate_byname): Use abi_tag when new ABI is in use.
* include/bits/locale_facets.h: Add _GLIBCXX_NUM_CXX11_FACETS macro.
(numpunct, numpunct_byname): Use __cxx11 namespace.
(num_get::_M_extract_float, num_get::_M_extract_int): Use abi_tag
when new ABI is in use.
(num_get::__do_get, num_put::__do_put): Do not declare long double
compat functions for new ABI.
* include/bits/locale_facets.tcc (num_get, num_put): Use abi_tag on
definitions.
(numpunct, numpunct_byname): Qualify explicit instantiations.
* include/bits/locale_facets_nonio.h (time_get, time_get_byname,
moneypunct, moneypunct_byname, money_get, money_put, messages,
messages_byname): Use new inline namespace macros.
(money_get::__do_get, money_put::__do_put): Do not declare long
double compat functions for new ABI.
* include/bits/locale_facets_nonio.tcc (money_get, money_put): Use
new namespace macros.
(money_get::__do_get, money_put::__do_put): Do not define for new ABI.
* include/bits/localefwd.h (numpunct, numpunct_byname, collate,
collate_byname, time_get, time_get_byname, moneypunct,
moneypunct_byname, money_get, money_put, messages, messages_byname):
Use new namespace macros.
* include/bits/regex.h: Use inline namespace macros.
* include/bits/stl_list.h (_List_base, list): Use inline namespace
instead of abi-tag.
* include/bits/stringfwd.h (basic_string): Use namespace macros.
* include/std/iosfwd (basic_stringbuf, basic_istringstream,
basic_ostringstream, basic_stringstream): Likewise.
* include/std/sstream: Likewise.
(basic_stringbuf::__xfer_bufptrs): Update streambuf pointers on move.
* include/std/stdexcept (__cow_string, __sso_string): New types for
indirectly using std::string with either ABI.
(logic_error, runtime_error): Replace std::string member with
__cow_string when new ABI is in use. Declare non-inline copy
constructor and assignment operator. Declare const char* constructors.
(domain_error, invalid_argument, length_error, out_of_range,
range_error, overflow_error, underflow_error): Declare const char*
constructors.
* include/std/system_error (error_category): Replace with new
definition in inline namespace _V2.
(error_code::message, error_condition::message): Use abi_tag on
functions returning std::string.
* python/libstdcxx/v6/printers.py (StdStringPrinter): Handle new ABI.
* src/c++11/Makefile.am: Add new files.
* src/c++11/Makefile.in: Regenerate.
* src/c++11/compatibility-c++0x.cc: Compile with old std::string ABI.
Define old error_category symbols.
* src/c++11/cow-fstream-inst.cc: New. Instantiate fstream members
using old std::string ABI.
* src/c++11/cow-locale_init.cc (locale::_Impl::_M_init_extra): Define.
* src/c++11/cow-shim_facets.cc: Define shim facets using old ABI.
* src/c++11/cow-sstream-inst.cc: Instantiate stringstreams using old
std::string ABI.
* src/c++11/cow-stdexcept.cc: Define new constructors and assignment
operators.
(__cow_string, error_category::_M_message): Define.
* src/c++11/cow-string-inst.cc: Explicit instantiations using old
std::string. Include src/c++98/istream-string.cc.
* src/c++11/cow-wstring-inst.cc: Explicit instantiations using old
std::wstring.
* src/c++11/cxx11-hash_tr1.cc: Explicit instantiations using new
string.
* src/c++11/cxx11-ios_failure.cc: Add sanity check.
* src/c++11/cxx11-locale-inst.cc: Instantiate facets using new
std::string.
* src/c++11/cxx11-shim_facets.cc: Define shim facets using new ABI.
* src/c++11/cxx11-stdexcept.cc: Define constructors taking new
std::string.
* src/c++11/cxx11-wlocale-inst.cc: Instantiate facets using
new std::wstring.
* src/c++11/fstream-inst.cc: Compile with new ABI.
* src/c++11/functexcept.cc: Compile with old ABI.
* src/c++11/random.cc: Compile with new ABI.
* src/c++11/sstream-inst.cc: Compile with new ABI.
* src/c++11/string-inst.cc: Explicit instantiations for new string.
* src/c++11/system_error.cc (__sso_string, error_category::_M_message):
Define.
* src/c++11/wstring-inst.cc: Compile with new ABI.
* src/c++98/Makefile.am: Compile some host files twice for old and
new std::string. Add new files.
* src/c++98/Makefile.in: Regenerate.
* src/c++98/compatibility-ldbl.cc: Compile with old ABI.
* src/c++98/compatibility.cc: Likewise.
* src/c++98/concept-inst.cc: Likewise.
* src/c++98/hash_tr1.cc: Likewise.
* src/c++98/istream-string.cc: New file defining functions that
work with istream and std::string moved from ...
* src/c++98/istream.cc: ... here.
* src/c++98/cow-istream-string.cc: Recompile istream-string.cc with
old ABI.
* src/c++98/locale-inst.cc: Adjust facet instantiations to work for
either ABI.
* src/c++98/locale.cc (locale::_M_install_facet,
locale::_M_install_cache): Handle twinned facets.
* src/c++98/locale-facets.cc: Compile with old std::string ABI.
(__verify_grouping): Define new overload and old std::string version.
* src/c++98/locale_init.cc: Initialize twinned facets.
* src/c++98/localename.cc: Likewise.
* src/c++98/misc-inst.cc: Instantiate C++98-only std::string members.
(__verify_grouping): Define new std::string version.
* src/c++98/stdexcept.cc: Compile with old std::string ABI.
* src/c++98/wlocale-inst.cc: Likewise.
* testsuite/18_support/50594.cc: Adjust to work with SSO strings.
* testsuite/21_strings/basic_string/capacity/1.cc: Likewise.
* testsuite/21_strings/basic_string/capacity/char/1.cc: Likewise.
* testsuite/21_strings/basic_string/capacity/char/18654.cc: Likewise.
* testsuite/21_strings/basic_string/capacity/char/2.cc: Likewise.
* testsuite/21_strings/basic_string/capacity/wchar_t/1.cc: Likewise.
* testsuite/21_strings/basic_string/capacity/wchar_t/18654.cc:
Likewise.
* testsuite/21_strings/headers/string/synopsis.cc: Use inline
namespace macros.
* testsuite/23_containers/headers/list/synopsis.cc: Likewise.
* testsuite/27_io/basic_ios/copyfmt/char/1.cc: Set dg-options so
correct exception type can be caught.
* testsuite/27_io/basic_ios/exceptions/char/1.cc: Likewise.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/
exceptions_failbit.cc: Likewise.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
exceptions_failbit.cc: Likewise.
* testsuite/27_io/basic_istream/extractors_other/char/
exceptions_null.cc: Likewise.
* testsuite/27_io/basic_istream/extractors_other/wchar_t/
exceptions_null.cc: Likewise.
* testsuite/27_io/basic_istream/sentry/char/12297.cc: Likewise.
* testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc: Likewise.
* testsuite/27_io/basic_ostream/inserters_other/char/
exceptions_null.cc: Likewise.
* testsuite/27_io/basic_ostream/inserters_other/wchar_t/
exceptions_null.cc: Likewise.
* testsuite/27_io/ios_base/storage/2.cc: Likewise.
* testsuite/27_io/ios_base/failure/cxx11.cc: Disable for old ABI.
* testsuite/ext/profile/mutex_extensions_neg.cc: Adjust dg-error.
* testsuite/libstdc++-prettyprinters/libfundts.cc: Use old ABI.
* testsuite/libstdc++-prettyprinters/simple.cc: Likewise.
* testsuite/libstdc++-prettyprinters/simple11.cc: Likewise.
* testsuite/libstdc++-prettyprinters/whatis.cc: Likewise.
* testsuite/util/exception/safety.h: Adjust member function types
for new std::string.
* testsuite/util/testsuite_abi.cc: Add new version and ignore
__float128 symbols in __cxx11 namespace.
2014-12-17 Tim Shen <timshen@google.com>
PR libstdc++/64302

View File

@ -244,6 +244,7 @@ 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@

View File

@ -3832,24 +3832,57 @@ AC_DEFUN([GLIBCXX_CHECK_SDT_H], [
])
dnl
dnl Check if the user wants the new C++11-conforming ABI.
dnl Control whether the library should define symbols for old and new ABIs.
dnl This affects definitions of strings, stringstreams and locale facets.
dnl
dnl --disable-libstdcxx-cxx11-abi will use old ABI for all types.
dnl --disable-libstdcxx-dual-abi will use old ABI for all types.
dnl
dnl Defines:
dnl _GLIBCXX_USE_ABI_TAG (always defined, either to 1 or 0)
dnl _GLIBCXX_USE_DUAL_ABI (always defined, either to 1 or 0)
dnl
AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_CXX11_ABI], [
AC_ARG_ENABLE([libstdcxx-cxx11-abi],
AC_HELP_STRING([--disable-libstdcxx-cxx11-abi],
[disable the C++11-conforming ABI]),,
[enable_libstdcxx_cxx11_abi=yes])
if test x"$enable_libstdcxx_cxx11_abi" != xyes; then
AC_MSG_NOTICE([C++11-conforming ABI is disabled])
AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_DUAL_ABI], [
GLIBCXX_ENABLE(libstdcxx-dual-abi,$1,,[support two versions of std::string])
if test x"$enable_libstdcxx_dual_abi" != xyes; then
AC_MSG_NOTICE([dual ABI is disabled])
default_libstdcxx_abi="c++98"
fi
GLIBCXX_CONDITIONAL(ENABLE_CXX11_ABI, test $enable_libstdcxx_cxx11_abi = yes)
GLIBCXX_CONDITIONAL(ENABLE_DUAL_ABI, test $enable_libstdcxx_dual_abi = yes)
])
dnl
dnl Check to see which ABI should be enabled by default.
dnl
dnl --with-default-libstdcxx-abi={c++98,c++11}
dnl
dnl Defines:
dnl _GLIBCXX_USE_CXX11_ABI (always defined, either to 1 or 0)
dnl
AC_DEFUN([GLIBCXX_DEFAULT_ABI], [
if test x$enable_libstdcxx_dual_abi = xyes; then
AC_MSG_CHECKING([for default std::string ABI to use])
AC_ARG_WITH([default-libstdcxx-abi],
AS_HELP_STRING([--with-default-libstdcxx-abi],
[set the std::string ABI to use by default]),
[case "$withval" in
c++98|gnu++98|c++03|gnu++03) default_libstdcxx_abi="c++98" ;;
c++1?|gnu++1?) default_libstdcxx_abi="c++11" ;;
*) AC_MSG_ERROR([Invalid argument for --with-default-libstdcxx-abi]) ;;
esac],
[default_libstdcxx_abi="c++11"])
AC_MSG_RESULT(${default_libstdcxx_abi})
fi
if test $default_libstdcxx_abi = "c++11"; then
glibcxx_cxx11_abi=1
glibcxx_cxx98_abi=0
else
glibcxx_cxx11_abi=0
glibcxx_cxx98_abi=1
fi
AC_SUBST(glibcxx_cxx98_abi)
GLIBCXX_CONDITIONAL(ENABLE_CXX11_ABI, test $glibcxx_cxx11_abi = 1)
])
# Macros from the top-level gcc directory.
m4_include([../config/gc++filt.m4])
m4_include([../config/tls.m4])

View File

@ -73,7 +73,7 @@ GLIBCXX_3.4 {
# std::[d-g]*;
std::d[a-d]*;
std::d[f-n]*;
std::domain_error::d*;
# std::domain_error::d*;
# std::domain_error::~d*;
std::d[p-z]*;
std::e[a-q]*;
@ -82,7 +82,7 @@ GLIBCXX_3.4 {
std::gslice*;
std::h[^a]*;
std::i[a-m]*;
std::invalid_argument::i*;
# std::invalid_argument::i*;
# std::invalid_argument::~i*;
# std::ios_base::[A-Ha-z]*;
std::ios_base::[A-Ha-e]*;
@ -103,9 +103,8 @@ GLIBCXX_3.4 {
std::istrstream*;
std::i[t-z]*;
std::[A-Zj-k]*;
std::length_error::l*;
# std::length_error::l*;
# std::length_error::~l*;
std::logic_error*;
std::locale::[A-Za-e]*;
std::locale::facet::[A-Za-z]*;
std::locale::facet::_S_get_c_locale*;
@ -115,13 +114,20 @@ GLIBCXX_3.4 {
std::locale::[A-Zg-h]*;
std::locale::id::[A-Za-z]*;
std::locale::id::_M_id*;
std::locale::[A-Zj-z]*;
std::locale::[A-Zj-m]*;
# std::locale::name();
std::locale::none*;
std::locale::numeric*;
std::locale::[A-Zn-z]*;
std::locale::_[A-Ha-z]*;
std::locale::_Impl::[A-Za-z]*;
# std::locale::_Impl::_M_[A-Za-z]*;
std::locale::_[J-Ra-z]*;
std::locale::_S_normalize_category*;
std::locale::_[T-Za-z]*;
# std::logic_error::l*;
std::logic_error::what*;
# std::logic_error::~l*;
# std::[A-Zm-r]*;
# std::[A-Zm]*;
std::[A-Z]*;
@ -133,16 +139,19 @@ GLIBCXX_3.4 {
std::nu[^m]*;
std::num[^e]*;
std::ostrstream*;
std::out_of_range::o*;
# std::out_of_range::o*;
# std::out_of_range::~o*;
std::overflow_error::o*;
# std::overflow_error::o*;
# std::overflow_error::~o*;
# std::[p-q]*;
std::r[^ae]*;
std::range_error::r*;
std::r[^aeu]*;
# std::range_error::r*;
# std::range_error::~r*;
# std::re[^t]*;
# std::rethrow_exception
# std::runtime_error::r*
std::runtime_error::what*;
# std::runtime_error::~r*;
std::set_new_handler*;
std::set_terminate*;
std::set_unexpected*;
@ -158,7 +167,7 @@ GLIBCXX_3.4 {
std::tr1::h[^a]*;
std::t[s-z]*;
# std::[A-Zu-z]*;
std::underflow_error::u*;
# std::underflow_error::u*;
# std::underflow_error::~u*;
std::uncaught_exception*;
std::unexpected*;
@ -337,19 +346,19 @@ GLIBCXX_3.4 {
_ZNSt19basic_istringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]E[RS]*;
_ZNSt19basic_istringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EED*;
_ZNSt19basic_istringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE3str*;
_ZNKSt19basic_istringstream*;
_ZNKSt19basic_istringstreamI*;
# std::basic_ostringstream
_ZNSt19basic_ostringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]E[RS]*;
_ZNSt19basic_ostringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EED*;
_ZNSt19basic_ostringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE3str*;
_ZNKSt19basic_ostringstream*;
_ZNKSt19basic_ostringstreamI*;
# std::basic_stringstream
_ZNSt18basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]E[RS]*;
_ZNSt18basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EED*;
_ZNSt18basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE3str*;
_ZNKSt18basic_stringstream*;
_ZNKSt18basic_stringstreamI*;
# std::basic_iostream constructors (except move), destructors
_ZNSdC[12]Ev;
@ -447,10 +456,10 @@ GLIBCXX_3.4 {
_ZNSt13basic_istreamIwSt11char_traitsIwEErsE*[^g];
# std::istream operators and extractors
_ZSt7getlineI[cw]St11char_traitsI[cw]ESaI[cw]EERSt13basic_istream*;
_ZSt7getlineI[cw]St11char_traitsI[cw]ESaI[cw]EERSt13basic_istreamIT_T0_ES7_RSbI*;
_ZSt2wsI[cw]St11char_traitsI[cw]EE*;
_ZStrsI[cw]St11char_traitsI[cw]EERSt13basic_istream*;
_ZStrsI[cw]St11char_traitsI[cw]ESaI[cw]EERSt13basic_istream*;
_ZStrsI[cw]St11char_traitsI[cw]ESaI[cw]EERSt13basic_istreamIT_T0_ES7_RSbI*;
_ZStrsISt11char_traitsI[cw]EERSt13basic_istream*;
_ZStrsId[cw]St11char_traitsI[cw]EERSt13basic_istream*;
_ZStrsIe[cw]St11char_traitsI[cw]EERSt13basic_istream*;
@ -484,7 +493,7 @@ GLIBCXX_3.4 {
_ZSt4end[ls]I[cw]St11char_traitsI[cw]EERSt13basic_ostream*;
_ZSt5flushI[cw]St11char_traitsI[cw]EERSt13basic_ostream*;
_ZStlsI[cw]St11char_traitsI[cw]EERSt13basic_ostream*;
_ZStlsI[cw]St11char_traitsI[cw]ESaI[cw]EERSt13basic_ostream*;
_ZStlsI[cw]St11char_traitsI[cw]ESaI[cw]EERSt13basic_ostreamIT_T0_ES7_RKSbI*;
_ZStlsISt11char_traitsI[cw]EERSt13basic_ostream*;
_ZStlsId[cw]St11char_traitsI[cw]EERSt13basic_ostream*;
_ZStlsIe[cw]St11char_traitsI[cw]EERSt13basic_ostream*;
@ -493,6 +502,9 @@ GLIBCXX_3.4 {
# std::locale destructors
_ZNSt6localeD*;
# std::locale::name() returning old std::string
_ZNKSt6locale4nameEv;
# std::locale::facet destructors
_ZNSt6locale5facetD*;
@ -529,16 +541,23 @@ GLIBCXX_3.4 {
_ZNSt12ctype_bynameI[cw]*;
# std::num_get
_ZNKSt7num_getI[cw]St19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEE*;
_ZNKSt7num_getI[cw]St19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEE[2-9]*;
_ZNKSt7num_getI[cw]St19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEE14_M_extract_intI*;
_ZNKSt7num_getI[cw]St19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEE16_M_extract_floatI*;
# std::num_put
_ZNKSt7num_putI[cw]St19ostreambuf_iteratorI[cw]St11char_traitsI[cw]EEE*;
_ZNKSt7num_putI[cw]St19ostreambuf_iteratorI[cw]St11char_traitsI[cw]EEE[2-9]*;
_ZNKSt7num_putI[cw]St19ostreambuf_iteratorI[cw]St11char_traitsI[cw]EEE1[234]*;
_ZNKSt7num_putI[cw]St19ostreambuf_iteratorI[cw]St11char_traitsI[cw]EEE15_M_insert_floatI*;
# std::money_get
_ZNKSt9money_getI[cw]St19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEE*;
_ZNKSt9money_getI[cw]St19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEE[2-9]*;
_ZNKSt9money_getI[cw]St19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEE10_M_extractILb[01]EEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRSs;
# std::money_put
_ZNKSt9money_putI[cw]St19ostreambuf_iteratorI[cw]St11char_traitsI[cw]EEE*;
_ZNKSt9money_putI[cw]St19ostreambuf_iteratorI[cw]St11char_traitsI[cw]EEE[1-8]*;
_ZNKSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb[01]EEES3_S3_RSt8ios_basecRKSs;
_ZNKSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE9_M_insertILb[01]EEES3_S3_RSt8ios_basewRKSbIwS2_SaIwEE;
# std::time_get
_ZNSt8time_get*;
@ -679,7 +698,13 @@ GLIBCXX_3.4 {
_ZTVSt[0-9][0-9]a*;
_ZTVSt10bad_typeid;
_ZTVSt13bad_exception;
_ZTVSt[0-9][0-9]basic*;
# _ZTVSt[0-9][0-9]basic*;
_ZTVSt1[34]basic*;
_ZTVSt15basic_streambufI*;
_ZTVSt15basic_stringbufI*;
_ZTVSt18basic_stringstreamI*;
_ZTVSt19basic_istringstreamI*;
_ZTVSt19basic_ostringstreamI*;
_ZTVSt[0-9][0-9][c-d]*;
_ZTVSt[0-9][0-9][g-k]*;
_ZTVSt11logic_error;
@ -701,7 +726,17 @@ GLIBCXX_3.4 {
# VTT structure
_ZTTS[a-z];
_ZTTSt[0-9][A-Za-z]*;
_ZTTSt[0-9][0-9][A-Za-z]*;
# _ZTTSt[0-9][0-9][A-Za-z]*;
_ZTTSt1[0-4]*;
_ZTTSt15a*;
_ZTTSt15basic_streambufI*;
_ZTTSt15basic_stringbufI*;
_ZTTSt15[c-z]*;
_ZTTSt1[67]*;
_ZTTSt18basic_stringstreamI*;
_ZTTSt19basic_istringstreamI*;
_ZTTSt19basic_ostringstreamI*;
_ZTTSt[2-9]*;
# typeinfo structure
_ZTIS[a-z];
@ -712,7 +747,13 @@ GLIBCXX_3.4 {
_ZTISt[0-9][0-9]a*;
_ZTISt10bad_typeid;
_ZTISt13bad_exception;
_ZTISt[0-9][0-9]basic*;
# _ZTISt[0-9][0-9]basic*;
_ZTISt1[34]basic*;
_ZTISt15basic_streambufI*;
_ZTISt15basic_stringbufI*;
_ZTISt18basic_stringstreamI*;
_ZTISt19basic_istringstreamI*;
_ZTISt19basic_ostringstreamI*;
_ZTISt[0-9][0-9][c-d]*;
_ZTISt[0-9][0-9][g-k]*;
_ZTISt11logic_error;
@ -749,7 +790,13 @@ GLIBCXX_3.4 {
_ZTSSt[0-9][0-9]a*;
_ZTSSt10bad_typeid;
_ZTSSt13bad_exception;
_ZTSSt[0-9][0-9]basic*;
# _ZTSSt[0-9][0-9]basic*;
_ZTSSt1[34]basic*;
_ZTSSt15basic_stringbufI*;
_ZTSSt15basic_streambufI*;
_ZTSSt18basic_stringstreamI*;
_ZTSSt19basic_istringstreamI*;
_ZTSSt19basic_ostringstreamI*;
_ZTSSt[0-9][0-9][c-d]*;
_ZTSSt[0-9][0-9][g-k]*;
_ZTSSt11logic_error;
@ -779,8 +826,33 @@ GLIBCXX_3.4 {
_ZNSt13bad_exceptionD*;
# function-scope static objects requires a guard variable.
_ZGVNSt[^1]*;
_ZGVNSt1[^7]*;
_ZGVNSt[2-6]*;
_ZGVNSt7collateI[cw]*;
_ZGVNSt7num_getI[cw]*;
_ZGVNSt7num_putI[cw]*;
_ZGVNSt8messagesI[cw]*;
_ZGVNSt8numpunctI[cw]*;
_ZGVNSt8time_getI[cw]*;
_ZGVNSt8time_putI[cw]*;
_ZGVNSt9money_getI[cw]*;
_ZGVNSt9money_putI[cw]*;
_ZGVNSt1[^07]*;
_ZGVNSt10moneypunctI[cw]Lb[01]*;
# exception constructors taking std::string
_ZNSt11logic_errorC[12]ERKSs;
_ZNSt13runtime_errorC[12]ERKSs;
_ZNSt11range_errorC[12]ERKSs;
_ZNSt12domain_errorC[12]ERKSs;
_ZNSt12length_errorC[12]ERKSs;
_ZNSt12out_of_rangeC[12]ERKSs;
_ZNSt14overflow_errorC[12]ERKSs;
_ZNSt15underflow_errorC[12]ERKSs;
_ZNSt16invalid_argumentC[12]ERKSs;
# complete, deleting and base destructors
_ZNSt11logic_errorD[012]Ev;
_ZNSt13runtime_errorD[012]Ev;
# complete and deleting destructors where base destructors should not
# be exported.
@ -793,10 +865,42 @@ GLIBCXX_3.4 {
_ZNSt16invalid_argumentD[01]Ev;
# virtual function thunks
_ZThn8_NS*;
_ZThn16_NS*;
_ZTv0_n12_NS*;
_ZTv0_n24_NS*;
# _ZThn8_NS*;
_ZThn8_NS[dio]*;
_ZThn8_NSt1[0-9]a*;
_ZThn8_NSt1[34]basic*;
_ZThn8_NSt18basic_stringstreamI*;
_ZThn8_NSt19basic_[io]stringstreamI*;
_ZThn8_NSt1[0-9][c-z]*;
_ZThn8_NSt[2-9][a-z0-9]*;
# _ZThn16_NS*;
_ZThn16_NS[dio]*;
_ZThn16_NSt1[0-9]a*;
_ZThn16_NSt1[34]basic*;
_ZThn16_NSt18basic_stringstreamI*;
_ZThn16_NSt19basic_[io]stringstreamI*;
_ZThn16_NSt1[0-9][c-z]*;
_ZThn16_NSt[2-9][a-z0-9]*;
# _ZTv0_n12_NS*;
_ZTv0_n12_NS[dio]*;
_ZTv0_n12_NSt1[0-9]a*;
_ZTv0_n12_NSt1[34]basic*;
_ZTv0_n12_NSt15basic_streambufI*;
_ZTv0_n12_NSt15basic_stringbufI*;
_ZTv0_n12_NSt18basic_stringstreamI*;
_ZTv0_n12_NSt19basic_[io]stringstreamI*;
_ZTv0_n12_NSt1[0-9][c-z]*;
_ZTv0_n12_NSt[2-9][a-z0-9]*;
# _ZTv0_n24_NS*;
_ZTv0_n24_NS[dio]*;
_ZTv0_n24_NSt1[0-9]a*;
_ZTv0_n24_NSt1[34]basic*;
_ZTv0_n24_NSt15basic_streambufI*;
_ZTv0_n24_NSt15basic_stringbufI*;
_ZTv0_n24_NSt18basic_stringstreamI*;
_ZTv0_n24_NSt19basic_[io]stringstreamI*;
_ZTv0_n24_NSt1[0-9][c-z]*;
_ZTv0_n24_NSt[2-9][a-z0-9]*;
# stub functions from libmath
sinf;
@ -1034,7 +1138,7 @@ GLIBCXX_3.4.10 {
_ZNKSt4hashISsEclESs;
_ZNKSt4hashIeEclEe;
_ZSt17__verify_grouping*;
_ZSt17__verify_groupingPKc[mj]RKSs;
_ZNSt8__detail12__prime_listE;
_ZNSt3tr18__detail12__prime_listE;
@ -1390,10 +1494,15 @@ GLIBCXX_3.4.18 {
# Names inside the 'extern' block are demangled names.
extern "C++"
{
std::random_device::*;
std::__detail::_Prime_rehash_policy::*;
};
_ZNSt13random_device14_M_init_pretr1ERKSs;
_ZNSt13random_device16_M_getval_pretr1Ev;
_ZNSt13random_device7_M_finiEv;
_ZNSt13random_device7_M_initERKSs;
_ZNSt13random_device9_M_getvalEv;
# std::this_thread::__sleep_for
_ZNSt11this_thread11__sleep_for*;
@ -1487,7 +1596,7 @@ GLIBCXX_3.4.21 {
_ZNKSt8ios_base7failureB5cxx114whatEv;
_ZNSt8ios_base7failureB5cxx11C[12]ERKSs;
_ZNSt8ios_base7failureB5cxx11C[12]EPKcRKSt10error_code;
_ZNSt8ios_base7failureB5cxx11C[12]ERKSsB5cxx11;
_ZNSt8ios_base7failureB5cxx11C[12]ERKNSt7__cxx1112basic_string*;
_ZNSt8ios_base7failureB5cxx11C[12]ERKSsB5cxx11RKSt10error_code;
_ZNSt8ios_base7failureB5cxx11D[012]Ev;
_ZTINSt8ios_base7failureB5cxx11E;
@ -1506,6 +1615,139 @@ GLIBCXX_3.4.21 {
# std::__future_base::_State_baseV2::_Make_ready::_M_set()
_ZNSt13__future_base13_State_baseV211_Make_ready6_M_setEv;
# ABI-tagged std::basic_string
_ZNSt7__cxx1112basic_string*;
_ZNKSt7__cxx1112basic_string*;
# ABI-tagged stringstreams
_ZNSt7__cxx1115basic_stringbuf*;
_ZNSt7__cxx1118basic_stringstream*;
_ZNSt7__cxx1119basic_istringstream*;
_ZNSt7__cxx1119basic_ostringstream*;
_ZNKSt7__cxx1115basic_stringbuf*;
_ZNKSt7__cxx1118basic_stringstream*;
_ZNKSt7__cxx1119basic_istringstream*;
_ZNKSt7__cxx1119basic_ostringstream*;
_ZT[ISTV]NSt7__cxx1115basic_stringbuf*;
_ZT[ISTV]NSt7__cxx1118basic_stringstream*;
_ZT[ISTV]NSt7__cxx1119basic_istringstream*;
_ZT[ISTV]NSt7__cxx1119basic_ostringstream*;
_ZThn8_NSt7__cxx1118basic_stringstream*;
_ZThn16_NSt7__cxx1118basic_stringstream*;
_ZTv0_n12_NSt7__cxx1115basic_stringbuf*;
_ZTv0_n12_NSt7__cxx1118basic_stringstream*;
_ZTv0_n12_NSt7__cxx1119basic_istringstream*;
_ZTv0_n12_NSt7__cxx1119basic_ostringstream*;
_ZTv0_n24_NSt7__cxx1115basic_stringbuf*;
_ZTv0_n24_NSt7__cxx1118basic_stringstream*;
_ZTv0_n24_NSt7__cxx1119basic_istringstream*;
_ZTv0_n24_NSt7__cxx1119basic_ostringstream*;
# I/O functions for ABI-tagged basic_string
_ZSt7getlineI[cw]St11char_traitsI[cw]ESaI[cw]EERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_string*;
_ZStlsI[cw]St11char_traitsI[cw]ESaI[cw]EERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_string*;
_ZStrsI[cw]St11char_traitsI[cw]ESaI[cw]EERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_string*;
# std::locale::name() returning new std::string
_ZNKSt6locale4nameB5cxx11Ev;
# ABI-tagged locale facets
_ZT[ISTV]NSt7__cxx117collateI[cw]*;
_ZT[ISTV]NSt7__cxx1114collate_bynameI[cw]*;
_ZT[ISTV]NSt7__cxx118messagesI[cw]*;
_ZT[ISTV]NSt7__cxx1115messages_bynameI[cw]*;
_ZT[ISTV]NSt7__cxx119money_getI[cw]*;
_ZT[ISTV]NSt7__cxx119money_putI[cw]*;
_ZT[ISTV]NSt7__cxx1110moneypunctI[cw]Lb[01]*;
_ZT[ISTV]NSt7__cxx1117moneypunct_bynameI[cw]Lb[01]*;
_ZT[ISTV]NSt7__cxx118numpunctI[cw]*;
_ZT[ISTV]NSt7__cxx1115numpunct_bynameI[cw]*;
_ZT[ISTV]NSt7__cxx118time_getI[cw]*;
_ZT[ISTV]NSt7__cxx1115time_get_bynameI[cw]*;
# guard vars for new facet::id globals
_ZGVNSt7__cxx117collateI[cw]*;
_ZGVNSt7__cxx118messagesI[cw]*;
_ZGVNSt7__cxx1110moneypunctI[cw]Lb[01]*;
_ZGVNSt7__cxx119money_getI[cw]*;
_ZGVNSt7__cxx119money_putI[cw]*;
_ZGVNSt7__cxx118numpunctI[cw]*;
_ZGVNSt7__cxx118time_getI[cw]*;
_ZNSt7__cxx117collateI*;
_ZNSt7__cxx1114collate_bynameI*;
_ZNSt7__cxx118messagesI*;
_ZNSt7__cxx1115messages_bynameI*;
_ZNSt7__cxx119money_getI*;
_ZNSt7__cxx119money_putI*;
_ZNSt7__cxx1110moneypunctI*;
_ZNSt7__cxx1117moneypunct_bynameI*;
_ZNSt7__cxx118numpunctI*;
_ZNSt7__cxx1115numpunct_bynameI*;
_ZNSt7__cxx118time_getI*;
_ZNSt7__cxx1115time_get_bynameI*;
_ZNKSt7__cxx117collateI*;
_ZNKSt7__cxx118messagesI*;
_ZNKSt7__cxx119money_getI*;
_ZNKSt7__cxx119money_putI*;
_ZNKSt7__cxx1110moneypunctI*;
_ZNKSt7__cxx118numpunctI*;
_ZNKSt7__cxx118time_getI*;
_ZSt9has_facetINSt7__cxx117collate*;
_ZSt9has_facetINSt7__cxx118messages*;
_ZSt9has_facetINSt7__cxx119money_get*;
_ZSt9has_facetINSt7__cxx119money_put*;
_ZSt9has_facetINSt7__cxx1110moneypunct*;
_ZSt9has_facetINSt7__cxx118numpunct*;
_ZSt9has_facetINSt7__cxx118time_get*;
_ZSt9use_facetINSt7__cxx117collate*;
_ZSt9use_facetINSt7__cxx118messages*;
_ZSt9use_facetINSt7__cxx119money_get*;
_ZSt9use_facetINSt7__cxx119money_put*;
_ZSt9use_facetINSt7__cxx1110moneypunct*;
_ZSt9use_facetINSt7__cxx118numpunct*;
_ZSt9use_facetINSt7__cxx118time_get*;
_ZSt17__verify_groupingPKc[mj]RKNSt7__cxx1112basic_string*;
_ZNSt3_V214error_category*;
_ZNKSt3_V214error_category*;
_ZTVNSt3_V214error_categoryE;
_ZTINSt3_V214error_categoryE;
_ZNSt3_V215system_categoryEv;
_ZNSt3_V216generic_categoryEv;
# New exception constructors
_ZNSt11logic_errorC[12]EPKc;
_ZNSt11logic_errorC[12]ERKS_;
_ZNSt11logic_erroraSERKS_;
_ZNSt11logic_errorC[12]ERKNSt7__cxx1112basic_string*;
_ZNSt11range_errorC[12]EPKc;
_ZNSt11range_errorC[12]ERKNSt7__cxx1112basic_string*;
_ZNSt12domain_errorC[12]EPKc;
_ZNSt12domain_errorC[12]ERKNSt7__cxx1112basic_string*;
_ZNSt12length_errorC[12]EPKc;
_ZNSt12length_errorC[12]ERKNSt7__cxx1112basic_string*;
_ZNSt12out_of_rangeC[12]EPKc;
_ZNSt12out_of_rangeC[12]ERKNSt7__cxx1112basic_string*;
_ZNSt13runtime_errorC[12]EPKc;
_ZNSt13runtime_errorC[12]ERKS_;
_ZNSt13runtime_erroraSERKS_;
_ZNSt13runtime_errorC[12]ERKNSt7__cxx1112basic_string*;
_ZNSt14overflow_errorC[12]EPKc;
_ZNSt14overflow_errorC[12]ERKNSt7__cxx1112basic_string*;
_ZNSt15underflow_errorC[12]EPKc;
_ZNSt15underflow_errorC[12]ERKNSt7__cxx1112basic_string*;
_ZNSt16invalid_argumentC[12]EPKc;
_ZNSt16invalid_argumentC[12]ERKNSt7__cxx1112basic_string*;
_ZNSt13random_device14_M_init_pretr1ERKNSt7__cxx1112basic_string*;
_ZNSt13random_device7_M_initERKNSt7__cxx1112basic_string*;
_ZNKSt3tr14hashINSt7__cxx1112basic_string*;
} GLIBCXX_3.4.20;

View File

@ -34,11 +34,16 @@ namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// This file might be compiled twice, but we only want to define the members
// of money_base once.
#if ! _GLIBCXX_USE_CXX11_ABI
// Construct and return valid pattern consisting of some combination of:
// space none symbol sign value
money_base::pattern
money_base::_S_construct_pattern(char, char, char) throw()
{ return _S_default_pattern; }
#endif
template<>
void

View File

@ -35,6 +35,10 @@ namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// This file might be compiled twice, but we only want to define the members
// of money_base once.
#if ! _GLIBCXX_USE_CXX11_ABI
// Construct and return valid pattern consisting of some combination of:
// space none symbol sign value
money_base::pattern
@ -201,6 +205,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
return __ret;
}
#endif
template<>
void

View File

@ -117,6 +117,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
if (_M_data->_M_grouping_size)
delete [] _M_data->_M_grouping;
_M_data->_M_grouping = 0;
delete _M_data;
}
@ -209,6 +210,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
if (_M_data->_M_grouping_size)
delete [] _M_data->_M_grouping;
_M_data->_M_grouping = 0;
delete _M_data;
}
#endif

View File

@ -9,7 +9,17 @@ GLIBCXX_LDBL_3.4 {
_ZSt14__convert_to_vIgEvPKcRT_RSt12_Ios_IostateRKP*;
_ZStlsIg[cw]St11char_traitsI[cw]EERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E;
_ZStrsIg[cw]St11char_traitsI[cw]EERSt13basic_istreamIT0_T1_ES6_RSt7complexIT_E;
*__gnu_cxx_ldbl128*;
*__gnu_cxx_ldbl128[1-6]*;
*St9has_facetINSt17__gnu_cxx_ldbl1287*;
*St9use_facetINSt17__gnu_cxx_ldbl1287*;
*__gnu_cxx_ldbl1287num_getI[cw]St19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEE[CD][0-2]E?;
*__gnu_cxx_ldbl1287num_getI[cw]St19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEE2idE;
*__gnu_cxx_ldbl1287num_getI[cw]St19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEEE;
*__gnu_cxx_ldbl1287num_getI[cw]*getE*;
*__gnu_cxx_ldbl1287num_getI[cw]*14_M_extract_intI*;
*__gnu_cxx_ldbl1287num_getI[cw]*16_M_extract_floatE*;
*__gnu_cxx_ldbl1287num_putI[cw]*;
*__gnu_cxx_ldbl128[8-9]*;
};
# Corresponding to exports in GLIBCXX_3.4.9, not GLIBCXX_3.4.7
@ -25,6 +35,11 @@ GLIBCXX_LDBL_3.4.10 {
_ZNKSt4hashIgEclEg;
} GLIBCXX_LDBL_3.4.7;
GLIBCXX_LDBL_3.4.21 {
__gnu_cxx_ldbl1287num_getI[cw]*14_M_extract_intB5cxx11*;
__gnu_cxx_ldbl1287num_getI[cw]*16_M_extract_floatB5cxx11*;
} GLIBCXX_LDBL_3.4.10;
CXXABI_LDBL_1.3 {
_ZT[IS]g;
_ZT[IS]Pg;

View File

@ -645,6 +645,9 @@ GLIBCXX_LDBL_COMPAT_FALSE
GLIBCXX_LDBL_COMPAT_TRUE
ENABLE_CXX11_ABI_FALSE
ENABLE_CXX11_ABI_TRUE
glibcxx_cxx98_abi
ENABLE_DUAL_ABI_FALSE
ENABLE_DUAL_ABI_TRUE
ENABLE_VISIBILITY_FALSE
ENABLE_VISIBILITY_TRUE
libtool_VERSION
@ -882,7 +885,8 @@ with_system_libunwind
enable_linux_futex
enable_symvers
enable_libstdcxx_visibility
enable_libstdcxx_cxx11_abi
enable_libstdcxx_dual_abi
with_default_libstdcxx_abi
enable_libstdcxx_threads
with_gxx_include_dir
enable_version_specific_runtime_libs
@ -1578,8 +1582,8 @@ Optional Features:
[default=yes]
--enable-libstdcxx-visibility
enables visibility safe usage [default=yes]
--disable-libstdcxx-cxx11-abi
disable the C++11-conforming ABI
--enable-libstdcxx-dual-abi
support two versions of std::string [default=yes]
--enable-libstdcxx-threads
enable C++11 threads support [default=auto]
--enable-version-specific-runtime-libs
@ -1602,6 +1606,8 @@ Optional Packages:
--with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib
--without-libiconv-prefix don't search for libiconv in includedir and libdir
--with-system-libunwind use installed libunwind
--with-default-libstdcxx-abi
set the std::string ABI to use by default
--with-gxx-include-dir=DIR
installation directory for include files
@ -11531,7 +11537,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11534 "configure"
#line 11540 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -11637,7 +11643,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11640 "configure"
#line 11646 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -15057,7 +15063,7 @@ fi
#
# Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style.
cat > conftest.$ac_ext << EOF
#line 15060 "configure"
#line 15066 "configure"
struct S { ~S(); };
void bar();
void foo()
@ -15409,7 +15415,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; }
# Fake what AC_TRY_COMPILE does.
cat > conftest.$ac_ext << EOF
#line 15412 "configure"
#line 15418 "configure"
int main()
{
typedef bool atomic_type;
@ -15444,7 +15450,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
#line 15447 "configure"
#line 15453 "configure"
int main()
{
typedef short atomic_type;
@ -15479,7 +15485,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
#line 15482 "configure"
#line 15488 "configure"
int main()
{
// NB: _Atomic_word not necessarily int.
@ -15515,7 +15521,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
#line 15518 "configure"
#line 15524 "configure"
int main()
{
typedef long long atomic_type;
@ -15594,7 +15600,7 @@ $as_echo "$as_me: WARNING: Performance of certain classes will degrade as a resu
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
#line 15597 "configure"
#line 15603 "configure"
int main()
{
_Decimal32 d1;
@ -15636,7 +15642,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
#line 15639 "configure"
#line 15645 "configure"
template<typename T1, typename T2>
struct same
{ typedef T2 type; };
@ -15670,7 +15676,7 @@ $as_echo "$enable_int128" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
#line 15673 "configure"
#line 15679 "configure"
template<typename T1, typename T2>
struct same
{ typedef T2 type; };
@ -78166,20 +78172,56 @@ $as_echo "$as_me: visibility supported: $enable_libstdcxx_visibility" >&6;}
# Check whether --enable-libstdcxx-cxx11-abi was given.
if test "${enable_libstdcxx_cxx11_abi+set}" = set; then :
enableval=$enable_libstdcxx_cxx11_abi;
# Check whether --enable-libstdcxx-dual-abi was given.
if test "${enable_libstdcxx_dual_abi+set}" = set; then :
enableval=$enable_libstdcxx_dual_abi;
case "$enableval" in
yes|no) ;;
*) as_fn_error "Argument to enable/disable libstdcxx-dual-abi must be yes or no" "$LINENO" 5 ;;
esac
else
enable_libstdcxx_cxx11_abi=yes
enable_libstdcxx_dual_abi=yes
fi
if test x"$enable_libstdcxx_cxx11_abi" != xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: C++11-conforming ABI is disabled" >&5
$as_echo "$as_me: C++11-conforming ABI is disabled" >&6;}
if test x"$enable_libstdcxx_dual_abi" != xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: dual ABI is disabled" >&5
$as_echo "$as_me: dual ABI is disabled" >&6;}
default_libstdcxx_abi="c++98"
fi
if test x$enable_libstdcxx_dual_abi = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for default std::string ABI to use" >&5
$as_echo_n "checking for default std::string ABI to use... " >&6; }
# Check whether --with-default-libstdcxx-abi was given.
if test "${with_default_libstdcxx_abi+set}" = set; then :
withval=$with_default_libstdcxx_abi; case "$withval" in
c++98|gnu++98|c++03|gnu++03) default_libstdcxx_abi="c++98" ;;
c++1?|gnu++1?) default_libstdcxx_abi="c++11" ;;
*) as_fn_error "Invalid argument for --with-default-libstdcxx-abi" "$LINENO" 5 ;;
esac
else
default_libstdcxx_abi="c++11"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${default_libstdcxx_abi}" >&5
$as_echo "${default_libstdcxx_abi}" >&6; }
fi
if test $default_libstdcxx_abi = "c++11"; then
glibcxx_cxx11_abi=1
glibcxx_cxx98_abi=0
else
glibcxx_cxx11_abi=0
glibcxx_cxx98_abi=1
fi
ac_ldbl_compat=no
case "$target" in
powerpc*-*-linux* | \
@ -79332,7 +79374,16 @@ else
fi
if test $enable_libstdcxx_cxx11_abi = yes; then
if test $enable_libstdcxx_dual_abi = yes; then
ENABLE_DUAL_ABI_TRUE=
ENABLE_DUAL_ABI_FALSE='#'
else
ENABLE_DUAL_ABI_TRUE='#'
ENABLE_DUAL_ABI_FALSE=
fi
if test $glibcxx_cxx11_abi = 1; then
ENABLE_CXX11_ABI_TRUE=
ENABLE_CXX11_ABI_FALSE='#'
else
@ -79758,6 +79809,10 @@ if test -z "${ENABLE_VISIBILITY_TRUE}" && test -z "${ENABLE_VISIBILITY_FALSE}";
as_fn_error "conditional \"ENABLE_VISIBILITY\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${ENABLE_DUAL_ABI_TRUE}" && test -z "${ENABLE_DUAL_ABI_FALSE}"; then
as_fn_error "conditional \"ENABLE_DUAL_ABI\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${ENABLE_CXX11_ABI_TRUE}" && test -z "${ENABLE_CXX11_ABI_FALSE}"; then
as_fn_error "conditional \"ENABLE_CXX11_ABI\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5

View File

@ -368,7 +368,8 @@ AC_SUBST(libtool_VERSION)
GLIBCXX_ENABLE_LIBSTDCXX_VISIBILITY([yes])
GLIBCXX_ENABLE_LIBSTDCXX_CXX11_ABI([yes])
GLIBCXX_ENABLE_LIBSTDCXX_DUAL_ABI([yes])
GLIBCXX_DEFAULT_ABI
ac_ldbl_compat=no
case "$target" in

View File

@ -218,6 +218,7 @@ 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@

View File

@ -227,6 +227,15 @@
facilities, which might be undesirable in a low-memory environment or
when standard error is not available. This option disables those
messages. This option does not change the library ABI.
</p></dd><dt><span class="term"><code class="code">--disable-libstdcxx-dual-abi</code></span></dt><dd><p>
Disable support for the new, C++11-conforming <code class="code">std::string</code>
implementation. This option changes the library ABI.
</p></dd><dt><span class="term"><code class="code">--with-default-libstdcxx-abi</code></span></dt><dd><p>
By default, the new <code class="code">std::string</code> implementation will be
declared and a macro must be defined to declare the old implementation
instead. That default can be reversed by configuring the library with
<code class="code">--with-default-libstdcxx-abi=c++98</code>.
This option does not change the library ABI.
</p></dd><dt><span class="term"><code class="code">--enable-vtable-verify</code>[default]</span></dt><dd><p>Use <code class="code">-fvtable-verify=std</code> to compile the C++
runtime with instrumentation for vtable verification. All virtual
functions in the standard library will be verified at runtime.

View File

@ -310,4 +310,4 @@ is called.
<a class="link" href="http://gcc.gnu.org/PR25191" target="_top">
GCC Bug 25191: exception_defines.h #defines try/catch
</a>
</em>. </span></p></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="using_concurrency.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="using.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="debug.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Concurrency </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Debugging Support</td></tr></table></div></body></html>
</em>. </span></p></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="using_concurrency.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="using.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="debug.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Concurrency </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Debugging Support</td></tr></table></div></body></html>

View File

@ -382,6 +382,25 @@
</para>
</listitem></varlistentry>
<varlistentry><term><code>--disable-libstdcxx-dual-abi</code></term>
<listitem>
<para>
Disable support for the new, C++11-conforming <code>std::string</code>
implementation. This option changes the library ABI.
</para>
</listitem></varlistentry>
<varlistentry><term><code>--with-default-libstdcxx-abi</code></term>
<listitem>
<para>
By default, the new <code>std::string</code> implementation will be
declared and a macro must be defined to declare the old implementation
instead. That default can be reversed by configuring the library with
<code>--with-default-libstdcxx-abi=c++98</code>.
This option does not change the library ABI.
</para>
</listitem></varlistentry>
<varlistentry><term><code>--enable-vtable-verify</code>[default]</term>
<listitem>
<para>Use <code>-fvtable-verify=std</code> to compile the C++

View File

@ -1129,6 +1129,14 @@ stamp-visibility:
echo 0 > stamp-visibility
endif
if ENABLE_DUAL_ABI
stamp-dual-abi:
echo 1 > stamp-dual-abi
else
stamp-dual-abi:
echo 0 > stamp-dual-abi
endif
if ENABLE_CXX11_ABI
stamp-cxx11-abi:
echo 1 > stamp-cxx11-abi
@ -1146,11 +1154,13 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \
stamp-namespace-version \
stamp-visibility \
stamp-extern-template \
stamp-dual-abi \
stamp-cxx11-abi
@date=`cat ${toplevel_srcdir}/gcc/DATESTAMP` ;\
ns_version=`cat stamp-namespace-version` ;\
visibility=`cat stamp-visibility` ;\
externtemplate=`cat stamp-extern-template` ;\
dualabi=`cat stamp-dual-abi` ;\
cxx11abi=`cat stamp-cxx11-abi` ;\
ldbl_compat='s,g,g,' ;\
grep "^[ ]*#[ ]*define[ ][ ]*_GLIBCXX_LONG_DOUBLE_COMPAT[ ][ ]*1[ ]*$$" \
@ -1160,6 +1170,7 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \
-e "s,define _GLIBCXX_INLINE_VERSION, define _GLIBCXX_INLINE_VERSION $$ns_version," \
-e "s,define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY, define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY $$visibility," \
-e "s,define _GLIBCXX_EXTERN_TEMPLATE$$, define _GLIBCXX_EXTERN_TEMPLATE $$externtemplate," \
-e "s,define _GLIBCXX_USE_DUAL_ABI, define _GLIBCXX_USE_DUAL_ABI $$dualabi," \
-e "s,define _GLIBCXX_USE_CXX11_ABI, define _GLIBCXX_USE_CXX11_ABI $$cxx11abi," \
-e "$$ldbl_compat" \
< ${glibcxx_srcdir}/include/bits/c++config > $@ ;\

View File

@ -216,6 +216,7 @@ 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@
@ -1539,6 +1540,11 @@ stamp-host: ${host_headers} ${bits_host_headers} ${ext_host_headers} ${host_head
@ENABLE_VISIBILITY_FALSE@stamp-visibility:
@ENABLE_VISIBILITY_FALSE@ echo 0 > stamp-visibility
@ENABLE_DUAL_ABI_TRUE@stamp-dual-abi:
@ENABLE_DUAL_ABI_TRUE@ echo 1 > stamp-dual-abi
@ENABLE_DUAL_ABI_FALSE@stamp-dual-abi:
@ENABLE_DUAL_ABI_FALSE@ echo 0 > stamp-dual-abi
@ENABLE_CXX11_ABI_TRUE@stamp-cxx11-abi:
@ENABLE_CXX11_ABI_TRUE@ echo 1 > stamp-cxx11-abi
@ENABLE_CXX11_ABI_FALSE@stamp-cxx11-abi:
@ -1553,11 +1559,13 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \
stamp-namespace-version \
stamp-visibility \
stamp-extern-template \
stamp-dual-abi \
stamp-cxx11-abi
@date=`cat ${toplevel_srcdir}/gcc/DATESTAMP` ;\
ns_version=`cat stamp-namespace-version` ;\
visibility=`cat stamp-visibility` ;\
externtemplate=`cat stamp-extern-template` ;\
dualabi=`cat stamp-dual-abi` ;\
cxx11abi=`cat stamp-cxx11-abi` ;\
ldbl_compat='s,g,g,' ;\
grep "^[ ]*#[ ]*define[ ][ ]*_GLIBCXX_LONG_DOUBLE_COMPAT[ ][ ]*1[ ]*$$" \
@ -1567,6 +1575,7 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \
-e "s,define _GLIBCXX_INLINE_VERSION, define _GLIBCXX_INLINE_VERSION $$ns_version," \
-e "s,define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY, define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY $$visibility," \
-e "s,define _GLIBCXX_EXTERN_TEMPLATE$$, define _GLIBCXX_EXTERN_TEMPLATE $$externtemplate," \
-e "s,define _GLIBCXX_USE_DUAL_ABI, define _GLIBCXX_USE_DUAL_ABI $$dualabi," \
-e "s,define _GLIBCXX_USE_CXX11_ABI, define _GLIBCXX_USE_CXX11_ABI $$cxx11abi," \
-e "$$ldbl_compat" \
< ${glibcxx_srcdir}/include/bits/c++config > $@ ;\

File diff suppressed because it is too large Load Diff

View File

@ -33,6 +33,8 @@
// Written by Jason Merrill based upon the specification by Takanori Adachi
// in ANSI X3J16/94-0013R2. Rewritten by Nathan Myers to ISO-14882.
// Non-reference-counted implementation written by Paolo Carlini and
// updated by Jonathan Wakely for ISO-14882-2011.
#ifndef _BASIC_STRING_TCC
#define _BASIC_STRING_TCC 1
@ -45,6 +47,448 @@ namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
#if _GLIBCXX_USE_CXX11_ABI
template<typename _CharT, typename _Traits, typename _Alloc>
const typename basic_string<_CharT, _Traits, _Alloc>::size_type
basic_string<_CharT, _Traits, _Alloc>::npos;
template<typename _CharT, typename _Traits, typename _Alloc>
void
basic_string<_CharT, _Traits, _Alloc>::
swap(basic_string& __s) _GLIBCXX_NOEXCEPT
{
if (this == &__s)
return;
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 431. Swapping containers with unequal allocators.
// TODO propagation traits
std::__alloc_swap<allocator_type>::_S_do_it(_M_get_allocator(),
__s._M_get_allocator());
if (_M_is_local())
if (__s._M_is_local())
{
if (length() && __s.length())
{
_CharT __tmp_data[_S_local_capacity + 1];
traits_type::copy(__tmp_data, __s._M_local_buf,
_S_local_capacity + 1);
traits_type::copy(__s._M_local_buf, _M_local_buf,
_S_local_capacity + 1);
traits_type::copy(_M_local_buf, __tmp_data,
_S_local_capacity + 1);
}
else if (__s.length())
{
traits_type::copy(_M_local_buf, __s._M_local_buf,
_S_local_capacity + 1);
_M_length(__s.length());
__s._M_set_length(0);
return;
}
else if (length())
{
traits_type::copy(__s._M_local_buf, _M_local_buf,
_S_local_capacity + 1);
__s._M_length(length());
_M_set_length(0);
return;
}
}
else
{
const size_type __tmp_capacity = __s._M_allocated_capacity;
traits_type::copy(__s._M_local_buf, _M_local_buf,
_S_local_capacity + 1);
_M_data(__s._M_data());
__s._M_data(__s._M_local_buf);
_M_capacity(__tmp_capacity);
}
else
{
const size_type __tmp_capacity = _M_allocated_capacity;
if (__s._M_is_local())
{
traits_type::copy(_M_local_buf, __s._M_local_buf,
_S_local_capacity + 1);
__s._M_data(_M_data());
_M_data(_M_local_buf);
}
else
{
pointer __tmp_ptr = _M_data();
_M_data(__s._M_data());
__s._M_data(__tmp_ptr);
_M_capacity(__s._M_allocated_capacity);
}
__s._M_capacity(__tmp_capacity);
}
const size_type __tmp_length = length();
_M_length(__s.length());
__s._M_length(__tmp_length);
}
template<typename _CharT, typename _Traits, typename _Alloc>
typename basic_string<_CharT, _Traits, _Alloc>::pointer
basic_string<_CharT, _Traits, _Alloc>::
_M_create(size_type& __capacity, size_type __old_capacity)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 83. String::npos vs. string::max_size()
if (__capacity > max_size())
std::__throw_length_error(__N("basic_string::_M_create"));
// The below implements an exponential growth policy, necessary to
// meet amortized linear time requirements of the library: see
// http://gcc.gnu.org/ml/libstdc++/2001-07/msg00085.html.
if (__capacity > __old_capacity && __capacity < 2 * __old_capacity)
{
__capacity = 2 * __old_capacity;
// Never allocate a string bigger than max_size.
if (__capacity > max_size())
__capacity = max_size();
}
// NB: Need an array of char_type[__capacity], plus a terminating
// null char_type() element.
return _Alloc_traits::allocate(_M_get_allocator(), __capacity + 1);
}
// NB: This is the special case for Input Iterators, used in
// istreambuf_iterators, etc.
// Input Iterators have a cost structure very different from
// pointers, calling for a different coding style.
template<typename _CharT, typename _Traits, typename _Alloc>
template<typename _InIterator>
void
basic_string<_CharT, _Traits, _Alloc>::
_M_construct(_InIterator __beg, _InIterator __end,
std::input_iterator_tag)
{
size_type __len = 0;
size_type __capacity = size_type(_S_local_capacity);
while (__beg != __end && __len < __capacity)
{
_M_data()[__len++] = *__beg;
++__beg;
}
__try
{
while (__beg != __end)
{
if (__len == __capacity)
{
// Allocate more space.
__capacity = __len + 1;
pointer __another = _M_create(__capacity, __len);
this->_S_copy(__another, _M_data(), __len);
_M_dispose();
_M_data(__another);
_M_capacity(__capacity);
}
_M_data()[__len++] = *__beg;
++__beg;
}
}
__catch(...)
{
_M_dispose();
__throw_exception_again;
}
_M_set_length(__len);
}
template<typename _CharT, typename _Traits, typename _Alloc>
template<typename _InIterator>
void
basic_string<_CharT, _Traits, _Alloc>::
_M_construct(_InIterator __beg, _InIterator __end,
std::forward_iterator_tag)
{
// NB: Not required, but considered best practice.
if (__gnu_cxx::__is_null_pointer(__beg) && __beg != __end)
std::__throw_logic_error(__N("basic_string::"
"_M_construct null not valid"));
size_type __dnew = static_cast<size_type>(std::distance(__beg, __end));
if (__dnew > size_type(_S_local_capacity))
{
_M_data(_M_create(__dnew, size_type(0)));
_M_capacity(__dnew);
}
// Check for out_of_range and length_error exceptions.
__try
{ this->_S_copy_chars(_M_data(), __beg, __end); }
__catch(...)
{
_M_dispose();
__throw_exception_again;
}
_M_set_length(__dnew);
}
template<typename _CharT, typename _Traits, typename _Alloc>
void
basic_string<_CharT, _Traits, _Alloc>::
_M_construct(size_type __n, _CharT __c)
{
if (__n > size_type(_S_local_capacity))
{
_M_data(_M_create(__n, size_type(0)));
_M_capacity(__n);
}
if (__n)
this->_S_assign(_M_data(), __n, __c);
_M_set_length(__n);
}
template<typename _CharT, typename _Traits, typename _Alloc>
void
basic_string<_CharT, _Traits, _Alloc>::
_M_assign(const basic_string& __str)
{
if (this != &__str)
{
const size_type __rsize = __str.length();
const size_type __capacity = capacity();
if (__rsize > __capacity)
{
size_type __new_capacity = __rsize;
pointer __tmp = _M_create(__new_capacity, __capacity);
_M_dispose();
_M_data(__tmp);
_M_capacity(__new_capacity);
}
if (__rsize)
this->_S_copy(_M_data(), __str._M_data(), __rsize);
_M_set_length(__rsize);
}
}
template<typename _CharT, typename _Traits, typename _Alloc>
void
basic_string<_CharT, _Traits, _Alloc>::
reserve(size_type __res)
{
// Make sure we don't shrink below the current size.
if (__res < length())
__res = length();
const size_type __capacity = capacity();
if (__res != __capacity)
{
if (__res > __capacity
|| __res > size_type(_S_local_capacity))
{
pointer __tmp = _M_create(__res, __capacity);
this->_S_copy(__tmp, _M_data(), length() + 1);
_M_dispose();
_M_data(__tmp);
_M_capacity(__res);
}
else if (!_M_is_local())
{
this->_S_copy(_M_local_data(), _M_data(), length() + 1);
_M_destroy(__capacity);
_M_data(_M_local_data());
}
}
}
template<typename _CharT, typename _Traits, typename _Alloc>
void
basic_string<_CharT, _Traits, _Alloc>::
_M_mutate(size_type __pos, size_type __len1, const _CharT* __s,
size_type __len2)
{
const size_type __how_much = length() - __pos - __len1;
size_type __new_capacity = length() + __len2 - __len1;
pointer __r = _M_create(__new_capacity, capacity());
if (__pos)
this->_S_copy(__r, _M_data(), __pos);
if (__s && __len2)
this->_S_copy(__r + __pos, __s, __len2);
if (__how_much)
this->_S_copy(__r + __pos + __len2,
_M_data() + __pos + __len1, __how_much);
_M_dispose();
_M_data(__r);
_M_capacity(__new_capacity);
}
template<typename _CharT, typename _Traits, typename _Alloc>
void
basic_string<_CharT, _Traits, _Alloc>::
_M_erase(size_type __pos, size_type __n)
{
const size_type __how_much = length() - __pos - __n;
if (__how_much && __n)
this->_S_move(_M_data() + __pos, _M_data() + __pos + __n, __how_much);
_M_set_length(length() - __n);
}
template<typename _CharT, typename _Traits, typename _Alloc>
void
basic_string<_CharT, _Traits, _Alloc>::
resize(size_type __n, _CharT __c)
{
const size_type __size = this->size();
if (__size < __n)
this->append(__n - __size, __c);
else if (__n < __size)
this->_M_erase(__n, __size - __n);
}
template<typename _CharT, typename _Traits, typename _Alloc>
basic_string<_CharT, _Traits, _Alloc>&
basic_string<_CharT, _Traits, _Alloc>::
_M_append(const _CharT* __s, size_type __n)
{
const size_type __len = __n + this->size();
if (__len <= this->capacity())
{
if (__n)
this->_S_copy(this->_M_data() + this->size(), __s, __n);
}
else
this->_M_mutate(this->size(), size_type(0), __s, __n);
this->_M_set_length(__len);
return *this;
}
template<typename _CharT, typename _Traits, typename _Alloc>
template<typename _InputIterator>
basic_string<_CharT, _Traits, _Alloc>&
basic_string<_CharT, _Traits, _Alloc>::
_M_replace_dispatch(const_iterator __i1, const_iterator __i2,
_InputIterator __k1, _InputIterator __k2,
std::__false_type)
{
const basic_string __s(__k1, __k2);
const size_type __n1 = __i2 - __i1;
return _M_replace(__i1 - begin(), __n1, __s._M_data(),
__s.size());
}
template<typename _CharT, typename _Traits, typename _Alloc>
basic_string<_CharT, _Traits, _Alloc>&
basic_string<_CharT, _Traits, _Alloc>::
_M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
_CharT __c)
{
_M_check_length(__n1, __n2, "basic_string::_M_replace_aux");
const size_type __old_size = this->size();
const size_type __new_size = __old_size + __n2 - __n1;
if (__new_size <= this->capacity())
{
_CharT* __p = this->_M_data() + __pos1;
const size_type __how_much = __old_size - __pos1 - __n1;
if (__how_much && __n1 != __n2)
this->_S_move(__p + __n2, __p + __n1, __how_much);
}
else
this->_M_mutate(__pos1, __n1, 0, __n2);
if (__n2)
this->_S_assign(this->_M_data() + __pos1, __n2, __c);
this->_M_set_length(__new_size);
return *this;
}
template<typename _CharT, typename _Traits, typename _Alloc>
basic_string<_CharT, _Traits, _Alloc>&
basic_string<_CharT, _Traits, _Alloc>::
_M_replace(size_type __pos, size_type __len1, const _CharT* __s,
const size_type __len2)
{
_M_check_length(__len1, __len2, "basic_string::_M_replace");
const size_type __old_size = this->size();
const size_type __new_size = __old_size + __len2 - __len1;
if (__new_size <= this->capacity())
{
_CharT* __p = this->_M_data() + __pos;
const size_type __how_much = __old_size - __pos - __len1;
if (_M_disjunct(__s))
{
if (__how_much && __len1 != __len2)
this->_S_move(__p + __len2, __p + __len1, __how_much);
if (__len2)
this->_S_copy(__p, __s, __len2);
}
else
{
// Work in-place.
if (__len2 && __len2 <= __len1)
this->_S_move(__p, __s, __len2);
if (__how_much && __len1 != __len2)
this->_S_move(__p + __len2, __p + __len1, __how_much);
if (__len2 > __len1)
{
if (__s + __len2 <= __p + __len1)
this->_S_move(__p, __s, __len2);
else if (__s >= __p + __len1)
this->_S_copy(__p, __s + __len2 - __len1, __len2);
else
{
const size_type __nleft = (__p + __len1) - __s;
this->_S_move(__p, __s, __nleft);
this->_S_copy(__p + __nleft, __p + __len2,
__len2 - __nleft);
}
}
}
}
else
this->_M_mutate(__pos, __len1, __s, __len2);
this->_M_set_length(__new_size);
return *this;
}
template<typename _CharT, typename _Traits, typename _Alloc>
typename basic_string<_CharT, _Traits, _Alloc>::size_type
basic_string<_CharT, _Traits, _Alloc>::
copy(_CharT* __s, size_type __n, size_type __pos) const
{
_M_check(__pos, "basic_string::copy");
__n = _M_limit(__pos, __n);
__glibcxx_requires_string_len(__s, __n);
if (__n)
_S_copy(__s, _M_data() + __pos, __n);
// 21.3.5.7 par 3: do not append null. (good.)
return __n;
}
#else // !_GLIBCXX_USE_CXX11_ABI
template<typename _CharT, typename _Traits, typename _Alloc>
const typename basic_string<_CharT, _Traits, _Alloc>::size_type
basic_string<_CharT, _Traits, _Alloc>::
@ -686,6 +1130,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_copy(_M_data() + __pos1, __s, __n2);
return *this;
}
template<typename _CharT, typename _Traits, typename _Alloc>
typename basic_string<_CharT, _Traits, _Alloc>::size_type
basic_string<_CharT, _Traits, _Alloc>::
copy(_CharT* __s, size_type __n, size_type __pos) const
{
_M_check(__pos, "basic_string::copy");
__n = _M_limit(__pos, __n);
__glibcxx_requires_string_len(__s, __n);
if (__n)
_M_copy(__s, _M_data() + __pos, __n);
// 21.3.5.7 par 3: do not append null. (good.)
return __n;
}
#endif // !_GLIBCXX_USE_CXX11_ABI
template<typename _CharT, typename _Traits, typename _Alloc>
basic_string<_CharT, _Traits, _Alloc>
@ -717,20 +1176,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __str;
}
template<typename _CharT, typename _Traits, typename _Alloc>
typename basic_string<_CharT, _Traits, _Alloc>::size_type
basic_string<_CharT, _Traits, _Alloc>::
copy(_CharT* __s, size_type __n, size_type __pos) const
{
_M_check(__pos, "basic_string::copy");
__n = _M_limit(__pos, __n);
__glibcxx_requires_string_len(__s, __n);
if (__n)
_M_copy(__s, _M_data() + __pos, __n);
// 21.3.5.7 par 3: do not append null. (good.)
return __n;
}
template<typename _CharT, typename _Traits, typename _Alloc>
typename basic_string<_CharT, _Traits, _Alloc>::size_type
basic_string<_CharT, _Traits, _Alloc>::

View File

@ -193,14 +193,30 @@ namespace std
#endif
}
// Use abi_tag("cxx11")
#define _GLIBCXX_USE_DUAL_ABI
#if ! _GLIBCXX_USE_DUAL_ABI
// Ignore any pre-defined value of _GLIBCXX_USE_CXX11_ABI
# undef _GLIBCXX_USE_CXX11_ABI
#endif
#ifndef _GLIBCXX_USE_CXX11_ABI
#define _GLIBCXX_USE_CXX11_ABI
#endif
#if _GLIBCXX_USE_CXX11_ABI
namespace std
{
inline namespace __cxx11 __attribute__((abi_tag)) { }
}
# define _GLIBCXX_NAMESPACE_CXX11 __cxx11::
# define _GLIBCXX_BEGIN_NAMESPACE_CXX11 namespace __cxx11 {
# define _GLIBCXX_END_NAMESPACE_CXX11 }
# define _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_ABI_TAG_CXX11
#else
# define _GLIBCXX_NAMESPACE_CXX11
# define _GLIBCXX_BEGIN_NAMESPACE_CXX11
# define _GLIBCXX_END_NAMESPACE_CXX11
# define _GLIBCXX_DEFAULT_ABI_TAG
#endif
@ -370,6 +386,15 @@ namespace std
# define _GLIBCXX_BEGIN_NAMESPACE_LDBL
# define _GLIBCXX_END_NAMESPACE_LDBL
#endif
#if _GLIBCXX_USE_CXX11_ABI
# define _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_NAMESPACE_CXX11
# define _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_BEGIN_NAMESPACE_CXX11
# define _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_END_NAMESPACE_CXX11
#else
# define _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_NAMESPACE_LDBL
# define _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_BEGIN_NAMESPACE_LDBL
# define _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_END_NAMESPACE_LDBL
#endif
// Assert.
#if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PARALLEL)

View File

@ -212,6 +212,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @brief Return locale name.
* @return Locale name or "*" if unnamed.
*/
_GLIBCXX_DEFAULT_ABI_TAG
string
name() const;
@ -321,6 +322,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
void
_M_coalesce(const locale& __base, const locale& __add, category __cat);
#if _GLIBCXX_USE_CXX11_ABI
static const id* const _S_twinned_facets[];
#endif
};
@ -419,6 +424,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
facet&
operator=(const facet&); // Not defined.
class __shim;
const facet* _M_sso_shim(const id*) const;
const facet* _M_cow_shim(const id*) const;
};
@ -563,8 +573,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_init_facet(_Facet* __facet)
{ _M_install_facet(&_Facet::id, __facet); }
template<typename _Facet>
void
_M_init_facet_unchecked(_Facet* __facet)
{
__facet->_M_add_reference();
_M_facets[_Facet::id._M_id()] = __facet;
}
void
_M_install_cache(const facet*, size_t);
void _M_init_extra(facet**);
void _M_init_extra(void*, void*, const char*, const char*);
};
@ -581,7 +602,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* collate facet.
*/
template<typename _CharT>
class collate : public locale::facet
class _GLIBCXX_NAMESPACE_CXX11 collate : public locale::facet
{
public:
// Types:
@ -755,7 +776,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// class collate_byname [22.2.4.2].
template<typename _CharT>
class collate_byname : public collate<_CharT>
class _GLIBCXX_NAMESPACE_CXX11 collate_byname : public collate<_CharT>
{
public:
//@{

View File

@ -54,8 +54,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// NB: Don't instantiate required wchar_t facets if no wchar_t support.
#ifdef _GLIBCXX_USE_WCHAR_T
# define _GLIBCXX_NUM_FACETS 28
# define _GLIBCXX_NUM_CXX11_FACETS 16
#else
# define _GLIBCXX_NUM_FACETS 14
# define _GLIBCXX_NUM_CXX11_FACETS 8
#endif
// Convert string to numeric value of type _Tp and store results.
@ -1623,6 +1625,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
}
_GLIBCXX_BEGIN_NAMESPACE_CXX11
/**
* @brief Primary class template numpunct.
* @ingroup locales
@ -1896,6 +1900,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
~numpunct_byname() { }
};
_GLIBCXX_END_NAMESPACE_CXX11
_GLIBCXX_BEGIN_NAMESPACE_LDBL
/**
@ -2107,11 +2113,13 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL
/// Destructor.
virtual ~num_get() { }
_GLIBCXX_DEFAULT_ABI_TAG
iter_type
_M_extract_float(iter_type, iter_type, ios_base&, ios_base::iostate&,
string&) const;
template<typename _ValueT>
_GLIBCXX_DEFAULT_ABI_TAG
iter_type
_M_extract_int(iter_type, iter_type, ios_base&, ios_base::iostate&,
_ValueT&) const;

View File

@ -143,6 +143,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_BEGIN_NAMESPACE_LDBL
template<typename _CharT, typename _InIter>
_GLIBCXX_DEFAULT_ABI_TAG
_InIter
num_get<_CharT, _InIter>::
_M_extract_float(_InIter __beg, _InIter __end, ios_base& __io,
@ -368,6 +369,7 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL
template<typename _CharT, typename _InIter>
template<typename _ValueT>
_GLIBCXX_DEFAULT_ABI_TAG
_InIter
num_get<_CharT, _InIter>::
_M_extract_int(_InIter __beg, _InIter __end, ios_base& __io,
@ -1290,8 +1292,8 @@ _GLIBCXX_END_NAMESPACE_LDBL
// Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere.
#if _GLIBCXX_EXTERN_TEMPLATE
extern template class numpunct<char>;
extern template class numpunct_byname<char>;
extern template class _GLIBCXX_NAMESPACE_CXX11 numpunct<char>;
extern template class _GLIBCXX_NAMESPACE_CXX11 numpunct_byname<char>;
extern template class _GLIBCXX_NAMESPACE_LDBL num_get<char>;
extern template class _GLIBCXX_NAMESPACE_LDBL num_put<char>;
extern template class ctype_byname<char>;
@ -1329,8 +1331,8 @@ _GLIBCXX_END_NAMESPACE_LDBL
has_facet<num_get<char> >(const locale&);
#ifdef _GLIBCXX_USE_WCHAR_T
extern template class numpunct<wchar_t>;
extern template class numpunct_byname<wchar_t>;
extern template class _GLIBCXX_NAMESPACE_CXX11 numpunct<wchar_t>;
extern template class _GLIBCXX_NAMESPACE_CXX11 numpunct_byname<wchar_t>;
extern template class _GLIBCXX_NAMESPACE_LDBL num_get<wchar_t>;
extern template class _GLIBCXX_NAMESPACE_LDBL num_put<wchar_t>;
extern template class ctype_byname<wchar_t>;

View File

@ -347,6 +347,8 @@ namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_BEGIN_NAMESPACE_CXX11
/**
* @brief Primary class template time_get.
* @ingroup locales
@ -694,6 +696,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
~time_get_byname() { }
};
_GLIBCXX_END_NAMESPACE_CXX11
/**
* @brief Primary class template time_put.
* @ingroup locales
@ -918,6 +922,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
}
_GLIBCXX_BEGIN_NAMESPACE_CXX11
/**
* @brief Primary class template moneypunct.
* @ingroup locales
@ -1346,7 +1352,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _CharT, bool _Intl>
const bool moneypunct_byname<_CharT, _Intl>::intl;
_GLIBCXX_BEGIN_NAMESPACE_LDBL
_GLIBCXX_END_NAMESPACE_CXX11
_GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11
/**
* @brief Primary class template money_get.
@ -1462,7 +1470,8 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL
* value returned. @see get() for details.
*/
// XXX GLIBCXX_ABI Deprecated
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \
&& _GLIBCXX_USE_CXX11_ABI == 0
virtual iter_type
__do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,
ios_base::iostate& __err, double& __units) const;
@ -1484,7 +1493,8 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL
ios_base::iostate& __err, string_type& __digits) const;
// XXX GLIBCXX_ABI Deprecated
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \
&& _GLIBCXX_USE_CXX11_ABI == 0
virtual iter_type
do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,
ios_base::iostate& __err, long double& __units) const;
@ -1605,7 +1615,8 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL
* @return Iterator after writing.
*/
// XXX GLIBCXX_ABI Deprecated
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \
&& _GLIBCXX_USE_CXX11_ABI == 0
virtual iter_type
__do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,
double __units) const;
@ -1639,7 +1650,8 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL
const string_type& __digits) const;
// XXX GLIBCXX_ABI Deprecated
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \
&& _GLIBCXX_USE_CXX11_ABI == 0
virtual iter_type
do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,
long double __units) const;
@ -1654,7 +1666,7 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL
template<typename _CharT, typename _OutIter>
locale::id money_put<_CharT, _OutIter>::id;
_GLIBCXX_END_NAMESPACE_LDBL
_GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11
/**
* @brief Messages facet base class providing catalog typedef.
@ -1665,6 +1677,8 @@ _GLIBCXX_END_NAMESPACE_LDBL
typedef int catalog;
};
_GLIBCXX_BEGIN_NAMESPACE_CXX11
/**
* @brief Primary class template messages.
* @ingroup locales
@ -1886,6 +1900,8 @@ _GLIBCXX_END_NAMESPACE_LDBL
{ }
};
_GLIBCXX_END_NAMESPACE_CXX11
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace

View File

@ -128,7 +128,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
}
_GLIBCXX_BEGIN_NAMESPACE_LDBL
_GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11
template<typename _CharT, typename _InIter>
template<bool _Intl>
@ -348,7 +348,8 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL
return __beg;
}
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \
&& _GLIBCXX_USE_CXX11_ABI == 0
template<typename _CharT, typename _InIter>
_InIter
money_get<_CharT, _InIter>::
@ -559,7 +560,8 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL
return __s;
}
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \
&& _GLIBCXX_USE_CXX11_ABI == 0
template<typename _CharT, typename _OutIter>
_OutIter
money_put<_CharT, _OutIter>::
@ -614,7 +616,7 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL
{ return __intl ? _M_insert<true>(__s, __io, __fill, __digits)
: _M_insert<false>(__s, __io, __fill, __digits); }
_GLIBCXX_END_NAMESPACE_LDBL
_GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11
// NB: Not especially useful. Without an ios_base object or some
// kind of locale reference, we are left clawing at the air where
@ -1222,8 +1224,8 @@ _GLIBCXX_END_NAMESPACE_LDBL
extern template class moneypunct<char, true>;
extern template class moneypunct_byname<char, false>;
extern template class moneypunct_byname<char, true>;
extern template class _GLIBCXX_NAMESPACE_LDBL money_get<char>;
extern template class _GLIBCXX_NAMESPACE_LDBL money_put<char>;
extern template class _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 money_get<char>;
extern template class _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 money_put<char>;
extern template class __timepunct<char>;
extern template class time_put<char>;
extern template class time_put_byname<char>;
@ -1297,8 +1299,8 @@ _GLIBCXX_END_NAMESPACE_LDBL
extern template class moneypunct<wchar_t, true>;
extern template class moneypunct_byname<wchar_t, false>;
extern template class moneypunct_byname<wchar_t, true>;
extern template class _GLIBCXX_NAMESPACE_LDBL money_get<wchar_t>;
extern template class _GLIBCXX_NAMESPACE_LDBL money_put<wchar_t>;
extern template class _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 money_get<wchar_t>;
extern template class _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 money_put<wchar_t>;
extern template class __timepunct<wchar_t>;
extern template class time_put<wchar_t>;
extern template class time_put_byname<wchar_t>;

View File

@ -150,21 +150,27 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL
template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
class num_put;
_GLIBCXX_END_NAMESPACE_LDBL
_GLIBCXX_BEGIN_NAMESPACE_CXX11
template<typename _CharT> class numpunct;
template<typename _CharT> class numpunct_byname;
_GLIBCXX_END_NAMESPACE_CXX11
_GLIBCXX_BEGIN_NAMESPACE_CXX11
// 22.2.4 collation
template<typename _CharT>
class collate;
template<typename _CharT> class
collate_byname;
template<typename _CharT>
class collate_byname;
_GLIBCXX_END_NAMESPACE_CXX11
// 22.2.5 date and time
class time_base;
_GLIBCXX_BEGIN_NAMESPACE_CXX11
template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
class time_get;
template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
class time_get_byname;
_GLIBCXX_END_NAMESPACE_CXX11
template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
class time_put;
template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
@ -172,23 +178,27 @@ _GLIBCXX_END_NAMESPACE_LDBL
// 22.2.6 money
class money_base;
_GLIBCXX_BEGIN_NAMESPACE_LDBL
_GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11
template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
class money_get;
template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
class money_put;
_GLIBCXX_END_NAMESPACE_LDBL
_GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11
_GLIBCXX_BEGIN_NAMESPACE_CXX11
template<typename _CharT, bool _Intl = false>
class moneypunct;
template<typename _CharT, bool _Intl = false>
class moneypunct_byname;
_GLIBCXX_END_NAMESPACE_CXX11
// 22.2.7 message retrieval
class messages_base;
_GLIBCXX_BEGIN_NAMESPACE_CXX11
template<typename _CharT>
class messages;
template<typename _CharT>
class messages_byname;
_GLIBCXX_END_NAMESPACE_CXX11
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std

View File

@ -31,12 +31,14 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_BEGIN_NAMESPACE_CXX11
template<typename, typename>
class basic_regex;
template<typename, typename>
class match_results;
_GLIBCXX_END_NAMESPACE_CXX11
_GLIBCXX_END_NAMESPACE_VERSION
namespace __detail
@ -71,6 +73,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
}
_GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_BEGIN_NAMESPACE_CXX11
/**
* @addtogroup regex
@ -1939,6 +1942,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
match_results<_Bi_iter, _Alloc>& __rhs)
{ __lhs.swap(__rhs); }
_GLIBCXX_END_NAMESPACE_CXX11
// [7.11.2] Function template regex_match
/**
* @name Matching, Searching, and Replacing
@ -2407,6 +2412,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
//@}
_GLIBCXX_BEGIN_NAMESPACE_CXX11
// std [28.12] Class template regex_iterator
/**
* An iterator adaptor that will provide repeated calls of regex_search over
@ -2770,6 +2777,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif
//@} // group regex
_GLIBCXX_END_NAMESPACE_CXX11
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace

View File

@ -292,10 +292,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
const _List_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT
{ return __x._M_node != __y._M_node; }
_GLIBCXX_BEGIN_NAMESPACE_CXX11
/// See bits/stl_deque.h's _Deque_base for an explanation.
template<typename _Tp, typename _Alloc>
class _GLIBCXX_DEFAULT_ABI_TAG _List_base
class _List_base
{
protected:
// NOTA BENE
@ -504,7 +504,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* %empty.
*/
template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
class _GLIBCXX_DEFAULT_ABI_TAG list : protected _List_base<_Tp, _Alloc>
class list : protected _List_base<_Tp, _Alloc>
{
// concept requirements
typedef typename _Alloc::value_type _Alloc_value_type;
@ -1790,6 +1790,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
__builtin_abort();
}
};
_GLIBCXX_END_NAMESPACE_CXX11
/**
* @brief List equality comparison.

View File

@ -52,35 +52,43 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<class _CharT>
struct char_traits;
template<> struct char_traits<char>;
#ifdef _GLIBCXX_USE_WCHAR_T
template<> struct char_traits<wchar_t>;
#endif
#if ((__cplusplus >= 201103L) \
&& defined(_GLIBCXX_USE_C99_STDINT_TR1))
template<> struct char_traits<char16_t>;
template<> struct char_traits<char32_t>;
#endif
_GLIBCXX_BEGIN_NAMESPACE_CXX11
template<typename _CharT, typename _Traits = char_traits<_CharT>,
typename _Alloc = allocator<_CharT> >
class basic_string;
template<> struct char_traits<char>;
/// A string of @c char
typedef basic_string<char> string;
#ifdef _GLIBCXX_USE_WCHAR_T
template<> struct char_traits<wchar_t>;
/// A string of @c wchar_t
typedef basic_string<wchar_t> wstring;
#endif
#if ((__cplusplus >= 201103L) \
&& defined(_GLIBCXX_USE_C99_STDINT_TR1))
template<> struct char_traits<char16_t>;
template<> struct char_traits<char32_t>;
/// A string of @c char16_t
typedef basic_string<char16_t> u16string;
/// A string of @c char32_t
typedef basic_string<char32_t> u32string;
#endif
_GLIBCXX_END_NAMESPACE_CXX11
/** @} */
_GLIBCXX_END_NAMESPACE_VERSION

View File

@ -88,6 +88,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _CharT, typename _Traits = char_traits<_CharT> >
class basic_iostream;
_GLIBCXX_BEGIN_NAMESPACE_CXX11
template<typename _CharT, typename _Traits = char_traits<_CharT>,
typename _Alloc = allocator<_CharT> >
class basic_stringbuf;
@ -104,6 +107,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typename _Alloc = allocator<_CharT> >
class basic_stringstream;
_GLIBCXX_END_NAMESPACE_CXX11
template<typename _CharT, typename _Traits = char_traits<_CharT> >
class basic_filebuf;

View File

@ -41,6 +41,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_BEGIN_NAMESPACE_CXX11
// [27.7.1] template class basic_stringbuf
/**
@ -63,6 +64,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _CharT, typename _Traits, typename _Alloc>
class basic_stringbuf : public basic_streambuf<_CharT, _Traits>
{
struct __xfer_bufptrs;
public:
// Types:
typedef _CharT char_type;
@ -117,9 +119,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
basic_stringbuf(const basic_stringbuf&) = delete;
basic_stringbuf(basic_stringbuf&& __rhs)
: __streambuf_type(static_cast<const __streambuf_type&>(__rhs)),
_M_mode(__rhs._M_mode), _M_string(std::move(__rhs._M_string))
{ __rhs._M_stringbuf_init(__rhs._M_mode); }
: basic_stringbuf(std::move(__rhs), __xfer_bufptrs(__rhs, this))
{ __rhs._M_sync(const_cast<char_type*>(__rhs._M_string.data()), 0, 0); }
// 27.8.2.2 Assign and swap:
@ -129,18 +130,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
basic_stringbuf&
operator=(basic_stringbuf&& __rhs)
{
__xfer_bufptrs __st{__rhs, this};
const __streambuf_type& __base = __rhs;
__streambuf_type::operator=(__base);
this->pubimbue(__rhs.getloc());
_M_mode = __rhs._M_mode;
_M_string = std::move(__rhs._M_string);
__rhs._M_stringbuf_init(__rhs._M_mode);
__rhs._M_sync(const_cast<char_type*>(__rhs._M_string.data()), 0, 0);
return *this;
}
void
swap(basic_stringbuf& __rhs)
{
__xfer_bufptrs __l_st{*this, std::__addressof(__rhs)};
__xfer_bufptrs __r_st{__rhs, this};
__streambuf_type& __base = __rhs;
__streambuf_type::swap(__base);
__rhs.pubimbue(this->pubimbue(__rhs.getloc()));
@ -185,7 +189,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
void
str(const __string_type& __s)
{
// Cannot use _M_string = __s, since v3 strings are COW.
// Cannot use _M_string = __s, since v3 strings are COW
// (not always true now but assign() always works).
_M_string.assign(__s.data(), __s.size());
_M_stringbuf_init(_M_mode);
}
@ -286,6 +291,60 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// interface of basic_streambuf, taking just an int.
void
_M_pbump(char_type* __pbeg, char_type* __pend, off_type __off);
private:
#if __cplusplus >= 201103L
#if _GLIBCXX_USE_CXX11_ABI
// This type captures the state of the gptr / pptr pointers as offsets
// so they can be restored in another object after moving the string.
struct __xfer_bufptrs
{
__xfer_bufptrs(const basic_stringbuf& __from, basic_stringbuf* __to)
: _M_to{__to}, _M_goff{-1, -1, -1}, _M_poff{-1, -1, -1}
{
const _CharT* __str = __from._M_string.data();
if (__from.eback())
{
_M_goff[0] = __from.eback() - __str;
_M_goff[1] = __from.gptr() - __str;
_M_goff[2] = __from.egptr() - __str;
}
if (__from.pbase())
{
_M_poff[0] = __from.pbase() - __str;
_M_poff[1] = __from.pptr() - __from.pbase();
_M_poff[2] = __from.epptr() - __str;
}
}
~__xfer_bufptrs()
{
char_type* __str = const_cast<char_type*>(_M_to->_M_string.data());
if (_M_goff[0] != -1)
_M_to->setg(__str+_M_goff[0], __str+_M_goff[1], __str+_M_goff[2]);
if (_M_poff[0] != -1)
_M_to->_M_pbump(__str+_M_poff[0], __str+_M_poff[2], _M_poff[1]);
}
basic_stringbuf* _M_to;
off_type _M_goff[3];
off_type _M_poff[3];
};
#else
// This type does nothing when using Copy-On-Write strings.
struct __xfer_bufptrs
{
__xfer_bufptrs(const basic_stringbuf&, basic_stringbuf*) { }
};
#endif
// The move constructor initializes an __xfer_bufptrs temporary then
// delegates to this constructor to performs moves during its lifetime.
basic_stringbuf(basic_stringbuf&& __rhs, __xfer_bufptrs&&)
: __streambuf_type(static_cast<const __streambuf_type&>(__rhs)),
_M_mode(__rhs._M_mode), _M_string(std::move(__rhs._M_string))
{ }
#endif
};
@ -747,6 +806,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ __x.swap(__y); }
#endif
_GLIBCXX_END_NAMESPACE_CXX11
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace

View File

@ -42,6 +42,64 @@ namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
#if _GLIBCXX_USE_DUAL_ABI
#if _GLIBCXX_USE_CXX11_ABI
// Emulates an old COW string when the new std::string is in use.
struct __cow_string
{
union {
const char* _M_p;
char _M_bytes[sizeof(_M_p)];
};
__cow_string();
__cow_string(const std::string&);
__cow_string(const char*, size_t);
__cow_string(const __cow_string&) _GLIBCXX_USE_NOEXCEPT;
__cow_string& operator=(const __cow_string&) _GLIBCXX_USE_NOEXCEPT;
~__cow_string();
#if __cplusplus >= 201103L
__cow_string(__cow_string&&) noexcept;
__cow_string& operator=(__cow_string&&) noexcept;
#endif
};
typedef basic_string<char> __sso_string;
#else // _GLIBCXX_USE_CXX11_ABI
typedef basic_string<char> __cow_string;
// Emulates a new SSO string when the old std::string is in use.
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)];
};
__sso_string() _GLIBCXX_USE_NOEXCEPT;
__sso_string(const std::string&);
__sso_string(const char*, size_t);
__sso_string(const __sso_string&);
__sso_string& operator=(const __sso_string&);
~__sso_string();
#if __cplusplus >= 201103L
__sso_string(__sso_string&&) noexcept;
__sso_string& operator=(__sso_string&&) noexcept;
#endif
};
#endif // _GLIBCXX_USE_CXX11_ABI
#else // _GLIBCXX_USE_DUAL_ABI
typedef basic_string<char> __sso_string;
typedef basic_string<char> __cow_string;
#endif
/**
* @addtogroup exceptions
* @{
@ -54,13 +112,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
class logic_error : public exception
{
string _M_msg;
__cow_string _M_msg;
public:
/** Takes a character string describing the error. */
explicit
logic_error(const string& __arg);
#if __cplusplus >= 201103L
explicit
logic_error(const char*);
#endif
#if _GLIBCXX_USE_CXX11_ABI || _GLIBCXX_DEFINE_STDEXCEPT_COPY_OPS
logic_error(const logic_error&) _GLIBCXX_USE_NOEXCEPT;
logic_error& operator=(const logic_error&) _GLIBCXX_USE_NOEXCEPT;
#endif
virtual ~logic_error() _GLIBCXX_USE_NOEXCEPT;
/** Returns a C-style character string describing the general cause of
@ -75,6 +143,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
public:
explicit domain_error(const string& __arg);
#if __cplusplus >= 201103L
explicit domain_error(const char*);
#endif
virtual ~domain_error() _GLIBCXX_USE_NOEXCEPT;
};
@ -83,6 +154,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
public:
explicit invalid_argument(const string& __arg);
#if __cplusplus >= 201103L
explicit invalid_argument(const char*);
#endif
virtual ~invalid_argument() _GLIBCXX_USE_NOEXCEPT;
};
@ -92,6 +166,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
public:
explicit length_error(const string& __arg);
#if __cplusplus >= 201103L
explicit length_error(const char*);
#endif
virtual ~length_error() _GLIBCXX_USE_NOEXCEPT;
};
@ -101,6 +178,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
public:
explicit out_of_range(const string& __arg);
#if __cplusplus >= 201103L
explicit out_of_range(const char*);
#endif
virtual ~out_of_range() _GLIBCXX_USE_NOEXCEPT;
};
@ -111,13 +191,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
class runtime_error : public exception
{
string _M_msg;
__cow_string _M_msg;
public:
/** Takes a character string describing the error. */
explicit
runtime_error(const string& __arg);
#if __cplusplus >= 201103L
explicit
runtime_error(const char*);
#endif
#if _GLIBCXX_USE_CXX11_ABI || _GLIBCXX_DEFINE_STDEXCEPT_COPY_OPS
runtime_error(const runtime_error&) _GLIBCXX_USE_NOEXCEPT;
runtime_error& operator=(const runtime_error&) _GLIBCXX_USE_NOEXCEPT;
#endif
virtual ~runtime_error() _GLIBCXX_USE_NOEXCEPT;
/** Returns a C-style character string describing the general cause of
@ -131,6 +221,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
public:
explicit range_error(const string& __arg);
#if __cplusplus >= 201103L
explicit range_error(const char*);
#endif
virtual ~range_error() _GLIBCXX_USE_NOEXCEPT;
};
@ -139,6 +232,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
public:
explicit overflow_error(const string& __arg);
#if __cplusplus >= 201103L
explicit overflow_error(const char*);
#endif
virtual ~overflow_error() _GLIBCXX_USE_NOEXCEPT;
};
@ -147,6 +243,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
public:
explicit underflow_error(const string& __arg);
#if __cplusplus >= 201103L
explicit underflow_error(const char*);
#endif
virtual ~underflow_error() _GLIBCXX_USE_NOEXCEPT;
};

View File

@ -46,7 +46,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class error_code;
class error_condition;
class error_category;
class system_error;
/// is_error_code_enum
@ -61,16 +60,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct is_error_condition_enum<errc>
: public true_type { };
inline namespace _V2 {
/// error_category
class error_category
{
public:
#ifdef _GLIBCXX_COMPATIBILITY_CXX0X
error_category() noexcept;
#else
constexpr error_category() noexcept = default;
#endif
virtual ~error_category();
@ -80,9 +76,30 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
virtual const char*
name() const noexcept = 0;
// We need two different virtual functions here, one returning a
// COW string and one returning an SSO string. Their positions in the
// vtable must be consistent for dynamic dispatch to work, but which one
// the name "message()" finds depends on which ABI the caller is using.
#if _GLIBCXX_USE_CXX11_ABI
private:
_GLIBCXX_DEFAULT_ABI_TAG
virtual __cow_string
_M_message(int) const;
public:
_GLIBCXX_DEFAULT_ABI_TAG
virtual string
message(int) const = 0;
#else
virtual string
message(int) const = 0;
private:
virtual __sso_string
_M_message(int) const;
#endif
public:
virtual error_condition
default_error_condition(int __i) const noexcept;
@ -109,6 +126,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_CONST const error_category& system_category() noexcept;
_GLIBCXX_CONST const error_category& generic_category() noexcept;
} // end inline namespace
error_code make_error_code(errc) noexcept;
template<typename _Tp>
@ -156,6 +175,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
error_condition
default_error_condition() const noexcept;
_GLIBCXX_DEFAULT_ABI_TAG
string
message() const
{ return category().message(value()); }
@ -231,6 +251,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const error_category&
category() const noexcept { return *_M_cat; }
_GLIBCXX_DEFAULT_ABI_TAG
string
message() const
{ return category().message(value()); }

View File

@ -280,6 +280,7 @@ 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@

View File

@ -216,6 +216,7 @@ 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@

View File

@ -240,6 +240,7 @@ 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@

View File

@ -660,6 +660,7 @@ class StdStringPrinter:
def __init__(self, typename, val):
self.val = val
self.new_string = typename.find("::__cxx11::basic_string") != -1
def to_string(self):
# Make sure &string works, too.
@ -671,13 +672,18 @@ class StdStringPrinter:
# the string according to length, not according to first null
# encountered.
ptr = self.val ['_M_dataplus']['_M_p']
realtype = type.unqualified ().strip_typedefs ()
reptype = gdb.lookup_type (str (realtype) + '::_Rep').pointer ()
header = ptr.cast(reptype) - 1
len = header.dereference ()['_M_length']
if self.new_string:
length = self.val['_M_string_length']
# https://sourceware.org/bugzilla/show_bug.cgi?id=17728
ptr = ptr.cast(ptr.type.strip_typedefs())
else:
realtype = type.unqualified ().strip_typedefs ()
reptype = gdb.lookup_type (str (realtype) + '::_Rep').pointer ()
header = ptr.cast(reptype) - 1
length = header.dereference ()['_M_length']
if hasattr(ptr, "lazy_string"):
return ptr.lazy_string (length = len)
return ptr.string (length = len)
return ptr.lazy_string (length = length)
return ptr.string (length = length)
def display_hint (self):
return 'string'
@ -1266,6 +1272,7 @@ def build_libstdcxx_dictionary ():
# In order from:
# http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01847.html
libstdcxx_printer.add_version('std::', 'basic_string', StdStringPrinter)
libstdcxx_printer.add_version('std::', '__cxx11::basic_string', StdStringPrinter)
libstdcxx_printer.add_container('std::', 'bitset', StdBitsetPrinter)
libstdcxx_printer.add_container('std::', 'deque', StdDequePrinter)
libstdcxx_printer.add_container('std::', 'list', StdListPrinter)

View File

@ -267,6 +267,7 @@ 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@

View File

@ -39,9 +39,14 @@ ctype_configure_char.cc: ${glibcxx_srcdir}/$(OS_INC_SRCDIR)/ctype_configure_char
ctype_members.cc: ${glibcxx_srcdir}/$(CCTYPE_CC)
$(LN_S) ${glibcxx_srcdir}/$(CCTYPE_CC) . || true
if ENABLE_CXX11_ABI
if ENABLE_DUAL_ABI
cxx11_abi_sources = \
cxx11-ios_failure.cc
cow-locale_init.cc \
cow-shim_facets.cc \
cxx11-hash_tr1.cc \
cxx11-ios_failure.cc \
cxx11-shim_facets.cc \
cxx11-stdexcept.cc
else
cxx11_abi_sources =
endif
@ -49,6 +54,7 @@ endif
sources = \
chrono.cc \
condition_variable.cc \
cow-stdexcept.cc \
ctype.cc \
debug.cc \
functexcept.cc \
@ -69,9 +75,22 @@ sources = \
${cxx11_abi_sources} \
${host_sources}
if ENABLE_DUAL_ABI
extra_string_inst_sources = \
cow-fstream-inst.cc \
cow-sstream-inst.cc \
cow-string-inst.cc \
cow-wstring-inst.cc \
cxx11-locale-inst.cc \
cxx11-wlocale-inst.cc
else
extra_string_inst_sources =
endif
if ENABLE_EXTERN_TEMPLATE
# XTEMPLATE_FLAGS = -fno-implicit-templates
inst_sources = \
$(extra_string_inst_sources) \
ext11-inst.cc \
fstream-inst.cc \
ios-inst.cc \

View File

@ -67,20 +67,28 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libc__11convenience_la_LIBADD =
@ENABLE_CXX11_ABI_TRUE@am__objects_1 = cxx11-ios_failure.lo
@ENABLE_DUAL_ABI_TRUE@am__objects_1 = cow-locale_init.lo \
@ENABLE_DUAL_ABI_TRUE@ cow-shim_facets.lo cxx11-hash_tr1.lo \
@ENABLE_DUAL_ABI_TRUE@ cxx11-ios_failure.lo \
@ENABLE_DUAL_ABI_TRUE@ cxx11-shim_facets.lo cxx11-stdexcept.lo
am__objects_2 = ctype_configure_char.lo ctype_members.lo
am__objects_3 = chrono.lo condition_variable.lo ctype.lo debug.lo \
functexcept.lo functional.lo future.lo hash_c++0x.lo \
hashtable_c++0x.lo ios.lo limits.lo mutex.lo placeholders.lo \
random.lo regex.lo shared_ptr.lo snprintf_lite.lo \
system_error.lo thread.lo $(am__objects_1) $(am__objects_2)
@ENABLE_EXTERN_TEMPLATE_TRUE@am__objects_4 = ext11-inst.lo \
@ENABLE_EXTERN_TEMPLATE_TRUE@ fstream-inst.lo ios-inst.lo \
@ENABLE_EXTERN_TEMPLATE_TRUE@ iostream-inst.lo istream-inst.lo \
@ENABLE_EXTERN_TEMPLATE_TRUE@ ostream-inst.lo sstream-inst.lo \
@ENABLE_EXTERN_TEMPLATE_TRUE@ streambuf-inst.lo string-inst.lo \
@ENABLE_EXTERN_TEMPLATE_TRUE@ wstring-inst.lo
am_libc__11convenience_la_OBJECTS = $(am__objects_3) $(am__objects_4)
am__objects_3 = chrono.lo condition_variable.lo cow-stdexcept.lo \
ctype.lo debug.lo functexcept.lo functional.lo future.lo \
hash_c++0x.lo hashtable_c++0x.lo ios.lo limits.lo mutex.lo \
placeholders.lo random.lo regex.lo shared_ptr.lo \
snprintf_lite.lo system_error.lo thread.lo $(am__objects_1) \
$(am__objects_2)
@ENABLE_DUAL_ABI_TRUE@am__objects_4 = cow-fstream-inst.lo \
@ENABLE_DUAL_ABI_TRUE@ cow-sstream-inst.lo cow-string-inst.lo \
@ENABLE_DUAL_ABI_TRUE@ cow-wstring-inst.lo cxx11-locale-inst.lo \
@ENABLE_DUAL_ABI_TRUE@ cxx11-wlocale-inst.lo
@ENABLE_EXTERN_TEMPLATE_TRUE@am__objects_5 = $(am__objects_4) \
@ENABLE_EXTERN_TEMPLATE_TRUE@ ext11-inst.lo fstream-inst.lo \
@ENABLE_EXTERN_TEMPLATE_TRUE@ ios-inst.lo iostream-inst.lo \
@ENABLE_EXTERN_TEMPLATE_TRUE@ istream-inst.lo ostream-inst.lo \
@ENABLE_EXTERN_TEMPLATE_TRUE@ sstream-inst.lo streambuf-inst.lo \
@ENABLE_EXTERN_TEMPLATE_TRUE@ string-inst.lo wstring-inst.lo
am_libc__11convenience_la_OBJECTS = $(am__objects_3) $(am__objects_5)
libc__11convenience_la_OBJECTS = $(am_libc__11convenience_la_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp =
@ -240,6 +248,7 @@ 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@
@ -323,13 +332,19 @@ host_sources = \
ctype_configure_char.cc \
ctype_members.cc
@ENABLE_CXX11_ABI_FALSE@cxx11_abi_sources =
@ENABLE_CXX11_ABI_TRUE@cxx11_abi_sources = \
@ENABLE_CXX11_ABI_TRUE@ cxx11-ios_failure.cc
@ENABLE_DUAL_ABI_FALSE@cxx11_abi_sources =
@ENABLE_DUAL_ABI_TRUE@cxx11_abi_sources = \
@ENABLE_DUAL_ABI_TRUE@ cow-locale_init.cc \
@ENABLE_DUAL_ABI_TRUE@ cow-shim_facets.cc \
@ENABLE_DUAL_ABI_TRUE@ cxx11-hash_tr1.cc \
@ENABLE_DUAL_ABI_TRUE@ cxx11-ios_failure.cc \
@ENABLE_DUAL_ABI_TRUE@ cxx11-shim_facets.cc \
@ENABLE_DUAL_ABI_TRUE@ cxx11-stdexcept.cc
sources = \
chrono.cc \
condition_variable.cc \
cow-stdexcept.cc \
ctype.cc \
debug.cc \
functexcept.cc \
@ -350,11 +365,21 @@ sources = \
${cxx11_abi_sources} \
${host_sources}
@ENABLE_DUAL_ABI_FALSE@extra_string_inst_sources =
@ENABLE_DUAL_ABI_TRUE@extra_string_inst_sources = \
@ENABLE_DUAL_ABI_TRUE@ cow-fstream-inst.cc \
@ENABLE_DUAL_ABI_TRUE@ cow-sstream-inst.cc \
@ENABLE_DUAL_ABI_TRUE@ cow-string-inst.cc \
@ENABLE_DUAL_ABI_TRUE@ cow-wstring-inst.cc \
@ENABLE_DUAL_ABI_TRUE@ cxx11-locale-inst.cc \
@ENABLE_DUAL_ABI_TRUE@ cxx11-wlocale-inst.cc
# XTEMPLATE_FLAGS =
@ENABLE_EXTERN_TEMPLATE_FALSE@inst_sources =
# XTEMPLATE_FLAGS = -fno-implicit-templates
@ENABLE_EXTERN_TEMPLATE_TRUE@inst_sources = \
@ENABLE_EXTERN_TEMPLATE_TRUE@ $(extra_string_inst_sources) \
@ENABLE_EXTERN_TEMPLATE_TRUE@ ext11-inst.cc \
@ENABLE_EXTERN_TEMPLATE_TRUE@ fstream-inst.cc \
@ENABLE_EXTERN_TEMPLATE_TRUE@ ios-inst.cc \

View File

@ -23,8 +23,18 @@
// <http://www.gnu.org/licenses/>.
#define _GLIBCXX_COMPATIBILITY_CXX0X
#define _GLIBCXX_USE_CXX11_ABI 0
#define error_category error_categoryxx
#define system_category system_categoryxx
#define generic_category generic_categoryxx
#define _V2 _V2xx
#include <string>
#include <system_error>
#include <cstring>
#undef error_category
#undef system_category
#undef generic_category
#undef _V2
#if __cplusplus < 201103L
# error "compatibility-c++0x.cc must be compiled with -std=gnu++0x"
@ -120,9 +130,125 @@ namespace std _GLIBCXX_VISIBILITY(default)
constexpr bool system_clock::is_monotonic;
} // namespace chrono
// gcc-5 replaces this with _V2::error_category
class error_category
{
public:
error_category() noexcept;
virtual ~error_category();
error_category(const error_category&) = delete;
error_category& operator=(const error_category&) = delete;
virtual const char*
name() const noexcept = 0;
virtual string
message(int) const = 0;
virtual error_condition
default_error_condition(int __i) const noexcept;
virtual bool
equivalent(int __i, const error_condition& __cond) const noexcept;
virtual bool
equivalent(const error_code& __code, int __i) const noexcept;
bool
operator<(const error_category& __other) const noexcept
{ return less<const error_category*>()(this, &__other); }
bool
operator==(const error_category& __other) const noexcept
{ return this == &__other; }
bool
operator!=(const error_category& __other) const noexcept
{ return this != &__other; }
};
// gcc-4.9.0
// LWG 2145 changes this constructor to constexpr i.e. inline
error_category::error_category() noexcept = default;
}
error_category::~error_category() noexcept = default;
namespace
{
using std::string;
struct generic_error_category : public std::error_category
{
virtual const char*
name() const noexcept
{ return "generic"; }
virtual string
message(int i) const
{
// XXX locale issues: how does one get or set loc.
// _GLIBCXX_HAVE_STRERROR_L, strerror_l(i, cloc)
return string(strerror(i));
}
};
struct system_error_category : public std::error_category
{
virtual const char*
name() const noexcept
{ return "system"; }
virtual string
message(int i) const
{
// XXX locale issues: how does one get or set loc.
// _GLIBCXX_HAVE_STRERROR_L, strerror_l(i, cloc)
return string(strerror(i));
}
};
const generic_error_category generic_category_instance{};
const system_error_category system_category_instance{};
}
const error_category&
system_category() noexcept { return system_category_instance; }
const error_category&
generic_category() noexcept { return generic_category_instance; }
namespace _V2
{
_GLIBCXX_CONST const error_categoryxx& system_category() noexcept;
_GLIBCXX_CONST const error_categoryxx& generic_category() noexcept;
}
error_condition
error_category::default_error_condition(int __i) const noexcept
{
if (*this == system_category())
return error_condition(__i, _V2::system_category());
return error_condition(__i, _V2::generic_category());
}
bool
error_category::equivalent(int __i,
const error_condition& __cond) const noexcept
{ return default_error_condition(__i) == __cond; }
bool
error_category::equivalent(const error_code& __code, int __i) const noexcept
{
if (*this == system_category()
&& __code.category() == _V2::system_category())
return __code.value() == __i;
if (*this == generic_category()
&& __code.category() == _V2::generic_category())
return __code.value() == __i;
return false;
}
}
#endif

View File

@ -0,0 +1,78 @@
// Explicit instantiation file.
// Copyright (C) 2014 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
//
// ISO C++ 14882:
//
#define _GLIBCXX_USE_CXX11_ABI 0
#include <fstream>
#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
template basic_filebuf<char>*
basic_filebuf<char>::open(const std::string&, ios_base::openmode);
template
basic_ifstream<char>::
basic_ifstream(const std::string&, ios_base::openmode);
template void
basic_ifstream<char>::open(const std::string&, ios_base::openmode);
template
basic_ofstream<char>::
basic_ofstream(const std::string&, ios_base::openmode);
template void
basic_ofstream<char>::open(const std::string&, ios_base::openmode);
template
basic_fstream<char>::basic_fstream(const std::string&, ios_base::openmode);
template void
basic_fstream<char>::open(const std::string&, ios_base::openmode);
#ifdef _GLIBCXX_USE_WCHAR_T
template basic_filebuf<wchar_t>*
basic_filebuf<wchar_t>::open(const std::string&, ios_base::openmode);
template
basic_ifstream<wchar_t>::
basic_ifstream(const std::string&, ios_base::openmode);
template void
basic_ifstream<wchar_t>::open(const std::string&, ios_base::openmode);
template
basic_ofstream<wchar_t>::
basic_ofstream(const std::string&, ios_base::openmode);
template void
basic_ofstream<wchar_t>::open(const std::string&, ios_base::openmode);
template
basic_fstream<wchar_t>::
basic_fstream(const std::string&, ios_base::openmode);
template void
basic_fstream<wchar_t>::open(const std::string&, ios_base::openmode);
#endif
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace

View File

@ -0,0 +1,194 @@
// Copyright (C) 2014 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Instantiate the facets using old std::string ABI.
#define _GLIBCXX_USE_CXX11_ABI 0
#include <locale>
#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
namespace
{
typedef char fake_collate_c[sizeof(std::collate<char>)]
__attribute__ ((aligned(__alignof__(std::collate<char>))));
fake_collate_c collate_c;
typedef char fake_numpunct_c[sizeof(numpunct<char>)]
__attribute__ ((aligned(__alignof__(numpunct<char>))));
fake_numpunct_c numpunct_c;
typedef char fake_moneypunct_c[sizeof(moneypunct<char, true>)]
__attribute__ ((aligned(__alignof__(moneypunct<char, true>))));
fake_moneypunct_c moneypunct_ct;
fake_moneypunct_c moneypunct_cf;
typedef char fake_money_get_c[sizeof(money_get<char>)]
__attribute__ ((aligned(__alignof__(money_get<char>))));
fake_money_get_c money_get_c;
typedef char fake_money_put_c[sizeof(money_put<char>)]
__attribute__ ((aligned(__alignof__(money_put<char>))));
fake_money_put_c money_put_c;
typedef char fake_time_get_c[sizeof(time_get<char>)]
__attribute__ ((aligned(__alignof__(time_get<char>))));
fake_time_get_c time_get_c;
typedef char fake_messages_c[sizeof(messages<char>)]
__attribute__ ((aligned(__alignof__(messages<char>))));
fake_messages_c messages_c;
#ifdef _GLIBCXX_USE_WCHAR_T
typedef char fake_wollate_w[sizeof(std::collate<wchar_t>)]
__attribute__ ((aligned(__alignof__(std::collate<wchar_t>))));
fake_wollate_w collate_w;
typedef char fake_numpunct_w[sizeof(numpunct<wchar_t>)]
__attribute__ ((aligned(__alignof__(numpunct<wchar_t>))));
fake_numpunct_w numpunct_w;
typedef char fake_moneypunct_w[sizeof(moneypunct<wchar_t, true>)]
__attribute__ ((aligned(__alignof__(moneypunct<wchar_t, true>))));
fake_moneypunct_w moneypunct_wt;
fake_moneypunct_w moneypunct_wf;
typedef char fake_money_get_w[sizeof(money_get<wchar_t>)]
__attribute__ ((aligned(__alignof__(money_get<wchar_t>))));
fake_money_get_w money_get_w;
typedef char fake_money_put_w[sizeof(money_put<wchar_t>)]
__attribute__ ((aligned(__alignof__(money_put<wchar_t>))));
fake_money_put_w money_put_w;
typedef char fake_time_get_w[sizeof(time_get<wchar_t>)]
__attribute__ ((aligned(__alignof__(time_get<wchar_t>))));
fake_time_get_w time_get_w;
typedef char fake_messages_w[sizeof(messages<wchar_t>)]
__attribute__ ((aligned(__alignof__(messages<wchar_t>))));
fake_messages_w messages_w;
#endif
} // anonymous namespace
void
locale::_Impl::_M_init_extra(facet** caches)
{
auto __npc = static_cast<__numpunct_cache<char>*>(caches[0]);
auto __mpcf = static_cast<__moneypunct_cache<char, false>*>(caches[1]);
auto __mpct = static_cast<__moneypunct_cache<char, true>*>(caches[2]);
_M_init_facet_unchecked(new (&numpunct_c) numpunct<char>(__npc, 1));
_M_init_facet_unchecked(new (&collate_c) std::collate<char>(1));
_M_init_facet_unchecked(new (&moneypunct_cf) moneypunct<char, false>(__mpcf, 1));
_M_init_facet_unchecked(new (&moneypunct_ct) moneypunct<char, true>(__mpct, 1));
_M_init_facet_unchecked(new (&money_get_c) money_get<char>(1));
_M_init_facet_unchecked(new (&money_put_c) money_put<char>(1));
_M_init_facet_unchecked(new (&time_get_c) time_get<char>(1));
_M_init_facet_unchecked(new (&messages_c) std::messages<char>(1));
#ifdef _GLIBCXX_USE_WCHAR_T
auto __npw = static_cast<__numpunct_cache<wchar_t>*>(caches[3]);
auto __mpwf = static_cast<__moneypunct_cache<wchar_t, false>*>(caches[4]);
auto __mpwt = static_cast<__moneypunct_cache<wchar_t, true>*>(caches[5]);
_M_init_facet_unchecked(new (&numpunct_w) numpunct<wchar_t>(__npw, 1));
_M_init_facet_unchecked(new (&collate_w) std::collate<wchar_t>(1));
_M_init_facet_unchecked(new (&moneypunct_wf) moneypunct<wchar_t, false>(__mpwf, 1));
_M_init_facet_unchecked(new (&moneypunct_wt) moneypunct<wchar_t, true>(__mpwt, 1));
_M_init_facet_unchecked(new (&money_get_w) money_get<wchar_t>(1));
_M_init_facet_unchecked(new (&money_put_w) money_put<wchar_t>(1));
_M_init_facet_unchecked(new (&time_get_w) time_get<wchar_t>(1));
_M_init_facet_unchecked(new (&messages_w) std::messages<wchar_t>(1));
#endif
_M_caches[numpunct<char>::id._M_id()] = __npc;
_M_caches[moneypunct<char, false>::id._M_id()] = __mpcf;
_M_caches[moneypunct<char, true>::id._M_id()] = __mpct;
#ifdef _GLIBCXX_USE_WCHAR_T
_M_caches[numpunct<wchar_t>::id._M_id()] = __npw;
_M_caches[moneypunct<wchar_t, false>::id._M_id()] = __mpwf;
_M_caches[moneypunct<wchar_t, true>::id._M_id()] = __mpwt;
#endif
}
void
locale::_Impl::_M_init_extra(void* cloc, void* clocm,
const char* __s, const char* __smon)
{
auto& __cloc = *static_cast<__c_locale*>(cloc);
_M_init_facet_unchecked(new numpunct<char>(__cloc));
_M_init_facet_unchecked(new std::collate<char>(__cloc));
_M_init_facet_unchecked(new moneypunct<char, false>(__cloc, 0));
_M_init_facet_unchecked(new moneypunct<char, true>(__cloc, 0));
_M_init_facet_unchecked(new money_get<char>);
_M_init_facet_unchecked(new money_put<char>);
_M_init_facet_unchecked(new time_get<char>);
_M_init_facet_unchecked(new std::messages<char>(__cloc, __s));
#ifdef _GLIBCXX_USE_WCHAR_T
auto& __clocm = *static_cast<__c_locale*>(clocm);
_M_init_facet_unchecked(new numpunct<wchar_t>(__cloc));
_M_init_facet_unchecked(new std::collate<wchar_t>(__cloc));
_M_init_facet_unchecked(new moneypunct<wchar_t, false>(__clocm, __smon));
_M_init_facet_unchecked(new moneypunct<wchar_t, true>(__clocm, __smon));
_M_init_facet_unchecked(new money_get<wchar_t>);
_M_init_facet_unchecked(new money_put<wchar_t>);
_M_init_facet_unchecked(new time_get<wchar_t>);
_M_init_facet_unchecked(new std::messages<wchar_t>(__cloc, __s));
#endif
}
// TODO should be in another file
string
locale::name() const
{
string __ret;
if (!_M_impl->_M_names[0])
__ret = '*';
else if (_M_impl->_M_check_same_name())
__ret = _M_impl->_M_names[0];
else
{
__ret.reserve(128);
__ret += _S_categories[0];
__ret += '=';
__ret += _M_impl->_M_names[0];
for (size_t __i = 1; __i < _S_categories_size; ++__i)
{
__ret += ';';
__ret += _S_categories[__i];
__ret += '=';
__ret += _M_impl->_M_names[__i];
}
}
return __ret;
}
_GLIBCXX_END_NAMESPACE_VERSION
}

View File

@ -0,0 +1,35 @@
// Locale support -*- C++ -*-
// Copyright (C) 2014 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/locale_classes.tcc
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{locale}
*/
//
// ISO C++ 14882: 22.1 Locales
//
#define _GLIBCXX_USE_CXX11_ABI 0
#include "cxx11-shim_facets.cc"

View File

@ -0,0 +1,34 @@
// Explicit instantiation file.
// Copyright (C) 2014 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
//
// ISO C++ 14882:
//
#define _GLIBCXX_USE_CXX11_ABI 0
#include "sstream-inst.cc"
#if ! _GLIBCXX_USE_DUAL_ABI
# error This file should not be compiled for this configuration.
#endif

View File

@ -0,0 +1,153 @@
// Methods for Exception Support for -*- C++ -*-
// Copyright (C) 2014 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
//
// ISO C++ 14882: 19.1 Exception classes
//
// All exception classes still use the classic COW std::string.
#define _GLIBCXX_USE_CXX11_ABI 0
#define _GLIBCXX_DEFINE_STDEXCEPT_COPY_OPS 1
#define __cow_string __cow_stringxxx
#include <stdexcept>
#include <system_error>
#undef __cow_string
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Copy constructors and assignment operators defined using COW std::string
logic_error::logic_error(const logic_error& e) noexcept
: _M_msg(e._M_msg) { }
logic_error& logic_error::operator=(const logic_error& e) noexcept
{ _M_msg = e._M_msg; return *this; }
runtime_error::runtime_error(const runtime_error& e) noexcept
: _M_msg(e._M_msg) { }
runtime_error&
runtime_error::operator=(const runtime_error& e) noexcept
{ _M_msg = e._M_msg; return *this; }
// New C++11 constructors:
logic_error::logic_error(const char* __arg)
: exception(), _M_msg(__arg) { }
domain_error::domain_error(const char* __arg)
: logic_error(__arg) { }
invalid_argument::invalid_argument(const char* __arg)
: logic_error(__arg) { }
length_error::length_error(const char* __arg)
: logic_error(__arg) { }
out_of_range::out_of_range(const char* __arg)
: logic_error(__arg) { }
runtime_error::runtime_error(const char* __arg)
: exception(), _M_msg(__arg) { }
range_error::range_error(const char* __arg)
: runtime_error(__arg) { }
overflow_error::overflow_error(const char* __arg)
: runtime_error(__arg) { }
underflow_error::underflow_error(const char* __arg)
: runtime_error(__arg) { }
#if _GLIBCXX_USE_DUAL_ABI
// Converting constructor from COW std::string to SSO string.
__sso_string::__sso_string(const string& s)
: __sso_string(s.c_str(), s.length()) { }
// Redefine __cow_string so that we can define and export its members
// in terms of the COW std::string.
struct __cow_string
{
union {
const char* _M_p;
char _M_bytes[sizeof(_M_p)];
std::string _M_str;
};
__cow_string();
__cow_string(const std::string& s);
__cow_string(const char*, size_t n);
__cow_string(const __cow_string&) noexcept;
__cow_string& operator=(const __cow_string&) noexcept;
~__cow_string();
__cow_string(__cow_string&&) noexcept;
__cow_string& operator=(__cow_string&&) noexcept;
};
__cow_string::__cow_string() : _M_str() { }
__cow_string::__cow_string(const std::string& s) : _M_str(s) { }
__cow_string::__cow_string(const char* s, size_t n) : _M_str(s, n) { }
__cow_string::__cow_string(const __cow_string& s) noexcept
: _M_str(s._M_str) { }
__cow_string&
__cow_string::operator=(const __cow_string& s) noexcept
{
_M_str = s._M_str;
return *this;
}
__cow_string::~__cow_string() { _M_str.~basic_string(); }
__cow_string::__cow_string(__cow_string&& s) noexcept
: _M_str(std::move(s._M_str)) { }
__cow_string&
__cow_string::operator=(__cow_string&& s) noexcept
{
_M_str = std::move(s._M_str);
return *this;
}
static_assert(sizeof(__cow_string) == sizeof(std::string),
"sizeof(std::string) has changed");
static_assert(alignof(__cow_string) == alignof(std::string),
"alignof(std::string) has changed");
#endif
// Return error_category::message() as an SSO string
__sso_string
error_category::_M_message(int i) const
{
string msg = this->message(i);
return {msg.c_str(), msg.length()};
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace

View File

@ -0,0 +1,120 @@
// Reference-counted COW string instantiations -*- C++ -*-
// Copyright (C) 2014 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
//
// ISO C++ 14882: 21 Strings library
//
#define _GLIBCXX_USE_CXX11_ABI 0
#include "string-inst.cc"
#include <istream>
#include <ostream>
#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<char>&
operator>>(basic_istream<char>&, string&);
template
basic_ostream<char>&
operator<<(basic_ostream<char>&, const string&);
template
basic_istream<char>&
getline(basic_istream<char>&, string&, char);
template
basic_istream<char>&
getline(basic_istream<char>&, string&);
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
#include <random>
#if defined __i386__ || defined __x86_64__
# include <cpuid.h>
#endif
#include <cstdio>
namespace std _GLIBCXX_VISIBILITY(default)
{
void
random_device::_M_init(const std::string& token)
{
const char *fname = token.c_str();
if (token == "default")
{
#if (defined __i386__ || defined __x86_64__) && defined _GLIBCXX_X86_RDRAND
unsigned int eax, ebx, ecx, edx;
// Check availability of cpuid and, for now at least, also the
// CPU signature for Intel's
if (__get_cpuid_max(0, &ebx) > 0 && ebx == signature_INTEL_ebx)
{
__cpuid(1, eax, ebx, ecx, edx);
if (ecx & bit_RDRND)
{
_M_file = nullptr;
return;
}
}
#endif
fname = "/dev/urandom";
}
else if (token != "/dev/urandom" && token != "/dev/random")
fail:
std::__throw_runtime_error(__N("random_device::"
"random_device(const std::string&)"));
_M_file = static_cast<void*>(std::fopen(fname, "rb"));
if (!_M_file)
goto fail;
}
void
random_device::_M_init_pretr1(const std::string& token)
{
unsigned long __seed = 5489UL;
if (token != "mt19937")
{
const char* __nptr = token.c_str();
char* __endptr;
__seed = std::strtoul(__nptr, &__endptr, 0);
if (*__nptr == '\0' || *__endptr != '\0')
std::__throw_runtime_error(__N("random_device::random_device"
"(const std::string&)"));
}
_M_mt.seed(__seed);
}
} // namespace
#endif

View File

@ -0,0 +1,64 @@
// Reference-counted COW wide string instantiations -*- C++ -*-
// Copyright (C) 2014 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
//
// ISO C++ 14882: 21 Strings library
//
#define _GLIBCXX_USE_CXX11_ABI 0
#include <bits/c++config.h>
#ifdef _GLIBCXX_USE_WCHAR_T
#define C wchar_t
#include "string-inst.cc"
#include <ostream>
#include <istream>
#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<wchar_t>&
operator>>(basic_istream<wchar_t>&, wstring&);
template
basic_ostream<wchar_t>&
operator<<(basic_ostream<wchar_t>&, const wstring&);
template
basic_istream<wchar_t>&
getline(basic_istream<wchar_t>&, wstring&, wchar_t);
template
basic_istream<wchar_t>&
getline(basic_istream<wchar_t>&, wstring&);
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif

View File

@ -0,0 +1,59 @@
// std::tr1::hash definitions with new string -*- C++ -*-
// Copyright (C) 2014 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
#define _GLIBCXX_USE_CXX11_ABI 1
#include <string>
#if ! _GLIBCXX_USE_DUAL_ABI
# error This file should not be compiled for this configuration.
#endif
#include <tr1/functional>
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace tr1
{
template<>
size_t
hash<string>::operator()(string __s) const
{ return _Fnv_hash::hash(__s.data(), __s.length()); }
template<>
size_t
hash<const string&>::operator()(const string& __s) const
{ return _Fnv_hash::hash(__s.data(), __s.length()); }
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
size_t
hash<wstring>::operator()(wstring __s) const
{ return _Fnv_hash::hash(__s.data(), __s.length() * sizeof(wchar_t)); }
template<>
size_t
hash<const wstring&>::operator()(const wstring& __s) const
{ return _Fnv_hash::hash(__s.data(), __s.length() * sizeof(wchar_t)); }
#endif
}
}

View File

@ -26,8 +26,13 @@
// ISO C++ 14882:2011: 27.5.3.1.1 Class ios_base::failure
//
#define _GLIBCXX_USE_CXX11_ABI 1
#include <ios>
#if ! _GLIBCXX_USE_DUAL_ABI
# error This file should not be compiled for this configuration.
#endif
namespace
{
struct io_error_category : std::error_category

View File

@ -0,0 +1,39 @@
// Copyright (C) 2014 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
//
// ISO C++ 14882: 22.1 Locales
//
// Facet instantiations using new ABI strings.
#define _GLIBCXX_USE_CXX11_ABI 1
#include <bits/c++config.h>
#if ! _GLIBCXX_USE_DUAL_ABI
# error This file should not be compiled for this configuration.
#endif
#ifndef C
# define C char
# define C_is_char
#endif
# include "../c++98/locale-inst.cc"

View File

@ -0,0 +1,813 @@
// Locale support -*- C++ -*-
// Copyright (C) 2014 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
//
// ISO C++ 14882: 22.1 Locales
//
// This file defines classes that behave like the standard predefined locale
// facets (collate, money_get etc.) except that they forward all virtual
// functions to another facet which uses a different std::string ABI,
// converting between string types as needed.
// When a user replaces one of the relevant facets the corresponding shim in
// this file is used so that the replacement facet can be used (via the shim)
// in code that uses the other std::string ABI from the replacing code.
#ifndef _GLIBCXX_USE_CXX11_ABI
# define _GLIBCXX_USE_CXX11_ABI 1
#endif
#include <locale>
#if ! _GLIBCXX_USE_DUAL_ABI
# error This file should not be compiled for this configuration.
#endif
namespace std _GLIBCXX_VISIBILITY(default)
{
// Base class of facet shims, holds a reference to the underlying facet
// that the shim forwards to.
class locale::facet::__shim
{
public:
const facet* _M_get() const { return _M_facet; }
__shim(const __shim&) = delete;
__shim& operator=(const __shim&) = delete;
protected:
explicit
__shim(const facet* __f) : _M_facet(__f) { __f->_M_add_reference(); }
~__shim() { _M_facet->_M_remove_reference(); }
private:
const facet* _M_facet;
};
namespace __facet_shims
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace // unnamed
{
template<typename C>
void __destroy_string(void* p)
{
static_cast<std::basic_string<C>*>(p)->~basic_string();
}
} // namespace
// Manages a buffer of uninitialized memory that can store a std::string
// or std::wstring, using either ABI, and convert to the other ABI.
class __any_string
{
struct __attribute__((may_alias)) __str_rep
{
union {
const void* _M_p;
char* _M_pc;
wchar_t* _M_pwc;
};
size_t _M_len;
char _M_unused[16];
operator const char*() const { return _M_pc; }
operator const wchar_t*() const { return _M_pwc; }
};
union {
__str_rep _M_str;
char _M_bytes[sizeof(__str_rep)];
};
using __dtor_func = void(*)(void*);
__dtor_func _M_dtor = nullptr;
#if _GLIBCXX_USE_CXX11_ABI
// SSO strings overlay the entire __str_rep structure.
static_assert(sizeof(std::string) == sizeof(__str_rep),
"std::string changed size!");
#else
// COW strings overlay just the pointer, the length is stored manually.
static_assert(sizeof(std::string) == sizeof(__str_rep::_M_p),
"std::string changed size!");
#endif
# ifdef _GLIBCXX_USE_WCHAR_T
static_assert(sizeof(std::wstring) == sizeof(std::string),
"std::wstring and std::string are different sizes!");
# endif
public:
__any_string() = default;
~__any_string() { if (_M_dtor) _M_dtor(_M_bytes); }
__any_string(const __any_string&) = delete;
__any_string& operator=(const __any_string&) = delete;
// Store a string (and its length if needed) in the buffer and
// set _M_dtor to the function that runs the right destructor.
template<typename C>
__any_string&
operator=(const basic_string<C>& s)
{
if (_M_dtor)
_M_dtor(_M_bytes);
::new(_M_bytes) basic_string<C>(s);
#if ! _GLIBCXX_USE_CXX11_ABI
_M_str._M_len = s.length();
#endif
_M_dtor = __destroy_string<C>;
return *this;
}
// Create a new string with a copy of the characters in the stored string.
// The returned object will match the caller's string ABI, even when the
// stored string doesn't.
template<typename C>
operator basic_string<C>() const
{
if (!_M_dtor)
__throw_logic_error("uninitialized __any_string");
return basic_string<C>(static_cast<const C*>(_M_str), _M_str._M_len);
}
};
// This file is compiled twice, with and without this macro defined.
// Define tag types to distinguish between the two cases and to allow
// overloading on the tag.
using current_abi = __bool_constant<_GLIBCXX_USE_CXX11_ABI>;
using other_abi = __bool_constant<!_GLIBCXX_USE_CXX11_ABI>;
using facet = locale::facet;
// Declare the functions that shims defined in this file will call to
// perform work in the context of the other ABI.
// These will be defined when this file is recompiled for the other ABI
// (at which point what is now "current_abi" will become "other_abi").
template<typename C>
void
__numpunct_fill_cache(other_abi, const facet*, __numpunct_cache<C>*,
const char*&, size_t&);
template<typename C>
int
__collate_compare(other_abi, const facet*, const C*, const C*,
const C*, const C*);
template<typename C>
void
__collate_transform(other_abi, const facet*, __any_string&,
const C*, const C*);
template<typename C>
time_base::dateorder
__time_get_dateorder(other_abi, const facet* f);
template<typename C>
istreambuf_iterator<C>
__time_get(other_abi, const facet* f,
istreambuf_iterator<C> beg, istreambuf_iterator<C> end,
ios_base& io, ios_base::iostate& err, tm* t, char which);
template<typename C, bool Intl>
void
__moneypunct_fill_cache(other_abi, const facet*,
__moneypunct_cache<C, Intl>*);
template<typename C>
istreambuf_iterator<C>
__money_get(other_abi, const facet*,
istreambuf_iterator<C>, istreambuf_iterator<C>,
bool, ios_base&, ios_base::iostate&,
long double*, __any_string*);
template<typename C>
ostreambuf_iterator<C>
__money_put(other_abi, const facet*, ostreambuf_iterator<C>, bool,
ios_base&, C, long double, const __any_string*);
template<typename C>
messages_base::catalog
__messages_open(other_abi, const facet*, const char*, size_t,
const locale&);
template<typename C>
void
__messages_get(other_abi, const facet*, __any_string&,
messages_base::catalog, int, int, const C*, size_t);
template<typename C>
void
__messages_close(other_abi, const facet*, messages_base::catalog);
namespace // unnamed
{
template<typename _CharT>
struct numpunct_shim : std::numpunct<_CharT>, facet::__shim
{
typedef typename numpunct<_CharT>::__cache_type __cache_type;
// f must point to a type derived from numpunct<C>[abi:other]
numpunct_shim(const facet* f, __cache_type* c = new __cache_type)
: std::numpunct<_CharT>(c), __shim(f), _M_cache(c)
{
__numpunct_fill_cache(other_abi{}, f, c, _M_grouping,
_M_grouping_size);
}
~numpunct_shim() { delete[] _M_grouping; }
virtual string
do_grouping() const
{ return string(_M_grouping, _M_grouping_size); }
// No need to override other virtual functions, the base definitions
// will return the cached data.
__cache_type* _M_cache;
// numpunct uses __numpunct_cache<C>::_M_grouping for its own purposes
// so we can't store that in the cache
const char* _M_grouping;
size_t _M_grouping_size;
};
template class numpunct_shim<char>;
template class numpunct_shim<wchar_t>;
template<typename _CharT>
struct collate_shim : std::collate<_CharT>, facet::__shim
{
typedef basic_string<_CharT> string_type;
// f must point to a type derived from collate<C>[abi:other]
collate_shim(const facet* f) : __shim(f) { }
virtual int
do_compare(const _CharT* lo1, const _CharT* hi1,
const _CharT* lo2, const _CharT* hi2) const
{
return __collate_compare(other_abi{}, _M_get(),
lo1, hi1, lo2, hi2);
}
virtual string_type
do_transform(const _CharT* lo, const _CharT* hi) const
{
__any_string st;
__collate_transform(other_abi{}, _M_get(), st, lo, hi);
return st;
}
};
template class collate_shim<char>;
template class collate_shim<wchar_t>;
template<typename _CharT>
struct time_get_shim : std::time_get<_CharT>, facet::__shim
{
typedef typename std::time_get<_CharT>::iter_type iter_type;
typedef typename std::time_get<_CharT>::char_type char_type;
// f must point to a type derived from time_get<C>[abi:other]
time_get_shim(const facet* f) : __shim(f) { }
virtual time_base::dateorder
do_date_order() const
{ return __time_get_dateorder<_CharT>(other_abi{}, _M_get()); }
virtual iter_type
do_get_time(iter_type beg, iter_type end, ios_base& io,
ios_base::iostate& err, tm* t) const
{
return __time_get(other_abi{}, _M_get(), beg, end, io, err, t,
't');
}
virtual iter_type
do_get_date(iter_type beg, iter_type end, ios_base& io,
ios_base::iostate& err, tm* t) const
{
return __time_get(other_abi{}, _M_get(), beg, end, io, err, t,
'd');
}
virtual iter_type
do_get_weekday(iter_type beg, iter_type end, ios_base& io,
ios_base::iostate& err, tm* t) const
{
return __time_get(other_abi{}, _M_get(), beg, end, io, err, t,
'w');
}
virtual iter_type
do_get_monthname(iter_type beg, iter_type end, ios_base& io,
ios_base::iostate& err, tm* t) const
{
return __time_get(other_abi{}, _M_get(), beg, end, io, err, t,
'm');
}
virtual iter_type
do_get_year(iter_type beg, iter_type end, ios_base& io,
ios_base::iostate& err, tm* t) const
{
return __time_get(other_abi{}, _M_get(), beg, end, io, err, t,
'y');
}
};
template<typename _CharT, bool _Intl>
struct moneypunct_shim : std::moneypunct<_CharT, _Intl>, facet::__shim
{
typedef typename moneypunct<_CharT, _Intl>::__cache_type __cache_type;
// f must point to a type derived from moneypunct<C>[abi:other]
moneypunct_shim(const facet* f, __cache_type* c = new __cache_type)
: std::moneypunct<_CharT, _Intl>(c), __shim(f), _M_cache(c)
{
__moneypunct_fill_cache(other_abi{}, f, c);
}
~moneypunct_shim()
{
// stop GNU locale's ~moneypunct() from freeing these strings
_M_cache->_M_grouping_size = 0;
_M_cache->_M_curr_symbol_size = 0;
_M_cache->_M_positive_sign_size = 0;
_M_cache->_M_negative_sign_size = 0;
}
// No need to override any virtual functions, the base definitions
// will return the cached data.
__cache_type* _M_cache;
};
template class moneypunct_shim<char, true>;
template class moneypunct_shim<char, false>;
template class moneypunct_shim<wchar_t, true>;
template class moneypunct_shim<wchar_t, false>;
template<typename _CharT>
struct money_get_shim : std::money_get<_CharT>, facet::__shim
{
typedef typename std::money_get<_CharT>::iter_type iter_type;
typedef typename std::money_get<_CharT>::char_type char_type;
typedef typename std::money_get<_CharT>::string_type string_type;
// f must point to a type derived from money_get<C>[abi:other]
money_get_shim(const facet* f) : __shim(f) { }
virtual iter_type
do_get(iter_type s, iter_type end, bool intl, ios_base& io,
ios_base::iostate& err, long double& units) const
{
ios_base::iostate err2 = ios_base::goodbit;
long double units2;
s = __money_get(other_abi{}, _M_get(), s, end, intl, io, err2,
&units2, nullptr);
if (err2 == ios_base::goodbit)
units = units2;
else
err = err2;
return s;
}
virtual iter_type
do_get(iter_type s, iter_type end, bool intl, ios_base& io,
ios_base::iostate& err, string_type& digits) const
{
__any_string st;
ios_base::iostate err2 = ios_base::goodbit;
s = __money_get(other_abi{}, _M_get(), s, end, intl, io, err2,
nullptr, &st);
if (err2 == ios_base::goodbit)
digits = st;
else
err = err2;
return s;
}
};
template class money_get_shim<char>;
template class money_get_shim<wchar_t>;
template<typename _CharT>
struct money_put_shim : std::money_put<_CharT>, facet::__shim
{
typedef typename std::money_put<_CharT>::iter_type iter_type;
typedef typename std::money_put<_CharT>::char_type char_type;
typedef typename std::money_put<_CharT>::string_type string_type;
// f must point to a type derived from money_put<C>[abi:other]
money_put_shim(const facet* f) : __shim(f) { }
virtual iter_type
do_put(iter_type s, bool intl, ios_base& io,
char_type fill, long double units) const
{
return __money_put(other_abi{}, _M_get(), s, intl, io, fill, units,
nullptr);
}
virtual iter_type
do_put(iter_type s, bool intl, ios_base& io,
char_type fill, const string_type& digits) const
{
__any_string st;
st = digits;
return __money_put(other_abi{}, _M_get(), s, intl, io, fill, 0.L,
&st);
}
};
template class money_put_shim<char>;
template class money_put_shim<wchar_t>;
template<typename _CharT>
struct messages_shim : std::messages<_CharT>, facet::__shim
{
typedef messages_base::catalog catalog;
typedef basic_string<_CharT> string_type;
// f must point to a type derived from messages<C>[abi:other]
messages_shim(const facet* f) : __shim(f) { }
virtual catalog
do_open(const basic_string<char>& s, const locale& l) const
{
return __messages_open<_CharT>(other_abi{}, _M_get(),
s.c_str(), s.size(), l);
}
virtual string_type
do_get(catalog c, int set, int msgid, const string_type& dfault) const
{
__any_string st;
__messages_get(other_abi{}, _M_get(), st, c, set, msgid,
dfault.c_str(), dfault.size());
return st;
}
virtual void
do_close(catalog c) const
{
__messages_close<_CharT>(other_abi{}, _M_get(), c);
}
};
template class messages_shim<char>;
template class messages_shim<wchar_t>;
template<typename C>
inline size_t
__copy(const C*& dest, const basic_string<C>& s)
{
auto len = s.length();
C* p = new C[len+1];
s.copy(p, len);
p[len] = '\0';
dest = p;
return len;
}
} // namespace
// Now define and instantiate the functions that will be called by the
// shim facets defined when this file is recompiled for the other ABI.
template<typename C>
void
__numpunct_fill_cache(current_abi, const facet* f, __numpunct_cache<C>* c,
const char*& grouping, size_t& grouping_size)
{
auto* m = static_cast<const numpunct<C>*>(f);
c->_M_decimal_point = m->decimal_point();
c->_M_thousands_sep = m->thousands_sep();
c->_M_truename = nullptr;
c->_M_falsename = nullptr;
// set _M_allocated so that if any allocation fails the previously
// allocated strings will be deleted in ~__numpunct_c()
c->_M_allocated = true;
c->_M_truename_size = __copy(c->_M_truename, m->truename());
c->_M_falsename_size = __copy(c->_M_falsename, m->falsename());
// Set grouping last as it is only deleted by ~numpunct_shim() which
// won't run if this function throws an exception.
grouping_size = __copy(grouping, m->grouping());
}
template void
__numpunct_fill_cache(current_abi, const facet*, __numpunct_cache<char>*,
const char*&, size_t&);
template void
__numpunct_fill_cache(current_abi, const facet*, __numpunct_cache<wchar_t>*,
const char*&, size_t&);
template<typename C>
int
__collate_compare(current_abi, const facet* f, const C* lo1, const C* hi1,
const C* lo2, const C* hi2)
{
return static_cast<const collate<C>*>(f)->compare(lo1, hi1, lo2, hi2);
}
template int
__collate_compare(current_abi, const facet*, const char*, const char*,
const char*, const char*);
template int
__collate_compare(current_abi, const facet*, const wchar_t*, const wchar_t*,
const wchar_t*, const wchar_t*);
template<typename C>
void
__collate_transform(current_abi, const facet* f, __any_string& st,
const C* __lo, const C* __hi)
{
auto* c = static_cast<const collate<C>*>(f);
st = c->transform(__lo, __hi);
}
template void
__collate_transform(current_abi, const facet*, __any_string&,
const char*, const char*);
template void
__collate_transform(current_abi, const facet*, __any_string&,
const wchar_t*, const wchar_t*);
template<typename C, bool Intl>
void
__moneypunct_fill_cache(current_abi, const facet* f,
__moneypunct_cache<C, Intl>* c)
{
auto* m = static_cast<const moneypunct<C, Intl>*>(f);
c->_M_decimal_point = m->decimal_point();
c->_M_thousands_sep = m->thousands_sep();
c->_M_frac_digits = m->frac_digits();
c->_M_grouping = nullptr;
c->_M_curr_symbol = nullptr;
c->_M_positive_sign = nullptr;
c->_M_negative_sign = nullptr;
// set _M_allocated so that if any allocation fails the previously
// allocated strings will be deleted in ~__moneypunct_c()
c->_M_allocated = true;
c->_M_grouping_size = __copy(c->_M_grouping, m->grouping());
c->_M_curr_symbol_size = __copy(c->_M_curr_symbol, m->curr_symbol());
c->_M_positive_sign_size
= __copy(c->_M_positive_sign, m->positive_sign());
c->_M_negative_sign_size
= __copy(c->_M_negative_sign, m->negative_sign());
c->_M_pos_format = m->pos_format();
c->_M_neg_format = m->neg_format();
}
template void
__moneypunct_fill_cache(current_abi, const facet*,
__moneypunct_cache<char, true>*);
template void
__moneypunct_fill_cache(current_abi, const facet*,
__moneypunct_cache<char, false>*);
template void
__moneypunct_fill_cache(current_abi, const facet*,
__moneypunct_cache<wchar_t, true>*);
template void
__moneypunct_fill_cache(current_abi, const facet*,
__moneypunct_cache<wchar_t, false>*);
template<typename C>
messages_base::catalog
__messages_open(current_abi, const facet* f, const char* s, size_t n,
const locale& l)
{
auto* m = static_cast<const messages<C>*>(f);
string str(s, n);
return m->open(str, l);
}
template messages_base::catalog
__messages_open<char>(current_abi, const facet*, const char*, size_t,
const locale&);
template messages_base::catalog
__messages_open<wchar_t>(current_abi, const facet*, const char*, size_t,
const locale&);
template<typename C>
void
__messages_get(current_abi, const facet* f, __any_string& st,
messages_base::catalog c, int set, int msgid,
const C* s, size_t n)
{
auto* m = static_cast<const messages<C>*>(f);
st = m->get(c, set, msgid, basic_string<C>(s, n));
}
template void
__messages_get(current_abi, const facet*, __any_string&,
messages_base::catalog, int, int, const char*, size_t);
template void
__messages_get(current_abi, const facet*, __any_string&,
messages_base::catalog, int, int, const wchar_t*, size_t);
template<typename C>
void
__messages_close(current_abi, const facet* f, messages_base::catalog c)
{
static_cast<const messages<C>*>(f)->close(c);
}
template void
__messages_close<char>(current_abi, const facet*, messages_base::catalog c);
template void
__messages_close<wchar_t>(current_abi, const facet*,
messages_base::catalog c);
template<typename C>
time_base::dateorder
__time_get_dateorder(current_abi, const facet* f)
{ return static_cast<const time_get<C>*>(f)->date_order(); }
template time_base::dateorder
__time_get_dateorder<char>(current_abi, const facet*);
template time_base::dateorder
__time_get_dateorder<wchar_t>(current_abi, const facet*);
template<typename C>
istreambuf_iterator<C>
__time_get(current_abi, const facet* f,
istreambuf_iterator<C> beg, istreambuf_iterator<C> end,
ios_base& io, ios_base::iostate& err, tm* t, char which)
{
auto* g = static_cast<const time_get<C>*>(f);
switch(which)
{
case 't':
return g->get_time(beg, end, io, err, t);
case 'd':
return g->get_date(beg, end, io, err, t);
case 'w':
return g->get_weekday(beg, end, io, err, t);
case 'm':
return g->get_monthname(beg, end, io, err, t);
case 'y':
return g->get_year(beg, end, io, err, t);
default:
__builtin_unreachable();
}
}
template istreambuf_iterator<char>
__time_get(current_abi, const facet*,
istreambuf_iterator<char>, istreambuf_iterator<char>,
ios_base&, ios_base::iostate&, tm*, char);
template istreambuf_iterator<wchar_t>
__time_get(current_abi, const facet*,
istreambuf_iterator<wchar_t>, istreambuf_iterator<wchar_t>,
ios_base&, ios_base::iostate&, tm*, char);
template<typename C>
istreambuf_iterator<C>
__money_get(current_abi, const facet* f,
istreambuf_iterator<C> s, istreambuf_iterator<C> end,
bool intl, ios_base& str, ios_base::iostate& err,
long double* units, __any_string* digits)
{
auto* m = static_cast<const money_get<C>*>(f);
if (units)
return m->get(s, end, intl, str, err, *units);
basic_string<C> digits2;
s = m->get(s, end, intl, str, err, digits2);
if (err == ios_base::goodbit)
*digits = digits2;
return s;
}
template istreambuf_iterator<char>
__money_get(current_abi, const facet*,
istreambuf_iterator<char>, istreambuf_iterator<char>,
bool, ios_base&, ios_base::iostate&,
long double*, __any_string*);
template istreambuf_iterator<wchar_t>
__money_get(current_abi, const facet*,
istreambuf_iterator<wchar_t>, istreambuf_iterator<wchar_t>,
bool, ios_base&, ios_base::iostate&,
long double*, __any_string*);
template<typename C>
ostreambuf_iterator<C>
__money_put(current_abi, const facet* f, ostreambuf_iterator<C> s,
bool intl, ios_base& io, C fill, long double units,
const __any_string* digits)
{
auto* m = static_cast<const money_put<C>*>(f);
if (digits)
return m->put(s, intl, io, fill, *digits);
else
return m->put(s, intl, io, fill, units);
}
template ostreambuf_iterator<char>
__money_put(current_abi, const facet*, ostreambuf_iterator<char>,
bool, ios_base&, char, long double, const __any_string*);
template ostreambuf_iterator<wchar_t>
__money_put(current_abi, const facet*, ostreambuf_iterator<wchar_t>,
bool, ios_base&, wchar_t, long double, const __any_string*);
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __facet_shims
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Create a new shim facet of type WHICH that forwards calls to F.
// F is the replacement facet provided by the user, WHICH is the ID of
// F's "other ABI twin" which we are replacing with a shim.
const locale::facet*
#if _GLIBCXX_USE_CXX11_ABI
locale::facet::_M_sso_shim(const locale::id* which) const
#else
locale::facet::_M_cow_shim(const locale::id* which) const
#endif
{
using namespace __facet_shims;
// If this is already a shim just use its underlying facet.
if (auto* p = dynamic_cast<const __shim*>(this))
return p->_M_get();
if (which == &numpunct<char>::id)
return new numpunct_shim<char>{this};
if (which == &std::collate<char>::id)
return new collate_shim<char>{this};
if (which == &time_get<char>::id)
return new time_get_shim<char>{this};
if (which == &money_get<char>::id)
return new money_get_shim<char>{this};
if (which == &money_put<char>::id)
return new money_put_shim<char>{this};
if (which == &moneypunct<char, true>::id)
return new moneypunct_shim<char, true>{this};
if (which == &moneypunct<char, false>::id)
return new moneypunct_shim<char, false>{this};
if (which == &std::messages<char>::id)
return new messages_shim<char>{this};
#ifdef _GLIBCXX_USE_WCHAR_T
if (which == &numpunct<wchar_t>::id)
return new numpunct_shim<wchar_t>{this};
if (which == &std::collate<wchar_t>::id)
return new collate_shim<wchar_t>{this};
if (which == &time_get<wchar_t>::id)
return new time_get_shim<wchar_t>{this};
if (which == &money_get<wchar_t>::id)
return new money_get_shim<wchar_t>{this};
if (which == &money_put<wchar_t>::id)
return new money_put_shim<wchar_t>{this};
if (which == &moneypunct<wchar_t, true>::id)
return new moneypunct_shim<wchar_t, true>{this};
if (which == &moneypunct<wchar_t, false>::id)
return new moneypunct_shim<wchar_t, false>{this};
if (which == &std::messages<wchar_t>::id)
return new messages_shim<wchar_t>{this};
#endif
__throw_logic_error("cannot create shim for unknown locale::facet");
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std

View File

@ -0,0 +1,78 @@
// Methods for Exception Support for -*- C++ -*-
// Copyright (C) 2014 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
//
// ISO C++ 14882: 19.1 Exception classes
//
#define _GLIBCXX_USE_CXX11_ABI 1
#include <stdexcept>
#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 constructors take an abi-tagged std::string and use it to
// initialize an untagged COW std::string in _M_msg.
logic_error::logic_error(const string& __arg)
: _M_msg(__arg) { }
runtime_error::runtime_error(const string& __arg)
: _M_msg(__arg) { }
// These constructors take an abi-tagged std::string and pass it to the
// base class constructors defined above.
domain_error::domain_error(const string& __arg)
: logic_error(__arg) { }
invalid_argument::invalid_argument(const string& __arg)
: logic_error(__arg) { }
length_error::length_error(const string& __arg)
: logic_error(__arg) { }
out_of_range::out_of_range(const string& __arg)
: logic_error(__arg) { }
range_error::range_error(const string& __arg)
: runtime_error(__arg) { }
overflow_error::overflow_error(const string& __arg)
: runtime_error(__arg) { }
underflow_error::underflow_error(const string& __arg)
: runtime_error(__arg) { }
// Converting constructor from ABI-tagged std::string to COW string.
__cow_string::__cow_string(const string& s)
: __cow_string(s.c_str(), s.length()) { }
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace

View File

@ -0,0 +1,32 @@
// Copyright (C) 2014 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
//
// ISO C++ 14882: 22.1 Locales
//
#define _GLIBCXX_USE_CXX11_ABI 1
#include <bits/c++config.h>
#ifdef _GLIBCXX_USE_WCHAR_T
#define C wchar_t
#include "cxx11-locale-inst.cc"
#endif

View File

@ -26,6 +26,7 @@
// ISO C++ 14882:
//
#define _GLIBCXX_USE_CXX11_ABI 1
#include <fstream>
namespace std _GLIBCXX_VISIBILITY(default)

View File

@ -20,6 +20,9 @@
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// We don't want to change the type thrown by __throw_ios_failure (yet?)
#define _GLIBCXX_USE_CXX11_ABI 0
#include <bits/functexcept.h>
#include <cstdlib>
#include <exception>

View File

@ -22,6 +22,7 @@
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
#define _GLIBCXX_USE_CXX11_ABI 1
#include <random>
#ifdef _GLIBCXX_USE_C99_STDINT_TR1

View File

@ -26,6 +26,11 @@
// ISO C++ 14882:
//
#ifndef _GLIBCXX_USE_CXX11_ABI
// Instantiations in this file use the new SSO std::string ABI unless included
// by another file which defines _GLIBCXX_USE_CXX11_ABI=0.
# define _GLIBCXX_USE_CXX11_ABI 1
#endif
#include <sstream>
namespace std _GLIBCXX_VISIBILITY(default)

View File

@ -29,6 +29,12 @@
// Written by Jason Merrill based upon the specification by Takanori Adachi
// in ANSI X3J16/94-0013R2. Rewritten by Nathan Myers.
#ifndef _GLIBCXX_USE_CXX11_ABI
// Instantiations in this file use the new SSO std::string ABI unless included
// by another file which defines _GLIBCXX_USE_CXX11_ABI=0.
# define _GLIBCXX_USE_CXX11_ABI 1
#endif
#include <string>
// Instantiation configuration.
@ -49,7 +55,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Only one template keyword allowed here.
// See core issue #46 (NAD)
// http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_closed.html#46
// http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#46
template
S::basic_string(C*, C*, const allocator<C>&);
@ -59,6 +65,26 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template
S::basic_string(S::iterator, S::iterator, const allocator<C>&);
#if _GLIBCXX_USE_CXX11_ABI
template
void
S::_M_construct(S::iterator, S::iterator, forward_iterator_tag);
template
void
S::_M_construct(S::const_iterator, S::const_iterator,
forward_iterator_tag);
template
void
S::_M_construct(C*, C*, forward_iterator_tag);
template
void
S::_M_construct(const C*, const C*, forward_iterator_tag);
#else // !_GLIBCXX_USE_CXX11_ABI
template
C*
S::_S_construct(S::iterator, S::iterator,
@ -72,6 +98,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
C*
S::_S_construct(const C*, const C*, const allocator<C>&,
forward_iterator_tag);
#endif
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace

View File

@ -23,10 +23,13 @@
// <http://www.gnu.org/licenses/>.
#define _GLIBCXX_USE_CXX11_ABI 1
#define __sso_string __sso_stringxxx
#include <cstring>
#include <system_error>
#include <bits/functexcept.h>
#include <limits>
#undef __sso_string
namespace
{
@ -73,10 +76,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
error_category::~error_category() noexcept = default;
const error_category&
system_category() noexcept { return system_category_instance; }
_V2::system_category() noexcept { return system_category_instance; }
const error_category&
generic_category() noexcept { return generic_category_instance; }
_V2::generic_category() noexcept { return generic_category_instance; }
system_error::~system_error() noexcept = default;
@ -97,5 +100,80 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
error_code::default_error_condition() const noexcept
{ return category().default_error_condition(value()); }
#if _GLIBCXX_USE_CXX11_ABI
// Return error_category::message() as a COW string
__cow_string
error_category::_M_message(int i) const
{
string msg = this->message(i);
return {msg.c_str(), msg.length()};
}
#endif
#if _GLIBCXX_USE_DUAL_ABI
// 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;
};
__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

View File

@ -26,6 +26,7 @@
// ISO C++ 14882: 21 Strings library
//
#define _GLIBCXX_USE_CXX11_ABI 1
#include <bits/c++config.h>
#ifdef _GLIBCXX_USE_WCHAR_T

View File

@ -27,9 +27,18 @@ noinst_LTLIBRARIES = libc++98convenience.la
headers =
if ENABLE_DUAL_ABI
cow_string_host_sources = \
collate_members_cow.cc \
messages_members_cow.cc \
monetary_members_cow.cc \
numeric_members_cow.cc
endif
# Source files linked in via configuration/make substitution for a
# particular host.
host_sources = \
$(cow_string_host_sources) \
atomicity.cc \
codecvt_members.cc \
collate_members.cc \
@ -60,6 +69,20 @@ atomicity_file = ${glibcxx_srcdir}/$(ATOMICITY_SRCDIR)/atomicity.h
atomicity.cc: ${atomicity_file}
$(LN_S) ${atomicity_file} ./atomicity.cc || true
if ENABLE_DUAL_ABI
collate_members_cow.cc: ${glibcxx_srcdir}/$(CCOLLATE_CC)
$(LN_S) ${glibcxx_srcdir}/$(CCOLLATE_CC) ./$@ || true
messages_members_cow.cc: ${glibcxx_srcdir}/$(CMESSAGES_CC)
$(LN_S) ${glibcxx_srcdir}/$(CMESSAGES_CC) ./$@ || true
monetary_members_cow.cc: ${glibcxx_srcdir}/$(CMONEY_CC)
$(LN_S) ${glibcxx_srcdir}/$(CMONEY_CC) ./$@ || true
numeric_members_cow.cc: ${glibcxx_srcdir}/$(CNUMERIC_CC)
$(LN_S) ${glibcxx_srcdir}/$(CNUMERIC_CC) ./$@ || true
endif
# Source files linked in via configuration/make substitution for a
# particular host, but with ad hoc naming rules.
host_sources_extra = \
@ -72,6 +95,12 @@ c++locale.cc: ${glibcxx_srcdir}/$(CLOCALE_CC)
basic_file.cc: ${glibcxx_srcdir}/$(BASIC_FILE_CC)
$(LN_S) ${glibcxx_srcdir}/$(BASIC_FILE_CC) ./$@ || true
if ENABLE_DUAL_ABI
cxx11_abi_sources = \
cow-istream-string.cc
else
cxx11_abi_sources =
endif
if ENABLE_EXTERN_TEMPLATE
# XTEMPLATE_FLAGS = -fno-implicit-templates
@ -117,8 +146,10 @@ sources = \
strstream.cc \
tree.cc \
istream.cc \
istream-string.cc \
streambuf.cc \
valarray.cc \
${cxx11_abi_sources} \
${host_sources} \
${host_sources_extra}
@ -126,6 +157,27 @@ vpath % $(top_srcdir)/src/c++98
libc__98convenience_la_SOURCES = $(sources)
if ENABLE_DUAL_ABI
GLIBCXX_ABI_FLAGS = -D_GLIBCXX_USE_CXX11_ABI=@glibcxx_cxx98_abi@
# Use special rules to compile with the non-default string ABI.
collate_members_cow.lo: collate_members_cow.cc
$(LTCXXCOMPILE) $(GLIBCXX_ABI_FLAGS) -fimplicit-templates -c $<
collate_members_cow.o: collate_members_cow.cc
$(CXXCOMPILE) $(GLIBCXX_ABI_FLAGS) -fimplicit-templates -c $<
messages_members_cow.lo: messages_members_cow.cc
$(LTCXXCOMPILE) $(GLIBCXX_ABI_FLAGS) -fimplicit-templates -c $<
messages_members_cow.o: messages_members_cow.cc
$(CXXCOMPILE) $(GLIBCXX_ABI_FLAGS) -fimplicit-templates -c $<
monetary_members_cow.lo: monetary_members_cow.cc
$(LTCXXCOMPILE) $(GLIBCXX_ABI_FLAGS) -fimplicit-templates -c $<
monetary_members_cow.o: monetary_members_cow.cc
$(CXXCOMPILE) $(GLIBCXX_ABI_FLAGS) -fimplicit-templates -c $<
numeric_members_cow.lo: numeric_members_cow.cc
$(LTCXXCOMPILE) $(GLIBCXX_ABI_FLAGS) -fimplicit-templates -c $<
numeric_members_cow.o: numeric_members_cow.cc
$(CXXCOMPILE) $(GLIBCXX_ABI_FLAGS) -fimplicit-templates -c $<
endif
# Use special rules for the deprecated source files so that they find
# deprecated include files.
GLIBCXX_INCLUDE_DIR=$(glibcxx_builddir)/include

View File

@ -67,25 +67,31 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libc__98convenience_la_LIBADD =
am__objects_1 = atomicity.lo codecvt_members.lo collate_members.lo \
messages_members.lo monetary_members.lo numeric_members.lo \
time_members.lo
@ENABLE_EXTERN_TEMPLATE_TRUE@am__objects_2 = allocator-inst.lo \
@ENABLE_DUAL_ABI_TRUE@am__objects_1 = cow-istream-string.lo
@ENABLE_DUAL_ABI_TRUE@am__objects_2 = collate_members_cow.lo \
@ENABLE_DUAL_ABI_TRUE@ messages_members_cow.lo \
@ENABLE_DUAL_ABI_TRUE@ monetary_members_cow.lo \
@ENABLE_DUAL_ABI_TRUE@ numeric_members_cow.lo
am__objects_3 = $(am__objects_2) atomicity.lo codecvt_members.lo \
collate_members.lo messages_members.lo monetary_members.lo \
numeric_members.lo time_members.lo
@ENABLE_EXTERN_TEMPLATE_TRUE@am__objects_4 = allocator-inst.lo \
@ENABLE_EXTERN_TEMPLATE_TRUE@ concept-inst.lo ext-inst.lo \
@ENABLE_EXTERN_TEMPLATE_TRUE@ locale-inst.lo misc-inst.lo \
@ENABLE_EXTERN_TEMPLATE_TRUE@ wlocale-inst.lo
am__objects_3 = parallel_settings.lo
am__objects_4 = basic_file.lo c++locale.lo $(am__objects_2) \
$(am__objects_3)
am__objects_5 = bitmap_allocator.lo pool_allocator.lo mt_allocator.lo \
am__objects_5 = parallel_settings.lo
am__objects_6 = basic_file.lo c++locale.lo $(am__objects_4) \
$(am__objects_5)
am__objects_7 = bitmap_allocator.lo pool_allocator.lo mt_allocator.lo \
codecvt.lo complex_io.lo globals_io.lo hash_tr1.lo \
hashtable_tr1.lo ios_failure.lo ios_init.lo ios_locale.lo \
list.lo list-aux.lo list-aux-2.lo list_associated.lo \
list_associated-2.lo locale.lo locale_init.lo locale_facets.lo \
localename.lo math_stubs_float.lo math_stubs_long_double.lo \
stdexcept.lo strstream.lo tree.lo istream.lo streambuf.lo \
valarray.lo $(am__objects_1) $(am__objects_4)
am_libc__98convenience_la_OBJECTS = $(am__objects_5)
stdexcept.lo strstream.lo tree.lo istream.lo istream-string.lo \
streambuf.lo valarray.lo $(am__objects_1) $(am__objects_3) \
$(am__objects_6)
am_libc__98convenience_la_OBJECTS = $(am__objects_7)
libc__98convenience_la_OBJECTS = $(am_libc__98convenience_la_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp =
@ -245,6 +251,7 @@ 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@
@ -321,10 +328,17 @@ AM_CPPFLAGS = $(GLIBCXX_INCLUDES)
# Convenience library for C++98 runtime.
noinst_LTLIBRARIES = libc++98convenience.la
headers =
@ENABLE_DUAL_ABI_TRUE@cow_string_host_sources = \
@ENABLE_DUAL_ABI_TRUE@ collate_members_cow.cc \
@ENABLE_DUAL_ABI_TRUE@ messages_members_cow.cc \
@ENABLE_DUAL_ABI_TRUE@ monetary_members_cow.cc \
@ENABLE_DUAL_ABI_TRUE@ numeric_members_cow.cc
# Source files linked in via configuration/make substitution for a
# particular host.
host_sources = \
$(cow_string_host_sources) \
atomicity.cc \
codecvt_members.cc \
collate_members.cc \
@ -341,6 +355,10 @@ host_sources_extra = \
basic_file.cc c++locale.cc \
${inst_sources} ${parallel_sources}
@ENABLE_DUAL_ABI_FALSE@cxx11_abi_sources =
@ENABLE_DUAL_ABI_TRUE@cxx11_abi_sources = \
@ENABLE_DUAL_ABI_TRUE@ cow-istream-string.cc
# XTEMPLATE_FLAGS =
@ENABLE_EXTERN_TEMPLATE_FALSE@inst_sources =
@ -383,12 +401,15 @@ sources = \
strstream.cc \
tree.cc \
istream.cc \
istream-string.cc \
streambuf.cc \
valarray.cc \
${cxx11_abi_sources} \
${host_sources} \
${host_sources_extra}
libc__98convenience_la_SOURCES = $(sources)
@ENABLE_DUAL_ABI_TRUE@GLIBCXX_ABI_FLAGS = -D_GLIBCXX_USE_CXX11_ABI=@glibcxx_cxx98_abi@
# Use special rules for the deprecated source files so that they find
# deprecated include files.
@ -710,6 +731,18 @@ time_members.cc: ${glibcxx_srcdir}/$(CTIME_CC)
atomicity.cc: ${atomicity_file}
$(LN_S) ${atomicity_file} ./atomicity.cc || true
@ENABLE_DUAL_ABI_TRUE@collate_members_cow.cc: ${glibcxx_srcdir}/$(CCOLLATE_CC)
@ENABLE_DUAL_ABI_TRUE@ $(LN_S) ${glibcxx_srcdir}/$(CCOLLATE_CC) ./$@ || true
@ENABLE_DUAL_ABI_TRUE@messages_members_cow.cc: ${glibcxx_srcdir}/$(CMESSAGES_CC)
@ENABLE_DUAL_ABI_TRUE@ $(LN_S) ${glibcxx_srcdir}/$(CMESSAGES_CC) ./$@ || true
@ENABLE_DUAL_ABI_TRUE@monetary_members_cow.cc: ${glibcxx_srcdir}/$(CMONEY_CC)
@ENABLE_DUAL_ABI_TRUE@ $(LN_S) ${glibcxx_srcdir}/$(CMONEY_CC) ./$@ || true
@ENABLE_DUAL_ABI_TRUE@numeric_members_cow.cc: ${glibcxx_srcdir}/$(CNUMERIC_CC)
@ENABLE_DUAL_ABI_TRUE@ $(LN_S) ${glibcxx_srcdir}/$(CNUMERIC_CC) ./$@ || true
c++locale.cc: ${glibcxx_srcdir}/$(CLOCALE_CC)
$(LN_S) ${glibcxx_srcdir}/$(CLOCALE_CC) ./$@ || true
@ -717,6 +750,23 @@ basic_file.cc: ${glibcxx_srcdir}/$(BASIC_FILE_CC)
$(LN_S) ${glibcxx_srcdir}/$(BASIC_FILE_CC) ./$@ || true
vpath % $(top_srcdir)/src/c++98
# Use special rules to compile with the non-default string ABI.
@ENABLE_DUAL_ABI_TRUE@collate_members_cow.lo: collate_members_cow.cc
@ENABLE_DUAL_ABI_TRUE@ $(LTCXXCOMPILE) $(GLIBCXX_ABI_FLAGS) -fimplicit-templates -c $<
@ENABLE_DUAL_ABI_TRUE@collate_members_cow.o: collate_members_cow.cc
@ENABLE_DUAL_ABI_TRUE@ $(CXXCOMPILE) $(GLIBCXX_ABI_FLAGS) -fimplicit-templates -c $<
@ENABLE_DUAL_ABI_TRUE@messages_members_cow.lo: messages_members_cow.cc
@ENABLE_DUAL_ABI_TRUE@ $(LTCXXCOMPILE) $(GLIBCXX_ABI_FLAGS) -fimplicit-templates -c $<
@ENABLE_DUAL_ABI_TRUE@messages_members_cow.o: messages_members_cow.cc
@ENABLE_DUAL_ABI_TRUE@ $(CXXCOMPILE) $(GLIBCXX_ABI_FLAGS) -fimplicit-templates -c $<
@ENABLE_DUAL_ABI_TRUE@monetary_members_cow.lo: monetary_members_cow.cc
@ENABLE_DUAL_ABI_TRUE@ $(LTCXXCOMPILE) $(GLIBCXX_ABI_FLAGS) -fimplicit-templates -c $<
@ENABLE_DUAL_ABI_TRUE@monetary_members_cow.o: monetary_members_cow.cc
@ENABLE_DUAL_ABI_TRUE@ $(CXXCOMPILE) $(GLIBCXX_ABI_FLAGS) -fimplicit-templates -c $<
@ENABLE_DUAL_ABI_TRUE@numeric_members_cow.lo: numeric_members_cow.cc
@ENABLE_DUAL_ABI_TRUE@ $(LTCXXCOMPILE) $(GLIBCXX_ABI_FLAGS) -fimplicit-templates -c $<
@ENABLE_DUAL_ABI_TRUE@numeric_members_cow.o: numeric_members_cow.cc
@ENABLE_DUAL_ABI_TRUE@ $(CXXCOMPILE) $(GLIBCXX_ABI_FLAGS) -fimplicit-templates -c $<
strstream.lo: strstream.cc
$(LTCXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $<
strstream.o: strstream.cc

View File

@ -22,6 +22,7 @@
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
#define _GLIBCXX_USE_CXX11_ABI 0
#include <locale>
#include <cmath>
#include <tr1/functional>

View File

@ -22,6 +22,7 @@
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
#define _GLIBCXX_USE_CXX11_ABI 0
#include <bits/c++config.h>
#if defined(_GLIBCXX_SYMVER_GNU) && defined(_GLIBCXX_SHARED) \

View File

@ -29,6 +29,7 @@
// explicitly instantiate the initial set of symbols; compiling this file
// with -fimplicit-templates will take care of the rest for us.
#define _GLIBCXX_USE_CXX11_ABI 0
#include <bits/concept_check.h>
#ifdef _GLIBCXX_CONCEPT_CHECKS

View File

@ -0,0 +1,30 @@
// Input streams operating on strings -*- C++ -*-
// Copyright (C) 2014 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
//
// ISO C++ 14882: 27.6.1 Input streams
//
#define _GLIBCXX_USE_CXX11_ABI 0
#include "istream-string.cc"

View File

@ -22,6 +22,7 @@
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
#define _GLIBCXX_USE_CXX11_ABI 0
#include <string>
#include <tr1/functional>

View File

@ -0,0 +1,291 @@
// Input streams operating on strings-*- C++ -*-
// Copyright (C) 2004-2014 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
//
// ISO C++ 14882: 27.6.1 Input streams
//
#ifndef _GLIBCXX_USE_CXX11_ABI
// Instantiations in this file use the new SSO std::string ABI unless included
// by another file which defines _GLIBCXX_USE_CXX11_ABI=0.
# define _GLIBCXX_USE_CXX11_ABI 1
#endif
#include <istream>
#include <string>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
template<>
basic_istream<char>&
operator>>(basic_istream<char>& __in, basic_string<char>& __str)
{
typedef basic_istream<char> __istream_type;
typedef __istream_type::int_type __int_type;
typedef __istream_type::traits_type __traits_type;
typedef __istream_type::__streambuf_type __streambuf_type;
typedef __istream_type::__ctype_type __ctype_type;
typedef basic_string<char> __string_type;
typedef __string_type::size_type __size_type;
__size_type __extracted = 0;
ios_base::iostate __err = ios_base::goodbit;
__istream_type::sentry __cerb(__in, false);
if (__cerb)
{
__try
{
__str.erase();
const streamsize __w = __in.width();
const __size_type __n = __w > 0 ? static_cast<__size_type>(__w)
: __str.max_size();
const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc());
const __int_type __eof = __traits_type::eof();
__streambuf_type* __sb = __in.rdbuf();
__int_type __c = __sb->sgetc();
while (__extracted < __n
&& !__traits_type::eq_int_type(__c, __eof)
&& !__ct.is(ctype_base::space,
__traits_type::to_char_type(__c)))
{
streamsize __size = std::min(streamsize(__sb->egptr()
- __sb->gptr()),
streamsize(__n - __extracted));
if (__size > 1)
{
__size = (__ct.scan_is(ctype_base::space,
__sb->gptr() + 1,
__sb->gptr() + __size)
- __sb->gptr());
__str.append(__sb->gptr(), __size);
__sb->__safe_gbump(__size);
__extracted += __size;
__c = __sb->sgetc();
}
else
{
__str += __traits_type::to_char_type(__c);
++__extracted;
__c = __sb->snextc();
}
}
if (__traits_type::eq_int_type(__c, __eof))
__err |= ios_base::eofbit;
__in.width(0);
}
__catch(__cxxabiv1::__forced_unwind&)
{
__in._M_setstate(ios_base::badbit);
__throw_exception_again;
}
__catch(...)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 91. Description of operator>> and getline() for string<>
// might cause endless loop
__in._M_setstate(ios_base::badbit);
}
}
if (!__extracted)
__err |= ios_base::failbit;
if (__err)
__in.setstate(__err);
return __in;
}
template<>
basic_istream<char>&
getline(basic_istream<char>& __in, basic_string<char>& __str,
char __delim)
{
typedef basic_istream<char> __istream_type;
typedef __istream_type::int_type __int_type;
typedef __istream_type::char_type __char_type;
typedef __istream_type::traits_type __traits_type;
typedef __istream_type::__streambuf_type __streambuf_type;
typedef basic_string<char> __string_type;
typedef __string_type::size_type __size_type;
__size_type __extracted = 0;
const __size_type __n = __str.max_size();
ios_base::iostate __err = ios_base::goodbit;
__istream_type::sentry __cerb(__in, true);
if (__cerb)
{
__try
{
__str.erase();
const __int_type __idelim = __traits_type::to_int_type(__delim);
const __int_type __eof = __traits_type::eof();
__streambuf_type* __sb = __in.rdbuf();
__int_type __c = __sb->sgetc();
while (__extracted < __n
&& !__traits_type::eq_int_type(__c, __eof)
&& !__traits_type::eq_int_type(__c, __idelim))
{
streamsize __size = std::min(streamsize(__sb->egptr()
- __sb->gptr()),
streamsize(__n - __extracted));
if (__size > 1)
{
const __char_type* __p = __traits_type::find(__sb->gptr(),
__size,
__delim);
if (__p)
__size = __p - __sb->gptr();
__str.append(__sb->gptr(), __size);
__sb->__safe_gbump(__size);
__extracted += __size;
__c = __sb->sgetc();
}
else
{
__str += __traits_type::to_char_type(__c);
++__extracted;
__c = __sb->snextc();
}
}
if (__traits_type::eq_int_type(__c, __eof))
__err |= ios_base::eofbit;
else if (__traits_type::eq_int_type(__c, __idelim))
{
++__extracted;
__sb->sbumpc();
}
else
__err |= ios_base::failbit;
}
__catch(__cxxabiv1::__forced_unwind&)
{
__in._M_setstate(ios_base::badbit);
__throw_exception_again;
}
__catch(...)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 91. Description of operator>> and getline() for string<>
// might cause endless loop
__in._M_setstate(ios_base::badbit);
}
}
if (!__extracted)
__err |= ios_base::failbit;
if (__err)
__in.setstate(__err);
return __in;
}
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
basic_istream<wchar_t>&
getline(basic_istream<wchar_t>& __in, basic_string<wchar_t>& __str,
wchar_t __delim)
{
typedef basic_istream<wchar_t> __istream_type;
typedef __istream_type::int_type __int_type;
typedef __istream_type::char_type __char_type;
typedef __istream_type::traits_type __traits_type;
typedef __istream_type::__streambuf_type __streambuf_type;
typedef basic_string<wchar_t> __string_type;
typedef __string_type::size_type __size_type;
__size_type __extracted = 0;
const __size_type __n = __str.max_size();
ios_base::iostate __err = ios_base::goodbit;
__istream_type::sentry __cerb(__in, true);
if (__cerb)
{
__try
{
__str.erase();
const __int_type __idelim = __traits_type::to_int_type(__delim);
const __int_type __eof = __traits_type::eof();
__streambuf_type* __sb = __in.rdbuf();
__int_type __c = __sb->sgetc();
while (__extracted < __n
&& !__traits_type::eq_int_type(__c, __eof)
&& !__traits_type::eq_int_type(__c, __idelim))
{
streamsize __size = std::min(streamsize(__sb->egptr()
- __sb->gptr()),
streamsize(__n - __extracted));
if (__size > 1)
{
const __char_type* __p = __traits_type::find(__sb->gptr(),
__size,
__delim);
if (__p)
__size = __p - __sb->gptr();
__str.append(__sb->gptr(), __size);
__sb->__safe_gbump(__size);
__extracted += __size;
__c = __sb->sgetc();
}
else
{
__str += __traits_type::to_char_type(__c);
++__extracted;
__c = __sb->snextc();
}
}
if (__traits_type::eq_int_type(__c, __eof))
__err |= ios_base::eofbit;
else if (__traits_type::eq_int_type(__c, __idelim))
{
++__extracted;
__sb->sbumpc();
}
else
__err |= ios_base::failbit;
}
__catch(__cxxabiv1::__forced_unwind&)
{
__in._M_setstate(ios_base::badbit);
__throw_exception_again;
}
__catch(...)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 91. Description of operator>> and getline() for string<>
// might cause endless loop
__in._M_setstate(ios_base::badbit);
}
}
if (!__extracted)
__err |= ios_base::failbit;
if (__err)
__in.setstate(__err);
return __in;
}
#endif
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace

View File

@ -273,169 +273,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __in;
}
template<>
basic_istream<char>&
operator>>(basic_istream<char>& __in, basic_string<char>& __str)
{
typedef basic_istream<char> __istream_type;
typedef __istream_type::int_type __int_type;
typedef __istream_type::traits_type __traits_type;
typedef __istream_type::__streambuf_type __streambuf_type;
typedef __istream_type::__ctype_type __ctype_type;
typedef basic_string<char> __string_type;
typedef __string_type::size_type __size_type;
__size_type __extracted = 0;
ios_base::iostate __err = ios_base::goodbit;
__istream_type::sentry __cerb(__in, false);
if (__cerb)
{
__try
{
__str.erase();
const streamsize __w = __in.width();
const __size_type __n = __w > 0 ? static_cast<__size_type>(__w)
: __str.max_size();
const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc());
const __int_type __eof = __traits_type::eof();
__streambuf_type* __sb = __in.rdbuf();
__int_type __c = __sb->sgetc();
while (__extracted < __n
&& !__traits_type::eq_int_type(__c, __eof)
&& !__ct.is(ctype_base::space,
__traits_type::to_char_type(__c)))
{
streamsize __size = std::min(streamsize(__sb->egptr()
- __sb->gptr()),
streamsize(__n - __extracted));
if (__size > 1)
{
__size = (__ct.scan_is(ctype_base::space,
__sb->gptr() + 1,
__sb->gptr() + __size)
- __sb->gptr());
__str.append(__sb->gptr(), __size);
__sb->__safe_gbump(__size);
__extracted += __size;
__c = __sb->sgetc();
}
else
{
__str += __traits_type::to_char_type(__c);
++__extracted;
__c = __sb->snextc();
}
}
if (__traits_type::eq_int_type(__c, __eof))
__err |= ios_base::eofbit;
__in.width(0);
}
__catch(__cxxabiv1::__forced_unwind&)
{
__in._M_setstate(ios_base::badbit);
__throw_exception_again;
}
__catch(...)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 91. Description of operator>> and getline() for string<>
// might cause endless loop
__in._M_setstate(ios_base::badbit);
}
}
if (!__extracted)
__err |= ios_base::failbit;
if (__err)
__in.setstate(__err);
return __in;
}
template<>
basic_istream<char>&
getline(basic_istream<char>& __in, basic_string<char>& __str,
char __delim)
{
typedef basic_istream<char> __istream_type;
typedef __istream_type::int_type __int_type;
typedef __istream_type::char_type __char_type;
typedef __istream_type::traits_type __traits_type;
typedef __istream_type::__streambuf_type __streambuf_type;
typedef basic_string<char> __string_type;
typedef __string_type::size_type __size_type;
__size_type __extracted = 0;
const __size_type __n = __str.max_size();
ios_base::iostate __err = ios_base::goodbit;
__istream_type::sentry __cerb(__in, true);
if (__cerb)
{
__try
{
__str.erase();
const __int_type __idelim = __traits_type::to_int_type(__delim);
const __int_type __eof = __traits_type::eof();
__streambuf_type* __sb = __in.rdbuf();
__int_type __c = __sb->sgetc();
while (__extracted < __n
&& !__traits_type::eq_int_type(__c, __eof)
&& !__traits_type::eq_int_type(__c, __idelim))
{
streamsize __size = std::min(streamsize(__sb->egptr()
- __sb->gptr()),
streamsize(__n - __extracted));
if (__size > 1)
{
const __char_type* __p = __traits_type::find(__sb->gptr(),
__size,
__delim);
if (__p)
__size = __p - __sb->gptr();
__str.append(__sb->gptr(), __size);
__sb->__safe_gbump(__size);
__extracted += __size;
__c = __sb->sgetc();
}
else
{
__str += __traits_type::to_char_type(__c);
++__extracted;
__c = __sb->snextc();
}
}
if (__traits_type::eq_int_type(__c, __eof))
__err |= ios_base::eofbit;
else if (__traits_type::eq_int_type(__c, __idelim))
{
++__extracted;
__sb->sbumpc();
}
else
__err |= ios_base::failbit;
}
__catch(__cxxabiv1::__forced_unwind&)
{
__in._M_setstate(ios_base::badbit);
__throw_exception_again;
}
__catch(...)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 91. Description of operator>> and getline() for string<>
// might cause endless loop
__in._M_setstate(ios_base::badbit);
}
}
if (!__extracted)
__err |= ios_base::failbit;
if (__err)
__in.setstate(__err);
return __in;
}
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
basic_istream<wchar_t>&
@ -596,91 +433,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
return *this;
}
template<>
basic_istream<wchar_t>&
getline(basic_istream<wchar_t>& __in, basic_string<wchar_t>& __str,
wchar_t __delim)
{
typedef basic_istream<wchar_t> __istream_type;
typedef __istream_type::int_type __int_type;
typedef __istream_type::char_type __char_type;
typedef __istream_type::traits_type __traits_type;
typedef __istream_type::__streambuf_type __streambuf_type;
typedef basic_string<wchar_t> __string_type;
typedef __string_type::size_type __size_type;
__size_type __extracted = 0;
const __size_type __n = __str.max_size();
ios_base::iostate __err = ios_base::goodbit;
__istream_type::sentry __cerb(__in, true);
if (__cerb)
{
__try
{
__str.erase();
const __int_type __idelim = __traits_type::to_int_type(__delim);
const __int_type __eof = __traits_type::eof();
__streambuf_type* __sb = __in.rdbuf();
__int_type __c = __sb->sgetc();
while (__extracted < __n
&& !__traits_type::eq_int_type(__c, __eof)
&& !__traits_type::eq_int_type(__c, __idelim))
{
streamsize __size = std::min(streamsize(__sb->egptr()
- __sb->gptr()),
streamsize(__n - __extracted));
if (__size > 1)
{
const __char_type* __p = __traits_type::find(__sb->gptr(),
__size,
__delim);
if (__p)
__size = __p - __sb->gptr();
__str.append(__sb->gptr(), __size);
__sb->__safe_gbump(__size);
__extracted += __size;
__c = __sb->sgetc();
}
else
{
__str += __traits_type::to_char_type(__c);
++__extracted;
__c = __sb->snextc();
}
}
if (__traits_type::eq_int_type(__c, __eof))
__err |= ios_base::eofbit;
else if (__traits_type::eq_int_type(__c, __idelim))
{
++__extracted;
__sb->sbumpc();
}
else
__err |= ios_base::failbit;
}
__catch(__cxxabiv1::__forced_unwind&)
{
__in._M_setstate(ios_base::badbit);
__throw_exception_again;
}
__catch(...)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 91. Description of operator>> and getline() for string<>
// might cause endless loop
__in._M_setstate(ios_base::badbit);
}
}
if (!__extracted)
__err |= ios_base::failbit;
if (__err)
__in.setstate(__err);
return __in;
}
#endif
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace

View File

@ -26,6 +26,15 @@
// ISO C++ 14882: 22.1 Locales
//
#ifndef _GLIBCXX_USE_CXX11_ABI
// Instantiations in this file use the old COW std::string ABI unless included
// by another file which defines _GLIBCXX_USE_CXX11_ABI=1. Some instantiations
// are guarded by a check for !_GLIBCXX_USE_CXX11_ABI so that they are only
// instantiated once, because they are not tagged with abi_tag so should not
// be instantiated twice.
# define _GLIBCXX_USE_CXX11_ABI 0
#endif
#include <locale>
// Instantiation configuration.
@ -39,13 +48,17 @@ namespace std _GLIBCXX_VISIBILITY(default)
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// moneypunct, money_get, and money_put
template class moneypunct<C, false>;
template class moneypunct<C, true>;
#if ! _GLIBCXX_USE_CXX11_ABI
template struct __moneypunct_cache<C, false>;
template struct __moneypunct_cache<C, true>;
#endif
_GLIBCXX_BEGIN_NAMESPACE_CXX11
template class moneypunct<C, false>;
template class moneypunct<C, true>;
template class moneypunct_byname<C, false>;
template class moneypunct_byname<C, true>;
_GLIBCXX_BEGIN_NAMESPACE_LDBL
_GLIBCXX_END_NAMESPACE_CXX11
_GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11
template class money_get<C, istreambuf_iterator<C> >;
template class money_put<C, ostreambuf_iterator<C> >;
template
@ -71,15 +84,21 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL
money_put<C, ostreambuf_iterator<C> >::
_M_insert<false>(ostreambuf_iterator<C>, ios_base&, C,
const string_type&) const;
_GLIBCXX_END_NAMESPACE_LDBL
_GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11
// numpunct, numpunct_byname, num_get, and num_put
template class numpunct<C>;
#if ! _GLIBCXX_USE_CXX11_ABI
template struct __numpunct_cache<C>;
#endif
_GLIBCXX_BEGIN_NAMESPACE_CXX11
template class numpunct<C>;
template class numpunct_byname<C>;
_GLIBCXX_END_NAMESPACE_CXX11
_GLIBCXX_BEGIN_NAMESPACE_LDBL
#if ! _GLIBCXX_USE_CXX11_ABI
template class num_get<C, istreambuf_iterator<C> >;
template class num_put<C, ostreambuf_iterator<C> >;
#endif
template
istreambuf_iterator<C>
num_get<C, istreambuf_iterator<C> >::
@ -124,6 +143,9 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL
unsigned long long&) const;
#endif
#if ! _GLIBCXX_USE_CXX11_ABI
template class num_put<C, ostreambuf_iterator<C> >;
template
ostreambuf_iterator<C>
num_put<C, ostreambuf_iterator<C> >::
@ -161,33 +183,47 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL
num_put<C, ostreambuf_iterator<C> >::
_M_insert_float(ostreambuf_iterator<C>, ios_base&, C, char,
long double) const;
#endif
_GLIBCXX_END_NAMESPACE_LDBL
// time_get and time_put
#if ! _GLIBCXX_USE_CXX11_ABI
template class __timepunct<C>;
template struct __timepunct_cache<C>;
template class time_put<C, ostreambuf_iterator<C> >;
template class time_put_byname<C, ostreambuf_iterator<C> >;
#endif
_GLIBCXX_BEGIN_NAMESPACE_CXX11
template class time_get<C, istreambuf_iterator<C> >;
template class time_get_byname<C, istreambuf_iterator<C> >;
_GLIBCXX_END_NAMESPACE_CXX11
// messages
_GLIBCXX_BEGIN_NAMESPACE_CXX11
template class messages<C>;
template class messages_byname<C>;
_GLIBCXX_END_NAMESPACE_CXX11
// ctype
#if ! _GLIBCXX_USE_CXX11_ABI
inline template class __ctype_abstract_base<C>;
template class ctype_byname<C>;
#endif
// codecvt
#if ! _GLIBCXX_USE_CXX11_ABI
inline template class __codecvt_abstract_base<C, char, mbstate_t>;
template class codecvt_byname<C, char, mbstate_t>;
#endif
// collate
_GLIBCXX_BEGIN_NAMESPACE_CXX11
template class collate<C>;
template class collate_byname<C>;
_GLIBCXX_END_NAMESPACE_CXX11
// use_facet
#if ! _GLIBCXX_USE_CXX11_ABI
template
const ctype<C>&
use_facet<ctype<C> >(const locale&);
@ -195,6 +231,7 @@ _GLIBCXX_END_NAMESPACE_LDBL
template
const codecvt<C, char, mbstate_t>&
use_facet<codecvt<C, char, mbstate_t> >(const locale&);
#endif
template
const collate<C>&
@ -204,6 +241,7 @@ _GLIBCXX_END_NAMESPACE_LDBL
const numpunct<C>&
use_facet<numpunct<C> >(const locale&);
#if ! _GLIBCXX_USE_CXX11_ABI
template
const num_put<C>&
use_facet<num_put<C> >(const locale&);
@ -211,6 +249,7 @@ _GLIBCXX_END_NAMESPACE_LDBL
template
const num_get<C>&
use_facet<num_get<C> >(const locale&);
#endif
template
const moneypunct<C, true>&
@ -228,6 +267,7 @@ _GLIBCXX_END_NAMESPACE_LDBL
const money_get<C>&
use_facet<money_get<C> >(const locale&);
#if ! _GLIBCXX_USE_CXX11_ABI
template
const __timepunct<C>&
use_facet<__timepunct<C> >(const locale&);
@ -235,6 +275,7 @@ _GLIBCXX_END_NAMESPACE_LDBL
template
const time_put<C>&
use_facet<time_put<C> >(const locale&);
#endif
template
const time_get<C>&
@ -245,6 +286,7 @@ _GLIBCXX_END_NAMESPACE_LDBL
use_facet<messages<C> >(const locale&);
// has_facet
#if ! _GLIBCXX_USE_CXX11_ABI
template
bool
has_facet<ctype<C> >(const locale&);
@ -252,6 +294,7 @@ _GLIBCXX_END_NAMESPACE_LDBL
template
bool
has_facet<codecvt<C, char, mbstate_t> >(const locale&);
#endif
template
bool
@ -261,6 +304,7 @@ _GLIBCXX_END_NAMESPACE_LDBL
bool
has_facet<numpunct<C> >(const locale&);
#if ! _GLIBCXX_USE_CXX11_ABI
template
bool
has_facet<num_put<C> >(const locale&);
@ -268,6 +312,7 @@ _GLIBCXX_END_NAMESPACE_LDBL
template
bool
has_facet<num_get<C> >(const locale&);
#endif
template
bool
@ -281,6 +326,7 @@ _GLIBCXX_END_NAMESPACE_LDBL
bool
has_facet<money_get<C> >(const locale&);
#if ! _GLIBCXX_USE_CXX11_ABI
template
bool
has_facet<__timepunct<C> >(const locale&);
@ -288,6 +334,7 @@ _GLIBCXX_END_NAMESPACE_LDBL
template
bool
has_facet<time_put<C> >(const locale&);
#endif
template
bool
@ -322,7 +369,8 @@ _GLIBCXX_END_NAMESPACE_VERSION
} // namespace
// XXX GLIBCXX_ABI Deprecated
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined C_is_char
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined C_is_char \
&& _GLIBCXX_USE_CXX11_ABI == 0
#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak))

View File

@ -20,6 +20,7 @@
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
#define _GLIBCXX_USE_CXX11_ABI 1
#include <clocale>
#include <cstring>
#include <cstdlib> // For getenv
@ -118,6 +119,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return *this;
}
_GLIBCXX_DEFAULT_ABI_TAG
string
locale::name() const
{
@ -357,6 +359,38 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const facet*& __fpr = _M_facets[__index];
if (__fpr)
{
#if _GLIBCXX_USE_DUAL_ABI
// If this is a twinned facet replace its twin with a shim.
for (const id* const* p = _S_twinned_facets; *p != 0; p += 2)
{
if (p[0]->_M_id() == __index)
{
// replacing the old ABI facet, also replace new ABI twin
const facet*& __fpr2 = _M_facets[p[1]->_M_id()];
if (__fpr2)
{
const facet* __fp2 = __fp->_M_sso_shim(p[1]);
__fp2->_M_add_reference();
__fpr2->_M_remove_reference();
__fpr2 = __fp2;
}
break;
}
else if (p[1]->_M_id() == __index)
{
// replacing the new ABI facet, also replace old ABI twin
const facet*& __fpr2 = _M_facets[p[0]->_M_id()];
if (__fpr2)
{
const facet* __fp2 = __fp->_M_cow_shim(p[0]);
__fp2->_M_add_reference();
__fpr2->_M_remove_reference();
__fpr2 = __fp2;
}
break;
}
}
#endif
// Replacing an existing facet. Order matters.
__fpr->_M_remove_reference();
__fpr = __fp;
@ -391,6 +425,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_install_cache(const facet* __cache, size_t __index)
{
__gnu_cxx::__scoped_lock sentry(get_locale_cache_mutex());
#if _GLIBCXX_USE_DUAL_ABI
// If this cache is for one of the facets that is instantiated twice,
// for old and new std::string ABI, install it in both slots.
size_t __index2 = -1;
for (const id* const* p = _S_twinned_facets; *p != 0; p += 2)
{
if (p[0]->_M_id() == __index)
{
__index2 = p[1]->_M_id();
break;
}
else if (p[1]->_M_id() == __index)
{
__index2 = __index;
__index = p[0]->_M_id();
break;
}
}
#endif
if (_M_caches[__index] != 0)
{
// Some other thread got in first.
@ -400,6 +453,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
__cache->_M_add_reference();
_M_caches[__index] = __cache;
#if _GLIBCXX_USE_DUAL_ABI
if (__index2 != size_t(-1))
{
__cache->_M_add_reference();
_M_caches[__index2] = __cache;
}
#endif
}
}

View File

@ -20,6 +20,7 @@
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
#define _GLIBCXX_USE_CXX11_ABI 0
#include <locale>
namespace std _GLIBCXX_VISIBILITY(default)
@ -97,11 +98,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*__fptr = '\0';
}
bool
__verify_grouping(const char* __grouping, size_t __grouping_size,
const string& __grouping_tmp) throw()
// This function is not exported but is needed internally, by the versions
// of __verify_grouping below and in src/c++11/cxx11-locale-inst.cc
extern bool
__verify_grouping_impl(const char* __grouping, size_t __grouping_size,
const char* __grouping_tmp, size_t __grouping_tmp_size)
{
const size_t __n = __grouping_tmp.size() - 1;
const size_t __n = __grouping_tmp_size - 1;
const size_t __min = std::min(__n, size_t(__grouping_size - 1));
size_t __i = __n;
bool __test = true;
@ -122,5 +125,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __test;
}
bool
__verify_grouping(const char* __grouping, size_t __grouping_size,
const string& __grouping_tmp) throw()
{
return __verify_grouping_impl(__grouping, __grouping_size,
__grouping_tmp.c_str(),
__grouping_tmp.size());
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace

View File

@ -20,6 +20,7 @@
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
#define _GLIBCXX_USE_CXX11_ABI 1
#include <clocale>
#include <cstring>
#include <cstdlib> // For getenv, free.
@ -28,8 +29,37 @@
#include <locale>
#include <ext/concurrence.h>
#if _GLIBCXX_USE_DUAL_ABI
// This file is compiled with the new std::string ABI so std::numpunct<char>
// refers to std::__cxx11::numpunct<char>. These declarations let us refer
// to the other facets instantiated with the old ABI.
# define _GLIBCXX_LOC_ID(mangled) extern std::locale::id mangled
_GLIBCXX_LOC_ID(_ZNSt8numpunctIcE2idE);
_GLIBCXX_LOC_ID(_ZNSt7collateIcE2idE);
_GLIBCXX_LOC_ID(_ZNSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE);
_GLIBCXX_LOC_ID(_ZNSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE);
_GLIBCXX_LOC_ID(_ZNSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE2idE);
_GLIBCXX_LOC_ID(_ZNSt10moneypunctIcLb0EE2idE);
_GLIBCXX_LOC_ID(_ZNSt10moneypunctIcLb1EE2idE);
_GLIBCXX_LOC_ID(_ZNSt8messagesIcE2idE);
# ifdef _GLIBCXX_USE_WCHAR_T
_GLIBCXX_LOC_ID(_ZNSt8numpunctIwE2idE);
_GLIBCXX_LOC_ID(_ZNSt7collateIwE2idE);
_GLIBCXX_LOC_ID(_ZNSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE2idE);
_GLIBCXX_LOC_ID(_ZNSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE2idE);
_GLIBCXX_LOC_ID(_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE2idE);
_GLIBCXX_LOC_ID(_ZNSt10moneypunctIwLb0EE2idE);
_GLIBCXX_LOC_ID(_ZNSt10moneypunctIwLb1EE2idE);
_GLIBCXX_LOC_ID(_ZNSt8messagesIwE2idE);
# endif
#endif
namespace
{
const int num_facets = _GLIBCXX_NUM_FACETS
+ (_GLIBCXX_USE_DUAL_ABI ? _GLIBCXX_NUM_CXX11_FACETS : 0);
__gnu_cxx::__mutex&
get_locale_mutex()
{
@ -57,11 +87,11 @@ namespace
typedef char fake_facet_vec[sizeof(locale::facet*)]
__attribute__ ((aligned(__alignof__(locale::facet*))));
fake_facet_vec facet_vec[_GLIBCXX_NUM_FACETS];
fake_facet_vec facet_vec[num_facets];
typedef char fake_cache_vec[sizeof(locale::facet*)]
__attribute__ ((aligned(__alignof__(locale::facet*))));
fake_cache_vec cache_vec[_GLIBCXX_NUM_FACETS];
fake_cache_vec cache_vec[num_facets];
typedef char fake_ctype_c[sizeof(std::ctype<char>)]
__attribute__ ((aligned(__alignof__(std::ctype<char>))));
@ -355,7 +385,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif
0
};
const locale::id* const* const
locale::_Impl::_S_facet_categories[] =
{
@ -369,10 +399,52 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
0
};
#if _GLIBCXX_USE_DUAL_ABI
// Facets that are instantiated for both the COW and SSO std::string ABIs.
// The COW ABI version must come first, followed by its SSO twin.
const locale::id* const locale::_S_twinned_facets[] = {
&::_ZNSt8numpunctIcE2idE,
&numpunct<char>::id,
&::_ZNSt7collateIcE2idE,
&std::collate<char>::id,
&::_ZNSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE,
&time_get<char>::id,
&::_ZNSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE,
&money_get<char>::id,
&::_ZNSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE2idE,
&money_put<char>::id,
&::_ZNSt10moneypunctIcLb0EE2idE,
&moneypunct<char, false>::id,
&::_ZNSt10moneypunctIcLb1EE2idE,
&moneypunct<char, true >::id,
&::_ZNSt8messagesIcE2idE,
&std::messages<char>::id,
# ifdef _GLIBCXX_USE_WCHAR_T
&::_ZNSt8numpunctIwE2idE,
&numpunct<wchar_t>::id,
&::_ZNSt7collateIwE2idE,
&std::collate<wchar_t>::id,
&::_ZNSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE2idE,
&time_get<wchar_t>::id,
&::_ZNSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE2idE,
&money_get<wchar_t>::id,
&::_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE2idE,
&money_put<wchar_t>::id,
&::_ZNSt10moneypunctIwLb0EE2idE,
&moneypunct<wchar_t, false>::id,
&::_ZNSt10moneypunctIwLb1EE2idE,
&moneypunct<wchar_t, true >::id,
&::_ZNSt8messagesIwE2idE,
&std::messages<wchar_t>::id,
# endif
0, 0
};
#endif
// Construct "C" _Impl.
locale::_Impl::
_Impl(size_t __refs) throw()
: _M_refcount(__refs), _M_facets(0), _M_facets_size(_GLIBCXX_NUM_FACETS),
: _M_refcount(__refs), _M_facets(0), _M_facets_size(num_facets),
_M_caches(0), _M_names(0)
{
_M_facets = new (&facet_vec) const facet*[_M_facets_size]();
@ -448,8 +520,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_init_facet(new (&time_get_w) time_get<wchar_t>(1));
_M_init_facet(new (&time_put_w) time_put<wchar_t>(1));
_M_init_facet(new (&messages_w) std::messages<wchar_t>(1));
#endif
#endif
#if _GLIBCXX_USE_DUAL_ABI
facet* extra[] = { __npc, __mpcf, __mpct
# ifdef _GLIBCXX_USE_WCHAR_T
, __npw, __mpwf, __mpwt
# endif
};
_M_init_extra(extra);
#endif
// This locale is safe to pre-cache, after all the facets have
// been created and installed.
_M_caches[numpunct<char>::id._M_id()] = __npc;

View File

@ -20,6 +20,7 @@
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
#define _GLIBCXX_USE_CXX11_ABI 1
#include <clocale>
#include <cstring>
#include <cstdlib>
@ -170,10 +171,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
}
const int num_facets = _GLIBCXX_NUM_FACETS
+ (_GLIBCXX_USE_DUAL_ABI ? _GLIBCXX_NUM_CXX11_FACETS : 0);
// Construct named _Impl.
locale::_Impl::
_Impl(const char* __s, size_t __refs)
: _M_refcount(__refs), _M_facets(0), _M_facets_size(_GLIBCXX_NUM_FACETS),
: _M_refcount(__refs), _M_facets(0), _M_facets_size(num_facets),
_M_caches(0), _M_names(0)
{
// Initialize the underlying locale model, which also checks to
@ -264,6 +268,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_init_facet(new time_put<wchar_t>);
_M_init_facet(new std::messages<wchar_t>(__cloc, __s));
#endif
#if _GLIBCXX_USE_DUAL_ABI
_M_init_extra(&__cloc, &__clocm, __s, __smon);
#endif
locale::facet::_S_destroy_c_locale(__cloc);
if (__clocm != __cloc)
locale::facet::_S_destroy_c_locale(__clocm);

View File

@ -26,6 +26,8 @@
// ISO C++ 14882:
//
#define _GLIBCXX_USE_CXX11_ABI 1
#define _GLIBCXX_DISAMBIGUATE_REPLACE_INST 1
#include <string>
#include <istream>
#include <ostream>
@ -62,5 +64,44 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
getline(basic_istream<wchar_t>&, 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.
template string::iterator string::erase(iterator);
template void string::insert(iterator, iterator, iterator);
template string::iterator string::insert(iterator, char);
template string& string::replace(iterator, iterator, size_type, char);
template string& string::replace(iterator, iterator, char*, char*);
template string& string::replace(iterator, iterator, iterator, iterator);
template string&
string::replace(iterator, iterator, const_iterator, const_iterator);
#ifdef _GLIBCXX_USE_WCHAR_T
template wstring::iterator wstring::erase(iterator);
template void wstring::insert(iterator, iterator, iterator);
template wstring::iterator wstring::insert(iterator, wchar_t);
template wstring& wstring::replace(iterator, iterator, size_type, wchar_t);
template wstring& wstring::replace(iterator, iterator, wchar_t*, wchar_t*);
template wstring& wstring::replace(iterator, iterator, iterator, iterator);
template wstring&
wstring::replace(iterator, iterator, const_iterator, const_iterator);
#endif
// XXX this doesn't belong in an -inst.cc file
// Defined in src/c++98/locale_facets.cc
_GLIBCXX_PURE bool
__verify_grouping_impl(const char* __grouping, size_t __grouping_size,
const char* __grouping_tmp, size_t __n);
bool
__verify_grouping(const char* __grouping, size_t __grouping_size,
const string& __grouping_tmp) throw()
{
return __verify_grouping_impl(__grouping, __grouping_size,
__grouping_tmp.c_str(),
__grouping_tmp.size());
}
#endif
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace

View File

@ -26,6 +26,8 @@
// ISO C++ 14882: 19.1 Exception classes
//
// All exception classes still use the classic COW std::string.
#define _GLIBCXX_USE_CXX11_ABI 0
#include <string>
#include <stdexcept>

View File

@ -26,6 +26,8 @@
// ISO C++ 14882: 22.1 Locales
//
// Instantiate locales using COW std::wstring ABI
#define _GLIBCXX_USE_CXX11_ABI 0
#include <bits/c++config.h>
#ifdef _GLIBCXX_USE_WCHAR_T

View File

@ -59,7 +59,7 @@ void test01()
bool test __attribute__((unused)) = true;
{
std::string s = "Hello World.";
std::string s = "Hello World, this is not a small string.";
}
VERIFY( user_new_called );

View File

@ -140,7 +140,11 @@ void test01()
VERIFY( sz04 >= 100 );
str02.reserve();
sz03 = str02.capacity();
#if _GLIBCXX_USE_CXX11_ABI
VERIFY( sz03 < 100);
#else
VERIFY( sz03 == 0 );
#endif
sz03 = str02.size() + 5;
str02.resize(sz03);

View File

@ -36,7 +36,11 @@ void test01()
VERIFY( sz02 >= 100 );
str01.reserve();
sz01 = str01.capacity();
#if _GLIBCXX_USE_CXX11_ABI
VERIFY( sz01 < 100);
#else
VERIFY( sz01 == 0 );
#endif
sz01 = str01.size() + 5;
str01.resize(sz01);

View File

@ -36,10 +36,13 @@ void test01()
typedef string::size_type size_type;
// Our current implementation provides exact shrink-to-size
// and shrink-to-fit (in the future, maybe this will change
// for short strings).
#if _GLIBCXX_USE_CXX11_ABI
// Can't shrink below small string size.
const size_type minsize = 2 << 3;
#else
// Exact shrink-to-size and shrink-to-fit
const size_type minsize = 2 << 0;
#endif
const size_type maxsize = 2 << MAX_SIZE;
for (size_type i = minsize; i <= maxsize; i *= 2)
{

View File

@ -32,7 +32,7 @@ void test02()
// str01 becomes shared
std::string str02 = str01;
str01.reserve(1);
VERIFY( str01.capacity() == 12 );
VERIFY( str01.capacity() >= 12 );
}
int main()

View File

@ -36,7 +36,11 @@ void test01()
VERIFY( sz02 >= 100 );
str01.reserve();
sz01 = str01.capacity();
#if _GLIBCXX_USE_CXX11_ABI
VERIFY( sz01 < 100);
#else
VERIFY( sz01 == 0 );
#endif
sz01 = str01.size() + 5;
str01.resize(sz01);

View File

@ -36,10 +36,13 @@ void test01()
typedef wstring::size_type size_type;
// Our current implementation provides exact shrink-to-size
// and shrink-to-fit (in the future, maybe this will change
// for short strings).
#if _GLIBCXX_USE_CXX11_ABI
// Can't shrink below small string size.
const size_type minsize = 2 << 1;
#else
// Exact shrink-to-size and shrink-to-fit
const size_type minsize = 2 << 0;
#endif
const size_type maxsize = 2 << MAX_SIZE;
for (size_type i = minsize; i <= maxsize; i *= 2)
{

View File

@ -26,9 +26,11 @@ namespace std {
template <> struct char_traits<char>;
template <> struct char_traits<wchar_t>;
_GLIBCXX_BEGIN_NAMESPACE_CXX11
// lib.basic.string, basic_string:
template<class charT, class traits, class Allocator >
class basic_string;
_GLIBCXX_END_NAMESPACE_CXX11
template<class charT, class traits, class Allocator>
basic_string<charT,traits,Allocator>

View File

@ -21,7 +21,9 @@
#include <list>
namespace std {
_GLIBCXX_BEGIN_NAMESPACE_CXX11
template <class T, class Allocator> class list;
_GLIBCXX_END_NAMESPACE_CXX11
template <class T, class Allocator>
bool operator==(const list<T,Allocator>& x, const list<T,Allocator>&);

View File

@ -17,6 +17,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// The library still throws the original definition of std::ios::failure
// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=0" }
// 27.4.4.2 basic_ios member functions

View File

@ -17,6 +17,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// The library still throws the original definition of std::ios::failure
// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=0" }
// 27.4.4.2 basic_ios member functions

View File

@ -15,6 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// The library still throws the original definition of std::ios::failure
// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=0" }
#include <sstream>
#include <testsuite_hooks.h>

View File

@ -15,6 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// The library still throws the original definition of std::ios::failure
// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=0" }
#include <sstream>
#include <testsuite_hooks.h>

View File

@ -15,6 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// The library still throws the original definition of std::ios::failure
// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=0" }
#include <istream>
#include <ostream>

View File

@ -15,6 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// The library still throws the original definition of std::ios::failure
// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=0" }
#include <istream>
#include <ostream>

View File

@ -18,6 +18,9 @@
// 27.6.1.1.2 class basic_istream::sentry
// The library still throws the original definition of std::ios::failure
// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=0" }
#include <sstream>
#include <testsuite_hooks.h>

View File

@ -15,6 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// The library still throws the original definition of std::ios::failure
// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=0" }
// 27.6.1.1.2 class basic_istream::sentry

View File

@ -15,6 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// The library still throws the original definition of std::ios::failure
// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=0" }
#include <istream>
#include <ostream>

View File

@ -15,6 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// The library still throws the original definition of std::ios::failure
// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=0" }
#include <istream>
#include <ostream>

View File

@ -20,6 +20,7 @@
#include <sstream>
namespace std {
_GLIBCXX_BEGIN_NAMESPACE_CXX11
template <class charT, class traits, class Allocator>
class basic_stringbuf;
typedef basic_stringbuf<char> stringbuf;
@ -39,4 +40,5 @@ namespace std {
class basic_stringstream;
typedef basic_stringstream<char> stringstream;
typedef basic_stringstream<wchar_t> wstringstream;
_GLIBCXX_END_NAMESPACE_CXX11
}

View File

@ -20,6 +20,7 @@
#include <ios>
#include <testsuite_hooks.h>
#if _GLIBCXX_USE_CXX11_ABI
using test_type = std::ios_base::failure;
static_assert( std::is_base_of<std::system_error, test_type>::value, "base" );
@ -50,3 +51,6 @@ main()
test01();
test02();
}
#else
int main() { }
#endif

View File

@ -28,6 +28,9 @@
// Radar 6467884: 10.X systems are not robust when paging space is exceeded
// { dg-skip-if "" { *-*-darwin* && lp64 } { "*" } { "" } }
// The library still throws the original definition of std::ios::failure
// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=0" }
#include <sstream>
#include <iostream>
#include <limits>

View File

@ -216,6 +216,7 @@ 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@

Some files were not shown because too many files have changed in this diff Show More