diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 9a32983e16d..4c604775bdb 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,13 @@ +2001-12-11 Benjamin Kosnik + + * config/os/generic/bits/ctype_inline.h: Remove spaces. + * config/os/gnu-linux/bits/ctype_noninline.h: Same. + * include/bits/locale_facets.h (__num_base): Move double data + members to first in class. + * include/bits/locale_facets.tcc: Re-arrange, tweak. + * src/locale.cc: Clean. + *include/bits/stl_vector.h: Space typedefs. + 2001-12-11 Phil Edwards * testsuite/ext/allocators.cc: New file. diff --git a/libstdc++-v3/config/os/generic/bits/ctype_inline.h b/libstdc++-v3/config/os/generic/bits/ctype_inline.h index a5f6e855a93..c10cb565b76 100644 --- a/libstdc++-v3/config/os/generic/bits/ctype_inline.h +++ b/libstdc++-v3/config/os/generic/bits/ctype_inline.h @@ -123,8 +123,3 @@ ++__low; return __low; } - - - - - diff --git a/libstdc++-v3/config/os/gnu-linux/bits/ctype_noninline.h b/libstdc++-v3/config/os/gnu-linux/bits/ctype_noninline.h index 0013c5b079a..0d649f681fb 100644 --- a/libstdc++-v3/config/os/gnu-linux/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/gnu-linux/bits/ctype_noninline.h @@ -74,15 +74,3 @@ } return __high; } - - - - - - - - - - - - diff --git a/libstdc++-v3/include/bits/locale_facets.h b/libstdc++-v3/include/bits/locale_facets.h index a992c455093..5d88ea9fc05 100644 --- a/libstdc++-v3/include/bits/locale_facets.h +++ b/libstdc++-v3/include/bits/locale_facets.h @@ -419,6 +419,12 @@ namespace std class __num_base { public: + // Used to establish gating factor for base 16 input. + static const double _S_scale_hex; + + // Used to establish gating factor for base 8 input. + static const double _S_scale_oct; + // String literal of acceptable (narrow) input, for num_get. // "0123456789eEabcdfABCDF" static const char _S_atoms[]; @@ -439,12 +445,6 @@ namespace std // Construct and return valid scanf format for integer types. static void _S_format_int(const ios_base& __io, char* __fptr, char __mod, char __modl); - - // Used to establish gating factor for base 16 input. - static const double _S_scale_hex; - - // Used to establish gating factor for base 8 input. - static const double _S_scale_oct; }; template diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc index e4b40af34f3..d4313721a3c 100644 --- a/libstdc++-v3/include/bits/locale_facets.tcc +++ b/libstdc++-v3/include/bits/locale_facets.tcc @@ -299,12 +299,12 @@ namespace std // Figure out the maximum number of digits that can be extracted // for the given type, using the determined base. int __max_digits; - if (__base == 10) - __max_digits = __max; - else if (__base == 16) + if (__base == 16) __max_digits = static_cast(ceil(__max * _S_scale_hex)); - else /* if (__base == 8) */ + else if (__base == 8) __max_digits = static_cast(ceil(__max * _S_scale_oct)); + else + __max_digits = __max; // Add in what's already been extracted. __max_digits += __pos; diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h index 39993b98d66..d327628c876 100644 --- a/libstdc++-v3/include/bits/stl_vector.h +++ b/libstdc++-v3/include/bits/stl_vector.h @@ -154,15 +154,15 @@ private: typedef _Vector_base<_Tp, _Alloc> _Base; typedef vector<_Tp, _Alloc> vector_type; public: - typedef _Tp value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef __normal_iterator iterator; + typedef _Tp value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef __normal_iterator iterator; typedef __normal_iterator const_iterator; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; typedef typename _Base::allocator_type allocator_type; allocator_type get_allocator() const { return _Base::get_allocator(); } diff --git a/libstdc++-v3/src/locale.cc b/libstdc++-v3/src/locale.cc index 92a8a5c0980..14938d9d730 100644 --- a/libstdc++-v3/src/locale.cc +++ b/libstdc++-v3/src/locale.cc @@ -74,12 +74,6 @@ namespace std // Definitions for static const data members of locale::id size_t locale::id::_S_highwater; // init'd to 0 by linker - const char __num_base::_S_atoms[] = "0123456789eEabcdfABCDF"; - - const double __num_base::_S_scale_hex = log(10.0)/log(16.0); - - const double __num_base::_S_scale_oct = log(10.0)/log(8.0); - // Definitions for static const data members of locale::_Impl const locale::id* const locale::_Impl::_S_id_ctype[] = @@ -440,119 +434,6 @@ namespace std : ctype(new mask[table_size], true, __refs) { } - // Definitions for static const data members of time_base - template<> - const char* - __timepunct::_S_timezones[14] = - { - "GMT", "HST", "AKST", "PST", "MST", "CST", "EST", "AST", "NST", "CET", - "IST", "EET", "CST", "JST" - }; - -#ifdef _GLIBCPP_USE_WCHAR_T - template<> - const wchar_t* - __timepunct::_S_timezones[14] = - { - L"GMT", L"HST", L"AKST", L"PST", L"MST", L"CST", L"EST", L"AST", - L"NST", L"CET", L"IST", L"EET", L"CST", L"JST" - }; -#endif - - // Definitions for static const data members of money_base - const money_base::pattern - money_base::_S_default_pattern = {{symbol, sign, none, value}}; - - template<> - const ctype& - use_facet >(const locale& __loc) - { - size_t __i = ctype::id._M_index; - const locale::_Impl* __tmp = __loc._M_impl; - return static_cast&>(* (*(__tmp->_M_facets))[__i]); - } - -#ifdef _GLIBCPP_USE_WCHAR_T - template<> - const ctype& - use_facet >(const locale& __loc) - { - size_t __i = ctype::id._M_index; - const locale::_Impl* __tmp = __loc._M_impl; - return static_cast&>(* (*(__tmp->_M_facets))[__i]); - } -#endif - - bool - __num_base::_S_format_float(const ios_base& __io, char* __fptr, char __mod, - streamsize __prec) - { - bool __incl_prec = false; - ios_base::fmtflags __flags = __io.flags(); - *__fptr++ = '%'; - // [22.2.2.2.2] Table 60 - if (__flags & ios_base::showpos) - *__fptr++ = '+'; - if (__flags & ios_base::showpoint) - *__fptr++ = '#'; - // As per [22.2.2.2.2.11] - if (__flags & ios_base::fixed || __prec > 0) - { - *__fptr++ = '.'; - *__fptr++ = '*'; - __incl_prec = true; - } - if (__mod) - *__fptr++ = __mod; - ios_base::fmtflags __fltfield = __flags & ios_base::floatfield; - // [22.2.2.2.2] Table 58 - if (__fltfield == ios_base::fixed) - *__fptr++ = 'f'; - else if (__fltfield == ios_base::scientific) - *__fptr++ = (__flags & ios_base::uppercase) ? 'E' : 'e'; - else - *__fptr++ = (__flags & ios_base::uppercase) ? 'G' : 'g'; - *__fptr = '\0'; - return __incl_prec; - } - - void - __num_base::_S_format_int(const ios_base& __io, char* __fptr, char __mod, - char __modl) - { - ios_base::fmtflags __flags = __io.flags(); - *__fptr++ = '%'; - // [22.2.2.2.2] Table 60 - if (__flags & ios_base::showpos) - *__fptr++ = '+'; - if (__flags & ios_base::showbase) - *__fptr++ = '#'; - *__fptr++ = 'l'; - - // For long long types. - if (__modl) - *__fptr++ = __modl; - - ios_base::fmtflags __bsefield = __flags & ios_base::basefield; - if (__bsefield == ios_base::hex) - *__fptr++ = (__flags & ios_base::uppercase) ? 'X' : 'x'; - else if (__bsefield == ios_base::oct) - *__fptr++ = 'o'; - else - *__fptr++ = __mod; - *__fptr = '\0'; - } - - template<> - moneypunct_byname::moneypunct_byname(const char* /*__s*/, - size_t __refs) - : moneypunct(__refs) { } - - template<> - moneypunct_byname::moneypunct_byname(const char* /*__s*/, - size_t __refs) - : moneypunct(__refs) { } - #ifdef _GLIBCPP_USE_WCHAR_T ctype::__wmask_type ctype::_M_convert_to_wmask(const mask __m) const @@ -710,4 +591,124 @@ namespace std ctype_byname(const char* /*__s*/, size_t __refs) : ctype(__refs) { } #endif // _GLIBCPP_USE_WCHAR_T + + // Definitions for static const data members of time_base + template<> + const char* + __timepunct::_S_timezones[14] = + { + "GMT", "HST", "AKST", "PST", "MST", "CST", "EST", "AST", "NST", "CET", + "IST", "EET", "CST", "JST" + }; + +#ifdef _GLIBCPP_USE_WCHAR_T + template<> + const wchar_t* + __timepunct::_S_timezones[14] = + { + L"GMT", L"HST", L"AKST", L"PST", L"MST", L"CST", L"EST", L"AST", + L"NST", L"CET", L"IST", L"EET", L"CST", L"JST" + }; +#endif + + // Definitions for static const data members of money_base + const money_base::pattern + money_base::_S_default_pattern = {{symbol, sign, none, value}}; + + template<> + const ctype& + use_facet >(const locale& __loc) + { + size_t __i = ctype::id._M_index; + const locale::_Impl* __tmp = __loc._M_impl; + return static_cast&>(* (*(__tmp->_M_facets))[__i]); + } + +#ifdef _GLIBCPP_USE_WCHAR_T + template<> + const ctype& + use_facet >(const locale& __loc) + { + size_t __i = ctype::id._M_index; + const locale::_Impl* __tmp = __loc._M_impl; + return static_cast&>(* (*(__tmp->_M_facets))[__i]); + } +#endif + + + const char __num_base::_S_atoms[] = "0123456789eEabcdfABCDF"; + + const double __num_base::_S_scale_hex = log(10.0)/log(16.0); + + const double __num_base::_S_scale_oct = log(10.0)/log(8.0); + + bool + __num_base::_S_format_float(const ios_base& __io, char* __fptr, char __mod, + streamsize __prec) + { + bool __incl_prec = false; + ios_base::fmtflags __flags = __io.flags(); + *__fptr++ = '%'; + // [22.2.2.2.2] Table 60 + if (__flags & ios_base::showpos) + *__fptr++ = '+'; + if (__flags & ios_base::showpoint) + *__fptr++ = '#'; + // As per [22.2.2.2.2.11] + if (__flags & ios_base::fixed || __prec > 0) + { + *__fptr++ = '.'; + *__fptr++ = '*'; + __incl_prec = true; + } + if (__mod) + *__fptr++ = __mod; + ios_base::fmtflags __fltfield = __flags & ios_base::floatfield; + // [22.2.2.2.2] Table 58 + if (__fltfield == ios_base::fixed) + *__fptr++ = 'f'; + else if (__fltfield == ios_base::scientific) + *__fptr++ = (__flags & ios_base::uppercase) ? 'E' : 'e'; + else + *__fptr++ = (__flags & ios_base::uppercase) ? 'G' : 'g'; + *__fptr = '\0'; + return __incl_prec; + } + + void + __num_base::_S_format_int(const ios_base& __io, char* __fptr, char __mod, + char __modl) + { + ios_base::fmtflags __flags = __io.flags(); + *__fptr++ = '%'; + // [22.2.2.2.2] Table 60 + if (__flags & ios_base::showpos) + *__fptr++ = '+'; + if (__flags & ios_base::showbase) + *__fptr++ = '#'; + *__fptr++ = 'l'; + + // For long long types. + if (__modl) + *__fptr++ = __modl; + + ios_base::fmtflags __bsefield = __flags & ios_base::basefield; + if (__bsefield == ios_base::hex) + *__fptr++ = (__flags & ios_base::uppercase) ? 'X' : 'x'; + else if (__bsefield == ios_base::oct) + *__fptr++ = 'o'; + else + *__fptr++ = __mod; + *__fptr = '\0'; + } + + template<> + moneypunct_byname::moneypunct_byname(const char* /*__s*/, + size_t __refs) + : moneypunct(__refs) { } + + template<> + moneypunct_byname::moneypunct_byname(const char* /*__s*/, + size_t __refs) + : moneypunct(__refs) { } } // namespace std