Commit 0fa96a60 by Paolo Carlini Committed by Paolo Carlini

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
parent 7618d510
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.
2003-12-08 David S. Miller <davem@redhat.com> 2003-12-08 David S. Miller <davem@redhat.com>
PR libstdc++/12496 PR libstdc++/12496
......
...@@ -47,78 +47,8 @@ namespace std ...@@ -47,78 +47,8 @@ namespace std
// Specializations for all types used in num_get. // Specializations for all types used in num_get.
template<> template<>
void void
__convert_to_v(const char* __s, long& __v, ios_base::iostate& __err,
const __c_locale&, int __base)
{
if (!(__err & ios_base::failbit))
{
char* __sanity;
errno = 0;
long __l = strtol(__s, &__sanity, __base);
if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)
__v = __l;
else
__err |= ios_base::failbit;
}
}
template<>
void
__convert_to_v(const char* __s, unsigned long& __v,
ios_base::iostate& __err, const __c_locale&, int __base)
{
if (!(__err & ios_base::failbit))
{
char* __sanity;
errno = 0;
unsigned long __ul = strtoul(__s, &__sanity, __base);
if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)
__v = __ul;
else
__err |= ios_base::failbit;
}
}
#ifdef _GLIBCXX_USE_LONG_LONG
template<>
void
__convert_to_v(const char* __s, long long& __v, ios_base::iostate& __err,
const __c_locale&, int __base)
{
if (!(__err & ios_base::failbit))
{
char* __sanity;
errno = 0;
long long __ll = strtoll(__s, &__sanity, __base);
if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)
__v = __ll;
else
__err |= ios_base::failbit;
}
}
template<>
void
__convert_to_v(const char* __s, unsigned long long& __v,
ios_base::iostate& __err, const __c_locale&, int __base)
{
if (!(__err & ios_base::failbit))
{
char* __sanity;
errno = 0;
unsigned long long __ull = strtoull(__s, &__sanity, __base);
if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)
__v = __ull;
else
__err |= ios_base::failbit;
}
}
#endif
template<>
void
__convert_to_v(const char* __s, float& __v, ios_base::iostate& __err, __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
const __c_locale&, int) const __c_locale&)
{ {
if (!(__err & ios_base::failbit)) if (!(__err & ios_base::failbit))
{ {
...@@ -158,7 +88,7 @@ namespace std ...@@ -158,7 +88,7 @@ namespace std
template<> template<>
void void
__convert_to_v(const char* __s, double& __v, ios_base::iostate& __err, __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
const __c_locale&, int) const __c_locale&)
{ {
if (!(__err & ios_base::failbit)) if (!(__err & ios_base::failbit))
{ {
...@@ -180,7 +110,7 @@ namespace std ...@@ -180,7 +110,7 @@ namespace std
template<> template<>
void void
__convert_to_v(const char* __s, long double& __v, __convert_to_v(const char* __s, long double& __v,
ios_base::iostate& __err, const __c_locale&, int) ios_base::iostate& __err, const __c_locale&)
{ {
if (!(__err & ios_base::failbit)) if (!(__err & ios_base::failbit))
{ {
......
...@@ -43,81 +43,8 @@ namespace std ...@@ -43,81 +43,8 @@ namespace std
{ {
template<> template<>
void void
__convert_to_v(const char* __s, long& __v, ios_base::iostate& __err,
const __c_locale& __cloc, int __base)
{
if (!(__err & ios_base::failbit))
{
char* __sanity;
errno = 0;
long __l = __strtol_l(__s, &__sanity, __base, __cloc);
if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)
__v = __l;
else
__err |= ios_base::failbit;
}
}
template<>
void
__convert_to_v(const char* __s, unsigned long& __v,
ios_base::iostate& __err, const __c_locale& __cloc,
int __base)
{
if (!(__err & ios_base::failbit))
{
char* __sanity;
errno = 0;
unsigned long __ul = __strtoul_l(__s, &__sanity, __base, __cloc);
if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)
__v = __ul;
else
__err |= ios_base::failbit;
}
}
#ifdef _GLIBCXX_USE_LONG_LONG
template<>
void
__convert_to_v(const char* __s, long long& __v, ios_base::iostate& __err,
const __c_locale& __cloc, int __base)
{
if (!(__err & ios_base::failbit))
{
char* __sanity;
errno = 0;
long long __ll = __strtoll_l(__s, &__sanity, __base, __cloc);
if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)
__v = __ll;
else
__err |= ios_base::failbit;
}
}
template<>
void
__convert_to_v(const char* __s, unsigned long long& __v,
ios_base::iostate& __err, const __c_locale& __cloc,
int __base)
{
if (!(__err & ios_base::failbit))
{
char* __sanity;
errno = 0;
unsigned long long __ull = __strtoull_l(__s, &__sanity, __base,
__cloc);
if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)
__v = __ull;
else
__err |= ios_base::failbit;
}
}
#endif
template<>
void
__convert_to_v(const char* __s, float& __v, ios_base::iostate& __err, __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
const __c_locale& __cloc, int) const __c_locale& __cloc)
{ {
if (!(__err & ios_base::failbit)) if (!(__err & ios_base::failbit))
{ {
...@@ -134,7 +61,7 @@ namespace std ...@@ -134,7 +61,7 @@ namespace std
template<> template<>
void void
__convert_to_v(const char* __s, double& __v, ios_base::iostate& __err, __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
const __c_locale& __cloc, int) const __c_locale& __cloc)
{ {
if (!(__err & ios_base::failbit)) if (!(__err & ios_base::failbit))
{ {
...@@ -151,7 +78,7 @@ namespace std ...@@ -151,7 +78,7 @@ namespace std
template<> template<>
void void
__convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err, __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
const __c_locale& __cloc, int) const __c_locale& __cloc)
{ {
if (!(__err & ios_base::failbit)) if (!(__err & ios_base::failbit))
{ {
......
...@@ -63,45 +63,23 @@ namespace std ...@@ -63,45 +63,23 @@ namespace std
template<typename _Tv> template<typename _Tv>
void void
__convert_to_v(const char* __in, _Tv& __out, ios_base::iostate& __err, __convert_to_v(const char* __in, _Tv& __out, ios_base::iostate& __err,
const __c_locale& __cloc, int __base = 10); const __c_locale& __cloc);
// Explicit specializations for required types. // Explicit specializations for required types.
template<> template<>
void void
__convert_to_v(const char*, long&, ios_base::iostate&,
const __c_locale&, int);
template<>
void
__convert_to_v(const char*, unsigned long&, ios_base::iostate&,
const __c_locale&, int);
#ifdef _GLIBCXX_USE_LONG_LONG
template<>
void
__convert_to_v(const char*, long long&, ios_base::iostate&,
const __c_locale&, int);
template<>
void
__convert_to_v(const char*, unsigned long long&, ios_base::iostate&,
const __c_locale&, int);
#endif
template<>
void
__convert_to_v(const char*, float&, ios_base::iostate&, __convert_to_v(const char*, float&, ios_base::iostate&,
const __c_locale&, int); const __c_locale&);
template<> template<>
void void
__convert_to_v(const char*, double&, ios_base::iostate&, __convert_to_v(const char*, double&, ios_base::iostate&,
const __c_locale&, int); const __c_locale&);
template<> template<>
void void
__convert_to_v(const char*, long double&, ios_base::iostate&, __convert_to_v(const char*, long double&, ios_base::iostate&,
const __c_locale&, int); const __c_locale&);
// NB: __pad is a struct, rather than a function, so it can be // NB: __pad is a struct, rather than a function, so it can be
// partially-specialized. // partially-specialized.
...@@ -586,7 +564,7 @@ namespace std ...@@ -586,7 +564,7 @@ namespace std
static const char* _S_atoms_out; static const char* _S_atoms_out;
// String literal of acceptable (narrow) input, for num_get. // String literal of acceptable (narrow) input, for num_get.
// "-+xX0123456789eEabcdfABCDF" // "-+xX0123456789abcdefABCDEF"
static const char* _S_atoms_in; static const char* _S_atoms_in;
enum enum
...@@ -596,8 +574,8 @@ namespace std ...@@ -596,8 +574,8 @@ namespace std
_S_ix, _S_ix,
_S_iX, _S_iX,
_S_izero, _S_izero,
_S_ie = _S_izero + 10, _S_ie = _S_izero + 14,
_S_iE = _S_izero + 11, _S_iE = _S_izero + 20,
_S_iend = 26 _S_iend = 26
}; };
...@@ -624,7 +602,7 @@ namespace std ...@@ -624,7 +602,7 @@ namespace std
_CharT _M_atoms_out[__num_base::_S_oend + 1]; _CharT _M_atoms_out[__num_base::_S_oend + 1];
// A list of valid numeric literals for input: in the standard // A list of valid numeric literals for input: in the standard
// "C" locale, this is "-+xX0123456789eEabcdfABCDF" // "C" locale, this is "-+xX0123456789abcdefABCDEF"
// This array contains the chars after having been passed // This array contains the chars after having been passed
// through the current locale's ctype<_CharT>.widen(). // through the current locale's ctype<_CharT>.widen().
_CharT _M_atoms_in[__num_base::_S_iend + 1]; _CharT _M_atoms_in[__num_base::_S_iend + 1];
...@@ -893,9 +871,10 @@ namespace std ...@@ -893,9 +871,10 @@ namespace std
_M_extract_float(iter_type, iter_type, ios_base&, ios_base::iostate&, _M_extract_float(iter_type, iter_type, ios_base&, ios_base::iostate&,
string& __xtrc) const; string& __xtrc) const;
iter_type template<typename _ValueT>
_M_extract_int(iter_type, iter_type, ios_base&, ios_base::iostate&, iter_type
string& __xtrc, int& __base) const; _M_extract_int(iter_type, iter_type, ios_base&, ios_base::iostate&,
_ValueT& __v) const;
virtual iter_type virtual iter_type
do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&) const; do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&) const;
......
...@@ -56,6 +56,50 @@ namespace std ...@@ -56,6 +56,50 @@ namespace std
template class num_get<C, istreambuf_iterator<C> >; template class num_get<C, istreambuf_iterator<C> >;
template class num_put<C, ostreambuf_iterator<C> >; template class num_put<C, ostreambuf_iterator<C> >;
template template
istreambuf_iterator<C>
num_get<C, istreambuf_iterator<C> >::
_M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
ios_base&, ios_base::iostate&,
long&) const;
template
istreambuf_iterator<C>
num_get<C, istreambuf_iterator<C> >::
_M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
ios_base&, ios_base::iostate&,
unsigned short&) const;
template
istreambuf_iterator<C>
num_get<C, istreambuf_iterator<C> >::
_M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
ios_base&, ios_base::iostate&,
unsigned int&) const;
template
istreambuf_iterator<C>
num_get<C, istreambuf_iterator<C> >::
_M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
ios_base&, ios_base::iostate&,
unsigned long&) const;
#ifdef _GLIBCXX_USE_LONG_LONG
template
istreambuf_iterator<C>
num_get<C, istreambuf_iterator<C> >::
_M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
ios_base&, ios_base::iostate&,
long long&) const;
template
istreambuf_iterator<C>
num_get<C, istreambuf_iterator<C> >::
_M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
ios_base&, ios_base::iostate&,
unsigned long long&) const;
#endif
template
ostreambuf_iterator<C> ostreambuf_iterator<C>
num_put<C, ostreambuf_iterator<C> >:: num_put<C, ostreambuf_iterator<C> >::
_M_insert_int(ostreambuf_iterator<C>, ios_base&, C, _M_insert_int(ostreambuf_iterator<C>, ios_base&, C,
......
...@@ -53,7 +53,7 @@ namespace std ...@@ -53,7 +53,7 @@ namespace std
const money_base::pattern const money_base::pattern
money_base::_S_default_pattern = { {symbol, sign, none, value} }; money_base::_S_default_pattern = { {symbol, sign, none, value} };
const char* __num_base::_S_atoms_in = "-+xX0123456789eEabcdfABCDF"; const char* __num_base::_S_atoms_in = "-+xX0123456789abcdefABCDEF";
const char* __num_base::_S_atoms_out ="-+xX0123456789abcdef0123456789ABCDEF"; const char* __num_base::_S_atoms_out ="-+xX0123456789abcdef0123456789ABCDEF";
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment