2003-01-22 17:51:52 +01:00
|
|
|
// Locale support -*- C++ -*-
|
|
|
|
|
2016-01-04 15:30:50 +01:00
|
|
|
// Copyright (C) 1997-2016 Free Software Foundation, Inc.
|
2003-01-22 17:51:52 +01:00
|
|
|
//
|
|
|
|
// 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
|
2009-04-09 17:00:19 +02:00
|
|
|
// Free Software Foundation; either version 3, or (at your option)
|
2003-01-22 17:51:52 +01:00
|
|
|
// 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.
|
|
|
|
|
2009-04-09 17:00:19 +02:00
|
|
|
// 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/>.
|
2003-01-22 17:51:52 +01:00
|
|
|
|
2010-12-19 10:21:16 +01:00
|
|
|
/** @file bits/locale_classes.h
|
2003-01-22 17:51:52 +01:00
|
|
|
* This is an internal header file, included by other library headers.
|
2010-12-19 10:21:16 +01:00
|
|
|
* Do not attempt to use it directly. @headername{locale}
|
2003-01-22 17:51:52 +01:00
|
|
|
*/
|
|
|
|
|
2006-12-06 00:24:07 +01:00
|
|
|
//
|
|
|
|
// ISO C++ 14882: 22.1 Locales
|
|
|
|
//
|
|
|
|
|
2003-07-05 06:05:45 +02:00
|
|
|
#ifndef _LOCALE_CLASSES_H
|
|
|
|
#define _LOCALE_CLASSES_H 1
|
2003-01-22 17:51:52 +01:00
|
|
|
|
|
|
|
#pragma GCC system_header
|
|
|
|
|
|
|
|
#include <bits/localefwd.h>
|
|
|
|
#include <string>
|
2006-09-14 11:48:15 +02:00
|
|
|
#include <ext/atomicity.h>
|
2003-01-22 17:51:52 +01:00
|
|
|
|
PR libstdc++/36104 part four
2011-01-30 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/36104 part four
* include/bits/c++config (_GLIBCXX_STD): Remove.
(_GLIBCXX_STD_D, _GLIBCXX_PR): Now _GLIBCXX_STD_C.
(_GLIBCXX_P): Now _GLIBCXX_STD_A.
(_GLIBCXX_NAMESPACE_DEBUG, _GLIBCXX_NAMESPACE_PARALLEL,
_GLIBCXX_NAMESPACE_PROFILE, _GLIBCXX_NAMESPACE_VERSION): Remove.
(_GLIBCXX_INLINE_DEBUG, _GLIBCXX_INLINE_PARALLEL,
_GLIBCXX_INLINE_PROFILE): Remove.
(_GLIBCXX_BEGIN_NAMESPACE(X)): Remove.
(_GLIBCXX_END_NAMESPACE): Remove.
(_GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y)): Remove.
(_GLIBCXX_END_NESTED_NAMESPACE): Remove.
(_GLIBCXX_BEGIN_NAMESPACE_ALGO): Add.
(_GLIBCXX_END_NAMESPACE_ALGO): Add.
(_GLIBCXX_BEGIN_NAMESPACE_CONTAINER): Add.
(_GLIBCXX_END_NAMESPACE_CONTAINER): Add.
(_GLIBCXX_BEGIN_NAMESPACE_VERSION): Add.
(_GLIBCXX_END_NAMESPACE_VERSION): Add.
(_GLIBCXX_BEGIN_LDBL_NAMESPACE): To _GLIBCXX_BEGIN_NAMESPACE_LDBL.
(_GLIBCXX_END_LDBL_NAMESPACE): To _GLIBCXX_END_NAMESPACE_LDBL.
(_GLIBCXX_VISIBILITY_ATTR): Revert to _GLIBCXX_VISIBILITY.
* include/*: Use new macros for namespace scope.
* config/*: Same.
* src/*: Same.
* src/Makefile.am (sources): Remove debug_list.cc, add
compatibility-debug_list-2.cc.
(parallel_sources): Remove parallel_list.cc, add
compatibility-parallel_list-2.cc.
(compatibility-parallel_list-2.[o,lo]): New rule.
* src/Makefile.in: Regenerate.
* src/debug_list.cc: Remove.
* src/parallel_list.cc: Remove.
* src/compatibility-list-2.cc: New.
* src/compatibility-debug_list-2.cc: New.
* src/compatibility-parallel_list-2.cc: New.
* doc/doxygen/user.cfg.in: Adjust macros.
* testsuite/20_util/auto_ptr/assign_neg.cc: Adjust line numbers, macros.
* testsuite/20_util/declval/requirements/1_neg.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Same.
* testsuite/20_util/forward/c_neg.cc: Same.
* testsuite/20_util/forward/f_neg.cc: Same.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Same.
* testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Same.
* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Same.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Same.
* testsuite/23_containers/forward_list/capacity/1.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
assign_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
insert_neg.cc: Same.
* testsuite/23_containers/list/capacity/29134.cc: Same.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc: Same.
* testsuite/23_containers/vector/bool/capacity/29134.cc: Same.
* testsuite/23_containers/vector/bool/modifiers/insert/31370.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Same.
* testsuite/25_algorithms/sort/35588.cc: Same.
* testsuite/27_io/ios_base/cons/assign_neg.cc: Same.
* testsuite/27_io/ios_base/cons/copy_neg.cc: Same.
* testsuite/ext/profile/mutex_extensions_neg.cc: Same.
* testsuite/ext/profile/profiler_algos.cc: Same.
* testsuite/ext/type_traits/add_unsigned_floating_neg.cc: Same.
* testsuite/ext/type_traits/add_unsigned_integer_neg.cc: Same.
* testsuite/ext/type_traits/remove_unsigned_floating_neg.cc: Same.
* testsuite/ext/type_traits/remove_unsigned_integer_neg.cc: Same.
* testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc: Same.
From-SVN: r169421
2011-01-30 23:39:36 +01:00
|
|
|
namespace std _GLIBCXX_VISIBILITY(default)
|
|
|
|
{
|
|
|
|
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
2005-12-19 01:56:05 +01:00
|
|
|
|
2003-01-22 17:51:52 +01:00
|
|
|
// 22.1.1 Class locale
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Container class for localization functionality.
|
2010-02-10 06:45:24 +01:00
|
|
|
* @ingroup locales
|
2003-12-20 16:51:09 +01:00
|
|
|
*
|
|
|
|
* The locale class is first a class wrapper for C library locales. It is
|
|
|
|
* also an extensible container for user-defined localization. A locale is
|
|
|
|
* a collection of facets that implement various localization features such
|
|
|
|
* as money, time, and number printing.
|
|
|
|
*
|
|
|
|
* Constructing C++ locales does not change the C library locale.
|
|
|
|
*
|
|
|
|
* This library supports efficient construction and copying of locales
|
|
|
|
* through a reference counting implementation of the locale class.
|
|
|
|
*/
|
2003-01-22 17:51:52 +01:00
|
|
|
class locale
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Types:
|
2003-12-20 16:51:09 +01:00
|
|
|
/// Definition of locale::category.
|
2004-01-10 11:15:35 +01:00
|
|
|
typedef int category;
|
2003-01-22 17:51:52 +01:00
|
|
|
|
|
|
|
// Forward decls and friends:
|
|
|
|
class facet;
|
|
|
|
class id;
|
|
|
|
class _Impl;
|
|
|
|
|
|
|
|
friend class facet;
|
|
|
|
friend class _Impl;
|
|
|
|
|
|
|
|
template<typename _Facet>
|
2004-02-08 05:46:42 +01:00
|
|
|
friend bool
|
2003-01-22 17:51:52 +01:00
|
|
|
has_facet(const locale&) throw();
|
2003-05-13 22:13:15 +02:00
|
|
|
|
|
|
|
template<typename _Facet>
|
2004-02-08 05:46:42 +01:00
|
|
|
friend const _Facet&
|
2003-05-13 22:13:15 +02:00
|
|
|
use_facet(const locale&);
|
2003-06-27 09:25:38 +02:00
|
|
|
|
|
|
|
template<typename _Cache>
|
2003-07-10 08:21:13 +02:00
|
|
|
friend struct __use_cache;
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
* @brief Category values.
|
|
|
|
*
|
|
|
|
* The standard category values are none, ctype, numeric, collate, time,
|
|
|
|
* monetary, and messages. They form a bitmask that supports union and
|
|
|
|
* intersection. The category all is the union of these values.
|
|
|
|
*
|
|
|
|
* NB: Order must match _S_facet_categories definition in locale.cc
|
|
|
|
*/
|
2003-01-22 17:51:52 +01:00
|
|
|
static const category none = 0;
|
2004-02-08 05:46:42 +01:00
|
|
|
static const category ctype = 1L << 0;
|
|
|
|
static const category numeric = 1L << 1;
|
|
|
|
static const category collate = 1L << 2;
|
|
|
|
static const category time = 1L << 3;
|
|
|
|
static const category monetary = 1L << 4;
|
|
|
|
static const category messages = 1L << 5;
|
|
|
|
static const category all = (ctype | numeric | collate |
|
|
|
|
time | monetary | messages);
|
2003-12-20 16:51:09 +01:00
|
|
|
//@}
|
2003-01-22 17:51:52 +01:00
|
|
|
|
|
|
|
// Construct/copy/destroy:
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Default constructor.
|
|
|
|
*
|
|
|
|
* Constructs a copy of the global locale. If no locale has been
|
2010-02-04 19:20:34 +01:00
|
|
|
* explicitly set, this is the C locale.
|
2003-12-20 16:51:09 +01:00
|
|
|
*/
|
2003-01-22 17:51:52 +01:00
|
|
|
locale() throw();
|
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Copy constructor.
|
|
|
|
*
|
|
|
|
* Constructs a copy of @a other.
|
|
|
|
*
|
2011-08-07 09:27:06 +02:00
|
|
|
* @param __other The locale to copy.
|
2003-12-20 16:51:09 +01:00
|
|
|
*/
|
2003-01-22 17:51:52 +01:00
|
|
|
locale(const locale& __other) throw();
|
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Named locale constructor.
|
|
|
|
*
|
|
|
|
* Constructs a copy of the named C library locale.
|
|
|
|
*
|
2011-08-07 09:27:06 +02:00
|
|
|
* @param __s Name of the locale to construct.
|
|
|
|
* @throw std::runtime_error if __s is null or an undefined locale.
|
2003-12-20 16:51:09 +01:00
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
explicit
|
2003-01-22 17:51:52 +01:00
|
|
|
locale(const char* __s);
|
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Construct locale with facets from another locale.
|
|
|
|
*
|
|
|
|
* Constructs a copy of the locale @a base. The facets specified by @a
|
|
|
|
* cat are replaced with those from the locale named by @a s. If base is
|
|
|
|
* named, this locale instance will also be named.
|
|
|
|
*
|
2011-08-07 09:27:06 +02:00
|
|
|
* @param __base The locale to copy.
|
|
|
|
* @param __s Name of the locale to use facets from.
|
|
|
|
* @param __cat Set of categories defining the facets to use from __s.
|
|
|
|
* @throw std::runtime_error if __s is null or an undefined locale.
|
2003-12-20 16:51:09 +01:00
|
|
|
*/
|
2003-01-22 17:51:52 +01:00
|
|
|
locale(const locale& __base, const char* __s, category __cat);
|
|
|
|
|
2015-01-20 12:50:51 +01:00
|
|
|
#if __cplusplus >= 201103L
|
|
|
|
/**
|
|
|
|
* @brief Named locale constructor.
|
|
|
|
*
|
|
|
|
* Constructs a copy of the named C library locale.
|
|
|
|
*
|
|
|
|
* @param __s Name of the locale to construct.
|
|
|
|
* @throw std::runtime_error if __s is an undefined locale.
|
|
|
|
*/
|
|
|
|
explicit
|
|
|
|
locale(const std::string& __s) : locale(__s.c_str()) { }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Construct locale with facets from another locale.
|
|
|
|
*
|
|
|
|
* Constructs a copy of the locale @a base. The facets specified by @a
|
|
|
|
* cat are replaced with those from the locale named by @a s. If base is
|
|
|
|
* named, this locale instance will also be named.
|
|
|
|
*
|
|
|
|
* @param __base The locale to copy.
|
|
|
|
* @param __s Name of the locale to use facets from.
|
|
|
|
* @param __cat Set of categories defining the facets to use from __s.
|
|
|
|
* @throw std::runtime_error if __s is an undefined locale.
|
|
|
|
*/
|
|
|
|
locale(const locale& __base, const std::string& __s, category __cat)
|
|
|
|
: locale(__base, __s.c_str(), __cat) { }
|
|
|
|
#endif
|
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Construct locale with facets from another locale.
|
|
|
|
*
|
|
|
|
* Constructs a copy of the locale @a base. The facets specified by @a
|
|
|
|
* cat are replaced with those from the locale @a add. If @a base and @a
|
|
|
|
* add are named, this locale instance will also be named.
|
|
|
|
*
|
2011-08-07 09:27:06 +02:00
|
|
|
* @param __base The locale to copy.
|
|
|
|
* @param __add The locale to use facets from.
|
|
|
|
* @param __cat Set of categories defining the facets to use from add.
|
2003-12-20 16:51:09 +01:00
|
|
|
*/
|
2003-01-22 17:51:52 +01:00
|
|
|
locale(const locale& __base, const locale& __add, category __cat);
|
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Construct locale with another facet.
|
|
|
|
*
|
2011-08-07 09:27:06 +02:00
|
|
|
* Constructs a copy of the locale @a __other. The facet @a __f
|
|
|
|
* is added to @a __other, replacing an existing facet of type
|
|
|
|
* Facet if there is one. If @a __f is null, this locale is a
|
|
|
|
* copy of @a __other.
|
2003-12-20 16:51:09 +01:00
|
|
|
*
|
2011-08-07 09:27:06 +02:00
|
|
|
* @param __other The locale to copy.
|
|
|
|
* @param __f The facet to add in.
|
2003-12-20 16:51:09 +01:00
|
|
|
*/
|
2003-01-22 17:51:52 +01:00
|
|
|
template<typename _Facet>
|
|
|
|
locale(const locale& __other, _Facet* __f);
|
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/// Locale destructor.
|
2003-01-22 17:51:52 +01:00
|
|
|
~locale() throw();
|
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Assignment operator.
|
|
|
|
*
|
|
|
|
* Set this locale to be a copy of @a other.
|
|
|
|
*
|
2011-08-07 09:27:06 +02:00
|
|
|
* @param __other The locale to copy.
|
2003-12-20 16:51:09 +01:00
|
|
|
* @return A reference to this locale.
|
|
|
|
*/
|
|
|
|
const locale&
|
2003-01-22 17:51:52 +01:00
|
|
|
operator=(const locale& __other) throw();
|
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Construct locale with another facet.
|
|
|
|
*
|
|
|
|
* Constructs and returns a new copy of this locale. Adds or replaces an
|
|
|
|
* existing facet of type Facet from the locale @a other into the new
|
|
|
|
* locale.
|
|
|
|
*
|
2011-08-07 09:27:06 +02:00
|
|
|
* @tparam _Facet The facet type to copy from other
|
|
|
|
* @param __other The locale to copy from.
|
2003-12-20 16:51:09 +01:00
|
|
|
* @return Newly constructed locale.
|
2011-08-07 09:27:06 +02:00
|
|
|
* @throw std::runtime_error if __other has no facet of type _Facet.
|
2003-12-20 16:51:09 +01:00
|
|
|
*/
|
2003-01-22 17:51:52 +01:00
|
|
|
template<typename _Facet>
|
2004-02-08 05:46:42 +01:00
|
|
|
locale
|
2003-01-22 17:51:52 +01:00
|
|
|
combine(const locale& __other) const;
|
|
|
|
|
|
|
|
// Locale operations:
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Return locale name.
|
|
|
|
* @return Locale name or "*" if unnamed.
|
|
|
|
*/
|
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
2014-12-19 19:16:39 +01:00
|
|
|
_GLIBCXX_DEFAULT_ABI_TAG
|
2004-02-08 05:46:42 +01:00
|
|
|
string
|
2003-01-22 17:51:52 +01:00
|
|
|
name() const;
|
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Locale equality.
|
|
|
|
*
|
2011-08-07 09:27:06 +02:00
|
|
|
* @param __other The locale to compare against.
|
2003-12-20 16:51:09 +01:00
|
|
|
* @return True if other and this refer to the same locale instance, are
|
2004-02-08 05:46:42 +01:00
|
|
|
* copies, or have the same name. False otherwise.
|
2003-12-20 16:51:09 +01:00
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
bool
|
2010-02-17 06:43:24 +01:00
|
|
|
operator==(const locale& __other) const throw();
|
2003-01-22 17:51:52 +01:00
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Locale inequality.
|
|
|
|
*
|
2011-08-07 09:27:06 +02:00
|
|
|
* @param __other The locale to compare against.
|
|
|
|
* @return ! (*this == __other)
|
2003-12-20 16:51:09 +01:00
|
|
|
*/
|
2007-04-25 11:25:05 +02:00
|
|
|
bool
|
2010-02-17 06:43:24 +01:00
|
|
|
operator!=(const locale& __other) const throw()
|
2007-04-25 11:25:05 +02:00
|
|
|
{ return !(this->operator==(__other)); }
|
2003-01-22 17:51:52 +01:00
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Compare two strings according to collate.
|
|
|
|
*
|
|
|
|
* Template operator to compare two strings using the compare function of
|
|
|
|
* the collate facet in this locale. One use is to provide the locale to
|
|
|
|
* the sort function. For example, a vector v of strings could be sorted
|
|
|
|
* according to locale loc by doing:
|
|
|
|
* @code
|
|
|
|
* std::sort(v.begin(), v.end(), loc);
|
|
|
|
* @endcode
|
|
|
|
*
|
2011-08-07 09:27:06 +02:00
|
|
|
* @param __s1 First string to compare.
|
|
|
|
* @param __s2 Second string to compare.
|
|
|
|
* @return True if collate<_Char> facet compares __s1 < __s2, else false.
|
2003-12-20 16:51:09 +01:00
|
|
|
*/
|
2003-01-22 17:51:52 +01:00
|
|
|
template<typename _Char, typename _Traits, typename _Alloc>
|
2004-02-08 05:46:42 +01:00
|
|
|
bool
|
2003-01-22 17:51:52 +01:00
|
|
|
operator()(const basic_string<_Char, _Traits, _Alloc>& __s1,
|
|
|
|
const basic_string<_Char, _Traits, _Alloc>& __s2) const;
|
|
|
|
|
|
|
|
// Global locale objects:
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Set global locale
|
|
|
|
*
|
|
|
|
* This function sets the global locale to the argument and returns a
|
|
|
|
* copy of the previous global locale. If the argument has a name, it
|
|
|
|
* will also call std::setlocale(LC_ALL, loc.name()).
|
|
|
|
*
|
2011-08-07 09:27:06 +02:00
|
|
|
* @param __loc The new locale to make global.
|
2003-12-20 16:51:09 +01:00
|
|
|
* @return Copy of the old global locale.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
static locale
|
2011-08-07 09:27:06 +02:00
|
|
|
global(const locale& __loc);
|
2003-01-22 17:51:52 +01:00
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
2010-02-04 19:20:34 +01:00
|
|
|
* @brief Return reference to the C locale.
|
2003-12-20 16:51:09 +01:00
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
static const locale&
|
2003-01-22 17:51:52 +01:00
|
|
|
classic();
|
|
|
|
|
|
|
|
private:
|
|
|
|
// The (shared) implementation
|
2004-02-08 05:46:42 +01:00
|
|
|
_Impl* _M_impl;
|
2003-01-22 17:51:52 +01:00
|
|
|
|
|
|
|
// The "C" reference locale
|
[multiple changes]
2003-10-02 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Export _S_get_c_locale instead of
_S_c_locale object.
2003-10-02 Petur Runolfsson <peturr02@ru.is>
* config/locale/generic/c_locale.cc
(category_names, locale::_S_categories): Const qualify.
* config/locale/gnu/c_locale.cc: Same.
* config/locale/generic/time_members.h (__timepunct::__timepunct):
Copy string contents before assigning to _M_name_timepunct,
qualify strcpy and strlen with std::.
* config/locale/gnu/time_members.h: Same.
* config/locale/gnu/messages_members.h (messages::messages):
Copy string contents before assigning to _M_name_messages,
qualify strcpy and strlen with std::.
* config/os/gnu-linux/ctype_noninline.h
(ctype<char>::classic_table()): Don't call locale::classic().
* include/bits/locale_classes.h
(locale::_S_categories): Const qualify.
(locale::_S_once, locale::_S_initialize_once,
locale::facet::_S_once, locale::facet::_S_initialize_once,
locale::facet::_S_get_c_locale): Declare.
(locale::_S_initialize): Don't define.
(locale::facet::_S_c_locale): Make private.
(locale::facet::_S_c_name): Same, const qualify.
(locale::_Impl::_Impl(facet**, size_t, bool)): Drop unused
parameters, add throw() specifier.
* include/bits/locale_facets.h (__timepunct::_M_name_timepunct,
messages::_M_name_messages): Const qualify.
* src/locale.cc
(locale::_S_once, locale::facet::_S_once): Define.
(locale::classic): Move initialization code...
(locale::_S_initialize_once): ...here.
(locale::_S_initialize): Call _S_initialize_once through
__gthread_once.
(locale::facet::_S_initialize_once): Initialize _S_c_locale.
(locale::facet::_S_get_c_locale): Call _S_initialize_once through
__gthread_once before returning _S_c_locale.
* src/localename.cc (locale::_Impl::_Impl(facet**, size_t, bool)):
Drop unused parameters, add throw() specifier, don't initialize
locale::facet::_S_c_locale and _S_c_name.
* config/locale/generic/messages_members.h:
Replace _S_c_locale with _S_get_c_locale().
* config/locale/gnu/c_locale.cc: Same.
* config/locale/gnu/messages_members.h: Same.
* config/locale/gnu/numeric_members.cc: Same.
* config/locale/gnu/time_members.cc: Same.
* config/os/gnu-linux/ctype_noninline.h: Same.
* include/bits/locale_facets.h: Same.
* include/bits/locale_facets.tcc: Same.
* src/codecvt.cc: Same.
* src/ctype.cc: Same.
From-SVN: r72040
2003-10-02 18:56:39 +02:00
|
|
|
static _Impl* _S_classic;
|
2003-01-22 17:51:52 +01:00
|
|
|
|
|
|
|
// Current global locale
|
2004-02-08 05:46:42 +01:00
|
|
|
static _Impl* _S_global;
|
2003-01-22 17:51:52 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
// Names of underlying locale categories.
|
2003-06-27 09:25:38 +02:00
|
|
|
// NB: locale::global() has to know how to modify all the
|
|
|
|
// underlying categories, not just the ones required by the C++
|
|
|
|
// standard.
|
[multiple changes]
2003-10-02 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Export _S_get_c_locale instead of
_S_c_locale object.
2003-10-02 Petur Runolfsson <peturr02@ru.is>
* config/locale/generic/c_locale.cc
(category_names, locale::_S_categories): Const qualify.
* config/locale/gnu/c_locale.cc: Same.
* config/locale/generic/time_members.h (__timepunct::__timepunct):
Copy string contents before assigning to _M_name_timepunct,
qualify strcpy and strlen with std::.
* config/locale/gnu/time_members.h: Same.
* config/locale/gnu/messages_members.h (messages::messages):
Copy string contents before assigning to _M_name_messages,
qualify strcpy and strlen with std::.
* config/os/gnu-linux/ctype_noninline.h
(ctype<char>::classic_table()): Don't call locale::classic().
* include/bits/locale_classes.h
(locale::_S_categories): Const qualify.
(locale::_S_once, locale::_S_initialize_once,
locale::facet::_S_once, locale::facet::_S_initialize_once,
locale::facet::_S_get_c_locale): Declare.
(locale::_S_initialize): Don't define.
(locale::facet::_S_c_locale): Make private.
(locale::facet::_S_c_name): Same, const qualify.
(locale::_Impl::_Impl(facet**, size_t, bool)): Drop unused
parameters, add throw() specifier.
* include/bits/locale_facets.h (__timepunct::_M_name_timepunct,
messages::_M_name_messages): Const qualify.
* src/locale.cc
(locale::_S_once, locale::facet::_S_once): Define.
(locale::classic): Move initialization code...
(locale::_S_initialize_once): ...here.
(locale::_S_initialize): Call _S_initialize_once through
__gthread_once.
(locale::facet::_S_initialize_once): Initialize _S_c_locale.
(locale::facet::_S_get_c_locale): Call _S_initialize_once through
__gthread_once before returning _S_c_locale.
* src/localename.cc (locale::_Impl::_Impl(facet**, size_t, bool)):
Drop unused parameters, add throw() specifier, don't initialize
locale::facet::_S_c_locale and _S_c_name.
* config/locale/generic/messages_members.h:
Replace _S_c_locale with _S_get_c_locale().
* config/locale/gnu/c_locale.cc: Same.
* config/locale/gnu/messages_members.h: Same.
* config/locale/gnu/numeric_members.cc: Same.
* config/locale/gnu/time_members.cc: Same.
* config/os/gnu-linux/ctype_noninline.h: Same.
* include/bits/locale_facets.h: Same.
* include/bits/locale_facets.tcc: Same.
* src/codecvt.cc: Same.
* src/ctype.cc: Same.
From-SVN: r72040
2003-10-02 18:56:39 +02:00
|
|
|
static const char* const* const _S_categories;
|
2003-06-27 09:25:38 +02:00
|
|
|
|
2003-01-22 17:51:52 +01:00
|
|
|
// Number of standard categories. For C++, these categories are
|
|
|
|
// collate, ctype, monetary, numeric, time, and messages. These
|
|
|
|
// directly correspond to ISO C99 macros LC_COLLATE, LC_CTYPE,
|
|
|
|
// LC_MONETARY, LC_NUMERIC, and LC_TIME. In addition, POSIX (IEEE
|
|
|
|
// 1003.1-2001) specifies LC_MESSAGES.
|
|
|
|
// In addition to the standard categories, the underlying
|
|
|
|
// operating system is allowed to define extra LC_*
|
|
|
|
// macros. For GNU systems, the following are also valid:
|
|
|
|
// LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE, LC_MEASUREMENT,
|
|
|
|
// and LC_IDENTIFICATION.
|
2006-03-06 19:06:47 +01:00
|
|
|
enum { _S_categories_size = 6 + _GLIBCXX_NUM_CATEGORIES };
|
2003-01-22 17:51:52 +01:00
|
|
|
|
[multiple changes]
2003-10-02 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Export _S_get_c_locale instead of
_S_c_locale object.
2003-10-02 Petur Runolfsson <peturr02@ru.is>
* config/locale/generic/c_locale.cc
(category_names, locale::_S_categories): Const qualify.
* config/locale/gnu/c_locale.cc: Same.
* config/locale/generic/time_members.h (__timepunct::__timepunct):
Copy string contents before assigning to _M_name_timepunct,
qualify strcpy and strlen with std::.
* config/locale/gnu/time_members.h: Same.
* config/locale/gnu/messages_members.h (messages::messages):
Copy string contents before assigning to _M_name_messages,
qualify strcpy and strlen with std::.
* config/os/gnu-linux/ctype_noninline.h
(ctype<char>::classic_table()): Don't call locale::classic().
* include/bits/locale_classes.h
(locale::_S_categories): Const qualify.
(locale::_S_once, locale::_S_initialize_once,
locale::facet::_S_once, locale::facet::_S_initialize_once,
locale::facet::_S_get_c_locale): Declare.
(locale::_S_initialize): Don't define.
(locale::facet::_S_c_locale): Make private.
(locale::facet::_S_c_name): Same, const qualify.
(locale::_Impl::_Impl(facet**, size_t, bool)): Drop unused
parameters, add throw() specifier.
* include/bits/locale_facets.h (__timepunct::_M_name_timepunct,
messages::_M_name_messages): Const qualify.
* src/locale.cc
(locale::_S_once, locale::facet::_S_once): Define.
(locale::classic): Move initialization code...
(locale::_S_initialize_once): ...here.
(locale::_S_initialize): Call _S_initialize_once through
__gthread_once.
(locale::facet::_S_initialize_once): Initialize _S_c_locale.
(locale::facet::_S_get_c_locale): Call _S_initialize_once through
__gthread_once before returning _S_c_locale.
* src/localename.cc (locale::_Impl::_Impl(facet**, size_t, bool)):
Drop unused parameters, add throw() specifier, don't initialize
locale::facet::_S_c_locale and _S_c_name.
* config/locale/generic/messages_members.h:
Replace _S_c_locale with _S_get_c_locale().
* config/locale/gnu/c_locale.cc: Same.
* config/locale/gnu/messages_members.h: Same.
* config/locale/gnu/numeric_members.cc: Same.
* config/locale/gnu/time_members.cc: Same.
* config/os/gnu-linux/ctype_noninline.h: Same.
* include/bits/locale_facets.h: Same.
* include/bits/locale_facets.tcc: Same.
* src/codecvt.cc: Same.
* src/ctype.cc: Same.
From-SVN: r72040
2003-10-02 18:56:39 +02:00
|
|
|
#ifdef __GTHREADS
|
|
|
|
static __gthread_once_t _S_once;
|
|
|
|
#endif
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
explicit
|
2003-01-22 17:51:52 +01:00
|
|
|
locale(_Impl*) throw();
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
static void
|
[multiple changes]
2003-10-02 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Export _S_get_c_locale instead of
_S_c_locale object.
2003-10-02 Petur Runolfsson <peturr02@ru.is>
* config/locale/generic/c_locale.cc
(category_names, locale::_S_categories): Const qualify.
* config/locale/gnu/c_locale.cc: Same.
* config/locale/generic/time_members.h (__timepunct::__timepunct):
Copy string contents before assigning to _M_name_timepunct,
qualify strcpy and strlen with std::.
* config/locale/gnu/time_members.h: Same.
* config/locale/gnu/messages_members.h (messages::messages):
Copy string contents before assigning to _M_name_messages,
qualify strcpy and strlen with std::.
* config/os/gnu-linux/ctype_noninline.h
(ctype<char>::classic_table()): Don't call locale::classic().
* include/bits/locale_classes.h
(locale::_S_categories): Const qualify.
(locale::_S_once, locale::_S_initialize_once,
locale::facet::_S_once, locale::facet::_S_initialize_once,
locale::facet::_S_get_c_locale): Declare.
(locale::_S_initialize): Don't define.
(locale::facet::_S_c_locale): Make private.
(locale::facet::_S_c_name): Same, const qualify.
(locale::_Impl::_Impl(facet**, size_t, bool)): Drop unused
parameters, add throw() specifier.
* include/bits/locale_facets.h (__timepunct::_M_name_timepunct,
messages::_M_name_messages): Const qualify.
* src/locale.cc
(locale::_S_once, locale::facet::_S_once): Define.
(locale::classic): Move initialization code...
(locale::_S_initialize_once): ...here.
(locale::_S_initialize): Call _S_initialize_once through
__gthread_once.
(locale::facet::_S_initialize_once): Initialize _S_c_locale.
(locale::facet::_S_get_c_locale): Call _S_initialize_once through
__gthread_once before returning _S_c_locale.
* src/localename.cc (locale::_Impl::_Impl(facet**, size_t, bool)):
Drop unused parameters, add throw() specifier, don't initialize
locale::facet::_S_c_locale and _S_c_name.
* config/locale/generic/messages_members.h:
Replace _S_c_locale with _S_get_c_locale().
* config/locale/gnu/c_locale.cc: Same.
* config/locale/gnu/messages_members.h: Same.
* config/locale/gnu/numeric_members.cc: Same.
* config/locale/gnu/time_members.cc: Same.
* config/os/gnu-linux/ctype_noninline.h: Same.
* include/bits/locale_facets.h: Same.
* include/bits/locale_facets.tcc: Same.
* src/codecvt.cc: Same.
* src/ctype.cc: Same.
From-SVN: r72040
2003-10-02 18:56:39 +02:00
|
|
|
_S_initialize();
|
|
|
|
|
|
|
|
static void
|
2010-02-17 06:43:24 +01:00
|
|
|
_S_initialize_once() throw();
|
2003-01-22 17:51:52 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
static category
|
2003-01-22 17:51:52 +01:00
|
|
|
_S_normalize_category(category);
|
|
|
|
|
|
|
|
void
|
|
|
|
_M_coalesce(const locale& __base, const locale& __add, category __cat);
|
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
2014-12-19 19:16:39 +01:00
|
|
|
|
|
|
|
#if _GLIBCXX_USE_CXX11_ABI
|
|
|
|
static const id* const _S_twinned_facets[];
|
|
|
|
#endif
|
2003-01-22 17:51:52 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-06-27 09:25:38 +02:00
|
|
|
// 22.1.1.1.2 Class locale::facet
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Localization functionality base class.
|
2010-02-10 06:45:24 +01:00
|
|
|
* @ingroup locales
|
2003-12-20 16:51:09 +01:00
|
|
|
*
|
|
|
|
* The facet class is the base class for a localization feature, such as
|
|
|
|
* money, time, and number printing. It provides common support for facets
|
|
|
|
* and reference management.
|
|
|
|
*
|
|
|
|
* Facets may not be copied or assigned.
|
|
|
|
*/
|
2003-06-27 09:25:38 +02:00
|
|
|
class locale::facet
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
friend class locale;
|
|
|
|
friend class locale::_Impl;
|
|
|
|
|
2003-12-15 20:48:50 +01:00
|
|
|
mutable _Atomic_word _M_refcount;
|
2003-06-27 09:25:38 +02:00
|
|
|
|
|
|
|
// Contains data from the underlying "C" library for the classic locale.
|
[multiple changes]
2003-10-02 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Export _S_get_c_locale instead of
_S_c_locale object.
2003-10-02 Petur Runolfsson <peturr02@ru.is>
* config/locale/generic/c_locale.cc
(category_names, locale::_S_categories): Const qualify.
* config/locale/gnu/c_locale.cc: Same.
* config/locale/generic/time_members.h (__timepunct::__timepunct):
Copy string contents before assigning to _M_name_timepunct,
qualify strcpy and strlen with std::.
* config/locale/gnu/time_members.h: Same.
* config/locale/gnu/messages_members.h (messages::messages):
Copy string contents before assigning to _M_name_messages,
qualify strcpy and strlen with std::.
* config/os/gnu-linux/ctype_noninline.h
(ctype<char>::classic_table()): Don't call locale::classic().
* include/bits/locale_classes.h
(locale::_S_categories): Const qualify.
(locale::_S_once, locale::_S_initialize_once,
locale::facet::_S_once, locale::facet::_S_initialize_once,
locale::facet::_S_get_c_locale): Declare.
(locale::_S_initialize): Don't define.
(locale::facet::_S_c_locale): Make private.
(locale::facet::_S_c_name): Same, const qualify.
(locale::_Impl::_Impl(facet**, size_t, bool)): Drop unused
parameters, add throw() specifier.
* include/bits/locale_facets.h (__timepunct::_M_name_timepunct,
messages::_M_name_messages): Const qualify.
* src/locale.cc
(locale::_S_once, locale::facet::_S_once): Define.
(locale::classic): Move initialization code...
(locale::_S_initialize_once): ...here.
(locale::_S_initialize): Call _S_initialize_once through
__gthread_once.
(locale::facet::_S_initialize_once): Initialize _S_c_locale.
(locale::facet::_S_get_c_locale): Call _S_initialize_once through
__gthread_once before returning _S_c_locale.
* src/localename.cc (locale::_Impl::_Impl(facet**, size_t, bool)):
Drop unused parameters, add throw() specifier, don't initialize
locale::facet::_S_c_locale and _S_c_name.
* config/locale/generic/messages_members.h:
Replace _S_c_locale with _S_get_c_locale().
* config/locale/gnu/c_locale.cc: Same.
* config/locale/gnu/messages_members.h: Same.
* config/locale/gnu/numeric_members.cc: Same.
* config/locale/gnu/time_members.cc: Same.
* config/os/gnu-linux/ctype_noninline.h: Same.
* include/bits/locale_facets.h: Same.
* include/bits/locale_facets.tcc: Same.
* src/codecvt.cc: Same.
* src/ctype.cc: Same.
From-SVN: r72040
2003-10-02 18:56:39 +02:00
|
|
|
static __c_locale _S_c_locale;
|
2003-06-27 09:25:38 +02:00
|
|
|
|
|
|
|
// String literal for the name of the classic locale.
|
[multiple changes]
2003-10-02 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Export _S_get_c_locale instead of
_S_c_locale object.
2003-10-02 Petur Runolfsson <peturr02@ru.is>
* config/locale/generic/c_locale.cc
(category_names, locale::_S_categories): Const qualify.
* config/locale/gnu/c_locale.cc: Same.
* config/locale/generic/time_members.h (__timepunct::__timepunct):
Copy string contents before assigning to _M_name_timepunct,
qualify strcpy and strlen with std::.
* config/locale/gnu/time_members.h: Same.
* config/locale/gnu/messages_members.h (messages::messages):
Copy string contents before assigning to _M_name_messages,
qualify strcpy and strlen with std::.
* config/os/gnu-linux/ctype_noninline.h
(ctype<char>::classic_table()): Don't call locale::classic().
* include/bits/locale_classes.h
(locale::_S_categories): Const qualify.
(locale::_S_once, locale::_S_initialize_once,
locale::facet::_S_once, locale::facet::_S_initialize_once,
locale::facet::_S_get_c_locale): Declare.
(locale::_S_initialize): Don't define.
(locale::facet::_S_c_locale): Make private.
(locale::facet::_S_c_name): Same, const qualify.
(locale::_Impl::_Impl(facet**, size_t, bool)): Drop unused
parameters, add throw() specifier.
* include/bits/locale_facets.h (__timepunct::_M_name_timepunct,
messages::_M_name_messages): Const qualify.
* src/locale.cc
(locale::_S_once, locale::facet::_S_once): Define.
(locale::classic): Move initialization code...
(locale::_S_initialize_once): ...here.
(locale::_S_initialize): Call _S_initialize_once through
__gthread_once.
(locale::facet::_S_initialize_once): Initialize _S_c_locale.
(locale::facet::_S_get_c_locale): Call _S_initialize_once through
__gthread_once before returning _S_c_locale.
* src/localename.cc (locale::_Impl::_Impl(facet**, size_t, bool)):
Drop unused parameters, add throw() specifier, don't initialize
locale::facet::_S_c_locale and _S_c_name.
* config/locale/generic/messages_members.h:
Replace _S_c_locale with _S_get_c_locale().
* config/locale/gnu/c_locale.cc: Same.
* config/locale/gnu/messages_members.h: Same.
* config/locale/gnu/numeric_members.cc: Same.
* config/locale/gnu/time_members.cc: Same.
* config/os/gnu-linux/ctype_noninline.h: Same.
* include/bits/locale_facets.h: Same.
* include/bits/locale_facets.tcc: Same.
* src/codecvt.cc: Same.
* src/ctype.cc: Same.
From-SVN: r72040
2003-10-02 18:56:39 +02:00
|
|
|
static const char _S_c_name[2];
|
|
|
|
|
|
|
|
#ifdef __GTHREADS
|
2004-02-08 05:46:42 +01:00
|
|
|
static __gthread_once_t _S_once;
|
[multiple changes]
2003-10-02 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Export _S_get_c_locale instead of
_S_c_locale object.
2003-10-02 Petur Runolfsson <peturr02@ru.is>
* config/locale/generic/c_locale.cc
(category_names, locale::_S_categories): Const qualify.
* config/locale/gnu/c_locale.cc: Same.
* config/locale/generic/time_members.h (__timepunct::__timepunct):
Copy string contents before assigning to _M_name_timepunct,
qualify strcpy and strlen with std::.
* config/locale/gnu/time_members.h: Same.
* config/locale/gnu/messages_members.h (messages::messages):
Copy string contents before assigning to _M_name_messages,
qualify strcpy and strlen with std::.
* config/os/gnu-linux/ctype_noninline.h
(ctype<char>::classic_table()): Don't call locale::classic().
* include/bits/locale_classes.h
(locale::_S_categories): Const qualify.
(locale::_S_once, locale::_S_initialize_once,
locale::facet::_S_once, locale::facet::_S_initialize_once,
locale::facet::_S_get_c_locale): Declare.
(locale::_S_initialize): Don't define.
(locale::facet::_S_c_locale): Make private.
(locale::facet::_S_c_name): Same, const qualify.
(locale::_Impl::_Impl(facet**, size_t, bool)): Drop unused
parameters, add throw() specifier.
* include/bits/locale_facets.h (__timepunct::_M_name_timepunct,
messages::_M_name_messages): Const qualify.
* src/locale.cc
(locale::_S_once, locale::facet::_S_once): Define.
(locale::classic): Move initialization code...
(locale::_S_initialize_once): ...here.
(locale::_S_initialize): Call _S_initialize_once through
__gthread_once.
(locale::facet::_S_initialize_once): Initialize _S_c_locale.
(locale::facet::_S_get_c_locale): Call _S_initialize_once through
__gthread_once before returning _S_c_locale.
* src/localename.cc (locale::_Impl::_Impl(facet**, size_t, bool)):
Drop unused parameters, add throw() specifier, don't initialize
locale::facet::_S_c_locale and _S_c_name.
* config/locale/generic/messages_members.h:
Replace _S_c_locale with _S_get_c_locale().
* config/locale/gnu/c_locale.cc: Same.
* config/locale/gnu/messages_members.h: Same.
* config/locale/gnu/numeric_members.cc: Same.
* config/locale/gnu/time_members.cc: Same.
* config/os/gnu-linux/ctype_noninline.h: Same.
* include/bits/locale_facets.h: Same.
* include/bits/locale_facets.tcc: Same.
* src/codecvt.cc: Same.
* src/ctype.cc: Same.
From-SVN: r72040
2003-10-02 18:56:39 +02:00
|
|
|
#endif
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
static void
|
[multiple changes]
2003-10-02 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Export _S_get_c_locale instead of
_S_c_locale object.
2003-10-02 Petur Runolfsson <peturr02@ru.is>
* config/locale/generic/c_locale.cc
(category_names, locale::_S_categories): Const qualify.
* config/locale/gnu/c_locale.cc: Same.
* config/locale/generic/time_members.h (__timepunct::__timepunct):
Copy string contents before assigning to _M_name_timepunct,
qualify strcpy and strlen with std::.
* config/locale/gnu/time_members.h: Same.
* config/locale/gnu/messages_members.h (messages::messages):
Copy string contents before assigning to _M_name_messages,
qualify strcpy and strlen with std::.
* config/os/gnu-linux/ctype_noninline.h
(ctype<char>::classic_table()): Don't call locale::classic().
* include/bits/locale_classes.h
(locale::_S_categories): Const qualify.
(locale::_S_once, locale::_S_initialize_once,
locale::facet::_S_once, locale::facet::_S_initialize_once,
locale::facet::_S_get_c_locale): Declare.
(locale::_S_initialize): Don't define.
(locale::facet::_S_c_locale): Make private.
(locale::facet::_S_c_name): Same, const qualify.
(locale::_Impl::_Impl(facet**, size_t, bool)): Drop unused
parameters, add throw() specifier.
* include/bits/locale_facets.h (__timepunct::_M_name_timepunct,
messages::_M_name_messages): Const qualify.
* src/locale.cc
(locale::_S_once, locale::facet::_S_once): Define.
(locale::classic): Move initialization code...
(locale::_S_initialize_once): ...here.
(locale::_S_initialize): Call _S_initialize_once through
__gthread_once.
(locale::facet::_S_initialize_once): Initialize _S_c_locale.
(locale::facet::_S_get_c_locale): Call _S_initialize_once through
__gthread_once before returning _S_c_locale.
* src/localename.cc (locale::_Impl::_Impl(facet**, size_t, bool)):
Drop unused parameters, add throw() specifier, don't initialize
locale::facet::_S_c_locale and _S_c_name.
* config/locale/generic/messages_members.h:
Replace _S_c_locale with _S_get_c_locale().
* config/locale/gnu/c_locale.cc: Same.
* config/locale/gnu/messages_members.h: Same.
* config/locale/gnu/numeric_members.cc: Same.
* config/locale/gnu/time_members.cc: Same.
* config/os/gnu-linux/ctype_noninline.h: Same.
* include/bits/locale_facets.h: Same.
* include/bits/locale_facets.tcc: Same.
* src/codecvt.cc: Same.
* src/ctype.cc: Same.
From-SVN: r72040
2003-10-02 18:56:39 +02:00
|
|
|
_S_initialize_once();
|
|
|
|
|
|
|
|
protected:
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Facet constructor.
|
|
|
|
*
|
|
|
|
* This is the constructor provided by the standard. If refs is 0, the
|
|
|
|
* facet is destroyed when the last referencing locale is destroyed.
|
|
|
|
* Otherwise the facet will never be destroyed.
|
|
|
|
*
|
2011-08-07 09:27:06 +02:00
|
|
|
* @param __refs The initial value for reference count.
|
2003-12-20 16:51:09 +01:00
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
explicit
|
2003-12-15 20:48:50 +01:00
|
|
|
facet(size_t __refs = 0) throw() : _M_refcount(__refs ? 1 : 0)
|
2003-06-27 09:25:38 +02:00
|
|
|
{ }
|
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/// Facet destructor.
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual
|
2003-06-27 09:25:38 +02:00
|
|
|
~facet();
|
|
|
|
|
|
|
|
static void
|
2004-02-08 05:46:42 +01:00
|
|
|
_S_create_c_locale(__c_locale& __cloc, const char* __s,
|
2003-06-27 09:25:38 +02:00
|
|
|
__c_locale __old = 0);
|
|
|
|
|
|
|
|
static __c_locale
|
2010-02-17 06:43:24 +01:00
|
|
|
_S_clone_c_locale(__c_locale& __cloc) throw();
|
2003-06-27 09:25:38 +02:00
|
|
|
|
|
|
|
static void
|
|
|
|
_S_destroy_c_locale(__c_locale& __cloc);
|
|
|
|
|
2009-05-19 20:20:47 +02:00
|
|
|
static __c_locale
|
|
|
|
_S_lc_ctype_c_locale(__c_locale __cloc, const char* __s);
|
|
|
|
|
2003-10-03 01:06:13 +02:00
|
|
|
// Returns data from the underlying "C" library data for the
|
|
|
|
// classic locale.
|
[multiple changes]
2003-10-02 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Export _S_get_c_locale instead of
_S_c_locale object.
2003-10-02 Petur Runolfsson <peturr02@ru.is>
* config/locale/generic/c_locale.cc
(category_names, locale::_S_categories): Const qualify.
* config/locale/gnu/c_locale.cc: Same.
* config/locale/generic/time_members.h (__timepunct::__timepunct):
Copy string contents before assigning to _M_name_timepunct,
qualify strcpy and strlen with std::.
* config/locale/gnu/time_members.h: Same.
* config/locale/gnu/messages_members.h (messages::messages):
Copy string contents before assigning to _M_name_messages,
qualify strcpy and strlen with std::.
* config/os/gnu-linux/ctype_noninline.h
(ctype<char>::classic_table()): Don't call locale::classic().
* include/bits/locale_classes.h
(locale::_S_categories): Const qualify.
(locale::_S_once, locale::_S_initialize_once,
locale::facet::_S_once, locale::facet::_S_initialize_once,
locale::facet::_S_get_c_locale): Declare.
(locale::_S_initialize): Don't define.
(locale::facet::_S_c_locale): Make private.
(locale::facet::_S_c_name): Same, const qualify.
(locale::_Impl::_Impl(facet**, size_t, bool)): Drop unused
parameters, add throw() specifier.
* include/bits/locale_facets.h (__timepunct::_M_name_timepunct,
messages::_M_name_messages): Const qualify.
* src/locale.cc
(locale::_S_once, locale::facet::_S_once): Define.
(locale::classic): Move initialization code...
(locale::_S_initialize_once): ...here.
(locale::_S_initialize): Call _S_initialize_once through
__gthread_once.
(locale::facet::_S_initialize_once): Initialize _S_c_locale.
(locale::facet::_S_get_c_locale): Call _S_initialize_once through
__gthread_once before returning _S_c_locale.
* src/localename.cc (locale::_Impl::_Impl(facet**, size_t, bool)):
Drop unused parameters, add throw() specifier, don't initialize
locale::facet::_S_c_locale and _S_c_name.
* config/locale/generic/messages_members.h:
Replace _S_c_locale with _S_get_c_locale().
* config/locale/gnu/c_locale.cc: Same.
* config/locale/gnu/messages_members.h: Same.
* config/locale/gnu/numeric_members.cc: Same.
* config/locale/gnu/time_members.cc: Same.
* config/os/gnu-linux/ctype_noninline.h: Same.
* include/bits/locale_facets.h: Same.
* include/bits/locale_facets.tcc: Same.
* src/codecvt.cc: Same.
* src/ctype.cc: Same.
From-SVN: r72040
2003-10-02 18:56:39 +02:00
|
|
|
static __c_locale
|
|
|
|
_S_get_c_locale();
|
|
|
|
|
condition_variable.cc (condition_variable, [...]): Mark throw()
* src/condition_variable.cc (condition_variable,
condition_variable_any constructors): Mark throw()
* src/hash.cc (operator() for long double, string, and wstring): Mark
throw ().
* src/strstream.cc (strstreambuf constructors, freeze, str, pcount,
_M_setup, rdbuf, str): Mark throw ().
* src/chrono.cc (new): Mark throw ().
* include/std/system_error (system_category, generic_category): Mark
throw () and const.
* include/std/chrono (now): Mark throw ().
* include/std/condition_variable (condition_variable,
~condition_variable, condition_variable_any,
~condition_variable_any): Mark throw ().
* include/std/mutex (mutex): Mark throw ().
* include/bits/stl_list.h (swap, transfer, reverse, hook, unhook): Mark
throw.
* include/bits/functional_hash.h (operator() on size_t): Mark pure and throw ().
* include/bits/locale_facets.tcc (__verify_grouping): Mark pure.
* include/bits/locale_classes.h (_S_initialize_once,
_S_clone_c_locale): Mark throw ().
(_S_get_c_name): Mark const and throw ().
(_M_id, _M_compare, _M_transform, _M_compare, _M_transform): Mark throw ().
* include/bits/locale_facets.h (__convert_to_v explicit instances):
Mark throw ().
(_M_convert_to_wmask, _M_initialize_ctype, _S_format_float): Mark throw ().
* include/bits/ios_base.h (_M_dispose_callbacks, _M_init, imbue,
ios_base): Mark throw ()
* include/bits/locale_facets_nonio.h (_M_put): Mark throw.
* include/backward/strstream (strstreambuf constructors): Mark throw ().
(str, freeze, _M_setupf): Mark throw ().
(pcount): Mark pure and throw ().
(rdbuf): Mark const and throw ().
From-SVN: r146328
2009-04-18 23:19:18 +02:00
|
|
|
_GLIBCXX_CONST static const char*
|
2010-02-17 06:43:24 +01:00
|
|
|
_S_get_c_name() throw();
|
2003-10-03 01:06:13 +02:00
|
|
|
|
2015-05-01 18:50:31 +02:00
|
|
|
#if __cplusplus < 201103L
|
|
|
|
private:
|
|
|
|
facet(const facet&); // Not defined.
|
|
|
|
|
|
|
|
facet&
|
|
|
|
operator=(const facet&); // Not defined.
|
|
|
|
#else
|
|
|
|
facet(const facet&) = delete;
|
|
|
|
|
|
|
|
facet&
|
|
|
|
operator=(const facet&) = delete;
|
|
|
|
#endif
|
|
|
|
|
2003-06-27 09:25:38 +02:00
|
|
|
private:
|
2007-04-25 11:25:05 +02:00
|
|
|
void
|
2003-06-27 09:25:38 +02:00
|
|
|
_M_add_reference() const throw()
|
2006-05-24 18:37:42 +02:00
|
|
|
{ __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); }
|
2003-06-27 09:25:38 +02:00
|
|
|
|
2007-04-25 11:25:05 +02:00
|
|
|
void
|
2003-06-27 09:25:38 +02:00
|
|
|
_M_remove_reference() const throw()
|
|
|
|
{
|
2010-08-13 00:56:59 +02:00
|
|
|
// Be race-detector-friendly. For more info see bits/c++config.
|
2010-08-13 13:48:34 +02:00
|
|
|
_GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount);
|
2006-05-24 18:37:42 +02:00
|
|
|
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1) == 1)
|
2003-06-27 09:25:38 +02:00
|
|
|
{
|
2010-08-13 13:48:34 +02:00
|
|
|
_GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount);
|
2009-02-04 00:44:53 +01:00
|
|
|
__try
|
2004-02-08 05:46:42 +01:00
|
|
|
{ delete this; }
|
2009-02-04 00:44:53 +01:00
|
|
|
__catch(...)
|
2003-06-27 09:25:38 +02:00
|
|
|
{ }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
2014-12-19 19:16:39 +01:00
|
|
|
class __shim;
|
|
|
|
|
|
|
|
const facet* _M_sso_shim(const id*) const;
|
|
|
|
const facet* _M_cow_shim(const id*) const;
|
2003-06-27 09:25:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 22.1.1.1.3 Class locale::id
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Facet ID class.
|
2010-02-10 06:45:24 +01:00
|
|
|
* @ingroup locales
|
2003-12-20 16:51:09 +01:00
|
|
|
*
|
|
|
|
* The ID class provides facets with an index used to identify them.
|
|
|
|
* Every facet class must define a public static member locale::id, or be
|
|
|
|
* derived from a facet that provides this member, otherwise the facet
|
|
|
|
* cannot be used in a locale. The locale::id ensures that each class
|
|
|
|
* type gets a unique identifier.
|
|
|
|
*/
|
2003-06-27 09:25:38 +02:00
|
|
|
class locale::id
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
friend class locale;
|
|
|
|
friend class locale::_Impl;
|
|
|
|
|
|
|
|
template<typename _Facet>
|
2004-02-08 05:46:42 +01:00
|
|
|
friend const _Facet&
|
2003-06-27 09:25:38 +02:00
|
|
|
use_facet(const locale&);
|
|
|
|
|
|
|
|
template<typename _Facet>
|
2004-02-08 05:46:42 +01:00
|
|
|
friend bool
|
2010-02-17 06:43:24 +01:00
|
|
|
has_facet(const locale&) throw();
|
2003-06-27 09:25:38 +02:00
|
|
|
|
|
|
|
// NB: There is no accessor for _M_index because it may be used
|
|
|
|
// before the constructor is run; the effect of calling a member
|
|
|
|
// function (even an inline) would be undefined.
|
2004-02-08 05:46:42 +01:00
|
|
|
mutable size_t _M_index;
|
2003-06-27 09:25:38 +02:00
|
|
|
|
|
|
|
// Last id number assigned.
|
2004-02-08 05:46:42 +01:00
|
|
|
static _Atomic_word _S_refcount;
|
2003-06-27 09:25:38 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
2003-06-27 09:25:38 +02:00
|
|
|
operator=(const id&); // Not defined.
|
|
|
|
|
|
|
|
id(const id&); // Not defined.
|
|
|
|
|
|
|
|
public:
|
|
|
|
// NB: This class is always a static data member, and thus can be
|
|
|
|
// counted on to be zero-initialized.
|
2003-12-20 16:51:09 +01:00
|
|
|
/// Constructor.
|
2003-06-27 09:25:38 +02:00
|
|
|
id() { }
|
|
|
|
|
2003-10-09 23:17:11 +02:00
|
|
|
size_t
|
2010-02-17 06:43:24 +01:00
|
|
|
_M_id() const throw();
|
2003-06-27 09:25:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Implementation object for locale.
|
2003-01-22 17:51:52 +01:00
|
|
|
class locale::_Impl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Friends.
|
|
|
|
friend class locale;
|
|
|
|
friend class locale::facet;
|
|
|
|
|
2003-06-27 09:25:38 +02:00
|
|
|
template<typename _Facet>
|
2004-02-08 05:46:42 +01:00
|
|
|
friend bool
|
2003-06-27 09:25:38 +02:00
|
|
|
has_facet(const locale&) throw();
|
|
|
|
|
2003-01-22 17:51:52 +01:00
|
|
|
template<typename _Facet>
|
2004-02-08 05:46:42 +01:00
|
|
|
friend const _Facet&
|
2003-01-22 17:51:52 +01:00
|
|
|
use_facet(const locale&);
|
|
|
|
|
2003-06-27 09:25:38 +02:00
|
|
|
template<typename _Cache>
|
2003-07-10 08:21:13 +02:00
|
|
|
friend struct __use_cache;
|
2003-01-22 17:51:52 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Data Members.
|
2003-12-15 20:48:50 +01:00
|
|
|
_Atomic_word _M_refcount;
|
2003-02-01 17:37:20 +01:00
|
|
|
const facet** _M_facets;
|
2004-02-08 05:46:42 +01:00
|
|
|
size_t _M_facets_size;
|
2003-06-27 09:25:38 +02:00
|
|
|
const facet** _M_caches;
|
2004-02-08 05:46:42 +01:00
|
|
|
char** _M_names;
|
|
|
|
static const locale::id* const _S_id_ctype[];
|
|
|
|
static const locale::id* const _S_id_numeric[];
|
|
|
|
static const locale::id* const _S_id_collate[];
|
|
|
|
static const locale::id* const _S_id_time[];
|
|
|
|
static const locale::id* const _S_id_monetary[];
|
|
|
|
static const locale::id* const _S_id_messages[];
|
2003-01-22 17:51:52 +01:00
|
|
|
static const locale::id* const* const _S_facet_categories[];
|
|
|
|
|
2007-04-25 11:25:05 +02:00
|
|
|
void
|
2003-01-22 17:51:52 +01:00
|
|
|
_M_add_reference() throw()
|
2006-05-24 18:37:42 +02:00
|
|
|
{ __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); }
|
2003-01-22 17:51:52 +01:00
|
|
|
|
2007-04-25 11:25:05 +02:00
|
|
|
void
|
2003-01-22 17:51:52 +01:00
|
|
|
_M_remove_reference() throw()
|
|
|
|
{
|
2010-08-13 00:56:59 +02:00
|
|
|
// Be race-detector-friendly. For more info see bits/c++config.
|
2010-08-13 13:48:34 +02:00
|
|
|
_GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount);
|
2006-05-24 18:37:42 +02:00
|
|
|
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1) == 1)
|
2003-01-22 17:51:52 +01:00
|
|
|
{
|
2010-08-13 13:48:34 +02:00
|
|
|
_GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount);
|
2009-02-04 00:44:53 +01:00
|
|
|
__try
|
2004-02-08 05:46:42 +01:00
|
|
|
{ delete this; }
|
2009-02-04 00:44:53 +01:00
|
|
|
__catch(...)
|
2003-01-22 17:51:52 +01:00
|
|
|
{ }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_Impl(const _Impl&, size_t);
|
|
|
|
_Impl(const char*, size_t);
|
[multiple changes]
2003-10-02 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Export _S_get_c_locale instead of
_S_c_locale object.
2003-10-02 Petur Runolfsson <peturr02@ru.is>
* config/locale/generic/c_locale.cc
(category_names, locale::_S_categories): Const qualify.
* config/locale/gnu/c_locale.cc: Same.
* config/locale/generic/time_members.h (__timepunct::__timepunct):
Copy string contents before assigning to _M_name_timepunct,
qualify strcpy and strlen with std::.
* config/locale/gnu/time_members.h: Same.
* config/locale/gnu/messages_members.h (messages::messages):
Copy string contents before assigning to _M_name_messages,
qualify strcpy and strlen with std::.
* config/os/gnu-linux/ctype_noninline.h
(ctype<char>::classic_table()): Don't call locale::classic().
* include/bits/locale_classes.h
(locale::_S_categories): Const qualify.
(locale::_S_once, locale::_S_initialize_once,
locale::facet::_S_once, locale::facet::_S_initialize_once,
locale::facet::_S_get_c_locale): Declare.
(locale::_S_initialize): Don't define.
(locale::facet::_S_c_locale): Make private.
(locale::facet::_S_c_name): Same, const qualify.
(locale::_Impl::_Impl(facet**, size_t, bool)): Drop unused
parameters, add throw() specifier.
* include/bits/locale_facets.h (__timepunct::_M_name_timepunct,
messages::_M_name_messages): Const qualify.
* src/locale.cc
(locale::_S_once, locale::facet::_S_once): Define.
(locale::classic): Move initialization code...
(locale::_S_initialize_once): ...here.
(locale::_S_initialize): Call _S_initialize_once through
__gthread_once.
(locale::facet::_S_initialize_once): Initialize _S_c_locale.
(locale::facet::_S_get_c_locale): Call _S_initialize_once through
__gthread_once before returning _S_c_locale.
* src/localename.cc (locale::_Impl::_Impl(facet**, size_t, bool)):
Drop unused parameters, add throw() specifier, don't initialize
locale::facet::_S_c_locale and _S_c_name.
* config/locale/generic/messages_members.h:
Replace _S_c_locale with _S_get_c_locale().
* config/locale/gnu/c_locale.cc: Same.
* config/locale/gnu/messages_members.h: Same.
* config/locale/gnu/numeric_members.cc: Same.
* config/locale/gnu/time_members.cc: Same.
* config/os/gnu-linux/ctype_noninline.h: Same.
* include/bits/locale_facets.h: Same.
* include/bits/locale_facets.tcc: Same.
* src/codecvt.cc: Same.
* src/ctype.cc: Same.
From-SVN: r72040
2003-10-02 18:56:39 +02:00
|
|
|
_Impl(size_t) throw();
|
2003-01-22 17:51:52 +01:00
|
|
|
|
|
|
|
~_Impl() throw();
|
|
|
|
|
|
|
|
_Impl(const _Impl&); // Not defined.
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
2003-01-22 17:51:52 +01:00
|
|
|
operator=(const _Impl&); // Not defined.
|
|
|
|
|
2007-04-25 11:25:05 +02:00
|
|
|
bool
|
2003-01-22 17:51:52 +01:00
|
|
|
_M_check_same_name()
|
|
|
|
{
|
|
|
|
bool __ret = true;
|
Optimize locale::_M_impl->_M_names for the most common cases...
2004-05-03 Paolo Carlini <pcarlini@suse.de>
Optimize locale::_M_impl->_M_names for the most common cases:
!_M_names[0] means unnamed; !_M_names[1] means all the categories
the same name (_M_names[0] && _M_names[1] means that the full set
of _M_names must be processed, the general case).
* include/bits/locale_classes.h (locale::_Impl::_M_check_same_name):
Tweak, saving work when !_M_names[1].
(locale::locale(const locale&, _Facet*): Simplify: now just setting
_M_names[0] = 0 means unnamed.
* src/locale.cc (locale::operator==): Deal first with the common,
easy cases, otherwise fall back to locale::name().
(locale::name()): Tweak, if !_M_names[0] just return "*".
(locale::_Impl::_Impl(const _Impl&, size_t): Tweak, early stop
copying __imp._M_names if !__imp._M_names[0] or !__imp._M_names[1].
* src/locale_init.cc (locale::_Impl::_Impl(size_t)): Tweak.
* src/localename.cc (locale::_Impl::_Impl(const char*, size_t):
Simplify when !std::strchr, just updating _M_names[0]; clean up.
(locale::_Impl::_M_replace_categories): When !_M_names[1] prepare
for the general case (full set of names), then do the usual work;
clean up.
* src/locale.cc (locale::name()): Reserve space in __ret.
* src/locale_init.cc (locale::global(const locale&)): Save
the name in a temporary.
* src/localename.cc (locale::locale(const char*)): Reserve space
in __str.
From-SVN: r81430
2004-05-03 14:14:07 +02:00
|
|
|
if (_M_names[1])
|
|
|
|
// We must actually compare all the _M_names: can be all equal!
|
|
|
|
for (size_t __i = 0; __ret && __i < _S_categories_size - 1; ++__i)
|
2007-05-11 20:58:08 +02:00
|
|
|
__ret = __builtin_strcmp(_M_names[__i], _M_names[__i + 1]) == 0;
|
2003-01-22 17:51:52 +01:00
|
|
|
return __ret;
|
|
|
|
}
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
2003-01-22 17:51:52 +01:00
|
|
|
_M_replace_categories(const _Impl*, category);
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
2003-01-22 17:51:52 +01:00
|
|
|
_M_replace_category(const _Impl*, const locale::id* const*);
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
2003-01-22 17:51:52 +01:00
|
|
|
_M_replace_facet(const _Impl*, const locale::id*);
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
2003-02-01 17:37:20 +01:00
|
|
|
_M_install_facet(const locale::id*, const facet*);
|
2003-01-22 17:51:52 +01:00
|
|
|
|
|
|
|
template<typename _Facet>
|
2007-04-25 11:25:05 +02:00
|
|
|
void
|
2003-01-22 17:51:52 +01:00
|
|
|
_M_init_facet(_Facet* __facet)
|
2003-06-27 09:25:38 +02:00
|
|
|
{ _M_install_facet(&_Facet::id, __facet); }
|
|
|
|
|
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
2014-12-19 19:16:39 +01:00
|
|
|
template<typename _Facet>
|
|
|
|
void
|
|
|
|
_M_init_facet_unchecked(_Facet* __facet)
|
|
|
|
{
|
|
|
|
__facet->_M_add_reference();
|
|
|
|
_M_facets[_Facet::id._M_id()] = __facet;
|
|
|
|
}
|
|
|
|
|
2003-06-27 09:25:38 +02:00
|
|
|
void
|
2005-10-11 08:19:13 +02:00
|
|
|
_M_install_cache(const facet*, size_t);
|
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
2014-12-19 19:16:39 +01:00
|
|
|
|
|
|
|
void _M_init_extra(facet**);
|
|
|
|
void _M_init_extra(void*, void*, const char*, const char*);
|
2003-01-22 17:51:52 +01:00
|
|
|
};
|
|
|
|
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Facet for localized string comparison.
|
|
|
|
*
|
|
|
|
* This facet encapsulates the code to compare strings in a localized
|
|
|
|
* manner.
|
|
|
|
*
|
|
|
|
* The collate template uses protected virtual functions to provide
|
|
|
|
* the actual results. The public accessors forward the call to
|
|
|
|
* the virtual functions. These virtual functions are hooks for
|
|
|
|
* developers to implement the behavior they require from the
|
|
|
|
* collate facet.
|
|
|
|
*/
|
|
|
|
template<typename _CharT>
|
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
2014-12-19 19:16:39 +01:00
|
|
|
class _GLIBCXX_NAMESPACE_CXX11 collate : public locale::facet
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Types:
|
|
|
|
//@{
|
|
|
|
/// Public typedefs
|
|
|
|
typedef _CharT char_type;
|
|
|
|
typedef basic_string<_CharT> string_type;
|
|
|
|
//@}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// Underlying "C" library locale information saved from
|
|
|
|
// initialization, needed by collate_byname as well.
|
|
|
|
__c_locale _M_c_locale_collate;
|
|
|
|
|
|
|
|
public:
|
|
|
|
/// Numpunct facet id.
|
|
|
|
static locale::id id;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Constructor performs initialization.
|
|
|
|
*
|
|
|
|
* This is the constructor provided by the standard.
|
|
|
|
*
|
2011-08-07 09:27:06 +02:00
|
|
|
* @param __refs Passed to the base facet class.
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
*/
|
|
|
|
explicit
|
|
|
|
collate(size_t __refs = 0)
|
|
|
|
: facet(__refs), _M_c_locale_collate(_S_get_c_locale())
|
|
|
|
{ }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Internal constructor. Not for general use.
|
|
|
|
*
|
|
|
|
* This is a constructor for use by the library itself to set up new
|
|
|
|
* locales.
|
|
|
|
*
|
2011-08-07 09:27:06 +02:00
|
|
|
* @param __cloc The C locale.
|
|
|
|
* @param __refs Passed to the base facet class.
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
*/
|
|
|
|
explicit
|
|
|
|
collate(__c_locale __cloc, size_t __refs = 0)
|
|
|
|
: facet(__refs), _M_c_locale_collate(_S_clone_c_locale(__cloc))
|
|
|
|
{ }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compare two strings.
|
|
|
|
*
|
|
|
|
* This function compares two strings and returns the result by calling
|
|
|
|
* collate::do_compare().
|
|
|
|
*
|
2011-08-07 09:27:06 +02:00
|
|
|
* @param __lo1 Start of string 1.
|
|
|
|
* @param __hi1 End of string 1.
|
|
|
|
* @param __lo2 Start of string 2.
|
|
|
|
* @param __hi2 End of string 2.
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
* @return 1 if string1 > string2, -1 if string1 < string2, else 0.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
compare(const _CharT* __lo1, const _CharT* __hi1,
|
|
|
|
const _CharT* __lo2, const _CharT* __hi2) const
|
|
|
|
{ return this->do_compare(__lo1, __hi1, __lo2, __hi2); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Transform string to comparable form.
|
|
|
|
*
|
|
|
|
* This function is a wrapper for strxfrm functionality. It takes the
|
|
|
|
* input string and returns a modified string that can be directly
|
2010-02-04 19:20:34 +01:00
|
|
|
* compared to other transformed strings. In the C locale, this
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
* function just returns a copy of the input string. In some other
|
|
|
|
* locales, it may replace two chars with one, change a char for
|
|
|
|
* another, etc. It does so by returning collate::do_transform().
|
|
|
|
*
|
2011-08-07 09:27:06 +02:00
|
|
|
* @param __lo Start of string.
|
|
|
|
* @param __hi End of string.
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
* @return Transformed string_type.
|
|
|
|
*/
|
|
|
|
string_type
|
|
|
|
transform(const _CharT* __lo, const _CharT* __hi) const
|
|
|
|
{ return this->do_transform(__lo, __hi); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Return hash of a string.
|
|
|
|
*
|
|
|
|
* This function computes and returns a hash on the input string. It
|
|
|
|
* does so by returning collate::do_hash().
|
|
|
|
*
|
2011-08-07 09:27:06 +02:00
|
|
|
* @param __lo Start of string.
|
|
|
|
* @param __hi End of string.
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
* @return Hash value.
|
|
|
|
*/
|
|
|
|
long
|
|
|
|
hash(const _CharT* __lo, const _CharT* __hi) const
|
|
|
|
{ return this->do_hash(__lo, __hi); }
|
|
|
|
|
|
|
|
// Used to abstract out _CharT bits in virtual member functions, below.
|
|
|
|
int
|
2010-02-17 06:43:24 +01:00
|
|
|
_M_compare(const _CharT*, const _CharT*) const throw();
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
|
|
|
|
size_t
|
2010-02-17 06:43:24 +01:00
|
|
|
_M_transform(_CharT*, const _CharT*, size_t) const throw();
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
/// Destructor.
|
|
|
|
virtual
|
|
|
|
~collate()
|
|
|
|
{ _S_destroy_c_locale(_M_c_locale_collate); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compare two strings.
|
|
|
|
*
|
|
|
|
* This function is a hook for derived classes to change the value
|
|
|
|
* returned. @see compare().
|
|
|
|
*
|
2011-08-07 09:27:06 +02:00
|
|
|
* @param __lo1 Start of string 1.
|
|
|
|
* @param __hi1 End of string 1.
|
|
|
|
* @param __lo2 Start of string 2.
|
|
|
|
* @param __hi2 End of string 2.
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
* @return 1 if string1 > string2, -1 if string1 < string2, else 0.
|
|
|
|
*/
|
|
|
|
virtual int
|
|
|
|
do_compare(const _CharT* __lo1, const _CharT* __hi1,
|
|
|
|
const _CharT* __lo2, const _CharT* __hi2) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Transform string to comparable form.
|
|
|
|
*
|
|
|
|
* This function is a hook for derived classes to change the value
|
|
|
|
* returned.
|
|
|
|
*
|
2011-08-07 09:27:06 +02:00
|
|
|
* @param __lo Start.
|
|
|
|
* @param __hi End.
|
|
|
|
* @return transformed string.
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
*/
|
|
|
|
virtual string_type
|
|
|
|
do_transform(const _CharT* __lo, const _CharT* __hi) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Return hash of a string.
|
|
|
|
*
|
|
|
|
* This function computes and returns a hash on the input string. This
|
|
|
|
* function is a hook for derived classes to change the value returned.
|
|
|
|
*
|
2011-08-07 09:27:06 +02:00
|
|
|
* @param __lo Start of string.
|
|
|
|
* @param __hi End of string.
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
* @return Hash value.
|
|
|
|
*/
|
|
|
|
virtual long
|
|
|
|
do_hash(const _CharT* __lo, const _CharT* __hi) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename _CharT>
|
|
|
|
locale::id collate<_CharT>::id;
|
|
|
|
|
|
|
|
// Specializations.
|
|
|
|
template<>
|
|
|
|
int
|
2010-02-17 06:43:24 +01:00
|
|
|
collate<char>::_M_compare(const char*, const char*) const throw();
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
|
|
|
|
template<>
|
|
|
|
size_t
|
2010-02-17 06:43:24 +01:00
|
|
|
collate<char>::_M_transform(char*, const char*, size_t) const throw();
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
|
|
|
|
#ifdef _GLIBCXX_USE_WCHAR_T
|
|
|
|
template<>
|
|
|
|
int
|
2010-02-17 06:43:24 +01:00
|
|
|
collate<wchar_t>::_M_compare(const wchar_t*, const wchar_t*) const throw();
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
|
|
|
|
template<>
|
|
|
|
size_t
|
2010-02-17 06:43:24 +01:00
|
|
|
collate<wchar_t>::_M_transform(wchar_t*, const wchar_t*, size_t) const throw();
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
#endif
|
|
|
|
|
2008-03-26 07:27:35 +01:00
|
|
|
/// class collate_byname [22.2.4.2].
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
template<typename _CharT>
|
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
2014-12-19 19:16:39 +01:00
|
|
|
class _GLIBCXX_NAMESPACE_CXX11 collate_byname : public collate<_CharT>
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
//@{
|
|
|
|
/// Public typedefs
|
|
|
|
typedef _CharT char_type;
|
|
|
|
typedef basic_string<_CharT> string_type;
|
|
|
|
//@}
|
|
|
|
|
|
|
|
explicit
|
|
|
|
collate_byname(const char* __s, size_t __refs = 0)
|
|
|
|
: collate<_CharT>(__refs)
|
|
|
|
{
|
2007-05-11 20:58:08 +02:00
|
|
|
if (__builtin_strcmp(__s, "C") != 0
|
|
|
|
&& __builtin_strcmp(__s, "POSIX") != 0)
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
{
|
|
|
|
this->_S_destroy_c_locale(this->_M_c_locale_collate);
|
|
|
|
this->_S_create_c_locale(this->_M_c_locale_collate, __s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-20 12:50:51 +01:00
|
|
|
#if __cplusplus >= 201103L
|
|
|
|
explicit
|
|
|
|
collate_byname(const string& __s, size_t __refs = 0)
|
|
|
|
: collate_byname(__s.c_str(), __refs) { }
|
|
|
|
#endif
|
|
|
|
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
protected:
|
|
|
|
virtual
|
|
|
|
~collate_byname() { }
|
|
|
|
};
|
|
|
|
|
PR libstdc++/36104 part four
2011-01-30 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/36104 part four
* include/bits/c++config (_GLIBCXX_STD): Remove.
(_GLIBCXX_STD_D, _GLIBCXX_PR): Now _GLIBCXX_STD_C.
(_GLIBCXX_P): Now _GLIBCXX_STD_A.
(_GLIBCXX_NAMESPACE_DEBUG, _GLIBCXX_NAMESPACE_PARALLEL,
_GLIBCXX_NAMESPACE_PROFILE, _GLIBCXX_NAMESPACE_VERSION): Remove.
(_GLIBCXX_INLINE_DEBUG, _GLIBCXX_INLINE_PARALLEL,
_GLIBCXX_INLINE_PROFILE): Remove.
(_GLIBCXX_BEGIN_NAMESPACE(X)): Remove.
(_GLIBCXX_END_NAMESPACE): Remove.
(_GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y)): Remove.
(_GLIBCXX_END_NESTED_NAMESPACE): Remove.
(_GLIBCXX_BEGIN_NAMESPACE_ALGO): Add.
(_GLIBCXX_END_NAMESPACE_ALGO): Add.
(_GLIBCXX_BEGIN_NAMESPACE_CONTAINER): Add.
(_GLIBCXX_END_NAMESPACE_CONTAINER): Add.
(_GLIBCXX_BEGIN_NAMESPACE_VERSION): Add.
(_GLIBCXX_END_NAMESPACE_VERSION): Add.
(_GLIBCXX_BEGIN_LDBL_NAMESPACE): To _GLIBCXX_BEGIN_NAMESPACE_LDBL.
(_GLIBCXX_END_LDBL_NAMESPACE): To _GLIBCXX_END_NAMESPACE_LDBL.
(_GLIBCXX_VISIBILITY_ATTR): Revert to _GLIBCXX_VISIBILITY.
* include/*: Use new macros for namespace scope.
* config/*: Same.
* src/*: Same.
* src/Makefile.am (sources): Remove debug_list.cc, add
compatibility-debug_list-2.cc.
(parallel_sources): Remove parallel_list.cc, add
compatibility-parallel_list-2.cc.
(compatibility-parallel_list-2.[o,lo]): New rule.
* src/Makefile.in: Regenerate.
* src/debug_list.cc: Remove.
* src/parallel_list.cc: Remove.
* src/compatibility-list-2.cc: New.
* src/compatibility-debug_list-2.cc: New.
* src/compatibility-parallel_list-2.cc: New.
* doc/doxygen/user.cfg.in: Adjust macros.
* testsuite/20_util/auto_ptr/assign_neg.cc: Adjust line numbers, macros.
* testsuite/20_util/declval/requirements/1_neg.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Same.
* testsuite/20_util/forward/c_neg.cc: Same.
* testsuite/20_util/forward/f_neg.cc: Same.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Same.
* testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Same.
* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Same.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Same.
* testsuite/23_containers/forward_list/capacity/1.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
assign_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
insert_neg.cc: Same.
* testsuite/23_containers/list/capacity/29134.cc: Same.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc: Same.
* testsuite/23_containers/vector/bool/capacity/29134.cc: Same.
* testsuite/23_containers/vector/bool/modifiers/insert/31370.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Same.
* testsuite/25_algorithms/sort/35588.cc: Same.
* testsuite/27_io/ios_base/cons/assign_neg.cc: Same.
* testsuite/27_io/ios_base/cons/copy_neg.cc: Same.
* testsuite/ext/profile/mutex_extensions_neg.cc: Same.
* testsuite/ext/profile/profiler_algos.cc: Same.
* testsuite/ext/type_traits/add_unsigned_floating_neg.cc: Same.
* testsuite/ext/type_traits/add_unsigned_integer_neg.cc: Same.
* testsuite/ext/type_traits/remove_unsigned_floating_neg.cc: Same.
* testsuite/ext/type_traits/remove_unsigned_integer_neg.cc: Same.
* testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc: Same.
From-SVN: r169421
2011-01-30 23:39:36 +01:00
|
|
|
_GLIBCXX_END_NAMESPACE_VERSION
|
|
|
|
} // namespace
|
2003-01-22 17:51:52 +01:00
|
|
|
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
# include <bits/locale_classes.tcc>
|
|
|
|
|
2003-01-22 17:51:52 +01:00
|
|
|
#endif
|