2000-10-05 13:27:02 +02:00
|
|
|
// Locale support -*- C++ -*-
|
|
|
|
|
PR libstdc++/28277 (partial: vstring bits)
2007-04-10 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/28277 (partial: vstring bits)
* include/bits/ostream_insert.h: New.
* include/Makefile.am: Add.
* include/ext/vstring.h (operator<<(basic_ostream<>&,
const __versa_string<>&): Forward to __ostream_insert.
* include/bits/basic_string.h (operator<<(basic_ostream<>&,
const string<>&)): Likewise.
* include/std/ostream (operator<<(basic_ostream<>&, _CharT),
operator<<(basic_ostream<char,>&, char), operator<<(basic_ostream<>&,
const _CharT*), operator<<(basic_ostream<char,>&, const char*)):
Likewise.
* include/ext/vstring.tcc (operator<<(basic_ostream<>&,
const __versa_string<>&)): Remove.
(class basic_ostream): Remove friend declarations.
(basic_ostream<>::_M_write(char_type, streamsize),
_M_insert(const char_type*, streamsize)): Remove.
* include/bits/ostream.tcc (_M_insert(const char_type*, streamsize)):
Remove definition.
(operator<<(basic_ostream<>&, const char*)): Use __ostream_insert.
* config/abi/pre/gnu.ver: Adjust.
* src/ostream-inst.cc: Add __ostream_insert instantiations.
* include/bits/locale_facets.h (__pad<>::_S_pad): Remove __num
parameter.
* include/bits/locale_facets.tcc (__pad<>::_S_pad): Adjust.
(num_put<>::_M_pad(_CharT, streamsize, ios_base&, _CharT*,
const _CharT*, int&)): Likewise.
* include/Makefile.in: Rebuild.
* testsuite/ext/vstring/inserters_extractors/char/28277.cc: New.
* testsuite/ext/vstring/inserters_extractors/wchar_t/28277.cc: New.
* include/ext/vstring_util.h: Do not include the whole <locale>.
* include/ext/vstring.tcc (operator>>(basic_istream<>&,
__versa_string<>&, getline(basic_istream<>&, __versa_string<>&,
_CharT)): Tweak to refer to ios_base as a base of istream; do not
refer to non-standard types of istream.
* include/bits/istream.tcc (operator>>(basic_istream<>&, _CharT*),
ws(basic_istream<>&)): Do not refer to non-standard types of istream.
* include/std/bitset (operator>>(std::basic_istream<>&, bitset<>&)):
Avoid using basic_streambuf<>*.
* include/bits/istream.tcc (operator>>(basic_istream<>&,
basic_string<>&), getline(basic_istream<>&, basic_string<>&, _CharT)):
Move...
* include/bits/basic_string.tcc: ... here; tweak to refer to ios_base
as a base of istream; do not refer to non-standard types of istream.
* include/std/string: Tweak includes.
* include/ext/type_traits.h (__is_null_pointer): Add.
* include/ext/rc_string_base.h: Use it.
* include/ext/sso_string_base.h: Likewise.
* include/bits/basic_string.tcc (__is_null_pointer): Remove, use
the above.
* include/ext/vstring_util.h (__vstring_utility<>::_S_is_null_pointer):
Remove.
From-SVN: r123692
2007-04-10 12:38:50 +02:00
|
|
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
2009-02-04 00:44:53 +01:00
|
|
|
// 2006, 2007, 2008, 2009
|
2002-01-23 00:09:04 +01:00
|
|
|
// Free Software Foundation, Inc.
|
2000-10-05 13:27:02 +02: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)
|
2000-10-05 13:27:02 +02: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/>.
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-11-24 05:11:23 +01:00
|
|
|
/** @file locale_facets.tcc
|
|
|
|
* This is an internal header file, included by other library headers.
|
|
|
|
* You should not attempt to use it directly.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2003-07-05 06:05:45 +02:00
|
|
|
#ifndef _LOCALE_FACETS_TCC
|
|
|
|
#define _LOCALE_FACETS_TCC 1
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2002-02-16 20:33:43 +01:00
|
|
|
#pragma GCC system_header
|
|
|
|
|
2005-12-19 01:56:05 +01:00
|
|
|
_GLIBCXX_BEGIN_NAMESPACE(std)
|
|
|
|
|
2003-06-27 09:25:38 +02:00
|
|
|
// Routine to access a cache for the facet. If the cache didn't
|
|
|
|
// exist before, it gets constructed on the fly.
|
|
|
|
template<typename _Facet>
|
2003-07-10 08:21:13 +02:00
|
|
|
struct __use_cache
|
|
|
|
{
|
|
|
|
const _Facet*
|
|
|
|
operator() (const locale& __loc) const;
|
|
|
|
};
|
2003-06-27 09:25:38 +02:00
|
|
|
|
2004-03-24 07:41:07 +01:00
|
|
|
// Specializations.
|
2003-07-10 08:21:13 +02:00
|
|
|
template<typename _CharT>
|
|
|
|
struct __use_cache<__numpunct_cache<_CharT> >
|
|
|
|
{
|
|
|
|
const __numpunct_cache<_CharT>*
|
|
|
|
operator() (const locale& __loc) const
|
|
|
|
{
|
2003-10-07 12:34:47 +02:00
|
|
|
const size_t __i = numpunct<_CharT>::id._M_id();
|
2003-07-10 08:21:13 +02:00
|
|
|
const locale::facet** __caches = __loc._M_impl->_M_caches;
|
|
|
|
if (!__caches[__i])
|
|
|
|
{
|
2003-09-23 22:03:30 +02:00
|
|
|
__numpunct_cache<_CharT>* __tmp = NULL;
|
2009-02-04 00:44:53 +01:00
|
|
|
__try
|
2003-07-10 08:21:13 +02:00
|
|
|
{
|
|
|
|
__tmp = new __numpunct_cache<_CharT>;
|
|
|
|
__tmp->_M_cache(__loc);
|
|
|
|
}
|
2009-02-04 00:44:53 +01:00
|
|
|
__catch(...)
|
2003-07-10 08:21:13 +02:00
|
|
|
{
|
|
|
|
delete __tmp;
|
|
|
|
__throw_exception_again;
|
|
|
|
}
|
|
|
|
__loc._M_impl->_M_install_cache(__tmp, __i);
|
|
|
|
}
|
|
|
|
return static_cast<const __numpunct_cache<_CharT>*>(__caches[__i]);
|
|
|
|
}
|
|
|
|
};
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-03-24 07:41:07 +01:00
|
|
|
template<typename _CharT>
|
|
|
|
void
|
|
|
|
__numpunct_cache<_CharT>::_M_cache(const locale& __loc)
|
|
|
|
{
|
|
|
|
_M_allocated = true;
|
|
|
|
|
|
|
|
const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc);
|
|
|
|
|
2009-07-19 00:58:10 +02:00
|
|
|
char* __grouping = 0;
|
|
|
|
_CharT* __truename = 0;
|
|
|
|
_CharT* __falsename = 0;
|
|
|
|
__try
|
|
|
|
{
|
|
|
|
_M_grouping_size = __np.grouping().size();
|
|
|
|
__grouping = new char[_M_grouping_size];
|
|
|
|
__np.grouping().copy(__grouping, _M_grouping_size);
|
|
|
|
_M_grouping = __grouping;
|
|
|
|
_M_use_grouping = (_M_grouping_size
|
|
|
|
&& static_cast<signed char>(_M_grouping[0]) > 0
|
|
|
|
&& (_M_grouping[0]
|
|
|
|
!= __gnu_cxx::__numeric_traits<char>::__max));
|
|
|
|
|
|
|
|
_M_truename_size = __np.truename().size();
|
|
|
|
__truename = new _CharT[_M_truename_size];
|
|
|
|
__np.truename().copy(__truename, _M_truename_size);
|
|
|
|
_M_truename = __truename;
|
|
|
|
|
|
|
|
_M_falsename_size = __np.falsename().size();
|
|
|
|
__falsename = new _CharT[_M_falsename_size];
|
|
|
|
__np.falsename().copy(__falsename, _M_falsename_size);
|
|
|
|
_M_falsename = __falsename;
|
|
|
|
|
|
|
|
_M_decimal_point = __np.decimal_point();
|
|
|
|
_M_thousands_sep = __np.thousands_sep();
|
|
|
|
|
|
|
|
const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__loc);
|
|
|
|
__ct.widen(__num_base::_S_atoms_out,
|
|
|
|
__num_base::_S_atoms_out
|
|
|
|
+ __num_base::_S_oend, _M_atoms_out);
|
|
|
|
__ct.widen(__num_base::_S_atoms_in,
|
|
|
|
__num_base::_S_atoms_in
|
|
|
|
+ __num_base::_S_iend, _M_atoms_in);
|
|
|
|
}
|
|
|
|
__catch(...)
|
|
|
|
{
|
|
|
|
delete [] __grouping;
|
|
|
|
delete [] __truename;
|
|
|
|
delete [] __falsename;
|
|
|
|
__throw_exception_again;
|
|
|
|
}
|
2004-03-24 07:41:07 +01:00
|
|
|
}
|
|
|
|
|
locale_facets.h (struct __numpunct_cache): Add member _M_grouping_size, caching the length of _M_grouping.
2004-01-14 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (struct __numpunct_cache):
Add member _M_grouping_size, caching the length of _M_grouping.
(__numpunct_cache<>::_M_cache): Assign the latter.
(__verify_grouping): Move declaration...
* include/bits/locale_facets.tcc (__verify_grouping):
... here, change signature to take a const char* and a size_t
for the grouping; not a template anymore.
(__add_grouping, num_put::_M_group_int, num_put::_M_group_float):
Likewise change signature and tweak consistently.
(num_get::_M_extract_float, num_get::_M_extract_int,
num_put::_M_insert_int, num_put::_M_insert_float,
money_get::do_get(string_type&), money_get::do_put(string_type)):
Update callers.
* config/locale/generic/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Assign the new member.
* config/locale/gnu/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Likewise.
* src/locale-inst.cc (__add_grouping): Tweak signature.
(__verify_grouping): Don't instantiate, not a template anymore.
* include/bits/locale_facets.h: Rename _M_truename_len ->
_M_truename_size, _M_falsename_len -> _M_falsename_size.
* include/bits/locale_facets.tcc: Likewise.
* config/locale/generic/numeric_members.cc: Likewise.
* config/locale/gnu/numeric_members.cc: Likewise.
From-SVN: r75876
2004-01-14 20:14:39 +01:00
|
|
|
// Used by both numeric and monetary facets.
|
|
|
|
// Check to make sure that the __grouping_tmp string constructed in
|
|
|
|
// money_get or num_get matches the canonical grouping for a given
|
|
|
|
// locale.
|
|
|
|
// __grouping_tmp is parsed L to R
|
|
|
|
// 1,222,444 == __grouping_tmp of "\1\3\3"
|
|
|
|
// __grouping is parsed R to L
|
|
|
|
// 1,222,444 == __grouping of "\3" == "\3\3\3"
|
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_PURE bool
|
locale_facets.h (struct __numpunct_cache): Add member _M_grouping_size, caching the length of _M_grouping.
2004-01-14 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (struct __numpunct_cache):
Add member _M_grouping_size, caching the length of _M_grouping.
(__numpunct_cache<>::_M_cache): Assign the latter.
(__verify_grouping): Move declaration...
* include/bits/locale_facets.tcc (__verify_grouping):
... here, change signature to take a const char* and a size_t
for the grouping; not a template anymore.
(__add_grouping, num_put::_M_group_int, num_put::_M_group_float):
Likewise change signature and tweak consistently.
(num_get::_M_extract_float, num_get::_M_extract_int,
num_put::_M_insert_int, num_put::_M_insert_float,
money_get::do_get(string_type&), money_get::do_put(string_type)):
Update callers.
* config/locale/generic/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Assign the new member.
* config/locale/gnu/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Likewise.
* src/locale-inst.cc (__add_grouping): Tweak signature.
(__verify_grouping): Don't instantiate, not a template anymore.
* include/bits/locale_facets.h: Rename _M_truename_len ->
_M_truename_size, _M_falsename_len -> _M_falsename_size.
* include/bits/locale_facets.tcc: Likewise.
* config/locale/generic/numeric_members.cc: Likewise.
* config/locale/gnu/numeric_members.cc: Likewise.
From-SVN: r75876
2004-01-14 20:14:39 +01:00
|
|
|
__verify_grouping(const char* __grouping, size_t __grouping_size,
|
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
|
|
|
const string& __grouping_tmp) throw ();
|
locale_facets.h (struct __numpunct_cache): Add member _M_grouping_size, caching the length of _M_grouping.
2004-01-14 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (struct __numpunct_cache):
Add member _M_grouping_size, caching the length of _M_grouping.
(__numpunct_cache<>::_M_cache): Assign the latter.
(__verify_grouping): Move declaration...
* include/bits/locale_facets.tcc (__verify_grouping):
... here, change signature to take a const char* and a size_t
for the grouping; not a template anymore.
(__add_grouping, num_put::_M_group_int, num_put::_M_group_float):
Likewise change signature and tweak consistently.
(num_get::_M_extract_float, num_get::_M_extract_int,
num_put::_M_insert_int, num_put::_M_insert_float,
money_get::do_get(string_type&), money_get::do_put(string_type)):
Update callers.
* config/locale/generic/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Assign the new member.
* config/locale/gnu/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Likewise.
* src/locale-inst.cc (__add_grouping): Tweak signature.
(__verify_grouping): Don't instantiate, not a template anymore.
* include/bits/locale_facets.h: Rename _M_truename_len ->
_M_truename_size, _M_falsename_len -> _M_falsename_size.
* include/bits/locale_facets.tcc: Likewise.
* config/locale/generic/numeric_members.cc: Likewise.
* config/locale/gnu/numeric_members.cc: Likewise.
From-SVN: r75876
2004-01-14 20:14:39 +01:00
|
|
|
|
configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
2006-02-07 Jakub Jelinek <jakub@redhat.com>
Benjamin Kosnik <bkoz@redhat.com>
* configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
If true, set also port_specific_symbol_files and create
as_symver_specs.
(GLIBCXX_LDBL_COMPAT): New GLIBCXX_CONDITIONAL.
* configure: Rebuilt.
* config.h.in: Rebuilt.
* config/os/gnu-linux/ldbl-extra.ver: New file.
* config/abi/pre/gnu.ver: Make sure no __float128 symbols are
exported.
* include/bits/c++config (_GLIBCXX_LONG_DOUBLE_COMPAT,
_GLIBCXX_LDBL_NAMESPACE, _GLIBCXX_BEGIN_LDBL_NAMESPACE,
_GLIBCXX_END_LDBL_NAMESPACE): Define.
* include/bits/localefwd.h: Use them to conditionally scope facets.
* include/bits/locale_facets.h: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_put): Add __do_put method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_put): Add __do_put method.
* include/bits/locale_facets.tcc: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
(std::money_get::__do_get, std::money_put::__do_put,
std::num_get::__do_get, std::num_put::__do_put): New
specializations.
* include/Makefile.am: Conditionally define
_GLIBCXX_LONG_DOUBLE_COMPAT in c++config.
* include/Makefile.in: Regenerate.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT] (_GLIBCXX_LOC_ID,
_GLIBCXX_SYNC_ID): Define, use them.
* src/compatibility-ldbl.cc: New file.
* src/complex_io.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Add compatibility
symbols.
* src/limits.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-misc-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/istream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/ostream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/wlocale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/compatibility.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* config/locale/generic/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* config/locale/gnu/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* src/Makefile.am (libstdc++-symbol.ver): Append instead of
insert in the middle if port specific symbol file requests it.
(ldbl_compat_sources): New variable.
(sources): Use it.
(compatibility-ldbl.lo, compatibility-ldbl.o): New rules.
* src/Makefile.in: Rebuilt.
* testsuite/testsuite_abi.cc: Recognize GLIBCXX_LDBL_3.4,
GLIBCXX_LDBL_3.4.7, CXXABI_LDBL_1.3.
Co-Authored-By: Benjamin Kosnik <bkoz@redhat.com>
From-SVN: r110725
2006-02-07 23:23:58 +01:00
|
|
|
_GLIBCXX_BEGIN_LDBL_NAMESPACE
|
|
|
|
|
2001-09-29 01:44:48 +02:00
|
|
|
template<typename _CharT, typename _InIter>
|
2002-01-11 06:07:22 +01:00
|
|
|
_InIter
|
2001-09-29 01:44:48 +02:00
|
|
|
num_get<_CharT, _InIter>::
|
2001-11-28 05:07:11 +01:00
|
|
|
_M_extract_float(_InIter __beg, _InIter __end, ios_base& __io,
|
2001-12-07 03:58:36 +01:00
|
|
|
ios_base::iostate& __err, string& __xtrc) const
|
2000-10-05 13:27:02 +02:00
|
|
|
{
|
2003-07-17 03:54:44 +02:00
|
|
|
typedef char_traits<_CharT> __traits_type;
|
2005-04-29 20:50:00 +02:00
|
|
|
typedef __numpunct_cache<_CharT> __cache_type;
|
2003-07-17 03:54:44 +02:00
|
|
|
__use_cache<__cache_type> __uc;
|
|
|
|
const locale& __loc = __io._M_getloc();
|
|
|
|
const __cache_type* __lc = __uc(__loc);
|
|
|
|
const _CharT* __lit = __lc->_M_atoms_in;
|
2004-11-01 12:31:44 +01:00
|
|
|
char_type __c = char_type();
|
2001-11-28 05:07:11 +01:00
|
|
|
|
2004-11-01 12:31:44 +01:00
|
|
|
// True if __beg becomes equal to __end.
|
|
|
|
bool __testeof = __beg == __end;
|
2003-12-22 12:00:43 +01:00
|
|
|
|
2002-01-23 00:09:04 +01:00
|
|
|
// First check for sign.
|
2004-11-01 12:31:44 +01:00
|
|
|
if (!__testeof)
|
2001-11-28 05:07:11 +01:00
|
|
|
{
|
2004-11-01 12:31:44 +01:00
|
|
|
__c = *__beg;
|
2004-03-24 07:41:07 +01:00
|
|
|
const bool __plus = __c == __lit[__num_base::_S_iplus];
|
|
|
|
if ((__plus || __c == __lit[__num_base::_S_iminus])
|
2004-03-06 10:00:14 +01:00
|
|
|
&& !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
|
|
|
|
&& !(__c == __lc->_M_decimal_point))
|
2003-10-27 17:21:14 +01:00
|
|
|
{
|
2004-02-28 21:37:54 +01:00
|
|
|
__xtrc += __plus ? '+' : '-';
|
2004-11-01 12:31:44 +01:00
|
|
|
if (++__beg != __end)
|
|
|
|
__c = *__beg;
|
|
|
|
else
|
|
|
|
__testeof = true;
|
2003-10-27 17:21:14 +01:00
|
|
|
}
|
2001-11-28 05:07:11 +01:00
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2003-12-22 12:00:43 +01:00
|
|
|
// Next, look for leading zeros.
|
2004-11-03 02:05:08 +01:00
|
|
|
bool __found_mantissa = false;
|
2005-06-29 13:48:53 +02:00
|
|
|
int __sep_pos = 0;
|
2004-11-01 12:31:44 +01:00
|
|
|
while (!__testeof)
|
2001-12-07 03:58:36 +01:00
|
|
|
{
|
2006-12-14 06:49:06 +01:00
|
|
|
if ((__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
|
2004-03-06 10:00:14 +01:00
|
|
|
|| __c == __lc->_M_decimal_point)
|
2003-12-22 12:00:43 +01:00
|
|
|
break;
|
2004-03-24 07:41:07 +01:00
|
|
|
else if (__c == __lit[__num_base::_S_izero])
|
2003-12-22 12:00:43 +01:00
|
|
|
{
|
|
|
|
if (!__found_mantissa)
|
|
|
|
{
|
2004-02-28 21:37:54 +01:00
|
|
|
__xtrc += '0';
|
2003-12-22 12:00:43 +01:00
|
|
|
__found_mantissa = true;
|
|
|
|
}
|
2005-06-29 13:48:53 +02:00
|
|
|
++__sep_pos;
|
|
|
|
|
2004-11-01 12:31:44 +01:00
|
|
|
if (++__beg != __end)
|
|
|
|
__c = *__beg;
|
|
|
|
else
|
|
|
|
__testeof = true;
|
2003-12-22 12:00:43 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
2001-12-07 03:58:36 +01:00
|
|
|
}
|
2001-11-28 05:07:11 +01:00
|
|
|
|
|
|
|
// Only need acceptable digits for floating point numbers.
|
|
|
|
bool __found_dec = false;
|
|
|
|
bool __found_sci = false;
|
|
|
|
string __found_grouping;
|
2004-02-27 15:30:19 +01:00
|
|
|
if (__lc->_M_use_grouping)
|
|
|
|
__found_grouping.reserve(32);
|
2004-03-24 07:41:07 +01:00
|
|
|
const char_type* __lit_zero = __lit + __num_base::_S_izero;
|
2004-11-01 12:31:44 +01:00
|
|
|
|
2006-04-29 20:16:47 +02:00
|
|
|
if (!__lc->_M_allocated)
|
|
|
|
// "C" locale
|
|
|
|
while (!__testeof)
|
|
|
|
{
|
|
|
|
const int __digit = _M_find(__lit_zero, 10, __c);
|
|
|
|
if (__digit != -1)
|
|
|
|
{
|
|
|
|
__xtrc += '0' + __digit;
|
|
|
|
__found_mantissa = true;
|
|
|
|
}
|
|
|
|
else if (__c == __lc->_M_decimal_point
|
|
|
|
&& !__found_dec && !__found_sci)
|
|
|
|
{
|
|
|
|
__xtrc += '.';
|
|
|
|
__found_dec = true;
|
|
|
|
}
|
|
|
|
else if ((__c == __lit[__num_base::_S_ie]
|
|
|
|
|| __c == __lit[__num_base::_S_iE])
|
|
|
|
&& !__found_sci && __found_mantissa)
|
|
|
|
{
|
|
|
|
// Scientific notation.
|
|
|
|
__xtrc += 'e';
|
|
|
|
__found_sci = true;
|
|
|
|
|
|
|
|
// Remove optional plus or minus sign, if they exist.
|
|
|
|
if (++__beg != __end)
|
|
|
|
{
|
|
|
|
__c = *__beg;
|
|
|
|
const bool __plus = __c == __lit[__num_base::_S_iplus];
|
|
|
|
if (__plus || __c == __lit[__num_base::_S_iminus])
|
|
|
|
__xtrc += __plus ? '+' : '-';
|
|
|
|
else
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
__testeof = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
2004-11-01 12:31:44 +01:00
|
|
|
|
2006-04-29 20:16:47 +02:00
|
|
|
if (++__beg != __end)
|
|
|
|
__c = *__beg;
|
|
|
|
else
|
|
|
|
__testeof = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
while (!__testeof)
|
|
|
|
{
|
|
|
|
// According to 22.2.2.1.2, p8-9, first look for thousands_sep
|
|
|
|
// and decimal_point.
|
|
|
|
if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
|
|
|
|
{
|
|
|
|
if (!__found_dec && !__found_sci)
|
|
|
|
{
|
|
|
|
// NB: Thousands separator at the beginning of a string
|
|
|
|
// is a no-no, as is two consecutive thousands separators.
|
|
|
|
if (__sep_pos)
|
|
|
|
{
|
|
|
|
__found_grouping += static_cast<char>(__sep_pos);
|
|
|
|
__sep_pos = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// NB: __convert_to_v will not assign __v and will
|
|
|
|
// set the failbit.
|
|
|
|
__xtrc.clear();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (__c == __lc->_M_decimal_point)
|
|
|
|
{
|
|
|
|
if (!__found_dec && !__found_sci)
|
|
|
|
{
|
|
|
|
// If no grouping chars are seen, no grouping check
|
|
|
|
// is applied. Therefore __found_grouping is adjusted
|
|
|
|
// only if decimal_point comes after some thousands_sep.
|
|
|
|
if (__found_grouping.size())
|
|
|
|
__found_grouping += static_cast<char>(__sep_pos);
|
|
|
|
__xtrc += '.';
|
|
|
|
__found_dec = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const char_type* __q =
|
|
|
|
__traits_type::find(__lit_zero, 10, __c);
|
|
|
|
if (__q)
|
|
|
|
{
|
|
|
|
__xtrc += '0' + (__q - __lit_zero);
|
|
|
|
__found_mantissa = true;
|
|
|
|
++__sep_pos;
|
|
|
|
}
|
|
|
|
else if ((__c == __lit[__num_base::_S_ie]
|
|
|
|
|| __c == __lit[__num_base::_S_iE])
|
|
|
|
&& !__found_sci && __found_mantissa)
|
|
|
|
{
|
|
|
|
// Scientific notation.
|
|
|
|
if (__found_grouping.size() && !__found_dec)
|
|
|
|
__found_grouping += static_cast<char>(__sep_pos);
|
|
|
|
__xtrc += 'e';
|
|
|
|
__found_sci = true;
|
|
|
|
|
|
|
|
// Remove optional plus or minus sign, if they exist.
|
|
|
|
if (++__beg != __end)
|
|
|
|
{
|
|
|
|
__c = *__beg;
|
|
|
|
const bool __plus = __c == __lit[__num_base::_S_iplus];
|
|
|
|
if ((__plus || __c == __lit[__num_base::_S_iminus])
|
|
|
|
&& !(__lc->_M_use_grouping
|
|
|
|
&& __c == __lc->_M_thousands_sep)
|
|
|
|
&& !(__c == __lc->_M_decimal_point))
|
|
|
|
__xtrc += __plus ? '+' : '-';
|
|
|
|
else
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
__testeof = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (++__beg != __end)
|
|
|
|
__c = *__beg;
|
|
|
|
else
|
|
|
|
__testeof = true;
|
|
|
|
}
|
2001-11-28 05:07:11 +01:00
|
|
|
|
|
|
|
// Digit grouping is checked. If grouping and found_grouping don't
|
|
|
|
// match, then get very very upset, and set failbit.
|
2004-02-17 12:19:25 +01:00
|
|
|
if (__found_grouping.size())
|
2001-11-28 05:07:11 +01:00
|
|
|
{
|
2004-02-28 21:37:54 +01:00
|
|
|
// Add the ending grouping if a decimal or 'e'/'E' wasn't found.
|
|
|
|
if (!__found_dec && !__found_sci)
|
2001-11-28 05:07:11 +01:00
|
|
|
__found_grouping += static_cast<char>(__sep_pos);
|
2003-07-17 03:54:44 +02:00
|
|
|
|
2004-03-24 07:41:07 +01:00
|
|
|
if (!std::__verify_grouping(__lc->_M_grouping,
|
|
|
|
__lc->_M_grouping_size,
|
locale_facets.h (struct __numpunct_cache): Add member _M_grouping_size, caching the length of _M_grouping.
2004-01-14 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (struct __numpunct_cache):
Add member _M_grouping_size, caching the length of _M_grouping.
(__numpunct_cache<>::_M_cache): Assign the latter.
(__verify_grouping): Move declaration...
* include/bits/locale_facets.tcc (__verify_grouping):
... here, change signature to take a const char* and a size_t
for the grouping; not a template anymore.
(__add_grouping, num_put::_M_group_int, num_put::_M_group_float):
Likewise change signature and tweak consistently.
(num_get::_M_extract_float, num_get::_M_extract_int,
num_put::_M_insert_int, num_put::_M_insert_float,
money_get::do_get(string_type&), money_get::do_put(string_type)):
Update callers.
* config/locale/generic/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Assign the new member.
* config/locale/gnu/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Likewise.
* src/locale-inst.cc (__add_grouping): Tweak signature.
(__verify_grouping): Don't instantiate, not a template anymore.
* include/bits/locale_facets.h: Rename _M_truename_len ->
_M_truename_size, _M_falsename_len -> _M_falsename_size.
* include/bits/locale_facets.tcc: Likewise.
* config/locale/generic/numeric_members.cc: Likewise.
* config/locale/gnu/numeric_members.cc: Likewise.
From-SVN: r75876
2004-01-14 20:14:39 +01:00
|
|
|
__found_grouping))
|
PR libstdc++/32422, DR 23 [Ready in R60]
2008-09-23 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/32422, DR 23 [Ready in R60]
* config/locale/gnu/c_locale.cc (__convert_to_v(const char*, float&,
ios_base::iostate&, const __c_locale&), __convert_to_v(const char*,
double&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, long double&, ios_base::iostate&, const __c_locale&)): Implement
DR 23 and deal correctly with broken exponents.
* config/locale/generic/c_locale.cc (__convert_to_v(const char*,
float&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, double&, ios_base::iostate&, const __c_locale&),
__convert_to_v(const char*, long double&, ios_base::iostate&, const
__c_locale&)): Likewise.
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int(_InIter,
_InIter, ios_base&, ios_base::iostate&, _ValueT&)): Likewise.
(num_get<>::_M_extract_float(_InIter, _InIter, ios_base&,
ios_base::iostate&, string&): Change grouping check to set instead of
OR failbit; do not check for eofbit here...
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, float&), num_get<>::do_get(iter_type, iter_type,
ios_base&, ios_base::iostate&, double&), num_get<>::do_get(iter_type,
iter_type, ios_base&, ios_base::iostate&, long double&),
num_get<>::__do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, double&)): ... do it here instead.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, bool&)): Implement DR 23.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, void*&)): Adjust.
* doc/xml/manual/intro.xml: Add and entry for DR 23.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/10.cc:
Adjust.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/10.cc:
Likewise.
* testsuite/22_locale/num_get/get/wchar_t/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/10.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/12.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/15.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/16.cc: Likewise.
* testsuite/22_locale/num_get/get/char/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/char/10.cc: Likewise.
* testsuite/22_locale/num_get/get/char/12.cc: Likewise.
* testsuite/22_locale/num_get/get/char/15.cc: Likewise.
* testsuite/22_locale/num_get/get/char/16.cc: Likewise.
From-SVN: r140574
2008-09-23 02:47:02 +02:00
|
|
|
__err = ios_base::failbit;
|
2001-11-28 05:07:11 +01:00
|
|
|
}
|
|
|
|
|
2002-01-11 06:07:22 +01:00
|
|
|
return __beg;
|
2000-10-05 13:27:02 +02:00
|
|
|
}
|
|
|
|
|
2001-11-28 05:07:11 +01:00
|
|
|
template<typename _CharT, typename _InIter>
|
2004-02-08 05:46:42 +01:00
|
|
|
template<typename _ValueT>
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
_InIter
|
|
|
|
num_get<_CharT, _InIter>::
|
|
|
|
_M_extract_int(_InIter __beg, _InIter __end, ios_base& __io,
|
|
|
|
ios_base::iostate& __err, _ValueT& __v) const
|
|
|
|
{
|
2005-04-26 11:31:07 +02:00
|
|
|
typedef char_traits<_CharT> __traits_type;
|
2006-09-18 15:30:56 +02:00
|
|
|
using __gnu_cxx::__add_unsigned;
|
|
|
|
typedef typename __add_unsigned<_ValueT>::__type __unsigned_type;
|
2005-04-29 20:50:00 +02:00
|
|
|
typedef __numpunct_cache<_CharT> __cache_type;
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
__use_cache<__cache_type> __uc;
|
|
|
|
const locale& __loc = __io._M_getloc();
|
|
|
|
const __cache_type* __lc = __uc(__loc);
|
|
|
|
const _CharT* __lit = __lc->_M_atoms_in;
|
2004-11-03 02:05:08 +01:00
|
|
|
char_type __c = char_type();
|
2001-11-28 05:07:11 +01:00
|
|
|
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
// NB: Iff __basefield == 0, __base can change based on contents.
|
2004-02-27 15:30:19 +01:00
|
|
|
const ios_base::fmtflags __basefield = __io.flags()
|
|
|
|
& ios_base::basefield;
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
const bool __oct = __basefield == ios_base::oct;
|
|
|
|
int __base = __oct ? 8 : (__basefield == ios_base::hex ? 16 : 10);
|
2001-11-28 05:07:11 +01:00
|
|
|
|
2004-11-03 02:05:08 +01:00
|
|
|
// True if __beg becomes equal to __end.
|
|
|
|
bool __testeof = __beg == __end;
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
|
|
|
|
// First check for sign.
|
|
|
|
bool __negative = false;
|
2004-11-03 02:05:08 +01:00
|
|
|
if (!__testeof)
|
2004-02-08 05:46:42 +01:00
|
|
|
{
|
2004-11-03 02:05:08 +01:00
|
|
|
__c = *__beg;
|
2009-04-18 21:28:40 +02:00
|
|
|
__negative = __c == __lit[__num_base::_S_iminus];
|
2004-03-24 07:41:07 +01:00
|
|
|
if ((__negative || __c == __lit[__num_base::_S_iplus])
|
2004-03-06 10:00:14 +01:00
|
|
|
&& !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
|
|
|
|
&& !(__c == __lc->_M_decimal_point))
|
2004-11-03 02:05:08 +01:00
|
|
|
{
|
|
|
|
if (++__beg != __end)
|
|
|
|
__c = *__beg;
|
|
|
|
else
|
|
|
|
__testeof = true;
|
|
|
|
}
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
}
|
2001-11-28 05:07:11 +01:00
|
|
|
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
// Next, look for leading zeros and check required digits
|
|
|
|
// for base formats.
|
2004-11-03 02:05:08 +01:00
|
|
|
bool __found_zero = false;
|
2005-06-29 13:48:53 +02:00
|
|
|
int __sep_pos = 0;
|
2004-11-03 02:05:08 +01:00
|
|
|
while (!__testeof)
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
{
|
2006-12-14 06:49:06 +01:00
|
|
|
if ((__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
|
2004-03-06 10:00:14 +01:00
|
|
|
|| __c == __lc->_M_decimal_point)
|
2003-12-22 12:00:43 +01:00
|
|
|
break;
|
2004-03-24 07:41:07 +01:00
|
|
|
else if (__c == __lit[__num_base::_S_izero]
|
2004-11-03 02:05:08 +01:00
|
|
|
&& (!__found_zero || __base == 10))
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
{
|
2005-06-29 13:48:53 +02:00
|
|
|
__found_zero = true;
|
|
|
|
++__sep_pos;
|
|
|
|
if (__basefield == 0)
|
|
|
|
__base = 8;
|
|
|
|
if (__base == 8)
|
|
|
|
__sep_pos = 0;
|
|
|
|
}
|
|
|
|
else if (__found_zero
|
|
|
|
&& (__c == __lit[__num_base::_S_ix]
|
|
|
|
|| __c == __lit[__num_base::_S_iX]))
|
|
|
|
{
|
|
|
|
if (__basefield == 0)
|
|
|
|
__base = 16;
|
|
|
|
if (__base == 16)
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
{
|
2005-06-29 13:48:53 +02:00
|
|
|
__found_zero = false;
|
|
|
|
__sep_pos = 0;
|
2004-11-03 02:05:08 +01:00
|
|
|
}
|
|
|
|
else
|
2005-06-29 13:48:53 +02:00
|
|
|
break;
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
}
|
2003-12-22 12:00:43 +01:00
|
|
|
else
|
|
|
|
break;
|
2001-11-28 05:07:11 +01:00
|
|
|
|
2004-11-03 02:05:08 +01:00
|
|
|
if (++__beg != __end)
|
|
|
|
{
|
|
|
|
__c = *__beg;
|
|
|
|
if (!__found_zero)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
__testeof = true;
|
|
|
|
}
|
|
|
|
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
// At this point, base is determined. If not hex, only allow
|
|
|
|
// base digits as valid input.
|
2004-05-22 11:02:56 +02:00
|
|
|
const size_t __len = (__base == 16 ? __num_base::_S_iend
|
|
|
|
- __num_base::_S_izero : __base);
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
|
|
|
|
// Extract.
|
|
|
|
string __found_grouping;
|
2004-02-27 15:30:19 +01:00
|
|
|
if (__lc->_M_use_grouping)
|
|
|
|
__found_grouping.reserve(32);
|
2005-06-29 13:48:53 +02:00
|
|
|
bool __testfail = false;
|
PR libstdc++/32422, DR 23 [Ready in R60]
2008-09-23 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/32422, DR 23 [Ready in R60]
* config/locale/gnu/c_locale.cc (__convert_to_v(const char*, float&,
ios_base::iostate&, const __c_locale&), __convert_to_v(const char*,
double&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, long double&, ios_base::iostate&, const __c_locale&)): Implement
DR 23 and deal correctly with broken exponents.
* config/locale/generic/c_locale.cc (__convert_to_v(const char*,
float&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, double&, ios_base::iostate&, const __c_locale&),
__convert_to_v(const char*, long double&, ios_base::iostate&, const
__c_locale&)): Likewise.
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int(_InIter,
_InIter, ios_base&, ios_base::iostate&, _ValueT&)): Likewise.
(num_get<>::_M_extract_float(_InIter, _InIter, ios_base&,
ios_base::iostate&, string&): Change grouping check to set instead of
OR failbit; do not check for eofbit here...
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, float&), num_get<>::do_get(iter_type, iter_type,
ios_base&, ios_base::iostate&, double&), num_get<>::do_get(iter_type,
iter_type, ios_base&, ios_base::iostate&, long double&),
num_get<>::__do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, double&)): ... do it here instead.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, bool&)): Implement DR 23.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, void*&)): Adjust.
* doc/xml/manual/intro.xml: Add and entry for DR 23.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/10.cc:
Adjust.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/10.cc:
Likewise.
* testsuite/22_locale/num_get/get/wchar_t/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/10.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/12.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/15.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/16.cc: Likewise.
* testsuite/22_locale/num_get/get/char/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/char/10.cc: Likewise.
* testsuite/22_locale/num_get/get/char/12.cc: Likewise.
* testsuite/22_locale/num_get/get/char/15.cc: Likewise.
* testsuite/22_locale/num_get/get/char/16.cc: Likewise.
From-SVN: r140574
2008-09-23 02:47:02 +02:00
|
|
|
bool __testoverflow = false;
|
2009-04-18 21:28:40 +02:00
|
|
|
const __unsigned_type __max =
|
|
|
|
(__negative && __gnu_cxx::__numeric_traits<_ValueT>::__is_signed)
|
numeric_traits.h: Do not include <limits>.
2007-04-13 Paolo Carlini <pcarlini@suse.de>
* include/ext/numeric_traits.h: Do not include <limits>.
(__numeric_traits_integer::__is_signed, __digits): Add.
(__numeric_traits_floating::__digits10, __max_exponent10): Add.
* src/istream.cc (ignore<char>(streamsize, int_type), operator>>
(basic_istream<char>&, char*), ignore<wchar_t>(streamsize,
int_type)): Use the latter.
* src/compatibility.cc (ignore<char>(streamsize),
ignore<wchar_t>(streamsize)): Likewise.
* include/ext/vstring_util.h (__vstring_utility<>::_S_compare):
Likewise.
* include/bits/stl_memory.h (__get_temporary_buffer): Likewise.
* include/bits/stl_algobase.h (lexicographical_compare(const char*,
const char*, const char*, const char*)): Likewise.
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int(_InIter,
_InIter, ios_base&, ios_base::iostate&, _ValueT&),
num_put<>::_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT),
num_put<>::_M_insert_float(_OutIter, ios_base&, _CharT, char,
_ValueT), collate<>::do_hash(const _CharT*, const _CharT*)): Likewise.
* include/bits/basic_string.h (basic_string<>::_S_compare): Likewise.
* include/bits/istream.tcc (operator>>(short&), operator>>(int&),
ignore(streamsize), ignore(streamsize, int_type), operator>>
(basic_istream<>&, _CharT*)): Likewise.
* include/bits/stl_bvector.h (vector<bool>::max_size): Likewise.
* include/tr1/functional_hash.h (struct hash<long double>): Likewise.
* include/std/istream: Do not include <limits>.
* include/tr1/cmath: Include <limits>.
* testsuite/23_containers/vector/bool/capacity/29134.cc: Likewise.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/12.cc:
Likewise.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/13.cc:
Likewise.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/12.cc:
Likewise.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/13.cc:
Likewise.
* testsuite/27_io/ios_base/storage/2.cc: Likewise.
* include/tr1/hashtable: Do not include the whole <iterator>.
From-SVN: r123779
2007-04-13 12:54:37 +02:00
|
|
|
? -__gnu_cxx::__numeric_traits<_ValueT>::__min
|
|
|
|
: __gnu_cxx::__numeric_traits<_ValueT>::__max;
|
2005-04-26 11:31:07 +02:00
|
|
|
const __unsigned_type __smax = __max / __base;
|
|
|
|
__unsigned_type __result = 0;
|
2006-04-29 20:16:47 +02:00
|
|
|
int __digit = 0;
|
2004-03-24 07:41:07 +01:00
|
|
|
const char_type* __lit_zero = __lit + __num_base::_S_izero;
|
2001-11-28 05:07:11 +01:00
|
|
|
|
2006-04-29 20:16:47 +02:00
|
|
|
if (!__lc->_M_allocated)
|
|
|
|
// "C" locale
|
|
|
|
while (!__testeof)
|
|
|
|
{
|
|
|
|
__digit = _M_find(__lit_zero, __len, __c);
|
|
|
|
if (__digit == -1)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (__result > __smax)
|
PR libstdc++/32422, DR 23 [Ready in R60]
2008-09-23 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/32422, DR 23 [Ready in R60]
* config/locale/gnu/c_locale.cc (__convert_to_v(const char*, float&,
ios_base::iostate&, const __c_locale&), __convert_to_v(const char*,
double&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, long double&, ios_base::iostate&, const __c_locale&)): Implement
DR 23 and deal correctly with broken exponents.
* config/locale/generic/c_locale.cc (__convert_to_v(const char*,
float&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, double&, ios_base::iostate&, const __c_locale&),
__convert_to_v(const char*, long double&, ios_base::iostate&, const
__c_locale&)): Likewise.
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int(_InIter,
_InIter, ios_base&, ios_base::iostate&, _ValueT&)): Likewise.
(num_get<>::_M_extract_float(_InIter, _InIter, ios_base&,
ios_base::iostate&, string&): Change grouping check to set instead of
OR failbit; do not check for eofbit here...
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, float&), num_get<>::do_get(iter_type, iter_type,
ios_base&, ios_base::iostate&, double&), num_get<>::do_get(iter_type,
iter_type, ios_base&, ios_base::iostate&, long double&),
num_get<>::__do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, double&)): ... do it here instead.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, bool&)): Implement DR 23.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, void*&)): Adjust.
* doc/xml/manual/intro.xml: Add and entry for DR 23.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/10.cc:
Adjust.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/10.cc:
Likewise.
* testsuite/22_locale/num_get/get/wchar_t/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/10.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/12.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/15.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/16.cc: Likewise.
* testsuite/22_locale/num_get/get/char/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/char/10.cc: Likewise.
* testsuite/22_locale/num_get/get/char/12.cc: Likewise.
* testsuite/22_locale/num_get/get/char/15.cc: Likewise.
* testsuite/22_locale/num_get/get/char/16.cc: Likewise.
From-SVN: r140574
2008-09-23 02:47:02 +02:00
|
|
|
__testoverflow = true;
|
2006-04-29 20:16:47 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
__result *= __base;
|
PR libstdc++/32422, DR 23 [Ready in R60]
2008-09-23 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/32422, DR 23 [Ready in R60]
* config/locale/gnu/c_locale.cc (__convert_to_v(const char*, float&,
ios_base::iostate&, const __c_locale&), __convert_to_v(const char*,
double&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, long double&, ios_base::iostate&, const __c_locale&)): Implement
DR 23 and deal correctly with broken exponents.
* config/locale/generic/c_locale.cc (__convert_to_v(const char*,
float&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, double&, ios_base::iostate&, const __c_locale&),
__convert_to_v(const char*, long double&, ios_base::iostate&, const
__c_locale&)): Likewise.
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int(_InIter,
_InIter, ios_base&, ios_base::iostate&, _ValueT&)): Likewise.
(num_get<>::_M_extract_float(_InIter, _InIter, ios_base&,
ios_base::iostate&, string&): Change grouping check to set instead of
OR failbit; do not check for eofbit here...
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, float&), num_get<>::do_get(iter_type, iter_type,
ios_base&, ios_base::iostate&, double&), num_get<>::do_get(iter_type,
iter_type, ios_base&, ios_base::iostate&, long double&),
num_get<>::__do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, double&)): ... do it here instead.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, bool&)): Implement DR 23.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, void*&)): Adjust.
* doc/xml/manual/intro.xml: Add and entry for DR 23.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/10.cc:
Adjust.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/10.cc:
Likewise.
* testsuite/22_locale/num_get/get/wchar_t/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/10.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/12.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/15.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/16.cc: Likewise.
* testsuite/22_locale/num_get/get/char/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/char/10.cc: Likewise.
* testsuite/22_locale/num_get/get/char/12.cc: Likewise.
* testsuite/22_locale/num_get/get/char/15.cc: Likewise.
* testsuite/22_locale/num_get/get/char/16.cc: Likewise.
From-SVN: r140574
2008-09-23 02:47:02 +02:00
|
|
|
__testoverflow |= __result > __max - __digit;
|
2006-04-29 20:16:47 +02:00
|
|
|
__result += __digit;
|
|
|
|
++__sep_pos;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (++__beg != __end)
|
|
|
|
__c = *__beg;
|
|
|
|
else
|
|
|
|
__testeof = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
while (!__testeof)
|
|
|
|
{
|
|
|
|
// According to 22.2.2.1.2, p8-9, first look for thousands_sep
|
|
|
|
// and decimal_point.
|
|
|
|
if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
|
|
|
|
{
|
|
|
|
// NB: Thousands separator at the beginning of a string
|
|
|
|
// is a no-no, as is two consecutive thousands separators.
|
|
|
|
if (__sep_pos)
|
|
|
|
{
|
|
|
|
__found_grouping += static_cast<char>(__sep_pos);
|
|
|
|
__sep_pos = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
__testfail = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (__c == __lc->_M_decimal_point)
|
|
|
|
break;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const char_type* __q =
|
|
|
|
__traits_type::find(__lit_zero, __len, __c);
|
|
|
|
if (!__q)
|
|
|
|
break;
|
|
|
|
|
|
|
|
__digit = __q - __lit_zero;
|
|
|
|
if (__digit > 15)
|
|
|
|
__digit -= 6;
|
|
|
|
if (__result > __smax)
|
PR libstdc++/32422, DR 23 [Ready in R60]
2008-09-23 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/32422, DR 23 [Ready in R60]
* config/locale/gnu/c_locale.cc (__convert_to_v(const char*, float&,
ios_base::iostate&, const __c_locale&), __convert_to_v(const char*,
double&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, long double&, ios_base::iostate&, const __c_locale&)): Implement
DR 23 and deal correctly with broken exponents.
* config/locale/generic/c_locale.cc (__convert_to_v(const char*,
float&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, double&, ios_base::iostate&, const __c_locale&),
__convert_to_v(const char*, long double&, ios_base::iostate&, const
__c_locale&)): Likewise.
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int(_InIter,
_InIter, ios_base&, ios_base::iostate&, _ValueT&)): Likewise.
(num_get<>::_M_extract_float(_InIter, _InIter, ios_base&,
ios_base::iostate&, string&): Change grouping check to set instead of
OR failbit; do not check for eofbit here...
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, float&), num_get<>::do_get(iter_type, iter_type,
ios_base&, ios_base::iostate&, double&), num_get<>::do_get(iter_type,
iter_type, ios_base&, ios_base::iostate&, long double&),
num_get<>::__do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, double&)): ... do it here instead.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, bool&)): Implement DR 23.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, void*&)): Adjust.
* doc/xml/manual/intro.xml: Add and entry for DR 23.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/10.cc:
Adjust.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/10.cc:
Likewise.
* testsuite/22_locale/num_get/get/wchar_t/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/10.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/12.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/15.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/16.cc: Likewise.
* testsuite/22_locale/num_get/get/char/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/char/10.cc: Likewise.
* testsuite/22_locale/num_get/get/char/12.cc: Likewise.
* testsuite/22_locale/num_get/get/char/15.cc: Likewise.
* testsuite/22_locale/num_get/get/char/16.cc: Likewise.
From-SVN: r140574
2008-09-23 02:47:02 +02:00
|
|
|
__testoverflow = true;
|
2006-04-29 20:16:47 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
__result *= __base;
|
PR libstdc++/32422, DR 23 [Ready in R60]
2008-09-23 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/32422, DR 23 [Ready in R60]
* config/locale/gnu/c_locale.cc (__convert_to_v(const char*, float&,
ios_base::iostate&, const __c_locale&), __convert_to_v(const char*,
double&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, long double&, ios_base::iostate&, const __c_locale&)): Implement
DR 23 and deal correctly with broken exponents.
* config/locale/generic/c_locale.cc (__convert_to_v(const char*,
float&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, double&, ios_base::iostate&, const __c_locale&),
__convert_to_v(const char*, long double&, ios_base::iostate&, const
__c_locale&)): Likewise.
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int(_InIter,
_InIter, ios_base&, ios_base::iostate&, _ValueT&)): Likewise.
(num_get<>::_M_extract_float(_InIter, _InIter, ios_base&,
ios_base::iostate&, string&): Change grouping check to set instead of
OR failbit; do not check for eofbit here...
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, float&), num_get<>::do_get(iter_type, iter_type,
ios_base&, ios_base::iostate&, double&), num_get<>::do_get(iter_type,
iter_type, ios_base&, ios_base::iostate&, long double&),
num_get<>::__do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, double&)): ... do it here instead.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, bool&)): Implement DR 23.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, void*&)): Adjust.
* doc/xml/manual/intro.xml: Add and entry for DR 23.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/10.cc:
Adjust.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/10.cc:
Likewise.
* testsuite/22_locale/num_get/get/wchar_t/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/10.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/12.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/15.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/16.cc: Likewise.
* testsuite/22_locale/num_get/get/char/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/char/10.cc: Likewise.
* testsuite/22_locale/num_get/get/char/12.cc: Likewise.
* testsuite/22_locale/num_get/get/char/15.cc: Likewise.
* testsuite/22_locale/num_get/get/char/16.cc: Likewise.
From-SVN: r140574
2008-09-23 02:47:02 +02:00
|
|
|
__testoverflow |= __result > __max - __digit;
|
2006-04-29 20:16:47 +02:00
|
|
|
__result += __digit;
|
|
|
|
++__sep_pos;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (++__beg != __end)
|
|
|
|
__c = *__beg;
|
|
|
|
else
|
|
|
|
__testeof = true;
|
|
|
|
}
|
|
|
|
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
// Digit grouping is checked. If grouping and found_grouping don't
|
|
|
|
// match, then get very very upset, and set failbit.
|
2004-02-17 12:19:25 +01:00
|
|
|
if (__found_grouping.size())
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
{
|
|
|
|
// Add the ending grouping.
|
|
|
|
__found_grouping += static_cast<char>(__sep_pos);
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2004-02-27 15:30:19 +01:00
|
|
|
if (!std::__verify_grouping(__lc->_M_grouping,
|
|
|
|
__lc->_M_grouping_size,
|
locale_facets.h (struct __numpunct_cache): Add member _M_grouping_size, caching the length of _M_grouping.
2004-01-14 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (struct __numpunct_cache):
Add member _M_grouping_size, caching the length of _M_grouping.
(__numpunct_cache<>::_M_cache): Assign the latter.
(__verify_grouping): Move declaration...
* include/bits/locale_facets.tcc (__verify_grouping):
... here, change signature to take a const char* and a size_t
for the grouping; not a template anymore.
(__add_grouping, num_put::_M_group_int, num_put::_M_group_float):
Likewise change signature and tweak consistently.
(num_get::_M_extract_float, num_get::_M_extract_int,
num_put::_M_insert_int, num_put::_M_insert_float,
money_get::do_get(string_type&), money_get::do_put(string_type)):
Update callers.
* config/locale/generic/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Assign the new member.
* config/locale/gnu/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Likewise.
* src/locale-inst.cc (__add_grouping): Tweak signature.
(__verify_grouping): Don't instantiate, not a template anymore.
* include/bits/locale_facets.h: Rename _M_truename_len ->
_M_truename_size, _M_falsename_len -> _M_falsename_size.
* include/bits/locale_facets.tcc: Likewise.
* config/locale/generic/numeric_members.cc: Likewise.
* config/locale/gnu/numeric_members.cc: Likewise.
From-SVN: r75876
2004-01-14 20:14:39 +01:00
|
|
|
__found_grouping))
|
PR libstdc++/32422, DR 23 [Ready in R60]
2008-09-23 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/32422, DR 23 [Ready in R60]
* config/locale/gnu/c_locale.cc (__convert_to_v(const char*, float&,
ios_base::iostate&, const __c_locale&), __convert_to_v(const char*,
double&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, long double&, ios_base::iostate&, const __c_locale&)): Implement
DR 23 and deal correctly with broken exponents.
* config/locale/generic/c_locale.cc (__convert_to_v(const char*,
float&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, double&, ios_base::iostate&, const __c_locale&),
__convert_to_v(const char*, long double&, ios_base::iostate&, const
__c_locale&)): Likewise.
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int(_InIter,
_InIter, ios_base&, ios_base::iostate&, _ValueT&)): Likewise.
(num_get<>::_M_extract_float(_InIter, _InIter, ios_base&,
ios_base::iostate&, string&): Change grouping check to set instead of
OR failbit; do not check for eofbit here...
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, float&), num_get<>::do_get(iter_type, iter_type,
ios_base&, ios_base::iostate&, double&), num_get<>::do_get(iter_type,
iter_type, ios_base&, ios_base::iostate&, long double&),
num_get<>::__do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, double&)): ... do it here instead.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, bool&)): Implement DR 23.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, void*&)): Adjust.
* doc/xml/manual/intro.xml: Add and entry for DR 23.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/10.cc:
Adjust.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/10.cc:
Likewise.
* testsuite/22_locale/num_get/get/wchar_t/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/10.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/12.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/15.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/16.cc: Likewise.
* testsuite/22_locale/num_get/get/char/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/char/10.cc: Likewise.
* testsuite/22_locale/num_get/get/char/12.cc: Likewise.
* testsuite/22_locale/num_get/get/char/15.cc: Likewise.
* testsuite/22_locale/num_get/get/char/16.cc: Likewise.
From-SVN: r140574
2008-09-23 02:47:02 +02:00
|
|
|
__err = ios_base::failbit;
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
}
|
2003-07-17 03:54:44 +02:00
|
|
|
|
PR libstdc++/32422, DR 23 [Ready in R60]
2008-09-23 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/32422, DR 23 [Ready in R60]
* config/locale/gnu/c_locale.cc (__convert_to_v(const char*, float&,
ios_base::iostate&, const __c_locale&), __convert_to_v(const char*,
double&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, long double&, ios_base::iostate&, const __c_locale&)): Implement
DR 23 and deal correctly with broken exponents.
* config/locale/generic/c_locale.cc (__convert_to_v(const char*,
float&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, double&, ios_base::iostate&, const __c_locale&),
__convert_to_v(const char*, long double&, ios_base::iostate&, const
__c_locale&)): Likewise.
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int(_InIter,
_InIter, ios_base&, ios_base::iostate&, _ValueT&)): Likewise.
(num_get<>::_M_extract_float(_InIter, _InIter, ios_base&,
ios_base::iostate&, string&): Change grouping check to set instead of
OR failbit; do not check for eofbit here...
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, float&), num_get<>::do_get(iter_type, iter_type,
ios_base&, ios_base::iostate&, double&), num_get<>::do_get(iter_type,
iter_type, ios_base&, ios_base::iostate&, long double&),
num_get<>::__do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, double&)): ... do it here instead.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, bool&)): Implement DR 23.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, void*&)): Adjust.
* doc/xml/manual/intro.xml: Add and entry for DR 23.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/10.cc:
Adjust.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/10.cc:
Likewise.
* testsuite/22_locale/num_get/get/wchar_t/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/10.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/12.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/15.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/16.cc: Likewise.
* testsuite/22_locale/num_get/get/char/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/char/10.cc: Likewise.
* testsuite/22_locale/num_get/get/char/12.cc: Likewise.
* testsuite/22_locale/num_get/get/char/15.cc: Likewise.
* testsuite/22_locale/num_get/get/char/16.cc: Likewise.
From-SVN: r140574
2008-09-23 02:47:02 +02:00
|
|
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
|
|
|
// 23. Num_get overflow result.
|
|
|
|
if ((!__sep_pos && !__found_zero && !__found_grouping.size())
|
|
|
|
|| __testfail)
|
|
|
|
{
|
|
|
|
__v = 0;
|
|
|
|
__err = ios_base::failbit;
|
|
|
|
}
|
|
|
|
else if (__testoverflow)
|
|
|
|
{
|
2009-04-18 21:28:40 +02:00
|
|
|
if (__negative
|
|
|
|
&& __gnu_cxx::__numeric_traits<_ValueT>::__is_signed)
|
PR libstdc++/32422, DR 23 [Ready in R60]
2008-09-23 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/32422, DR 23 [Ready in R60]
* config/locale/gnu/c_locale.cc (__convert_to_v(const char*, float&,
ios_base::iostate&, const __c_locale&), __convert_to_v(const char*,
double&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, long double&, ios_base::iostate&, const __c_locale&)): Implement
DR 23 and deal correctly with broken exponents.
* config/locale/generic/c_locale.cc (__convert_to_v(const char*,
float&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, double&, ios_base::iostate&, const __c_locale&),
__convert_to_v(const char*, long double&, ios_base::iostate&, const
__c_locale&)): Likewise.
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int(_InIter,
_InIter, ios_base&, ios_base::iostate&, _ValueT&)): Likewise.
(num_get<>::_M_extract_float(_InIter, _InIter, ios_base&,
ios_base::iostate&, string&): Change grouping check to set instead of
OR failbit; do not check for eofbit here...
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, float&), num_get<>::do_get(iter_type, iter_type,
ios_base&, ios_base::iostate&, double&), num_get<>::do_get(iter_type,
iter_type, ios_base&, ios_base::iostate&, long double&),
num_get<>::__do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, double&)): ... do it here instead.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, bool&)): Implement DR 23.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, void*&)): Adjust.
* doc/xml/manual/intro.xml: Add and entry for DR 23.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/10.cc:
Adjust.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/10.cc:
Likewise.
* testsuite/22_locale/num_get/get/wchar_t/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/10.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/12.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/15.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/16.cc: Likewise.
* testsuite/22_locale/num_get/get/char/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/char/10.cc: Likewise.
* testsuite/22_locale/num_get/get/char/12.cc: Likewise.
* testsuite/22_locale/num_get/get/char/15.cc: Likewise.
* testsuite/22_locale/num_get/get/char/16.cc: Likewise.
From-SVN: r140574
2008-09-23 02:47:02 +02:00
|
|
|
__v = __gnu_cxx::__numeric_traits<_ValueT>::__min;
|
|
|
|
else
|
|
|
|
__v = __gnu_cxx::__numeric_traits<_ValueT>::__max;
|
|
|
|
__err = ios_base::failbit;
|
|
|
|
}
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
else
|
PR libstdc++/32422, DR 23 [Ready in R60]
2008-09-23 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/32422, DR 23 [Ready in R60]
* config/locale/gnu/c_locale.cc (__convert_to_v(const char*, float&,
ios_base::iostate&, const __c_locale&), __convert_to_v(const char*,
double&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, long double&, ios_base::iostate&, const __c_locale&)): Implement
DR 23 and deal correctly with broken exponents.
* config/locale/generic/c_locale.cc (__convert_to_v(const char*,
float&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, double&, ios_base::iostate&, const __c_locale&),
__convert_to_v(const char*, long double&, ios_base::iostate&, const
__c_locale&)): Likewise.
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int(_InIter,
_InIter, ios_base&, ios_base::iostate&, _ValueT&)): Likewise.
(num_get<>::_M_extract_float(_InIter, _InIter, ios_base&,
ios_base::iostate&, string&): Change grouping check to set instead of
OR failbit; do not check for eofbit here...
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, float&), num_get<>::do_get(iter_type, iter_type,
ios_base&, ios_base::iostate&, double&), num_get<>::do_get(iter_type,
iter_type, ios_base&, ios_base::iostate&, long double&),
num_get<>::__do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, double&)): ... do it here instead.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, bool&)): Implement DR 23.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, void*&)): Adjust.
* doc/xml/manual/intro.xml: Add and entry for DR 23.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/10.cc:
Adjust.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/10.cc:
Likewise.
* testsuite/22_locale/num_get/get/wchar_t/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/10.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/12.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/15.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/16.cc: Likewise.
* testsuite/22_locale/num_get/get/char/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/char/10.cc: Likewise.
* testsuite/22_locale/num_get/get/char/12.cc: Likewise.
* testsuite/22_locale/num_get/get/char/15.cc: Likewise.
* testsuite/22_locale/num_get/get/char/16.cc: Likewise.
From-SVN: r140574
2008-09-23 02:47:02 +02:00
|
|
|
__v = __negative ? -__result : __result;
|
2001-11-28 05:07:11 +01:00
|
|
|
|
2004-11-03 02:05:08 +01:00
|
|
|
if (__testeof)
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
__err |= ios_base::eofbit;
|
|
|
|
return __beg;
|
|
|
|
}
|
2001-09-29 01:44:48 +02:00
|
|
|
|
2003-10-12 12:12:09 +02:00
|
|
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
|
|
|
// 17. Bad bool parsing
|
2001-09-29 01:44:48 +02:00
|
|
|
template<typename _CharT, typename _InIter>
|
|
|
|
_InIter
|
|
|
|
num_get<_CharT, _InIter>::
|
|
|
|
do_get(iter_type __beg, iter_type __end, ios_base& __io,
|
|
|
|
ios_base::iostate& __err, bool& __v) const
|
2000-10-05 13:27:02 +02:00
|
|
|
{
|
2001-09-29 01:44:48 +02:00
|
|
|
if (!(__io.flags() & ios_base::boolalpha))
|
2000-10-05 13:27:02 +02:00
|
|
|
{
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
// Parse bool values as long.
|
2001-09-29 01:44:48 +02:00
|
|
|
// NB: We can't just call do_get(long) here, as it might
|
|
|
|
// refer to a derived class.
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
long __l = -1;
|
|
|
|
__beg = _M_extract_int(__beg, __end, __io, __err, __l);
|
|
|
|
if (__l == 0 || __l == 1)
|
locale_facets.tcc (num_get<>::do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&), [...]): -Wconversion and -Woverflow fixes.
2007-01-28 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.tcc (num_get<>::do_get(iter_type,
iter_type, ios_base&, ios_base::iostate&, bool&),
num_put<>::_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)):
-Wconversion and -Woverflow fixes.
* include/bits/istream.tcc (operator>>(int&), operator>>(short&)):
Likewise.
* include/std/valarray (valarray<>::shift, cshift): Likewise.
From-SVN: r121264
2007-01-28 19:40:42 +01:00
|
|
|
__v = bool(__l);
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
else
|
PR libstdc++/32422, DR 23 [Ready in R60]
2008-09-23 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/32422, DR 23 [Ready in R60]
* config/locale/gnu/c_locale.cc (__convert_to_v(const char*, float&,
ios_base::iostate&, const __c_locale&), __convert_to_v(const char*,
double&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, long double&, ios_base::iostate&, const __c_locale&)): Implement
DR 23 and deal correctly with broken exponents.
* config/locale/generic/c_locale.cc (__convert_to_v(const char*,
float&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, double&, ios_base::iostate&, const __c_locale&),
__convert_to_v(const char*, long double&, ios_base::iostate&, const
__c_locale&)): Likewise.
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int(_InIter,
_InIter, ios_base&, ios_base::iostate&, _ValueT&)): Likewise.
(num_get<>::_M_extract_float(_InIter, _InIter, ios_base&,
ios_base::iostate&, string&): Change grouping check to set instead of
OR failbit; do not check for eofbit here...
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, float&), num_get<>::do_get(iter_type, iter_type,
ios_base&, ios_base::iostate&, double&), num_get<>::do_get(iter_type,
iter_type, ios_base&, ios_base::iostate&, long double&),
num_get<>::__do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, double&)): ... do it here instead.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, bool&)): Implement DR 23.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, void*&)): Adjust.
* doc/xml/manual/intro.xml: Add and entry for DR 23.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/10.cc:
Adjust.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/10.cc:
Likewise.
* testsuite/22_locale/num_get/get/wchar_t/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/10.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/12.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/15.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/16.cc: Likewise.
* testsuite/22_locale/num_get/get/char/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/char/10.cc: Likewise.
* testsuite/22_locale/num_get/get/char/12.cc: Likewise.
* testsuite/22_locale/num_get/get/char/15.cc: Likewise.
* testsuite/22_locale/num_get/get/char/16.cc: Likewise.
From-SVN: r140574
2008-09-23 02:47:02 +02:00
|
|
|
{
|
|
|
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
|
|
|
// 23. Num_get overflow result.
|
|
|
|
__v = true;
|
|
|
|
__err = ios_base::failbit;
|
|
|
|
if (__beg == __end)
|
|
|
|
__err |= ios_base::eofbit;
|
|
|
|
}
|
2001-09-29 01:44:48 +02:00
|
|
|
}
|
|
|
|
else
|
2000-10-05 13:27:02 +02:00
|
|
|
{
|
2003-07-17 03:54:44 +02:00
|
|
|
// Parse bool values as alphanumeric.
|
2008-10-31 17:47:48 +01:00
|
|
|
typedef __numpunct_cache<_CharT> __cache_type;
|
2003-07-17 03:54:44 +02:00
|
|
|
__use_cache<__cache_type> __uc;
|
|
|
|
const locale& __loc = __io._M_getloc();
|
|
|
|
const __cache_type* __lc = __uc(__loc);
|
2001-11-28 05:07:11 +01:00
|
|
|
|
2008-11-01 17:17:42 +01:00
|
|
|
bool __testf = true;
|
|
|
|
bool __testt = true;
|
2008-11-01 23:09:43 +01:00
|
|
|
bool __donef = __lc->_M_falsename_size == 0;
|
|
|
|
bool __donet = __lc->_M_truename_size == 0;
|
2008-11-01 17:17:42 +01:00
|
|
|
bool __testeof = false;
|
2008-11-01 23:09:43 +01:00
|
|
|
size_t __n = 0;
|
|
|
|
while (!__donef || !__donet)
|
2008-11-01 17:17:42 +01:00
|
|
|
{
|
|
|
|
if (__beg == __end)
|
2008-10-31 17:47:48 +01:00
|
|
|
{
|
2008-11-01 17:17:42 +01:00
|
|
|
__testeof = true;
|
|
|
|
break;
|
2007-02-13 11:13:04 +01:00
|
|
|
}
|
2003-07-17 03:54:44 +02:00
|
|
|
|
2008-11-01 17:17:42 +01:00
|
|
|
const char_type __c = *__beg;
|
2003-07-17 03:54:44 +02:00
|
|
|
|
2008-11-01 23:09:43 +01:00
|
|
|
if (!__donef)
|
2008-11-01 17:17:42 +01:00
|
|
|
__testf = __c == __lc->_M_falsename[__n];
|
|
|
|
|
2008-11-03 11:23:38 +01:00
|
|
|
if (!__testf && __donet)
|
|
|
|
break;
|
|
|
|
|
2008-11-01 23:09:43 +01:00
|
|
|
if (!__donet)
|
2008-11-01 17:17:42 +01:00
|
|
|
__testt = __c == __lc->_M_truename[__n];
|
|
|
|
|
2008-11-03 11:23:38 +01:00
|
|
|
if (!__testt && __donef)
|
2004-02-08 05:46:42 +01:00
|
|
|
break;
|
2008-11-01 17:17:42 +01:00
|
|
|
|
2008-11-03 11:23:38 +01:00
|
|
|
if (!__testt && !__testf)
|
2008-11-01 17:17:42 +01:00
|
|
|
break;
|
2008-11-01 23:09:43 +01:00
|
|
|
|
|
|
|
++__n;
|
|
|
|
++__beg;
|
|
|
|
|
|
|
|
__donef = !__testf || __n >= __lc->_M_falsename_size;
|
|
|
|
__donet = !__testt || __n >= __lc->_M_truename_size;
|
2008-11-01 17:17:42 +01:00
|
|
|
}
|
|
|
|
if (__testf && __n == __lc->_M_falsename_size && __n)
|
2008-10-31 17:47:48 +01:00
|
|
|
{
|
|
|
|
__v = false;
|
|
|
|
if (__testt && __n == __lc->_M_truename_size)
|
|
|
|
__err = ios_base::failbit;
|
|
|
|
else
|
2008-11-01 17:17:42 +01:00
|
|
|
__err = __testeof ? ios_base::eofbit : ios_base::goodbit;
|
2008-10-31 17:47:48 +01:00
|
|
|
}
|
2008-11-01 17:17:42 +01:00
|
|
|
else if (__testt && __n == __lc->_M_truename_size && __n)
|
2008-10-31 17:47:48 +01:00
|
|
|
{
|
|
|
|
__v = true;
|
2008-11-01 17:17:42 +01:00
|
|
|
__err = __testeof ? ios_base::eofbit : ios_base::goodbit;
|
2008-10-31 17:47:48 +01:00
|
|
|
}
|
2003-12-15 17:56:42 +01:00
|
|
|
else
|
PR libstdc++/32422, DR 23 [Ready in R60]
2008-09-23 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/32422, DR 23 [Ready in R60]
* config/locale/gnu/c_locale.cc (__convert_to_v(const char*, float&,
ios_base::iostate&, const __c_locale&), __convert_to_v(const char*,
double&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, long double&, ios_base::iostate&, const __c_locale&)): Implement
DR 23 and deal correctly with broken exponents.
* config/locale/generic/c_locale.cc (__convert_to_v(const char*,
float&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, double&, ios_base::iostate&, const __c_locale&),
__convert_to_v(const char*, long double&, ios_base::iostate&, const
__c_locale&)): Likewise.
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int(_InIter,
_InIter, ios_base&, ios_base::iostate&, _ValueT&)): Likewise.
(num_get<>::_M_extract_float(_InIter, _InIter, ios_base&,
ios_base::iostate&, string&): Change grouping check to set instead of
OR failbit; do not check for eofbit here...
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, float&), num_get<>::do_get(iter_type, iter_type,
ios_base&, ios_base::iostate&, double&), num_get<>::do_get(iter_type,
iter_type, ios_base&, ios_base::iostate&, long double&),
num_get<>::__do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, double&)): ... do it here instead.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, bool&)): Implement DR 23.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, void*&)): Adjust.
* doc/xml/manual/intro.xml: Add and entry for DR 23.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/10.cc:
Adjust.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/10.cc:
Likewise.
* testsuite/22_locale/num_get/get/wchar_t/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/10.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/12.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/15.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/16.cc: Likewise.
* testsuite/22_locale/num_get/get/char/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/char/10.cc: Likewise.
* testsuite/22_locale/num_get/get/char/12.cc: Likewise.
* testsuite/22_locale/num_get/get/char/15.cc: Likewise.
* testsuite/22_locale/num_get/get/char/16.cc: Likewise.
From-SVN: r140574
2008-09-23 02:47:02 +02:00
|
|
|
{
|
|
|
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
|
|
|
// 23. Num_get overflow result.
|
|
|
|
__v = false;
|
|
|
|
__err = ios_base::failbit;
|
2008-11-01 17:17:42 +01:00
|
|
|
if (__testeof)
|
2008-10-31 17:47:48 +01:00
|
|
|
__err |= ios_base::eofbit;
|
PR libstdc++/32422, DR 23 [Ready in R60]
2008-09-23 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/32422, DR 23 [Ready in R60]
* config/locale/gnu/c_locale.cc (__convert_to_v(const char*, float&,
ios_base::iostate&, const __c_locale&), __convert_to_v(const char*,
double&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, long double&, ios_base::iostate&, const __c_locale&)): Implement
DR 23 and deal correctly with broken exponents.
* config/locale/generic/c_locale.cc (__convert_to_v(const char*,
float&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, double&, ios_base::iostate&, const __c_locale&),
__convert_to_v(const char*, long double&, ios_base::iostate&, const
__c_locale&)): Likewise.
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int(_InIter,
_InIter, ios_base&, ios_base::iostate&, _ValueT&)): Likewise.
(num_get<>::_M_extract_float(_InIter, _InIter, ios_base&,
ios_base::iostate&, string&): Change grouping check to set instead of
OR failbit; do not check for eofbit here...
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, float&), num_get<>::do_get(iter_type, iter_type,
ios_base&, ios_base::iostate&, double&), num_get<>::do_get(iter_type,
iter_type, ios_base&, ios_base::iostate&, long double&),
num_get<>::__do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, double&)): ... do it here instead.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, bool&)): Implement DR 23.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, void*&)): Adjust.
* doc/xml/manual/intro.xml: Add and entry for DR 23.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/10.cc:
Adjust.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/10.cc:
Likewise.
* testsuite/22_locale/num_get/get/wchar_t/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/10.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/12.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/15.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/16.cc: Likewise.
* testsuite/22_locale/num_get/get/char/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/char/10.cc: Likewise.
* testsuite/22_locale/num_get/get/char/12.cc: Likewise.
* testsuite/22_locale/num_get/get/char/15.cc: Likewise.
* testsuite/22_locale/num_get/get/char/16.cc: Likewise.
From-SVN: r140574
2008-09-23 02:47:02 +02:00
|
|
|
}
|
2008-11-01 17:17:42 +01:00
|
|
|
}
|
2001-09-29 01:44:48 +02:00
|
|
|
return __beg;
|
2000-10-05 13:27:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _CharT, typename _InIter>
|
2001-09-29 01:44:48 +02:00
|
|
|
_InIter
|
2000-10-05 13:27:02 +02:00
|
|
|
num_get<_CharT, _InIter>::
|
2004-02-08 05:46:42 +01:00
|
|
|
do_get(iter_type __beg, iter_type __end, ios_base& __io,
|
2001-11-28 05:07:11 +01:00
|
|
|
ios_base::iostate& __err, float& __v) const
|
2000-10-05 13:27:02 +02:00
|
|
|
{
|
2001-12-07 03:58:36 +01:00
|
|
|
string __xtrc;
|
|
|
|
__xtrc.reserve(32);
|
2002-01-11 06:07:22 +01:00
|
|
|
__beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());
|
PR libstdc++/32422, DR 23 [Ready in R60]
2008-09-23 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/32422, DR 23 [Ready in R60]
* config/locale/gnu/c_locale.cc (__convert_to_v(const char*, float&,
ios_base::iostate&, const __c_locale&), __convert_to_v(const char*,
double&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, long double&, ios_base::iostate&, const __c_locale&)): Implement
DR 23 and deal correctly with broken exponents.
* config/locale/generic/c_locale.cc (__convert_to_v(const char*,
float&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, double&, ios_base::iostate&, const __c_locale&),
__convert_to_v(const char*, long double&, ios_base::iostate&, const
__c_locale&)): Likewise.
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int(_InIter,
_InIter, ios_base&, ios_base::iostate&, _ValueT&)): Likewise.
(num_get<>::_M_extract_float(_InIter, _InIter, ios_base&,
ios_base::iostate&, string&): Change grouping check to set instead of
OR failbit; do not check for eofbit here...
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, float&), num_get<>::do_get(iter_type, iter_type,
ios_base&, ios_base::iostate&, double&), num_get<>::do_get(iter_type,
iter_type, ios_base&, ios_base::iostate&, long double&),
num_get<>::__do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, double&)): ... do it here instead.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, bool&)): Implement DR 23.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, void*&)): Adjust.
* doc/xml/manual/intro.xml: Add and entry for DR 23.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/10.cc:
Adjust.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/10.cc:
Likewise.
* testsuite/22_locale/num_get/get/wchar_t/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/10.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/12.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/15.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/16.cc: Likewise.
* testsuite/22_locale/num_get/get/char/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/char/10.cc: Likewise.
* testsuite/22_locale/num_get/get/char/12.cc: Likewise.
* testsuite/22_locale/num_get/get/char/15.cc: Likewise.
* testsuite/22_locale/num_get/get/char/16.cc: Likewise.
From-SVN: r140574
2008-09-23 02:47:02 +02:00
|
|
|
if (__beg == __end)
|
|
|
|
__err |= ios_base::eofbit;
|
2001-09-29 01:44:48 +02:00
|
|
|
return __beg;
|
|
|
|
}
|
2000-10-05 13:27:02 +02:00
|
|
|
|
|
|
|
template<typename _CharT, typename _InIter>
|
|
|
|
_InIter
|
|
|
|
num_get<_CharT, _InIter>::
|
|
|
|
do_get(iter_type __beg, iter_type __end, ios_base& __io,
|
2001-09-29 01:44:48 +02:00
|
|
|
ios_base::iostate& __err, double& __v) const
|
2000-10-05 13:27:02 +02:00
|
|
|
{
|
2001-12-07 03:58:36 +01:00
|
|
|
string __xtrc;
|
|
|
|
__xtrc.reserve(32);
|
2002-01-11 06:07:22 +01:00
|
|
|
__beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
|
[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
|
|
|
std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());
|
PR libstdc++/32422, DR 23 [Ready in R60]
2008-09-23 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/32422, DR 23 [Ready in R60]
* config/locale/gnu/c_locale.cc (__convert_to_v(const char*, float&,
ios_base::iostate&, const __c_locale&), __convert_to_v(const char*,
double&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, long double&, ios_base::iostate&, const __c_locale&)): Implement
DR 23 and deal correctly with broken exponents.
* config/locale/generic/c_locale.cc (__convert_to_v(const char*,
float&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, double&, ios_base::iostate&, const __c_locale&),
__convert_to_v(const char*, long double&, ios_base::iostate&, const
__c_locale&)): Likewise.
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int(_InIter,
_InIter, ios_base&, ios_base::iostate&, _ValueT&)): Likewise.
(num_get<>::_M_extract_float(_InIter, _InIter, ios_base&,
ios_base::iostate&, string&): Change grouping check to set instead of
OR failbit; do not check for eofbit here...
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, float&), num_get<>::do_get(iter_type, iter_type,
ios_base&, ios_base::iostate&, double&), num_get<>::do_get(iter_type,
iter_type, ios_base&, ios_base::iostate&, long double&),
num_get<>::__do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, double&)): ... do it here instead.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, bool&)): Implement DR 23.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, void*&)): Adjust.
* doc/xml/manual/intro.xml: Add and entry for DR 23.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/10.cc:
Adjust.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/10.cc:
Likewise.
* testsuite/22_locale/num_get/get/wchar_t/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/10.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/12.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/15.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/16.cc: Likewise.
* testsuite/22_locale/num_get/get/char/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/char/10.cc: Likewise.
* testsuite/22_locale/num_get/get/char/12.cc: Likewise.
* testsuite/22_locale/num_get/get/char/15.cc: Likewise.
* testsuite/22_locale/num_get/get/char/16.cc: Likewise.
From-SVN: r140574
2008-09-23 02:47:02 +02:00
|
|
|
if (__beg == __end)
|
|
|
|
__err |= ios_base::eofbit;
|
2000-10-05 13:27:02 +02:00
|
|
|
return __beg;
|
|
|
|
}
|
|
|
|
|
configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
2006-02-07 Jakub Jelinek <jakub@redhat.com>
Benjamin Kosnik <bkoz@redhat.com>
* configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
If true, set also port_specific_symbol_files and create
as_symver_specs.
(GLIBCXX_LDBL_COMPAT): New GLIBCXX_CONDITIONAL.
* configure: Rebuilt.
* config.h.in: Rebuilt.
* config/os/gnu-linux/ldbl-extra.ver: New file.
* config/abi/pre/gnu.ver: Make sure no __float128 symbols are
exported.
* include/bits/c++config (_GLIBCXX_LONG_DOUBLE_COMPAT,
_GLIBCXX_LDBL_NAMESPACE, _GLIBCXX_BEGIN_LDBL_NAMESPACE,
_GLIBCXX_END_LDBL_NAMESPACE): Define.
* include/bits/localefwd.h: Use them to conditionally scope facets.
* include/bits/locale_facets.h: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_put): Add __do_put method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_put): Add __do_put method.
* include/bits/locale_facets.tcc: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
(std::money_get::__do_get, std::money_put::__do_put,
std::num_get::__do_get, std::num_put::__do_put): New
specializations.
* include/Makefile.am: Conditionally define
_GLIBCXX_LONG_DOUBLE_COMPAT in c++config.
* include/Makefile.in: Regenerate.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT] (_GLIBCXX_LOC_ID,
_GLIBCXX_SYNC_ID): Define, use them.
* src/compatibility-ldbl.cc: New file.
* src/complex_io.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Add compatibility
symbols.
* src/limits.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-misc-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/istream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/ostream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/wlocale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/compatibility.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* config/locale/generic/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* config/locale/gnu/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* src/Makefile.am (libstdc++-symbol.ver): Append instead of
insert in the middle if port specific symbol file requests it.
(ldbl_compat_sources): New variable.
(sources): Use it.
(compatibility-ldbl.lo, compatibility-ldbl.o): New rules.
* src/Makefile.in: Rebuilt.
* testsuite/testsuite_abi.cc: Recognize GLIBCXX_LDBL_3.4,
GLIBCXX_LDBL_3.4.7, CXXABI_LDBL_1.3.
Co-Authored-By: Benjamin Kosnik <bkoz@redhat.com>
From-SVN: r110725
2006-02-07 23:23:58 +01:00
|
|
|
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
|
|
|
|
template<typename _CharT, typename _InIter>
|
|
|
|
_InIter
|
|
|
|
num_get<_CharT, _InIter>::
|
|
|
|
__do_get(iter_type __beg, iter_type __end, ios_base& __io,
|
|
|
|
ios_base::iostate& __err, double& __v) const
|
|
|
|
{
|
|
|
|
string __xtrc;
|
|
|
|
__xtrc.reserve(32);
|
|
|
|
__beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
|
|
|
|
std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());
|
PR libstdc++/32422, DR 23 [Ready in R60]
2008-09-23 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/32422, DR 23 [Ready in R60]
* config/locale/gnu/c_locale.cc (__convert_to_v(const char*, float&,
ios_base::iostate&, const __c_locale&), __convert_to_v(const char*,
double&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, long double&, ios_base::iostate&, const __c_locale&)): Implement
DR 23 and deal correctly with broken exponents.
* config/locale/generic/c_locale.cc (__convert_to_v(const char*,
float&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, double&, ios_base::iostate&, const __c_locale&),
__convert_to_v(const char*, long double&, ios_base::iostate&, const
__c_locale&)): Likewise.
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int(_InIter,
_InIter, ios_base&, ios_base::iostate&, _ValueT&)): Likewise.
(num_get<>::_M_extract_float(_InIter, _InIter, ios_base&,
ios_base::iostate&, string&): Change grouping check to set instead of
OR failbit; do not check for eofbit here...
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, float&), num_get<>::do_get(iter_type, iter_type,
ios_base&, ios_base::iostate&, double&), num_get<>::do_get(iter_type,
iter_type, ios_base&, ios_base::iostate&, long double&),
num_get<>::__do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, double&)): ... do it here instead.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, bool&)): Implement DR 23.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, void*&)): Adjust.
* doc/xml/manual/intro.xml: Add and entry for DR 23.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/10.cc:
Adjust.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/10.cc:
Likewise.
* testsuite/22_locale/num_get/get/wchar_t/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/10.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/12.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/15.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/16.cc: Likewise.
* testsuite/22_locale/num_get/get/char/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/char/10.cc: Likewise.
* testsuite/22_locale/num_get/get/char/12.cc: Likewise.
* testsuite/22_locale/num_get/get/char/15.cc: Likewise.
* testsuite/22_locale/num_get/get/char/16.cc: Likewise.
From-SVN: r140574
2008-09-23 02:47:02 +02:00
|
|
|
if (__beg == __end)
|
|
|
|
__err |= ios_base::eofbit;
|
configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
2006-02-07 Jakub Jelinek <jakub@redhat.com>
Benjamin Kosnik <bkoz@redhat.com>
* configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
If true, set also port_specific_symbol_files and create
as_symver_specs.
(GLIBCXX_LDBL_COMPAT): New GLIBCXX_CONDITIONAL.
* configure: Rebuilt.
* config.h.in: Rebuilt.
* config/os/gnu-linux/ldbl-extra.ver: New file.
* config/abi/pre/gnu.ver: Make sure no __float128 symbols are
exported.
* include/bits/c++config (_GLIBCXX_LONG_DOUBLE_COMPAT,
_GLIBCXX_LDBL_NAMESPACE, _GLIBCXX_BEGIN_LDBL_NAMESPACE,
_GLIBCXX_END_LDBL_NAMESPACE): Define.
* include/bits/localefwd.h: Use them to conditionally scope facets.
* include/bits/locale_facets.h: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_put): Add __do_put method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_put): Add __do_put method.
* include/bits/locale_facets.tcc: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
(std::money_get::__do_get, std::money_put::__do_put,
std::num_get::__do_get, std::num_put::__do_put): New
specializations.
* include/Makefile.am: Conditionally define
_GLIBCXX_LONG_DOUBLE_COMPAT in c++config.
* include/Makefile.in: Regenerate.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT] (_GLIBCXX_LOC_ID,
_GLIBCXX_SYNC_ID): Define, use them.
* src/compatibility-ldbl.cc: New file.
* src/complex_io.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Add compatibility
symbols.
* src/limits.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-misc-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/istream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/ostream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/wlocale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/compatibility.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* config/locale/generic/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* config/locale/gnu/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* src/Makefile.am (libstdc++-symbol.ver): Append instead of
insert in the middle if port specific symbol file requests it.
(ldbl_compat_sources): New variable.
(sources): Use it.
(compatibility-ldbl.lo, compatibility-ldbl.o): New rules.
* src/Makefile.in: Rebuilt.
* testsuite/testsuite_abi.cc: Recognize GLIBCXX_LDBL_3.4,
GLIBCXX_LDBL_3.4.7, CXXABI_LDBL_1.3.
Co-Authored-By: Benjamin Kosnik <bkoz@redhat.com>
From-SVN: r110725
2006-02-07 23:23:58 +01:00
|
|
|
return __beg;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2000-10-05 13:27:02 +02:00
|
|
|
template<typename _CharT, typename _InIter>
|
|
|
|
_InIter
|
|
|
|
num_get<_CharT, _InIter>::
|
|
|
|
do_get(iter_type __beg, iter_type __end, ios_base& __io,
|
2001-09-29 01:44:48 +02:00
|
|
|
ios_base::iostate& __err, long double& __v) const
|
2000-10-05 13:27:02 +02:00
|
|
|
{
|
2001-12-07 03:58:36 +01:00
|
|
|
string __xtrc;
|
|
|
|
__xtrc.reserve(32);
|
2002-01-11 06:07:22 +01:00
|
|
|
__beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
|
[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
|
|
|
std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());
|
PR libstdc++/32422, DR 23 [Ready in R60]
2008-09-23 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/32422, DR 23 [Ready in R60]
* config/locale/gnu/c_locale.cc (__convert_to_v(const char*, float&,
ios_base::iostate&, const __c_locale&), __convert_to_v(const char*,
double&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, long double&, ios_base::iostate&, const __c_locale&)): Implement
DR 23 and deal correctly with broken exponents.
* config/locale/generic/c_locale.cc (__convert_to_v(const char*,
float&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, double&, ios_base::iostate&, const __c_locale&),
__convert_to_v(const char*, long double&, ios_base::iostate&, const
__c_locale&)): Likewise.
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int(_InIter,
_InIter, ios_base&, ios_base::iostate&, _ValueT&)): Likewise.
(num_get<>::_M_extract_float(_InIter, _InIter, ios_base&,
ios_base::iostate&, string&): Change grouping check to set instead of
OR failbit; do not check for eofbit here...
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, float&), num_get<>::do_get(iter_type, iter_type,
ios_base&, ios_base::iostate&, double&), num_get<>::do_get(iter_type,
iter_type, ios_base&, ios_base::iostate&, long double&),
num_get<>::__do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, double&)): ... do it here instead.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, bool&)): Implement DR 23.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, void*&)): Adjust.
* doc/xml/manual/intro.xml: Add and entry for DR 23.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/10.cc:
Adjust.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/10.cc:
Likewise.
* testsuite/22_locale/num_get/get/wchar_t/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/10.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/12.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/15.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/16.cc: Likewise.
* testsuite/22_locale/num_get/get/char/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/char/10.cc: Likewise.
* testsuite/22_locale/num_get/get/char/12.cc: Likewise.
* testsuite/22_locale/num_get/get/char/15.cc: Likewise.
* testsuite/22_locale/num_get/get/char/16.cc: Likewise.
From-SVN: r140574
2008-09-23 02:47:02 +02:00
|
|
|
if (__beg == __end)
|
|
|
|
__err |= ios_base::eofbit;
|
2000-10-05 13:27:02 +02:00
|
|
|
return __beg;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _CharT, typename _InIter>
|
|
|
|
_InIter
|
|
|
|
num_get<_CharT, _InIter>::
|
|
|
|
do_get(iter_type __beg, iter_type __end, ios_base& __io,
|
2001-09-29 01:44:48 +02:00
|
|
|
ios_base::iostate& __err, void*& __v) const
|
2000-10-05 13:27:02 +02:00
|
|
|
{
|
2003-07-17 03:54:44 +02:00
|
|
|
// Prepare for hex formatted input.
|
2001-09-29 01:44:48 +02:00
|
|
|
typedef ios_base::fmtflags fmtflags;
|
2003-10-07 12:34:47 +02:00
|
|
|
const fmtflags __fmt = __io.flags();
|
2006-12-14 06:49:06 +01:00
|
|
|
__io.flags((__fmt & ~ios_base::basefield) | ios_base::hex);
|
2001-09-29 01:44:48 +02:00
|
|
|
|
2007-04-11 17:19:15 +02:00
|
|
|
typedef __gnu_cxx::__conditional_type<(sizeof(void*)
|
|
|
|
<= sizeof(unsigned long)),
|
|
|
|
unsigned long, unsigned long long>::__type _UIntPtrType;
|
|
|
|
|
|
|
|
_UIntPtrType __ul;
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
__beg = _M_extract_int(__beg, __end, __io, __err, __ul);
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2003-07-17 03:54:44 +02:00
|
|
|
// Reset from hex formatted input.
|
2001-09-29 01:44:48 +02:00
|
|
|
__io.flags(__fmt);
|
2002-01-23 00:09:04 +01:00
|
|
|
|
PR libstdc++/32422, DR 23 [Ready in R60]
2008-09-23 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/32422, DR 23 [Ready in R60]
* config/locale/gnu/c_locale.cc (__convert_to_v(const char*, float&,
ios_base::iostate&, const __c_locale&), __convert_to_v(const char*,
double&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, long double&, ios_base::iostate&, const __c_locale&)): Implement
DR 23 and deal correctly with broken exponents.
* config/locale/generic/c_locale.cc (__convert_to_v(const char*,
float&, ios_base::iostate&, const __c_locale&), __convert_to_v(const
char*, double&, ios_base::iostate&, const __c_locale&),
__convert_to_v(const char*, long double&, ios_base::iostate&, const
__c_locale&)): Likewise.
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int(_InIter,
_InIter, ios_base&, ios_base::iostate&, _ValueT&)): Likewise.
(num_get<>::_M_extract_float(_InIter, _InIter, ios_base&,
ios_base::iostate&, string&): Change grouping check to set instead of
OR failbit; do not check for eofbit here...
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, float&), num_get<>::do_get(iter_type, iter_type,
ios_base&, ios_base::iostate&, double&), num_get<>::do_get(iter_type,
iter_type, ios_base&, ios_base::iostate&, long double&),
num_get<>::__do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, double&)): ... do it here instead.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, bool&)): Implement DR 23.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, void*&)): Adjust.
* doc/xml/manual/intro.xml: Add and entry for DR 23.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/10.cc:
Adjust.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/10.cc:
Likewise.
* testsuite/22_locale/num_get/get/wchar_t/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/10.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/12.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/15.cc: Likewise.
* testsuite/22_locale/num_get/get/wchar_t/16.cc: Likewise.
* testsuite/22_locale/num_get/get/char/22131.cc: Likewise.
* testsuite/22_locale/num_get/get/char/10.cc: Likewise.
* testsuite/22_locale/num_get/get/char/12.cc: Likewise.
* testsuite/22_locale/num_get/get/char/15.cc: Likewise.
* testsuite/22_locale/num_get/get/char/16.cc: Likewise.
From-SVN: r140574
2008-09-23 02:47:02 +02:00
|
|
|
__v = reinterpret_cast<void*>(__ul);
|
2000-10-05 13:27:02 +02:00
|
|
|
return __beg;
|
|
|
|
}
|
|
|
|
|
2003-02-11 22:55:49 +01:00
|
|
|
// For use by integer and floating-point types after they have been
|
|
|
|
// converted into a char_type string.
|
|
|
|
template<typename _CharT, typename _OutIter>
|
|
|
|
void
|
|
|
|
num_put<_CharT, _OutIter>::
|
2004-02-08 05:46:42 +01:00
|
|
|
_M_pad(_CharT __fill, streamsize __w, ios_base& __io,
|
2003-02-11 22:55:49 +01:00
|
|
|
_CharT* __new, const _CharT* __cs, int& __len) const
|
|
|
|
{
|
|
|
|
// [22.2.2.2.2] Stage 3.
|
|
|
|
// If necessary, pad.
|
PR libstdc++/28277 (partial: vstring bits)
2007-04-10 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/28277 (partial: vstring bits)
* include/bits/ostream_insert.h: New.
* include/Makefile.am: Add.
* include/ext/vstring.h (operator<<(basic_ostream<>&,
const __versa_string<>&): Forward to __ostream_insert.
* include/bits/basic_string.h (operator<<(basic_ostream<>&,
const string<>&)): Likewise.
* include/std/ostream (operator<<(basic_ostream<>&, _CharT),
operator<<(basic_ostream<char,>&, char), operator<<(basic_ostream<>&,
const _CharT*), operator<<(basic_ostream<char,>&, const char*)):
Likewise.
* include/ext/vstring.tcc (operator<<(basic_ostream<>&,
const __versa_string<>&)): Remove.
(class basic_ostream): Remove friend declarations.
(basic_ostream<>::_M_write(char_type, streamsize),
_M_insert(const char_type*, streamsize)): Remove.
* include/bits/ostream.tcc (_M_insert(const char_type*, streamsize)):
Remove definition.
(operator<<(basic_ostream<>&, const char*)): Use __ostream_insert.
* config/abi/pre/gnu.ver: Adjust.
* src/ostream-inst.cc: Add __ostream_insert instantiations.
* include/bits/locale_facets.h (__pad<>::_S_pad): Remove __num
parameter.
* include/bits/locale_facets.tcc (__pad<>::_S_pad): Adjust.
(num_put<>::_M_pad(_CharT, streamsize, ios_base&, _CharT*,
const _CharT*, int&)): Likewise.
* include/Makefile.in: Rebuild.
* testsuite/ext/vstring/inserters_extractors/char/28277.cc: New.
* testsuite/ext/vstring/inserters_extractors/wchar_t/28277.cc: New.
* include/ext/vstring_util.h: Do not include the whole <locale>.
* include/ext/vstring.tcc (operator>>(basic_istream<>&,
__versa_string<>&, getline(basic_istream<>&, __versa_string<>&,
_CharT)): Tweak to refer to ios_base as a base of istream; do not
refer to non-standard types of istream.
* include/bits/istream.tcc (operator>>(basic_istream<>&, _CharT*),
ws(basic_istream<>&)): Do not refer to non-standard types of istream.
* include/std/bitset (operator>>(std::basic_istream<>&, bitset<>&)):
Avoid using basic_streambuf<>*.
* include/bits/istream.tcc (operator>>(basic_istream<>&,
basic_string<>&), getline(basic_istream<>&, basic_string<>&, _CharT)):
Move...
* include/bits/basic_string.tcc: ... here; tweak to refer to ios_base
as a base of istream; do not refer to non-standard types of istream.
* include/std/string: Tweak includes.
* include/ext/type_traits.h (__is_null_pointer): Add.
* include/ext/rc_string_base.h: Use it.
* include/ext/sso_string_base.h: Likewise.
* include/bits/basic_string.tcc (__is_null_pointer): Remove, use
the above.
* include/ext/vstring_util.h (__vstring_utility<>::_S_is_null_pointer):
Remove.
From-SVN: r123692
2007-04-10 12:38:50 +02:00
|
|
|
__pad<_CharT, char_traits<_CharT> >::_S_pad(__io, __fill, __new,
|
|
|
|
__cs, __w, __len);
|
2003-02-11 22:55:49 +01:00
|
|
|
__len = static_cast<int>(__w);
|
|
|
|
}
|
|
|
|
|
configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
2006-02-07 Jakub Jelinek <jakub@redhat.com>
Benjamin Kosnik <bkoz@redhat.com>
* configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
If true, set also port_specific_symbol_files and create
as_symver_specs.
(GLIBCXX_LDBL_COMPAT): New GLIBCXX_CONDITIONAL.
* configure: Rebuilt.
* config.h.in: Rebuilt.
* config/os/gnu-linux/ldbl-extra.ver: New file.
* config/abi/pre/gnu.ver: Make sure no __float128 symbols are
exported.
* include/bits/c++config (_GLIBCXX_LONG_DOUBLE_COMPAT,
_GLIBCXX_LDBL_NAMESPACE, _GLIBCXX_BEGIN_LDBL_NAMESPACE,
_GLIBCXX_END_LDBL_NAMESPACE): Define.
* include/bits/localefwd.h: Use them to conditionally scope facets.
* include/bits/locale_facets.h: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_put): Add __do_put method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_put): Add __do_put method.
* include/bits/locale_facets.tcc: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
(std::money_get::__do_get, std::money_put::__do_put,
std::num_get::__do_get, std::num_put::__do_put): New
specializations.
* include/Makefile.am: Conditionally define
_GLIBCXX_LONG_DOUBLE_COMPAT in c++config.
* include/Makefile.in: Regenerate.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT] (_GLIBCXX_LOC_ID,
_GLIBCXX_SYNC_ID): Define, use them.
* src/compatibility-ldbl.cc: New file.
* src/complex_io.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Add compatibility
symbols.
* src/limits.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-misc-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/istream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/ostream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/wlocale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/compatibility.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* config/locale/generic/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* config/locale/gnu/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* src/Makefile.am (libstdc++-symbol.ver): Append instead of
insert in the middle if port specific symbol file requests it.
(ldbl_compat_sources): New variable.
(sources): Use it.
(compatibility-ldbl.lo, compatibility-ldbl.o): New rules.
* src/Makefile.in: Rebuilt.
* testsuite/testsuite_abi.cc: Recognize GLIBCXX_LDBL_3.4,
GLIBCXX_LDBL_3.4.7, CXXABI_LDBL_1.3.
Co-Authored-By: Benjamin Kosnik <bkoz@redhat.com>
From-SVN: r110725
2006-02-07 23:23:58 +01:00
|
|
|
_GLIBCXX_END_LDBL_NAMESPACE
|
|
|
|
|
2003-02-11 22:55:49 +01:00
|
|
|
template<typename _CharT, typename _ValueT>
|
|
|
|
int
|
2003-10-22 23:53:21 +02:00
|
|
|
__int_to_char(_CharT* __bufend, _ValueT __v, const _CharT* __lit,
|
locale_facets.tcc (__int_to_char<>(_CharT*, long, const _CharT*, ios_base::fmtflags), [...]): Remove.
2006-07-09 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.tcc (__int_to_char<>(_CharT*,
long, const _CharT*, ios_base::fmtflags), __int_to_char<>(_CharT*,
unsigned long, const _CharT*, ios_base::fmtflags),
__int_to_char<>(_CharT*, long long, const _CharT*, ios_base::fmtflags),
__int_to_char<>(_CharT*, unsigned long long, const _CharT*,
ios_base::fmtflags)): Remove.
(__int_to_char<>(_CharT*, _ValueT, const _CharT*, ios_base::fmtflags,
bool)): Adjust.
(num_put<>::_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)):
Likewise.
From-SVN: r115298
2006-07-09 23:26:19 +02:00
|
|
|
ios_base::fmtflags __flags, bool __dec)
|
2003-02-11 22:55:49 +01:00
|
|
|
{
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
_CharT* __buf = __bufend;
|
locale_facets.tcc (__int_to_char<>(_CharT*, long, const _CharT*, ios_base::fmtflags), [...]): Remove.
2006-07-09 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.tcc (__int_to_char<>(_CharT*,
long, const _CharT*, ios_base::fmtflags), __int_to_char<>(_CharT*,
unsigned long, const _CharT*, ios_base::fmtflags),
__int_to_char<>(_CharT*, long long, const _CharT*, ios_base::fmtflags),
__int_to_char<>(_CharT*, unsigned long long, const _CharT*,
ios_base::fmtflags)): Remove.
(__int_to_char<>(_CharT*, _ValueT, const _CharT*, ios_base::fmtflags,
bool)): Adjust.
(num_put<>::_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)):
Likewise.
From-SVN: r115298
2006-07-09 23:26:19 +02:00
|
|
|
if (__builtin_expect(__dec, true))
|
2003-07-05 00:33:04 +02:00
|
|
|
{
|
|
|
|
// Decimal.
|
2004-02-08 05:46:42 +01:00
|
|
|
do
|
2003-07-05 00:33:04 +02:00
|
|
|
{
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
*--__buf = __lit[(__v % 10) + __num_base::_S_odigits];
|
2003-07-05 00:33:04 +02:00
|
|
|
__v /= 10;
|
2004-02-08 05:46:42 +01:00
|
|
|
}
|
2003-07-05 00:33:04 +02:00
|
|
|
while (__v != 0);
|
|
|
|
}
|
locale_facets.tcc (__int_to_char<>(_CharT*, long, const _CharT*, ios_base::fmtflags), [...]): Remove.
2006-07-09 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.tcc (__int_to_char<>(_CharT*,
long, const _CharT*, ios_base::fmtflags), __int_to_char<>(_CharT*,
unsigned long, const _CharT*, ios_base::fmtflags),
__int_to_char<>(_CharT*, long long, const _CharT*, ios_base::fmtflags),
__int_to_char<>(_CharT*, unsigned long long, const _CharT*,
ios_base::fmtflags)): Remove.
(__int_to_char<>(_CharT*, _ValueT, const _CharT*, ios_base::fmtflags,
bool)): Adjust.
(num_put<>::_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)):
Likewise.
From-SVN: r115298
2006-07-09 23:26:19 +02:00
|
|
|
else if ((__flags & ios_base::basefield) == ios_base::oct)
|
2003-02-11 22:55:49 +01:00
|
|
|
{
|
|
|
|
// Octal.
|
2004-02-08 05:46:42 +01:00
|
|
|
do
|
2003-02-11 22:55:49 +01:00
|
|
|
{
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
*--__buf = __lit[(__v & 0x7) + __num_base::_S_odigits];
|
2003-02-11 22:55:49 +01:00
|
|
|
__v >>= 3;
|
2004-02-08 05:46:42 +01:00
|
|
|
}
|
2003-02-11 22:55:49 +01:00
|
|
|
while (__v != 0);
|
|
|
|
}
|
2003-07-05 00:33:04 +02:00
|
|
|
else
|
2003-02-11 22:55:49 +01:00
|
|
|
{
|
|
|
|
// Hex.
|
|
|
|
const bool __uppercase = __flags & ios_base::uppercase;
|
2004-02-08 05:46:42 +01:00
|
|
|
const int __case_offset = __uppercase ? __num_base::_S_oudigits
|
2003-10-07 12:34:47 +02:00
|
|
|
: __num_base::_S_odigits;
|
2004-02-08 05:46:42 +01:00
|
|
|
do
|
2003-02-11 22:55:49 +01:00
|
|
|
{
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
*--__buf = __lit[(__v & 0xf) + __case_offset];
|
2003-02-11 22:55:49 +01:00
|
|
|
__v >>= 4;
|
2004-02-08 05:46:42 +01:00
|
|
|
}
|
2003-02-11 22:55:49 +01:00
|
|
|
while (__v != 0);
|
|
|
|
}
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
return __bufend - __buf;
|
2003-02-11 22:55:49 +01:00
|
|
|
}
|
|
|
|
|
configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
2006-02-07 Jakub Jelinek <jakub@redhat.com>
Benjamin Kosnik <bkoz@redhat.com>
* configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
If true, set also port_specific_symbol_files and create
as_symver_specs.
(GLIBCXX_LDBL_COMPAT): New GLIBCXX_CONDITIONAL.
* configure: Rebuilt.
* config.h.in: Rebuilt.
* config/os/gnu-linux/ldbl-extra.ver: New file.
* config/abi/pre/gnu.ver: Make sure no __float128 symbols are
exported.
* include/bits/c++config (_GLIBCXX_LONG_DOUBLE_COMPAT,
_GLIBCXX_LDBL_NAMESPACE, _GLIBCXX_BEGIN_LDBL_NAMESPACE,
_GLIBCXX_END_LDBL_NAMESPACE): Define.
* include/bits/localefwd.h: Use them to conditionally scope facets.
* include/bits/locale_facets.h: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_put): Add __do_put method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_put): Add __do_put method.
* include/bits/locale_facets.tcc: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
(std::money_get::__do_get, std::money_put::__do_put,
std::num_get::__do_get, std::num_put::__do_put): New
specializations.
* include/Makefile.am: Conditionally define
_GLIBCXX_LONG_DOUBLE_COMPAT in c++config.
* include/Makefile.in: Regenerate.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT] (_GLIBCXX_LOC_ID,
_GLIBCXX_SYNC_ID): Define, use them.
* src/compatibility-ldbl.cc: New file.
* src/complex_io.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Add compatibility
symbols.
* src/limits.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-misc-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/istream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/ostream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/wlocale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/compatibility.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* config/locale/generic/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* config/locale/gnu/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* src/Makefile.am (libstdc++-symbol.ver): Append instead of
insert in the middle if port specific symbol file requests it.
(ldbl_compat_sources): New variable.
(sources): Use it.
(compatibility-ldbl.lo, compatibility-ldbl.o): New rules.
* src/Makefile.in: Rebuilt.
* testsuite/testsuite_abi.cc: Recognize GLIBCXX_LDBL_3.4,
GLIBCXX_LDBL_3.4.7, CXXABI_LDBL_1.3.
Co-Authored-By: Benjamin Kosnik <bkoz@redhat.com>
From-SVN: r110725
2006-02-07 23:23:58 +01:00
|
|
|
_GLIBCXX_BEGIN_LDBL_NAMESPACE
|
|
|
|
|
2003-02-11 22:55:49 +01:00
|
|
|
template<typename _CharT, typename _OutIter>
|
|
|
|
void
|
|
|
|
num_put<_CharT, _OutIter>::
|
locale_facets.h (struct __numpunct_cache): Add member _M_grouping_size, caching the length of _M_grouping.
2004-01-14 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (struct __numpunct_cache):
Add member _M_grouping_size, caching the length of _M_grouping.
(__numpunct_cache<>::_M_cache): Assign the latter.
(__verify_grouping): Move declaration...
* include/bits/locale_facets.tcc (__verify_grouping):
... here, change signature to take a const char* and a size_t
for the grouping; not a template anymore.
(__add_grouping, num_put::_M_group_int, num_put::_M_group_float):
Likewise change signature and tweak consistently.
(num_get::_M_extract_float, num_get::_M_extract_int,
num_put::_M_insert_int, num_put::_M_insert_float,
money_get::do_get(string_type&), money_get::do_put(string_type)):
Update callers.
* config/locale/generic/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Assign the new member.
* config/locale/gnu/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Likewise.
* src/locale-inst.cc (__add_grouping): Tweak signature.
(__verify_grouping): Don't instantiate, not a template anymore.
* include/bits/locale_facets.h: Rename _M_truename_len ->
_M_truename_size, _M_falsename_len -> _M_falsename_size.
* include/bits/locale_facets.tcc: Likewise.
* config/locale/generic/numeric_members.cc: Likewise.
* config/locale/gnu/numeric_members.cc: Likewise.
From-SVN: r75876
2004-01-14 20:14:39 +01:00
|
|
|
_M_group_int(const char* __grouping, size_t __grouping_size, _CharT __sep,
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
ios_base&, _CharT* __new, _CharT* __cs, int& __len) const
|
2003-02-11 22:55:49 +01:00
|
|
|
{
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
_CharT* __p = std::__add_grouping(__new, __sep, __grouping,
|
|
|
|
__grouping_size, __cs, __cs + __len);
|
2003-02-11 22:55:49 +01:00
|
|
|
__len = __p - __new;
|
|
|
|
}
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
|
2003-02-11 22:55:49 +01:00
|
|
|
template<typename _CharT, typename _OutIter>
|
|
|
|
template<typename _ValueT>
|
|
|
|
_OutIter
|
|
|
|
num_put<_CharT, _OutIter>::
|
2004-02-08 05:46:42 +01:00
|
|
|
_M_insert_int(_OutIter __s, ios_base& __io, _CharT __fill,
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
_ValueT __v) const
|
2003-02-11 22:55:49 +01:00
|
|
|
{
|
2006-09-18 15:30:56 +02:00
|
|
|
using __gnu_cxx::__add_unsigned;
|
|
|
|
typedef typename __add_unsigned<_ValueT>::__type __unsigned_type;
|
locale_facets.tcc (__int_to_char<>(_CharT*, long, const _CharT*, ios_base::fmtflags), [...]): Remove.
2006-07-09 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.tcc (__int_to_char<>(_CharT*,
long, const _CharT*, ios_base::fmtflags), __int_to_char<>(_CharT*,
unsigned long, const _CharT*, ios_base::fmtflags),
__int_to_char<>(_CharT*, long long, const _CharT*, ios_base::fmtflags),
__int_to_char<>(_CharT*, unsigned long long, const _CharT*,
ios_base::fmtflags)): Remove.
(__int_to_char<>(_CharT*, _ValueT, const _CharT*, ios_base::fmtflags,
bool)): Adjust.
(num_put<>::_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)):
Likewise.
From-SVN: r115298
2006-07-09 23:26:19 +02:00
|
|
|
typedef __numpunct_cache<_CharT> __cache_type;
|
2003-07-10 08:21:13 +02:00
|
|
|
__use_cache<__cache_type> __uc;
|
2003-06-27 09:25:38 +02:00
|
|
|
const locale& __loc = __io._M_getloc();
|
2003-07-10 08:21:13 +02:00
|
|
|
const __cache_type* __lc = __uc(__loc);
|
|
|
|
const _CharT* __lit = __lc->_M_atoms_out;
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
const ios_base::fmtflags __flags = __io.flags();
|
2003-02-11 22:55:49 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
// Long enough to hold hex, dec, and octal representations.
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
const int __ilen = 5 * sizeof(_ValueT);
|
2004-02-08 05:46:42 +01:00
|
|
|
_CharT* __cs = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
|
2003-02-11 22:55:49 +01:00
|
|
|
* __ilen));
|
2003-10-08 16:20:42 +02:00
|
|
|
|
2003-02-11 22:55:49 +01:00
|
|
|
// [22.2.2.2.2] Stage 1, numeric conversion to character.
|
|
|
|
// Result is returned right-justified in the buffer.
|
locale_facets.tcc (__int_to_char<>(_CharT*, long, const _CharT*, ios_base::fmtflags), [...]): Remove.
2006-07-09 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.tcc (__int_to_char<>(_CharT*,
long, const _CharT*, ios_base::fmtflags), __int_to_char<>(_CharT*,
unsigned long, const _CharT*, ios_base::fmtflags),
__int_to_char<>(_CharT*, long long, const _CharT*, ios_base::fmtflags),
__int_to_char<>(_CharT*, unsigned long long, const _CharT*,
ios_base::fmtflags)): Remove.
(__int_to_char<>(_CharT*, _ValueT, const _CharT*, ios_base::fmtflags,
bool)): Adjust.
(num_put<>::_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)):
Likewise.
From-SVN: r115298
2006-07-09 23:26:19 +02:00
|
|
|
const ios_base::fmtflags __basefield = __flags & ios_base::basefield;
|
|
|
|
const bool __dec = (__basefield != ios_base::oct
|
|
|
|
&& __basefield != ios_base::hex);
|
locale_facets.tcc (num_get<>::do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&), [...]): -Wconversion and -Woverflow fixes.
2007-01-28 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.tcc (num_get<>::do_get(iter_type,
iter_type, ios_base&, ios_base::iostate&, bool&),
num_put<>::_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)):
-Wconversion and -Woverflow fixes.
* include/bits/istream.tcc (operator>>(int&), operator>>(short&)):
Likewise.
* include/std/valarray (valarray<>::shift, cshift): Likewise.
From-SVN: r121264
2007-01-28 19:40:42 +01:00
|
|
|
const __unsigned_type __u = ((__v > 0 || !__dec)
|
|
|
|
? __unsigned_type(__v)
|
|
|
|
: -__unsigned_type(__v));
|
locale_facets.tcc (__int_to_char<>(_CharT*, long, const _CharT*, ios_base::fmtflags), [...]): Remove.
2006-07-09 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.tcc (__int_to_char<>(_CharT*,
long, const _CharT*, ios_base::fmtflags), __int_to_char<>(_CharT*,
unsigned long, const _CharT*, ios_base::fmtflags),
__int_to_char<>(_CharT*, long long, const _CharT*, ios_base::fmtflags),
__int_to_char<>(_CharT*, unsigned long long, const _CharT*,
ios_base::fmtflags)): Remove.
(__int_to_char<>(_CharT*, _ValueT, const _CharT*, ios_base::fmtflags,
bool)): Adjust.
(num_put<>::_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)):
Likewise.
From-SVN: r115298
2006-07-09 23:26:19 +02:00
|
|
|
int __len = __int_to_char(__cs + __ilen, __u, __lit, __flags, __dec);
|
2003-10-08 16:20:42 +02:00
|
|
|
__cs += __ilen - __len;
|
2004-02-08 05:46:42 +01:00
|
|
|
|
|
|
|
// Add grouping, if necessary.
|
2003-07-10 08:21:13 +02:00
|
|
|
if (__lc->_M_use_grouping)
|
2003-02-11 22:55:49 +01:00
|
|
|
{
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
// Grouping can add (almost) as many separators as the number
|
|
|
|
// of digits + space is reserved for numeric base or sign.
|
2004-02-08 05:46:42 +01:00
|
|
|
_CharT* __cs2 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
* (__len + 1)
|
|
|
|
* 2));
|
locale_facets.h (struct __numpunct_cache): Add member _M_grouping_size, caching the length of _M_grouping.
2004-01-14 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (struct __numpunct_cache):
Add member _M_grouping_size, caching the length of _M_grouping.
(__numpunct_cache<>::_M_cache): Assign the latter.
(__verify_grouping): Move declaration...
* include/bits/locale_facets.tcc (__verify_grouping):
... here, change signature to take a const char* and a size_t
for the grouping; not a template anymore.
(__add_grouping, num_put::_M_group_int, num_put::_M_group_float):
Likewise change signature and tweak consistently.
(num_get::_M_extract_float, num_get::_M_extract_int,
num_put::_M_insert_int, num_put::_M_insert_float,
money_get::do_get(string_type&), money_get::do_put(string_type)):
Update callers.
* config/locale/generic/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Assign the new member.
* config/locale/gnu/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Likewise.
* src/locale-inst.cc (__add_grouping): Tweak signature.
(__verify_grouping): Don't instantiate, not a template anymore.
* include/bits/locale_facets.h: Rename _M_truename_len ->
_M_truename_size, _M_falsename_len -> _M_falsename_size.
* include/bits/locale_facets.tcc: Likewise.
* config/locale/generic/numeric_members.cc: Likewise.
* config/locale/gnu/numeric_members.cc: Likewise.
From-SVN: r75876
2004-01-14 20:14:39 +01:00
|
|
|
_M_group_int(__lc->_M_grouping, __lc->_M_grouping_size,
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
__lc->_M_thousands_sep, __io, __cs2 + 2, __cs, __len);
|
|
|
|
__cs = __cs2 + 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Complete Stage 1, prepend numeric base or sign.
|
locale_facets.tcc (__int_to_char<>(_CharT*, long, const _CharT*, ios_base::fmtflags), [...]): Remove.
2006-07-09 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.tcc (__int_to_char<>(_CharT*,
long, const _CharT*, ios_base::fmtflags), __int_to_char<>(_CharT*,
unsigned long, const _CharT*, ios_base::fmtflags),
__int_to_char<>(_CharT*, long long, const _CharT*, ios_base::fmtflags),
__int_to_char<>(_CharT*, unsigned long long, const _CharT*,
ios_base::fmtflags)): Remove.
(__int_to_char<>(_CharT*, _ValueT, const _CharT*, ios_base::fmtflags,
bool)): Adjust.
(num_put<>::_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)):
Likewise.
From-SVN: r115298
2006-07-09 23:26:19 +02:00
|
|
|
if (__builtin_expect(__dec, true))
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
{
|
|
|
|
// Decimal.
|
2007-11-27 02:59:41 +01:00
|
|
|
if (__v >= 0)
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
{
|
2007-11-15 23:59:12 +01:00
|
|
|
if (bool(__flags & ios_base::showpos)
|
numeric_traits.h: Do not include <limits>.
2007-04-13 Paolo Carlini <pcarlini@suse.de>
* include/ext/numeric_traits.h: Do not include <limits>.
(__numeric_traits_integer::__is_signed, __digits): Add.
(__numeric_traits_floating::__digits10, __max_exponent10): Add.
* src/istream.cc (ignore<char>(streamsize, int_type), operator>>
(basic_istream<char>&, char*), ignore<wchar_t>(streamsize,
int_type)): Use the latter.
* src/compatibility.cc (ignore<char>(streamsize),
ignore<wchar_t>(streamsize)): Likewise.
* include/ext/vstring_util.h (__vstring_utility<>::_S_compare):
Likewise.
* include/bits/stl_memory.h (__get_temporary_buffer): Likewise.
* include/bits/stl_algobase.h (lexicographical_compare(const char*,
const char*, const char*, const char*)): Likewise.
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int(_InIter,
_InIter, ios_base&, ios_base::iostate&, _ValueT&),
num_put<>::_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT),
num_put<>::_M_insert_float(_OutIter, ios_base&, _CharT, char,
_ValueT), collate<>::do_hash(const _CharT*, const _CharT*)): Likewise.
* include/bits/basic_string.h (basic_string<>::_S_compare): Likewise.
* include/bits/istream.tcc (operator>>(short&), operator>>(int&),
ignore(streamsize), ignore(streamsize, int_type), operator>>
(basic_istream<>&, _CharT*)): Likewise.
* include/bits/stl_bvector.h (vector<bool>::max_size): Likewise.
* include/tr1/functional_hash.h (struct hash<long double>): Likewise.
* include/std/istream: Do not include <limits>.
* include/tr1/cmath: Include <limits>.
* testsuite/23_containers/vector/bool/capacity/29134.cc: Likewise.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/12.cc:
Likewise.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/13.cc:
Likewise.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/12.cc:
Likewise.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/13.cc:
Likewise.
* testsuite/27_io/ios_base/storage/2.cc: Likewise.
* include/tr1/hashtable: Do not include the whole <iterator>.
From-SVN: r123779
2007-04-13 12:54:37 +02:00
|
|
|
&& __gnu_cxx::__numeric_traits<_ValueT>::__is_signed)
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
*--__cs = __lit[__num_base::_S_oplus], ++__len;
|
|
|
|
}
|
2007-11-27 02:59:41 +01:00
|
|
|
else
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
*--__cs = __lit[__num_base::_S_ominus], ++__len;
|
|
|
|
}
|
2007-11-15 23:59:12 +01:00
|
|
|
else if (bool(__flags & ios_base::showbase) && __v)
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
{
|
ostream.tcc (basic_ostream<>::operator<<(long), [...]): Don't deal with oct and hex and casts to unsigned here...
2005-07-11 Paolo Carlini <pcarlini@suse.de>
* include/bits/ostream.tcc (basic_ostream<>::operator<<(long),
basic_ostream<>::operator<<(long long)): Don't deal with oct
and hex and casts to unsigned here...
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, long,
const _CharT*, ios_base::fmtflags), __int_to_char(_CharT*, long
long, const _CharT*, ios_base::fmtflags)): ... do that here,
instead, as per Table 57.
(num_put<>::_M_insert_int): Tidy treatment of numeric base and
sign.
* include/std/std_ostream.h (operator<<(short), operator<<(int)):
Adjust logic, as per the letter of the resolution of DR117 [WP].
* testsuite/22_locale/num_put/put/char/10.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/10.cc: Likewise.
* testsuite/27_io/basic_ostream/inserters_arithmetic/char/7.cc:
Likewise.
* testsuite/27_io/basic_ostream/inserters_arithmetic/wchar_t/7.cc:
Likewise.
From-SVN: r101872
2005-07-11 11:48:31 +02:00
|
|
|
if (__basefield == ios_base::oct)
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
*--__cs = __lit[__num_base::_S_odigits], ++__len;
|
ostream.tcc (basic_ostream<>::operator<<(long), [...]): Don't deal with oct and hex and casts to unsigned here...
2005-07-11 Paolo Carlini <pcarlini@suse.de>
* include/bits/ostream.tcc (basic_ostream<>::operator<<(long),
basic_ostream<>::operator<<(long long)): Don't deal with oct
and hex and casts to unsigned here...
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, long,
const _CharT*, ios_base::fmtflags), __int_to_char(_CharT*, long
long, const _CharT*, ios_base::fmtflags)): ... do that here,
instead, as per Table 57.
(num_put<>::_M_insert_int): Tidy treatment of numeric base and
sign.
* include/std/std_ostream.h (operator<<(short), operator<<(int)):
Adjust logic, as per the letter of the resolution of DR117 [WP].
* testsuite/22_locale/num_put/put/char/10.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/10.cc: Likewise.
* testsuite/27_io/basic_ostream/inserters_arithmetic/char/7.cc:
Likewise.
* testsuite/27_io/basic_ostream/inserters_arithmetic/wchar_t/7.cc:
Likewise.
From-SVN: r101872
2005-07-11 11:48:31 +02:00
|
|
|
else
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
{
|
|
|
|
// 'x' or 'X'
|
|
|
|
const bool __uppercase = __flags & ios_base::uppercase;
|
|
|
|
*--__cs = __lit[__num_base::_S_ox + __uppercase];
|
|
|
|
// '0'
|
|
|
|
*--__cs = __lit[__num_base::_S_odigits];
|
|
|
|
__len += 2;
|
|
|
|
}
|
2003-02-11 22:55:49 +01:00
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2003-02-11 22:55:49 +01:00
|
|
|
// Pad.
|
2003-10-07 12:34:47 +02:00
|
|
|
const streamsize __w = __io.width();
|
2003-02-11 22:55:49 +01:00
|
|
|
if (__w > static_cast<streamsize>(__len))
|
|
|
|
{
|
2004-02-08 05:46:42 +01:00
|
|
|
_CharT* __cs3 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
|
2003-11-09 20:15:25 +01:00
|
|
|
* __w));
|
2003-02-11 22:55:49 +01:00
|
|
|
_M_pad(__fill, __w, __io, __cs3, __cs, __len);
|
|
|
|
__cs = __cs3;
|
|
|
|
}
|
|
|
|
__io.width(0);
|
|
|
|
|
|
|
|
// [22.2.2.2.2] Stage 4.
|
|
|
|
// Write resulting, fully-formatted string to output iterator.
|
2003-07-06 11:37:11 +02:00
|
|
|
return std::__write(__s, __cs, __len);
|
2004-02-08 05:46:42 +01:00
|
|
|
}
|
2003-02-11 22:55:49 +01:00
|
|
|
|
|
|
|
template<typename _CharT, typename _OutIter>
|
|
|
|
void
|
|
|
|
num_put<_CharT, _OutIter>::
|
2004-02-27 15:30:19 +01:00
|
|
|
_M_group_float(const char* __grouping, size_t __grouping_size,
|
|
|
|
_CharT __sep, const _CharT* __p, _CharT* __new,
|
|
|
|
_CharT* __cs, int& __len) const
|
2003-02-11 22:55:49 +01:00
|
|
|
{
|
2003-10-12 12:12:09 +02:00
|
|
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
|
|
|
// 282. What types does numpunct grouping refer to?
|
2004-02-08 05:46:42 +01:00
|
|
|
// Add grouping, if necessary.
|
2003-10-08 16:20:42 +02:00
|
|
|
const int __declen = __p ? __p - __cs : __len;
|
2004-08-15 21:03:44 +02:00
|
|
|
_CharT* __p2 = std::__add_grouping(__new, __sep, __grouping,
|
|
|
|
__grouping_size,
|
|
|
|
__cs, __cs + __declen);
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2003-02-11 22:55:49 +01:00
|
|
|
// Tack on decimal part.
|
|
|
|
int __newlen = __p2 - __new;
|
|
|
|
if (__p)
|
|
|
|
{
|
|
|
|
char_traits<_CharT>::copy(__p2, __p, __len - __declen);
|
|
|
|
__newlen += __len - __declen;
|
2004-02-08 05:46:42 +01:00
|
|
|
}
|
2003-02-11 22:55:49 +01:00
|
|
|
__len = __newlen;
|
|
|
|
}
|
|
|
|
|
2006-06-13 01:24:22 +02:00
|
|
|
// The following code uses vsnprintf (or vsprintf(), when
|
2003-07-05 06:05:45 +02:00
|
|
|
// _GLIBCXX_USE_C99 is not defined) to convert floating point values
|
2003-02-11 22:55:49 +01:00
|
|
|
// for insertion into a stream. An optimization would be to replace
|
|
|
|
// them with code that works directly on a wide buffer and then use
|
|
|
|
// __pad to do the padding. It would be good to replace them anyway
|
|
|
|
// to gain back the efficiency that C++ provides by knowing up front
|
|
|
|
// the type of the values to insert. Also, sprintf is dangerous
|
|
|
|
// since may lead to accidental buffer overruns. This
|
|
|
|
// implementation follows the C++ standard fairly directly as
|
2002-03-19 23:33:06 +01:00
|
|
|
// outlined in 22.2.2.2 [lib.locale.num.put]
|
2001-09-29 01:44:48 +02:00
|
|
|
template<typename _CharT, typename _OutIter>
|
2001-11-28 05:07:11 +01:00
|
|
|
template<typename _ValueT>
|
|
|
|
_OutIter
|
|
|
|
num_put<_CharT, _OutIter>::
|
2003-07-17 03:54:44 +02:00
|
|
|
_M_insert_float(_OutIter __s, ios_base& __io, _CharT __fill, char __mod,
|
2001-11-28 05:07:11 +01:00
|
|
|
_ValueT __v) const
|
|
|
|
{
|
2005-04-29 20:50:00 +02:00
|
|
|
typedef __numpunct_cache<_CharT> __cache_type;
|
2003-07-17 03:54:44 +02:00
|
|
|
__use_cache<__cache_type> __uc;
|
|
|
|
const locale& __loc = __io._M_getloc();
|
|
|
|
const __cache_type* __lc = __uc(__loc);
|
|
|
|
|
2003-02-11 22:55:49 +01:00
|
|
|
// Use default precision if out of range.
|
2006-07-31 21:26:58 +02:00
|
|
|
const streamsize __prec = __io.precision() < 0 ? 6 : __io.precision();
|
2001-11-28 05:07:11 +01:00
|
|
|
|
numeric_traits.h: Do not include <limits>.
2007-04-13 Paolo Carlini <pcarlini@suse.de>
* include/ext/numeric_traits.h: Do not include <limits>.
(__numeric_traits_integer::__is_signed, __digits): Add.
(__numeric_traits_floating::__digits10, __max_exponent10): Add.
* src/istream.cc (ignore<char>(streamsize, int_type), operator>>
(basic_istream<char>&, char*), ignore<wchar_t>(streamsize,
int_type)): Use the latter.
* src/compatibility.cc (ignore<char>(streamsize),
ignore<wchar_t>(streamsize)): Likewise.
* include/ext/vstring_util.h (__vstring_utility<>::_S_compare):
Likewise.
* include/bits/stl_memory.h (__get_temporary_buffer): Likewise.
* include/bits/stl_algobase.h (lexicographical_compare(const char*,
const char*, const char*, const char*)): Likewise.
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int(_InIter,
_InIter, ios_base&, ios_base::iostate&, _ValueT&),
num_put<>::_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT),
num_put<>::_M_insert_float(_OutIter, ios_base&, _CharT, char,
_ValueT), collate<>::do_hash(const _CharT*, const _CharT*)): Likewise.
* include/bits/basic_string.h (basic_string<>::_S_compare): Likewise.
* include/bits/istream.tcc (operator>>(short&), operator>>(int&),
ignore(streamsize), ignore(streamsize, int_type), operator>>
(basic_istream<>&, _CharT*)): Likewise.
* include/bits/stl_bvector.h (vector<bool>::max_size): Likewise.
* include/tr1/functional_hash.h (struct hash<long double>): Likewise.
* include/std/istream: Do not include <limits>.
* include/tr1/cmath: Include <limits>.
* testsuite/23_containers/vector/bool/capacity/29134.cc: Likewise.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/12.cc:
Likewise.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/13.cc:
Likewise.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/12.cc:
Likewise.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/13.cc:
Likewise.
* testsuite/27_io/ios_base/storage/2.cc: Likewise.
* include/tr1/hashtable: Do not include the whole <iterator>.
From-SVN: r123779
2007-04-13 12:54:37 +02:00
|
|
|
const int __max_digits =
|
|
|
|
__gnu_cxx::__numeric_traits<_ValueT>::__digits10;
|
2004-07-30 00:11:04 +02:00
|
|
|
|
2003-02-11 22:55:49 +01:00
|
|
|
// [22.2.2.2.2] Stage 1, numeric conversion to character.
|
|
|
|
int __len;
|
2001-11-28 05:07:11 +01:00
|
|
|
// Long enough for the max format spec.
|
|
|
|
char __fbuf[16];
|
2006-07-31 21:26:58 +02:00
|
|
|
__num_base::_S_format_float(__io, __fbuf, __mod);
|
2001-12-05 23:07:36 +01:00
|
|
|
|
2003-07-05 06:05:45 +02:00
|
|
|
#ifdef _GLIBCXX_USE_C99
|
2004-07-30 00:11:04 +02:00
|
|
|
// First try a buffer perhaps big enough (most probably sufficient
|
2003-02-11 22:55:49 +01:00
|
|
|
// for non-ios_base::fixed outputs)
|
2002-03-19 23:33:06 +01:00
|
|
|
int __cs_size = __max_digits * 3;
|
|
|
|
char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
|
2006-06-13 01:24:22 +02:00
|
|
|
__len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
|
|
|
|
__fbuf, __prec, __v);
|
2002-03-19 23:33:06 +01:00
|
|
|
|
|
|
|
// If the buffer was not large enough, try again with the correct size.
|
|
|
|
if (__len >= __cs_size)
|
|
|
|
{
|
2004-02-08 05:46:42 +01:00
|
|
|
__cs_size = __len + 1;
|
2002-03-19 23:33:06 +01:00
|
|
|
__cs = static_cast<char*>(__builtin_alloca(__cs_size));
|
2006-06-13 01:24:22 +02:00
|
|
|
__len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
|
|
|
|
__fbuf, __prec, __v);
|
2002-03-19 23:33:06 +01:00
|
|
|
}
|
|
|
|
#else
|
2001-12-05 23:07:36 +01:00
|
|
|
// Consider the possibility of long ios_base::fixed outputs
|
|
|
|
const bool __fixed = __io.flags() & ios_base::fixed;
|
numeric_traits.h: Do not include <limits>.
2007-04-13 Paolo Carlini <pcarlini@suse.de>
* include/ext/numeric_traits.h: Do not include <limits>.
(__numeric_traits_integer::__is_signed, __digits): Add.
(__numeric_traits_floating::__digits10, __max_exponent10): Add.
* src/istream.cc (ignore<char>(streamsize, int_type), operator>>
(basic_istream<char>&, char*), ignore<wchar_t>(streamsize,
int_type)): Use the latter.
* src/compatibility.cc (ignore<char>(streamsize),
ignore<wchar_t>(streamsize)): Likewise.
* include/ext/vstring_util.h (__vstring_utility<>::_S_compare):
Likewise.
* include/bits/stl_memory.h (__get_temporary_buffer): Likewise.
* include/bits/stl_algobase.h (lexicographical_compare(const char*,
const char*, const char*, const char*)): Likewise.
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int(_InIter,
_InIter, ios_base&, ios_base::iostate&, _ValueT&),
num_put<>::_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT),
num_put<>::_M_insert_float(_OutIter, ios_base&, _CharT, char,
_ValueT), collate<>::do_hash(const _CharT*, const _CharT*)): Likewise.
* include/bits/basic_string.h (basic_string<>::_S_compare): Likewise.
* include/bits/istream.tcc (operator>>(short&), operator>>(int&),
ignore(streamsize), ignore(streamsize, int_type), operator>>
(basic_istream<>&, _CharT*)): Likewise.
* include/bits/stl_bvector.h (vector<bool>::max_size): Likewise.
* include/tr1/functional_hash.h (struct hash<long double>): Likewise.
* include/std/istream: Do not include <limits>.
* include/tr1/cmath: Include <limits>.
* testsuite/23_containers/vector/bool/capacity/29134.cc: Likewise.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/12.cc:
Likewise.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/13.cc:
Likewise.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/12.cc:
Likewise.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/13.cc:
Likewise.
* testsuite/27_io/ios_base/storage/2.cc: Likewise.
* include/tr1/hashtable: Do not include the whole <iterator>.
From-SVN: r123779
2007-04-13 12:54:37 +02:00
|
|
|
const int __max_exp =
|
|
|
|
__gnu_cxx::__numeric_traits<_ValueT>::__max_exponent10;
|
2003-02-11 22:55:49 +01:00
|
|
|
|
2003-07-17 03:54:44 +02:00
|
|
|
// The size of the output string is computed as follows.
|
2004-07-30 00:11:04 +02:00
|
|
|
// ios_base::fixed outputs may need up to __max_exp + 1 chars
|
|
|
|
// for the integer part + __prec chars for the fractional part
|
|
|
|
// + 3 chars for sign, decimal point, '\0'. On the other hand,
|
|
|
|
// for non-fixed outputs __max_digits * 2 + __prec chars are
|
|
|
|
// largely sufficient.
|
|
|
|
const int __cs_size = __fixed ? __max_exp + __prec + 4
|
|
|
|
: __max_digits * 2 + __prec;
|
2001-12-05 23:07:36 +01:00
|
|
|
char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
|
2006-06-13 01:24:22 +02:00
|
|
|
__len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, __fbuf,
|
|
|
|
__prec, __v);
|
2002-03-19 23:33:06 +01:00
|
|
|
#endif
|
2000-10-05 13:27:02 +02:00
|
|
|
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
// [22.2.2.2.2] Stage 2, convert to char_type, using correct
|
|
|
|
// numpunct.decimal_point() values for '.' and adding grouping.
|
|
|
|
const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
|
|
|
|
|
|
|
|
_CharT* __ws = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
|
|
|
|
* __len));
|
|
|
|
__ctype.widen(__cs, __cs + __len, __ws);
|
|
|
|
|
|
|
|
// Replace decimal point.
|
2006-07-31 21:26:58 +02:00
|
|
|
_CharT* __wp = 0;
|
|
|
|
const char* __p = char_traits<char>::find(__cs, __len, '.');
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
if (__p)
|
2006-07-31 21:26:58 +02:00
|
|
|
{
|
|
|
|
__wp = __ws + (__p - __cs);
|
|
|
|
*__wp = __lc->_M_decimal_point;
|
|
|
|
}
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
|
|
|
|
// Add grouping, if necessary.
|
|
|
|
// N.B. Make sure to not group things like 2e20, i.e., no decimal
|
|
|
|
// point, scientific notation.
|
|
|
|
if (__lc->_M_use_grouping
|
2006-07-31 21:26:58 +02:00
|
|
|
&& (__wp || __len < 3 || (__cs[1] <= '9' && __cs[2] <= '9'
|
|
|
|
&& __cs[1] >= '0' && __cs[2] >= '0')))
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
{
|
|
|
|
// Grouping can add (almost) as many separators as the
|
|
|
|
// number of digits, but no more.
|
|
|
|
_CharT* __ws2 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
|
|
|
|
* __len * 2));
|
|
|
|
|
|
|
|
streamsize __off = 0;
|
|
|
|
if (__cs[0] == '-' || __cs[0] == '+')
|
|
|
|
{
|
|
|
|
__off = 1;
|
|
|
|
__ws2[0] = __ws[0];
|
|
|
|
__len -= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
_M_group_float(__lc->_M_grouping, __lc->_M_grouping_size,
|
2006-07-31 21:26:58 +02:00
|
|
|
__lc->_M_thousands_sep, __wp, __ws2 + __off,
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
__ws + __off, __len);
|
|
|
|
__len += __off;
|
|
|
|
|
|
|
|
__ws = __ws2;
|
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
// Pad.
|
|
|
|
const streamsize __w = __io.width();
|
|
|
|
if (__w > static_cast<streamsize>(__len))
|
|
|
|
{
|
|
|
|
_CharT* __ws3 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
|
|
|
|
* __w));
|
|
|
|
_M_pad(__fill, __w, __io, __ws3, __ws, __len);
|
|
|
|
__ws = __ws3;
|
|
|
|
}
|
|
|
|
__io.width(0);
|
|
|
|
|
|
|
|
// [22.2.2.2.2] Stage 4.
|
|
|
|
// Write resulting, fully-formatted string to output iterator.
|
|
|
|
return std::__write(__s, __ws, __len);
|
2003-02-11 22:55:49 +01:00
|
|
|
}
|
re PR libstdc++/20914 (Another grouping trouble)
2005-04-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/20914
* include/bits/locale_facets.tcc (__int_to_char(_CharT*, _ValueT,
const _CharT*, ios_base::fmtflags, bool)): Don't deal with numeric
base or sign here, instead...
(_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): ... here,
after adding the grouping. This fixes the bug and also allows to
clean-up the code dealing with integer types.
(_M_group_int(const char*, size_t, _CharT, ios_base&, _CharT*,
_CharT*, int&)): Simplify, remove bits dealing with numeric base.
(__int_to_char(_CharT*, unsigned long, const _CharT*,
ios_base::fmtflags), __int_to_char(_CharT*, unsigned long long,
const _CharT*, ios_base::fmtflags)): Remove hackish fix for
libstdc++/15565.
(__int_to_char(_CharT*, long, const _CharT*, ios_base::fmtflags),
__int_to_char(_CharT*, long long, const _CharT*, ios_base::fmtflags)):
Simplify, don't pass the sign.
(_M_insert_float(_OutIter, ios_base&, _CharT, char, _ValueT)):
Deal with a sign at the beginning of __cs; robustify the grouping
check.
* testsuite/22_locale/num_put/put/char/20914.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/20914.cc: Likewise.
From-SVN: r98271
2005-04-17 16:30:37 +02:00
|
|
|
|
2001-09-14 01:21:25 +02:00
|
|
|
template<typename _CharT, typename _OutIter>
|
2000-10-05 13:27:02 +02:00
|
|
|
_OutIter
|
|
|
|
num_put<_CharT, _OutIter>::
|
|
|
|
do_put(iter_type __s, ios_base& __io, char_type __fill, bool __v) const
|
|
|
|
{
|
2003-10-07 12:34:47 +02:00
|
|
|
const ios_base::fmtflags __flags = __io.flags();
|
2000-10-05 13:27:02 +02:00
|
|
|
if ((__flags & ios_base::boolalpha) == 0)
|
|
|
|
{
|
2004-08-22 19:55:51 +02:00
|
|
|
const long __l = __v;
|
|
|
|
__s = _M_insert_int(__s, __io, __fill, __l);
|
2000-10-05 13:27:02 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-04-29 20:50:00 +02:00
|
|
|
typedef __numpunct_cache<_CharT> __cache_type;
|
2003-07-10 08:21:13 +02:00
|
|
|
__use_cache<__cache_type> __uc;
|
2003-06-27 09:25:38 +02:00
|
|
|
const locale& __loc = __io._M_getloc();
|
2003-07-10 08:21:13 +02:00
|
|
|
const __cache_type* __lc = __uc(__loc);
|
2003-06-27 09:25:38 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
const _CharT* __name = __v ? __lc->_M_truename
|
2003-11-30 12:33:23 +01:00
|
|
|
: __lc->_M_falsename;
|
locale_facets.h (struct __numpunct_cache): Add member _M_grouping_size, caching the length of _M_grouping.
2004-01-14 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (struct __numpunct_cache):
Add member _M_grouping_size, caching the length of _M_grouping.
(__numpunct_cache<>::_M_cache): Assign the latter.
(__verify_grouping): Move declaration...
* include/bits/locale_facets.tcc (__verify_grouping):
... here, change signature to take a const char* and a size_t
for the grouping; not a template anymore.
(__add_grouping, num_put::_M_group_int, num_put::_M_group_float):
Likewise change signature and tweak consistently.
(num_get::_M_extract_float, num_get::_M_extract_int,
num_put::_M_insert_int, num_put::_M_insert_float,
money_get::do_get(string_type&), money_get::do_put(string_type)):
Update callers.
* config/locale/generic/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Assign the new member.
* config/locale/gnu/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Likewise.
* src/locale-inst.cc (__add_grouping): Tweak signature.
(__verify_grouping): Don't instantiate, not a template anymore.
* include/bits/locale_facets.h: Rename _M_truename_len ->
_M_truename_size, _M_falsename_len -> _M_falsename_size.
* include/bits/locale_facets.tcc: Likewise.
* config/locale/generic/numeric_members.cc: Likewise.
* config/locale/gnu/numeric_members.cc: Likewise.
From-SVN: r75876
2004-01-14 20:14:39 +01:00
|
|
|
int __len = __v ? __lc->_M_truename_size
|
|
|
|
: __lc->_M_falsename_size;
|
2003-02-11 22:55:49 +01:00
|
|
|
|
2003-10-07 12:34:47 +02:00
|
|
|
const streamsize __w = __io.width();
|
2003-02-11 22:55:49 +01:00
|
|
|
if (__w > static_cast<streamsize>(__len))
|
|
|
|
{
|
2008-11-20 17:00:17 +01:00
|
|
|
const streamsize __plen = __w - __len;
|
|
|
|
_CharT* __ps
|
2004-02-27 15:30:19 +01:00
|
|
|
= static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
|
2008-11-20 17:00:17 +01:00
|
|
|
* __plen));
|
|
|
|
|
|
|
|
char_traits<_CharT>::assign(__ps, __plen, __fill);
|
|
|
|
__io.width(0);
|
|
|
|
|
|
|
|
if ((__flags & ios_base::adjustfield) == ios_base::left)
|
|
|
|
{
|
|
|
|
__s = std::__write(__s, __name, __len);
|
|
|
|
__s = std::__write(__s, __ps, __plen);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
__s = std::__write(__s, __ps, __plen);
|
|
|
|
__s = std::__write(__s, __name, __len);
|
|
|
|
}
|
|
|
|
return __s;
|
2003-02-11 22:55:49 +01:00
|
|
|
}
|
|
|
|
__io.width(0);
|
2003-07-17 03:54:44 +02:00
|
|
|
__s = std::__write(__s, __name, __len);
|
2001-11-28 05:07:11 +01:00
|
|
|
}
|
|
|
|
return __s;
|
2001-09-29 01:44:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _CharT, typename _OutIter>
|
|
|
|
_OutIter
|
|
|
|
num_put<_CharT, _OutIter>::
|
|
|
|
do_put(iter_type __s, ios_base& __io, char_type __fill, double __v) const
|
2003-07-17 03:54:44 +02:00
|
|
|
{ return _M_insert_float(__s, __io, __fill, char(), __v); }
|
2001-09-29 01:44:48 +02:00
|
|
|
|
configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
2006-02-07 Jakub Jelinek <jakub@redhat.com>
Benjamin Kosnik <bkoz@redhat.com>
* configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
If true, set also port_specific_symbol_files and create
as_symver_specs.
(GLIBCXX_LDBL_COMPAT): New GLIBCXX_CONDITIONAL.
* configure: Rebuilt.
* config.h.in: Rebuilt.
* config/os/gnu-linux/ldbl-extra.ver: New file.
* config/abi/pre/gnu.ver: Make sure no __float128 symbols are
exported.
* include/bits/c++config (_GLIBCXX_LONG_DOUBLE_COMPAT,
_GLIBCXX_LDBL_NAMESPACE, _GLIBCXX_BEGIN_LDBL_NAMESPACE,
_GLIBCXX_END_LDBL_NAMESPACE): Define.
* include/bits/localefwd.h: Use them to conditionally scope facets.
* include/bits/locale_facets.h: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_put): Add __do_put method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_put): Add __do_put method.
* include/bits/locale_facets.tcc: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
(std::money_get::__do_get, std::money_put::__do_put,
std::num_get::__do_get, std::num_put::__do_put): New
specializations.
* include/Makefile.am: Conditionally define
_GLIBCXX_LONG_DOUBLE_COMPAT in c++config.
* include/Makefile.in: Regenerate.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT] (_GLIBCXX_LOC_ID,
_GLIBCXX_SYNC_ID): Define, use them.
* src/compatibility-ldbl.cc: New file.
* src/complex_io.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Add compatibility
symbols.
* src/limits.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-misc-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/istream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/ostream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/wlocale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/compatibility.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* config/locale/generic/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* config/locale/gnu/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* src/Makefile.am (libstdc++-symbol.ver): Append instead of
insert in the middle if port specific symbol file requests it.
(ldbl_compat_sources): New variable.
(sources): Use it.
(compatibility-ldbl.lo, compatibility-ldbl.o): New rules.
* src/Makefile.in: Rebuilt.
* testsuite/testsuite_abi.cc: Recognize GLIBCXX_LDBL_3.4,
GLIBCXX_LDBL_3.4.7, CXXABI_LDBL_1.3.
Co-Authored-By: Benjamin Kosnik <bkoz@redhat.com>
From-SVN: r110725
2006-02-07 23:23:58 +01:00
|
|
|
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
|
|
|
|
template<typename _CharT, typename _OutIter>
|
|
|
|
_OutIter
|
|
|
|
num_put<_CharT, _OutIter>::
|
|
|
|
__do_put(iter_type __s, ios_base& __io, char_type __fill, double __v) const
|
|
|
|
{ return _M_insert_float(__s, __io, __fill, char(), __v); }
|
|
|
|
#endif
|
|
|
|
|
2001-09-29 01:44:48 +02:00
|
|
|
template<typename _CharT, typename _OutIter>
|
|
|
|
_OutIter
|
|
|
|
num_put<_CharT, _OutIter>::
|
2004-02-08 05:46:42 +01:00
|
|
|
do_put(iter_type __s, ios_base& __io, char_type __fill,
|
2001-11-28 05:07:11 +01:00
|
|
|
long double __v) const
|
2003-07-17 03:54:44 +02:00
|
|
|
{ return _M_insert_float(__s, __io, __fill, 'L', __v); }
|
2001-09-29 01:44:48 +02:00
|
|
|
|
|
|
|
template<typename _CharT, typename _OutIter>
|
|
|
|
_OutIter
|
|
|
|
num_put<_CharT, _OutIter>::
|
|
|
|
do_put(iter_type __s, ios_base& __io, char_type __fill,
|
|
|
|
const void* __v) const
|
|
|
|
{
|
2003-10-07 12:34:47 +02:00
|
|
|
const ios_base::fmtflags __flags = __io.flags();
|
2004-08-22 19:55:51 +02:00
|
|
|
const ios_base::fmtflags __fmt = ~(ios_base::basefield
|
2008-11-21 10:59:17 +01:00
|
|
|
| ios_base::uppercase);
|
2006-12-14 06:49:06 +01:00
|
|
|
__io.flags((__flags & __fmt) | (ios_base::hex | ios_base::showbase));
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2007-04-02 11:49:31 +02:00
|
|
|
typedef __gnu_cxx::__conditional_type<(sizeof(const void*)
|
|
|
|
<= sizeof(unsigned long)),
|
|
|
|
unsigned long, unsigned long long>::__type _UIntPtrType;
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
__s = _M_insert_int(__s, __io, __fill,
|
2007-04-02 11:49:31 +02:00
|
|
|
reinterpret_cast<_UIntPtrType>(__v));
|
2003-12-10 11:06:19 +01:00
|
|
|
__io.flags(__flags);
|
2001-11-28 05:07:11 +01:00
|
|
|
return __s;
|
2001-09-29 01:44:48 +02:00
|
|
|
}
|
|
|
|
|
configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
2006-02-07 Jakub Jelinek <jakub@redhat.com>
Benjamin Kosnik <bkoz@redhat.com>
* configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
If true, set also port_specific_symbol_files and create
as_symver_specs.
(GLIBCXX_LDBL_COMPAT): New GLIBCXX_CONDITIONAL.
* configure: Rebuilt.
* config.h.in: Rebuilt.
* config/os/gnu-linux/ldbl-extra.ver: New file.
* config/abi/pre/gnu.ver: Make sure no __float128 symbols are
exported.
* include/bits/c++config (_GLIBCXX_LONG_DOUBLE_COMPAT,
_GLIBCXX_LDBL_NAMESPACE, _GLIBCXX_BEGIN_LDBL_NAMESPACE,
_GLIBCXX_END_LDBL_NAMESPACE): Define.
* include/bits/localefwd.h: Use them to conditionally scope facets.
* include/bits/locale_facets.h: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_put): Add __do_put method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_put): Add __do_put method.
* include/bits/locale_facets.tcc: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
(std::money_get::__do_get, std::money_put::__do_put,
std::num_get::__do_get, std::num_put::__do_put): New
specializations.
* include/Makefile.am: Conditionally define
_GLIBCXX_LONG_DOUBLE_COMPAT in c++config.
* include/Makefile.in: Regenerate.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT] (_GLIBCXX_LOC_ID,
_GLIBCXX_SYNC_ID): Define, use them.
* src/compatibility-ldbl.cc: New file.
* src/complex_io.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Add compatibility
symbols.
* src/limits.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-misc-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/istream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/ostream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/wlocale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/compatibility.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* config/locale/generic/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* config/locale/gnu/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* src/Makefile.am (libstdc++-symbol.ver): Append instead of
insert in the middle if port specific symbol file requests it.
(ldbl_compat_sources): New variable.
(sources): Use it.
(compatibility-ldbl.lo, compatibility-ldbl.o): New rules.
* src/Makefile.in: Rebuilt.
* testsuite/testsuite_abi.cc: Recognize GLIBCXX_LDBL_3.4,
GLIBCXX_LDBL_3.4.7, CXXABI_LDBL_1.3.
Co-Authored-By: Benjamin Kosnik <bkoz@redhat.com>
From-SVN: r110725
2006-02-07 23:23:58 +01:00
|
|
|
_GLIBCXX_END_LDBL_NAMESPACE
|
2004-03-24 07:41:07 +01:00
|
|
|
|
2001-11-28 05:07:11 +01:00
|
|
|
// Construct correctly padded string, as per 22.2.2.2.2
|
2004-02-08 05:46:42 +01:00
|
|
|
// Assumes
|
2001-11-28 05:07:11 +01:00
|
|
|
// __newlen > __oldlen
|
|
|
|
// __news is allocated for __newlen size
|
2002-07-31 04:47:36 +02:00
|
|
|
|
|
|
|
// NB: Of the two parameters, _CharT can be deduced from the
|
|
|
|
// function arguments. The other (_Traits) has to be explicitly specified.
|
|
|
|
template<typename _CharT, typename _Traits>
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
|
|
|
__pad<_CharT, _Traits>::_S_pad(ios_base& __io, _CharT __fill,
|
|
|
|
_CharT* __news, const _CharT* __olds,
|
2008-09-23 12:09:38 +02:00
|
|
|
streamsize __newlen, streamsize __oldlen)
|
2002-07-31 04:47:36 +02:00
|
|
|
{
|
2003-10-06 21:46:21 +02:00
|
|
|
const size_t __plen = static_cast<size_t>(__newlen - __oldlen);
|
|
|
|
const ios_base::fmtflags __adjust = __io.flags() & ios_base::adjustfield;
|
2001-11-28 05:07:11 +01:00
|
|
|
|
2003-10-06 21:46:21 +02:00
|
|
|
// Padding last.
|
2001-11-28 05:07:11 +01:00
|
|
|
if (__adjust == ios_base::left)
|
|
|
|
{
|
2007-05-17 11:01:27 +02:00
|
|
|
_Traits::copy(__news, __olds, __oldlen);
|
2003-10-06 21:46:21 +02:00
|
|
|
_Traits::assign(__news + __oldlen, __plen, __fill);
|
|
|
|
return;
|
2001-11-28 05:07:11 +01:00
|
|
|
}
|
2003-10-06 21:46:21 +02:00
|
|
|
|
|
|
|
size_t __mod = 0;
|
PR libstdc++/28277 (partial: vstring bits)
2007-04-10 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/28277 (partial: vstring bits)
* include/bits/ostream_insert.h: New.
* include/Makefile.am: Add.
* include/ext/vstring.h (operator<<(basic_ostream<>&,
const __versa_string<>&): Forward to __ostream_insert.
* include/bits/basic_string.h (operator<<(basic_ostream<>&,
const string<>&)): Likewise.
* include/std/ostream (operator<<(basic_ostream<>&, _CharT),
operator<<(basic_ostream<char,>&, char), operator<<(basic_ostream<>&,
const _CharT*), operator<<(basic_ostream<char,>&, const char*)):
Likewise.
* include/ext/vstring.tcc (operator<<(basic_ostream<>&,
const __versa_string<>&)): Remove.
(class basic_ostream): Remove friend declarations.
(basic_ostream<>::_M_write(char_type, streamsize),
_M_insert(const char_type*, streamsize)): Remove.
* include/bits/ostream.tcc (_M_insert(const char_type*, streamsize)):
Remove definition.
(operator<<(basic_ostream<>&, const char*)): Use __ostream_insert.
* config/abi/pre/gnu.ver: Adjust.
* src/ostream-inst.cc: Add __ostream_insert instantiations.
* include/bits/locale_facets.h (__pad<>::_S_pad): Remove __num
parameter.
* include/bits/locale_facets.tcc (__pad<>::_S_pad): Adjust.
(num_put<>::_M_pad(_CharT, streamsize, ios_base&, _CharT*,
const _CharT*, int&)): Likewise.
* include/Makefile.in: Rebuild.
* testsuite/ext/vstring/inserters_extractors/char/28277.cc: New.
* testsuite/ext/vstring/inserters_extractors/wchar_t/28277.cc: New.
* include/ext/vstring_util.h: Do not include the whole <locale>.
* include/ext/vstring.tcc (operator>>(basic_istream<>&,
__versa_string<>&, getline(basic_istream<>&, __versa_string<>&,
_CharT)): Tweak to refer to ios_base as a base of istream; do not
refer to non-standard types of istream.
* include/bits/istream.tcc (operator>>(basic_istream<>&, _CharT*),
ws(basic_istream<>&)): Do not refer to non-standard types of istream.
* include/std/bitset (operator>>(std::basic_istream<>&, bitset<>&)):
Avoid using basic_streambuf<>*.
* include/bits/istream.tcc (operator>>(basic_istream<>&,
basic_string<>&), getline(basic_istream<>&, basic_string<>&, _CharT)):
Move...
* include/bits/basic_string.tcc: ... here; tweak to refer to ios_base
as a base of istream; do not refer to non-standard types of istream.
* include/std/string: Tweak includes.
* include/ext/type_traits.h (__is_null_pointer): Add.
* include/ext/rc_string_base.h: Use it.
* include/ext/sso_string_base.h: Likewise.
* include/bits/basic_string.tcc (__is_null_pointer): Remove, use
the above.
* include/ext/vstring_util.h (__vstring_utility<>::_S_is_null_pointer):
Remove.
From-SVN: r123692
2007-04-10 12:38:50 +02:00
|
|
|
if (__adjust == ios_base::internal)
|
2001-11-28 05:07:11 +01:00
|
|
|
{
|
|
|
|
// Pad after the sign, if there is one.
|
|
|
|
// Pad after 0[xX], if there is one.
|
|
|
|
// Who came up with these rules, anyway? Jeeze.
|
2003-07-17 03:54:44 +02:00
|
|
|
const locale& __loc = __io._M_getloc();
|
2004-02-08 05:46:42 +01:00
|
|
|
const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
|
2004-02-15 18:19:00 +01:00
|
|
|
|
2007-05-17 11:01:27 +02:00
|
|
|
if (__ctype.widen('-') == __olds[0]
|
|
|
|
|| __ctype.widen('+') == __olds[0])
|
2001-11-28 05:07:11 +01:00
|
|
|
{
|
2004-02-08 05:46:42 +01:00
|
|
|
__news[0] = __olds[0];
|
2007-05-17 11:01:27 +02:00
|
|
|
__mod = 1;
|
|
|
|
++__news;
|
2001-11-28 05:07:11 +01:00
|
|
|
}
|
2007-05-17 11:01:27 +02:00
|
|
|
else if (__ctype.widen('0') == __olds[0]
|
|
|
|
&& __oldlen > 1
|
|
|
|
&& (__ctype.widen('x') == __olds[1]
|
|
|
|
|| __ctype.widen('X') == __olds[1]))
|
2001-11-28 05:07:11 +01:00
|
|
|
{
|
2003-08-29 19:40:12 +02:00
|
|
|
__news[0] = __olds[0];
|
2007-05-17 11:01:27 +02:00
|
|
|
__news[1] = __olds[1];
|
|
|
|
__mod = 2;
|
|
|
|
__news += 2;
|
2001-11-28 05:07:11 +01:00
|
|
|
}
|
2003-10-05 17:08:46 +02:00
|
|
|
// else Padding first.
|
2001-11-28 05:07:11 +01:00
|
|
|
}
|
2003-10-06 21:46:21 +02:00
|
|
|
_Traits::assign(__news, __plen, __fill);
|
2007-05-17 11:01:27 +02:00
|
|
|
_Traits::copy(__news + __plen, __olds + __mod, __oldlen - __mod);
|
2001-11-28 05:07:11 +01:00
|
|
|
}
|
|
|
|
|
2001-09-29 01:44:48 +02:00
|
|
|
template<typename _CharT>
|
|
|
|
_CharT*
|
locale_facets.h (struct __numpunct_cache): Add member _M_grouping_size, caching the length of _M_grouping.
2004-01-14 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (struct __numpunct_cache):
Add member _M_grouping_size, caching the length of _M_grouping.
(__numpunct_cache<>::_M_cache): Assign the latter.
(__verify_grouping): Move declaration...
* include/bits/locale_facets.tcc (__verify_grouping):
... here, change signature to take a const char* and a size_t
for the grouping; not a template anymore.
(__add_grouping, num_put::_M_group_int, num_put::_M_group_float):
Likewise change signature and tweak consistently.
(num_get::_M_extract_float, num_get::_M_extract_int,
num_put::_M_insert_int, num_put::_M_insert_float,
money_get::do_get(string_type&), money_get::do_put(string_type)):
Update callers.
* config/locale/generic/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Assign the new member.
* config/locale/gnu/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Likewise.
* src/locale-inst.cc (__add_grouping): Tweak signature.
(__verify_grouping): Don't instantiate, not a template anymore.
* include/bits/locale_facets.h: Rename _M_truename_len ->
_M_truename_size, _M_falsename_len -> _M_falsename_size.
* include/bits/locale_facets.tcc: Likewise.
* config/locale/generic/numeric_members.cc: Likewise.
* config/locale/gnu/numeric_members.cc: Likewise.
From-SVN: r75876
2004-01-14 20:14:39 +01:00
|
|
|
__add_grouping(_CharT* __s, _CharT __sep,
|
|
|
|
const char* __gbeg, size_t __gsize,
|
2001-09-29 01:44:48 +02:00
|
|
|
const _CharT* __first, const _CharT* __last)
|
2003-11-23 15:49:54 +01:00
|
|
|
{
|
2006-10-09 20:04:18 +02:00
|
|
|
size_t __idx = 0;
|
|
|
|
size_t __ctr = 0;
|
|
|
|
|
|
|
|
while (__last - __first > __gbeg[__idx]
|
2009-02-15 17:47:57 +01:00
|
|
|
&& static_cast<signed char>(__gbeg[__idx]) > 0
|
|
|
|
&& __gbeg[__idx] != __gnu_cxx::__numeric_traits<char>::__max)
|
2003-11-23 15:49:54 +01:00
|
|
|
{
|
2006-10-09 20:04:18 +02:00
|
|
|
__last -= __gbeg[__idx];
|
|
|
|
__idx < __gsize - 1 ? ++__idx : ++__ctr;
|
2003-11-23 15:49:54 +01:00
|
|
|
}
|
2006-10-09 20:04:18 +02:00
|
|
|
|
|
|
|
while (__first != __last)
|
2003-11-23 15:49:54 +01:00
|
|
|
*__s++ = *__first++;
|
2006-10-09 20:04:18 +02:00
|
|
|
|
|
|
|
while (__ctr--)
|
|
|
|
{
|
|
|
|
*__s++ = __sep;
|
|
|
|
for (char __i = __gbeg[__idx]; __i > 0; --__i)
|
|
|
|
*__s++ = *__first++;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (__idx--)
|
|
|
|
{
|
|
|
|
*__s++ = __sep;
|
|
|
|
for (char __i = __gbeg[__idx]; __i > 0; --__i)
|
|
|
|
*__s++ = *__first++;
|
|
|
|
}
|
|
|
|
|
2003-11-23 15:49:54 +01:00
|
|
|
return __s;
|
|
|
|
}
|
Tune for size.
2002-02-15 Benjamin Kosnik <bkoz@redhat.com>
Tune for size.
* src/string-inst.cc (string::_Rep::_S_terminal): Remove redundant
explicit instantiation.
(string::_Rep::_S_max_size): Same.
* include/bits/basic_string.tcc: Add extern explicit
instantiations for string, wstring.
* include/bits/basic_ios.tcc: Add extern explicit instantiations
for ios, wios.
* include/bits/streambuf.tcc: Same, for streambuf, wstreambuf.
* include/bits/istream.tcc: Same, for istream, wistream.
* include/bits/ostream.tcc: Same for ostream, wostream, iostream,
wiostream.
* include/bits/sstream.tcc: Same, for stringbuf, wstringbuf,
istringstream, wistringstream, ostringstream, wostringstream,
stringstream, wstringstream.
* include/bits/fstream.tcc: Same, for filebuf, wfilebuf, ifstream,
wifstream, ofstream, wofstream, fstream, wfstream.
* src/misc-inst.cc: Correct comments.
Add iomanip instantiations for wide streams.
* include/std/std_iomanip.h: Same.
* include/bits/locale_facets.tcc: Same.
* include/std/std_streambuf.h: Correct
_GLIBCPP_FULLY_COMPLIANT_HEADERS guard.
* include/std/std_sstream.h: Same.
* include/std/std_ostream.h: Same.
* include/std/std_istream.h: Same.
* include/std/std_fstream.h: Same.
* include/std/std_streambuf.h: Add definitions for private copy
ctor and assignment operator.
* include/std/std_istream.h: Remove declared but undefined copy
ctor and assignment operator. This is taken care of in ios_base,
so adding it in the derived class as well is superfluous.
* include/std/std_ostream.h: Same.
* include/bits/basic_ios.h (basic_ios::clear): Don't inline.
* include/bits/basic_ios.tcc (basic_ios::clear): Move definition here.
From-SVN: r49798
2002-02-16 01:19:13 +01:00
|
|
|
|
|
|
|
// Inhibit implicit instantiations for required instantiations,
|
2004-02-08 05:46:42 +01:00
|
|
|
// which are defined via explicit instantiations elsewhere.
|
Tune for size.
2002-02-15 Benjamin Kosnik <bkoz@redhat.com>
Tune for size.
* src/string-inst.cc (string::_Rep::_S_terminal): Remove redundant
explicit instantiation.
(string::_Rep::_S_max_size): Same.
* include/bits/basic_string.tcc: Add extern explicit
instantiations for string, wstring.
* include/bits/basic_ios.tcc: Add extern explicit instantiations
for ios, wios.
* include/bits/streambuf.tcc: Same, for streambuf, wstreambuf.
* include/bits/istream.tcc: Same, for istream, wistream.
* include/bits/ostream.tcc: Same for ostream, wostream, iostream,
wiostream.
* include/bits/sstream.tcc: Same, for stringbuf, wstringbuf,
istringstream, wistringstream, ostringstream, wostringstream,
stringstream, wstringstream.
* include/bits/fstream.tcc: Same, for filebuf, wfilebuf, ifstream,
wifstream, ofstream, wofstream, fstream, wfstream.
* src/misc-inst.cc: Correct comments.
Add iomanip instantiations for wide streams.
* include/std/std_iomanip.h: Same.
* include/bits/locale_facets.tcc: Same.
* include/std/std_streambuf.h: Correct
_GLIBCPP_FULLY_COMPLIANT_HEADERS guard.
* include/std/std_sstream.h: Same.
* include/std/std_ostream.h: Same.
* include/std/std_istream.h: Same.
* include/std/std_fstream.h: Same.
* include/std/std_streambuf.h: Add definitions for private copy
ctor and assignment operator.
* include/std/std_istream.h: Remove declared but undefined copy
ctor and assignment operator. This is taken care of in ios_base,
so adding it in the derived class as well is superfluous.
* include/std/std_ostream.h: Same.
* include/bits/basic_ios.h (basic_ios::clear): Don't inline.
* include/bits/basic_ios.tcc (basic_ios::clear): Move definition here.
From-SVN: r49798
2002-02-16 01:19:13 +01:00
|
|
|
// NB: This syntax is a GNU extension.
|
2003-07-05 06:05:45 +02:00
|
|
|
#if _GLIBCXX_EXTERN_TEMPLATE
|
Tune for size.
2002-02-15 Benjamin Kosnik <bkoz@redhat.com>
Tune for size.
* src/string-inst.cc (string::_Rep::_S_terminal): Remove redundant
explicit instantiation.
(string::_Rep::_S_max_size): Same.
* include/bits/basic_string.tcc: Add extern explicit
instantiations for string, wstring.
* include/bits/basic_ios.tcc: Add extern explicit instantiations
for ios, wios.
* include/bits/streambuf.tcc: Same, for streambuf, wstreambuf.
* include/bits/istream.tcc: Same, for istream, wistream.
* include/bits/ostream.tcc: Same for ostream, wostream, iostream,
wiostream.
* include/bits/sstream.tcc: Same, for stringbuf, wstringbuf,
istringstream, wistringstream, ostringstream, wostringstream,
stringstream, wstringstream.
* include/bits/fstream.tcc: Same, for filebuf, wfilebuf, ifstream,
wifstream, ofstream, wofstream, fstream, wfstream.
* src/misc-inst.cc: Correct comments.
Add iomanip instantiations for wide streams.
* include/std/std_iomanip.h: Same.
* include/bits/locale_facets.tcc: Same.
* include/std/std_streambuf.h: Correct
_GLIBCPP_FULLY_COMPLIANT_HEADERS guard.
* include/std/std_sstream.h: Same.
* include/std/std_ostream.h: Same.
* include/std/std_istream.h: Same.
* include/std/std_fstream.h: Same.
* include/std/std_streambuf.h: Add definitions for private copy
ctor and assignment operator.
* include/std/std_istream.h: Remove declared but undefined copy
ctor and assignment operator. This is taken care of in ios_base,
so adding it in the derived class as well is superfluous.
* include/std/std_ostream.h: Same.
* include/bits/basic_ios.h (basic_ios::clear): Don't inline.
* include/bits/basic_ios.tcc (basic_ios::clear): Move definition here.
From-SVN: r49798
2002-02-16 01:19:13 +01:00
|
|
|
extern template class numpunct<char>;
|
|
|
|
extern template class numpunct_byname<char>;
|
configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
2006-02-07 Jakub Jelinek <jakub@redhat.com>
Benjamin Kosnik <bkoz@redhat.com>
* configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
If true, set also port_specific_symbol_files and create
as_symver_specs.
(GLIBCXX_LDBL_COMPAT): New GLIBCXX_CONDITIONAL.
* configure: Rebuilt.
* config.h.in: Rebuilt.
* config/os/gnu-linux/ldbl-extra.ver: New file.
* config/abi/pre/gnu.ver: Make sure no __float128 symbols are
exported.
* include/bits/c++config (_GLIBCXX_LONG_DOUBLE_COMPAT,
_GLIBCXX_LDBL_NAMESPACE, _GLIBCXX_BEGIN_LDBL_NAMESPACE,
_GLIBCXX_END_LDBL_NAMESPACE): Define.
* include/bits/localefwd.h: Use them to conditionally scope facets.
* include/bits/locale_facets.h: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_put): Add __do_put method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_put): Add __do_put method.
* include/bits/locale_facets.tcc: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
(std::money_get::__do_get, std::money_put::__do_put,
std::num_get::__do_get, std::num_put::__do_put): New
specializations.
* include/Makefile.am: Conditionally define
_GLIBCXX_LONG_DOUBLE_COMPAT in c++config.
* include/Makefile.in: Regenerate.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT] (_GLIBCXX_LOC_ID,
_GLIBCXX_SYNC_ID): Define, use them.
* src/compatibility-ldbl.cc: New file.
* src/complex_io.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Add compatibility
symbols.
* src/limits.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-misc-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/istream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/ostream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/wlocale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/compatibility.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* config/locale/generic/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* config/locale/gnu/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* src/Makefile.am (libstdc++-symbol.ver): Append instead of
insert in the middle if port specific symbol file requests it.
(ldbl_compat_sources): New variable.
(sources): Use it.
(compatibility-ldbl.lo, compatibility-ldbl.o): New rules.
* src/Makefile.in: Rebuilt.
* testsuite/testsuite_abi.cc: Recognize GLIBCXX_LDBL_3.4,
GLIBCXX_LDBL_3.4.7, CXXABI_LDBL_1.3.
Co-Authored-By: Benjamin Kosnik <bkoz@redhat.com>
From-SVN: r110725
2006-02-07 23:23:58 +01:00
|
|
|
extern template class _GLIBCXX_LDBL_NAMESPACE num_get<char>;
|
|
|
|
extern template class _GLIBCXX_LDBL_NAMESPACE num_put<char>;
|
Tune for size.
2002-02-15 Benjamin Kosnik <bkoz@redhat.com>
Tune for size.
* src/string-inst.cc (string::_Rep::_S_terminal): Remove redundant
explicit instantiation.
(string::_Rep::_S_max_size): Same.
* include/bits/basic_string.tcc: Add extern explicit
instantiations for string, wstring.
* include/bits/basic_ios.tcc: Add extern explicit instantiations
for ios, wios.
* include/bits/streambuf.tcc: Same, for streambuf, wstreambuf.
* include/bits/istream.tcc: Same, for istream, wistream.
* include/bits/ostream.tcc: Same for ostream, wostream, iostream,
wiostream.
* include/bits/sstream.tcc: Same, for stringbuf, wstringbuf,
istringstream, wistringstream, ostringstream, wostringstream,
stringstream, wstringstream.
* include/bits/fstream.tcc: Same, for filebuf, wfilebuf, ifstream,
wifstream, ofstream, wofstream, fstream, wfstream.
* src/misc-inst.cc: Correct comments.
Add iomanip instantiations for wide streams.
* include/std/std_iomanip.h: Same.
* include/bits/locale_facets.tcc: Same.
* include/std/std_streambuf.h: Correct
_GLIBCPP_FULLY_COMPLIANT_HEADERS guard.
* include/std/std_sstream.h: Same.
* include/std/std_ostream.h: Same.
* include/std/std_istream.h: Same.
* include/std/std_fstream.h: Same.
* include/std/std_streambuf.h: Add definitions for private copy
ctor and assignment operator.
* include/std/std_istream.h: Remove declared but undefined copy
ctor and assignment operator. This is taken care of in ios_base,
so adding it in the derived class as well is superfluous.
* include/std/std_ostream.h: Same.
* include/bits/basic_ios.h (basic_ios::clear): Don't inline.
* include/bits/basic_ios.tcc (basic_ios::clear): Move definition here.
From-SVN: r49798
2002-02-16 01:19:13 +01:00
|
|
|
extern template class ctype_byname<char>;
|
2002-03-08 07:05:21 +01:00
|
|
|
|
2008-09-10 23:34:38 +02:00
|
|
|
extern template
|
|
|
|
const ctype<char>&
|
|
|
|
use_facet<ctype<char> >(const locale&);
|
|
|
|
|
2002-03-08 07:05:21 +01:00
|
|
|
extern template
|
2004-02-08 05:46:42 +01:00
|
|
|
const numpunct<char>&
|
2002-03-08 07:05:21 +01:00
|
|
|
use_facet<numpunct<char> >(const locale&);
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
extern template
|
|
|
|
const num_put<char>&
|
2002-03-08 07:05:21 +01:00
|
|
|
use_facet<num_put<char> >(const locale&);
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
extern template
|
|
|
|
const num_get<char>&
|
2002-03-08 07:05:21 +01:00
|
|
|
use_facet<num_get<char> >(const locale&);
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
extern template
|
2002-03-08 07:05:21 +01:00
|
|
|
bool
|
|
|
|
has_facet<ctype<char> >(const locale&);
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
extern template
|
2002-03-08 07:05:21 +01:00
|
|
|
bool
|
|
|
|
has_facet<numpunct<char> >(const locale&);
|
Tune for size.
2002-02-15 Benjamin Kosnik <bkoz@redhat.com>
Tune for size.
* src/string-inst.cc (string::_Rep::_S_terminal): Remove redundant
explicit instantiation.
(string::_Rep::_S_max_size): Same.
* include/bits/basic_string.tcc: Add extern explicit
instantiations for string, wstring.
* include/bits/basic_ios.tcc: Add extern explicit instantiations
for ios, wios.
* include/bits/streambuf.tcc: Same, for streambuf, wstreambuf.
* include/bits/istream.tcc: Same, for istream, wistream.
* include/bits/ostream.tcc: Same for ostream, wostream, iostream,
wiostream.
* include/bits/sstream.tcc: Same, for stringbuf, wstringbuf,
istringstream, wistringstream, ostringstream, wostringstream,
stringstream, wstringstream.
* include/bits/fstream.tcc: Same, for filebuf, wfilebuf, ifstream,
wifstream, ofstream, wofstream, fstream, wfstream.
* src/misc-inst.cc: Correct comments.
Add iomanip instantiations for wide streams.
* include/std/std_iomanip.h: Same.
* include/bits/locale_facets.tcc: Same.
* include/std/std_streambuf.h: Correct
_GLIBCPP_FULLY_COMPLIANT_HEADERS guard.
* include/std/std_sstream.h: Same.
* include/std/std_ostream.h: Same.
* include/std/std_istream.h: Same.
* include/std/std_fstream.h: Same.
* include/std/std_streambuf.h: Add definitions for private copy
ctor and assignment operator.
* include/std/std_istream.h: Remove declared but undefined copy
ctor and assignment operator. This is taken care of in ios_base,
so adding it in the derived class as well is superfluous.
* include/std/std_ostream.h: Same.
* include/bits/basic_ios.h (basic_ios::clear): Don't inline.
* include/bits/basic_ios.tcc (basic_ios::clear): Move definition here.
From-SVN: r49798
2002-02-16 01:19:13 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
extern template
|
2002-03-08 07:05:21 +01:00
|
|
|
bool
|
|
|
|
has_facet<num_put<char> >(const locale&);
|
Tune for size.
2002-02-15 Benjamin Kosnik <bkoz@redhat.com>
Tune for size.
* src/string-inst.cc (string::_Rep::_S_terminal): Remove redundant
explicit instantiation.
(string::_Rep::_S_max_size): Same.
* include/bits/basic_string.tcc: Add extern explicit
instantiations for string, wstring.
* include/bits/basic_ios.tcc: Add extern explicit instantiations
for ios, wios.
* include/bits/streambuf.tcc: Same, for streambuf, wstreambuf.
* include/bits/istream.tcc: Same, for istream, wistream.
* include/bits/ostream.tcc: Same for ostream, wostream, iostream,
wiostream.
* include/bits/sstream.tcc: Same, for stringbuf, wstringbuf,
istringstream, wistringstream, ostringstream, wostringstream,
stringstream, wstringstream.
* include/bits/fstream.tcc: Same, for filebuf, wfilebuf, ifstream,
wifstream, ofstream, wofstream, fstream, wfstream.
* src/misc-inst.cc: Correct comments.
Add iomanip instantiations for wide streams.
* include/std/std_iomanip.h: Same.
* include/bits/locale_facets.tcc: Same.
* include/std/std_streambuf.h: Correct
_GLIBCPP_FULLY_COMPLIANT_HEADERS guard.
* include/std/std_sstream.h: Same.
* include/std/std_ostream.h: Same.
* include/std/std_istream.h: Same.
* include/std/std_fstream.h: Same.
* include/std/std_streambuf.h: Add definitions for private copy
ctor and assignment operator.
* include/std/std_istream.h: Remove declared but undefined copy
ctor and assignment operator. This is taken care of in ios_base,
so adding it in the derived class as well is superfluous.
* include/std/std_ostream.h: Same.
* include/bits/basic_ios.h (basic_ios::clear): Don't inline.
* include/bits/basic_ios.tcc (basic_ios::clear): Move definition here.
From-SVN: r49798
2002-02-16 01:19:13 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
extern template
|
2002-03-08 07:05:21 +01:00
|
|
|
bool
|
|
|
|
has_facet<num_get<char> >(const locale&);
|
Tune for size.
2002-02-15 Benjamin Kosnik <bkoz@redhat.com>
Tune for size.
* src/string-inst.cc (string::_Rep::_S_terminal): Remove redundant
explicit instantiation.
(string::_Rep::_S_max_size): Same.
* include/bits/basic_string.tcc: Add extern explicit
instantiations for string, wstring.
* include/bits/basic_ios.tcc: Add extern explicit instantiations
for ios, wios.
* include/bits/streambuf.tcc: Same, for streambuf, wstreambuf.
* include/bits/istream.tcc: Same, for istream, wistream.
* include/bits/ostream.tcc: Same for ostream, wostream, iostream,
wiostream.
* include/bits/sstream.tcc: Same, for stringbuf, wstringbuf,
istringstream, wistringstream, ostringstream, wostringstream,
stringstream, wstringstream.
* include/bits/fstream.tcc: Same, for filebuf, wfilebuf, ifstream,
wifstream, ofstream, wofstream, fstream, wfstream.
* src/misc-inst.cc: Correct comments.
Add iomanip instantiations for wide streams.
* include/std/std_iomanip.h: Same.
* include/bits/locale_facets.tcc: Same.
* include/std/std_streambuf.h: Correct
_GLIBCPP_FULLY_COMPLIANT_HEADERS guard.
* include/std/std_sstream.h: Same.
* include/std/std_ostream.h: Same.
* include/std/std_istream.h: Same.
* include/std/std_fstream.h: Same.
* include/std/std_streambuf.h: Add definitions for private copy
ctor and assignment operator.
* include/std/std_istream.h: Remove declared but undefined copy
ctor and assignment operator. This is taken care of in ios_base,
so adding it in the derived class as well is superfluous.
* include/std/std_ostream.h: Same.
* include/bits/basic_ios.h (basic_ios::clear): Don't inline.
* include/bits/basic_ios.tcc (basic_ios::clear): Move definition here.
From-SVN: r49798
2002-02-16 01:19:13 +01:00
|
|
|
|
2003-07-05 06:05:45 +02:00
|
|
|
#ifdef _GLIBCXX_USE_WCHAR_T
|
2002-11-01 18:30:36 +01:00
|
|
|
extern template class numpunct<wchar_t>;
|
|
|
|
extern template class numpunct_byname<wchar_t>;
|
configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
2006-02-07 Jakub Jelinek <jakub@redhat.com>
Benjamin Kosnik <bkoz@redhat.com>
* configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
If true, set also port_specific_symbol_files and create
as_symver_specs.
(GLIBCXX_LDBL_COMPAT): New GLIBCXX_CONDITIONAL.
* configure: Rebuilt.
* config.h.in: Rebuilt.
* config/os/gnu-linux/ldbl-extra.ver: New file.
* config/abi/pre/gnu.ver: Make sure no __float128 symbols are
exported.
* include/bits/c++config (_GLIBCXX_LONG_DOUBLE_COMPAT,
_GLIBCXX_LDBL_NAMESPACE, _GLIBCXX_BEGIN_LDBL_NAMESPACE,
_GLIBCXX_END_LDBL_NAMESPACE): Define.
* include/bits/localefwd.h: Use them to conditionally scope facets.
* include/bits/locale_facets.h: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_put): Add __do_put method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_put): Add __do_put method.
* include/bits/locale_facets.tcc: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
(std::money_get::__do_get, std::money_put::__do_put,
std::num_get::__do_get, std::num_put::__do_put): New
specializations.
* include/Makefile.am: Conditionally define
_GLIBCXX_LONG_DOUBLE_COMPAT in c++config.
* include/Makefile.in: Regenerate.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT] (_GLIBCXX_LOC_ID,
_GLIBCXX_SYNC_ID): Define, use them.
* src/compatibility-ldbl.cc: New file.
* src/complex_io.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Add compatibility
symbols.
* src/limits.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-misc-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/istream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/ostream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/wlocale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/compatibility.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* config/locale/generic/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* config/locale/gnu/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* src/Makefile.am (libstdc++-symbol.ver): Append instead of
insert in the middle if port specific symbol file requests it.
(ldbl_compat_sources): New variable.
(sources): Use it.
(compatibility-ldbl.lo, compatibility-ldbl.o): New rules.
* src/Makefile.in: Rebuilt.
* testsuite/testsuite_abi.cc: Recognize GLIBCXX_LDBL_3.4,
GLIBCXX_LDBL_3.4.7, CXXABI_LDBL_1.3.
Co-Authored-By: Benjamin Kosnik <bkoz@redhat.com>
From-SVN: r110725
2006-02-07 23:23:58 +01:00
|
|
|
extern template class _GLIBCXX_LDBL_NAMESPACE num_get<wchar_t>;
|
|
|
|
extern template class _GLIBCXX_LDBL_NAMESPACE num_put<wchar_t>;
|
2002-11-01 18:30:36 +01:00
|
|
|
extern template class ctype_byname<wchar_t>;
|
|
|
|
|
2008-09-10 23:34:38 +02:00
|
|
|
extern template
|
|
|
|
const ctype<wchar_t>&
|
|
|
|
use_facet<ctype<wchar_t> >(const locale&);
|
|
|
|
|
2002-11-01 18:30:36 +01:00
|
|
|
extern template
|
2004-02-08 05:46:42 +01:00
|
|
|
const numpunct<wchar_t>&
|
2002-11-01 18:30:36 +01:00
|
|
|
use_facet<numpunct<wchar_t> >(const locale&);
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
extern template
|
|
|
|
const num_put<wchar_t>&
|
2002-11-01 18:30:36 +01:00
|
|
|
use_facet<num_put<wchar_t> >(const locale&);
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
extern template
|
|
|
|
const num_get<wchar_t>&
|
2002-11-01 18:30:36 +01:00
|
|
|
use_facet<num_get<wchar_t> >(const locale&);
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
extern template
|
2002-03-08 07:05:21 +01:00
|
|
|
bool
|
|
|
|
has_facet<ctype<wchar_t> >(const locale&);
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
extern template
|
2002-03-08 07:05:21 +01:00
|
|
|
bool
|
|
|
|
has_facet<numpunct<wchar_t> >(const locale&);
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
extern template
|
2002-03-08 07:05:21 +01:00
|
|
|
bool
|
|
|
|
has_facet<num_put<wchar_t> >(const locale&);
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
extern template
|
2002-03-08 07:05:21 +01:00
|
|
|
bool
|
|
|
|
has_facet<num_get<wchar_t> >(const locale&);
|
2002-11-01 18:30:36 +01:00
|
|
|
#endif
|
2003-02-13 22:39:03 +01:00
|
|
|
#endif
|
2005-12-19 01:56:05 +01:00
|
|
|
|
|
|
|
_GLIBCXX_END_NAMESPACE
|
2002-03-08 07:05:21 +01:00
|
|
|
|
|
|
|
#endif
|