diff options
author | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-12-22 11:03:33 +0000 |
---|---|---|
committer | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-12-22 11:03:33 +0000 |
commit | 3e39c5849e02c97f2c36f2ef969c5c4fabc5de50 (patch) | |
tree | ba2a71822454ed105ee4d838865ccfaecacf0f7c /libstdc++-v3 | |
parent | c87623b510ec57d983359c5fc9abbf44e375c81c (diff) | |
download | gcc-3e39c5849e02c97f2c36f2ef969c5c4fabc5de50.tar.gz |
2000-12-22 Benjamin Kosnik <bkoz@fillmore.redhat.com>
Attempt to make locale visible in gdb.
* include/bits/std_locale.h: Remove codecvt.h include.
* include/bits/locale_facets.h: Add here, after ctype decls.
* include/bits/codecvt.h: Remove std namespace, as assumed to be
in std now.
* include/bits/locale_facets.h: Consistently move generic static
member definitions directly after generic facet declarations.
* include/bits/locale_facets.tcc: From here.
* src/locale.cc: Organize locale::id static definitions for
required facets.
* src/codecvt.cc (codecvt<char...>): Remove locale::id definition.
(codecvt<wchar_t...>): Same.
* src/localename: And here.
* include/bits/localefwd.h (_Count_ones): Change _S_count to _M_count.
Same for _M_halfcount.
(std): make locale::_Impl protected. CHANGE BACK
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38449 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 22 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/codecvt.h | 9 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/locale_facets.h | 60 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/locale_facets.tcc | 46 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/localefwd.h | 35 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/std_locale.h | 1 | ||||
-rw-r--r-- | libstdc++-v3/src/codecvt.cc | 5 | ||||
-rw-r--r-- | libstdc++-v3/src/locale.cc | 137 | ||||
-rw-r--r-- | libstdc++-v3/src/localename.cc | 52 |
9 files changed, 181 insertions, 186 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index acda82529d9..2e63a936c10 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,25 @@ +2000-12-22 Benjamin Kosnik <bkoz@fillmore.redhat.com> + + Attempt to make locale visible in gdb. + * include/bits/std_locale.h: Remove codecvt.h include. + * include/bits/locale_facets.h: Add here, after ctype decls. + * include/bits/codecvt.h: Remove std namespace, as assumed to be + in std now. + + * include/bits/locale_facets.h: Consistently move generic static + member definitions directly after generic facet declarations. + * include/bits/locale_facets.tcc: From here. + + * src/locale.cc: Organize locale::id static definitions for + required facets. + * src/codecvt.cc (codecvt<char...>): Remove locale::id definition. + (codecvt<wchar_t...>): Same. + * src/localename: And here. + + * include/bits/localefwd.h (_Count_ones): Change _S_count to _M_count. + Same for _M_halfcount. + (std): make locale::_Impl protected. CHANGE BACK + 2000-12-22 Alexandre Oliva <aoliva@redhat.com> * mknumeric_limits: Output to temporary files, and rename them at diff --git a/libstdc++-v3/include/bits/codecvt.h b/libstdc++-v3/include/bits/codecvt.h index 8b90b94bfb3..8873298e476 100644 --- a/libstdc++-v3/include/bits/codecvt.h +++ b/libstdc++-v3/include/bits/codecvt.h @@ -38,14 +38,6 @@ #ifndef _CPP_BITS_CODECVT_H #define _CPP_BITS_CODECVT_H 1 -#include <bits/c++config.h> -#ifdef _GLIBCPP_USE_WCHAR_T -#include <iconv.h> // For iconv, iconv_t -#include <langinfo.h> -#endif - -namespace std -{ // XXX // __enc_traits may need to move up the locale header hierarchy, // depending on if ctype ends up using it. @@ -714,7 +706,6 @@ namespace std virtual ~codecvt_byname() { } }; -} // namespace std #endif // _CPP_BITS_CODECVT_H diff --git a/libstdc++-v3/include/bits/locale_facets.h b/libstdc++-v3/include/bits/locale_facets.h index 51e727642cf..6d3b3a358b3 100644 --- a/libstdc++-v3/include/bits/locale_facets.h +++ b/libstdc++-v3/include/bits/locale_facets.h @@ -41,6 +41,8 @@ #include <bits/std_ios.h> // For ios_base #ifdef _GLIBCPP_USE_WCHAR_T # include <bits/std_cwctype.h> // For wctype_t +# include <iconv.h> // For codecvt using iconv, iconv_t +# include <langinfo.h> // For codecvt using nl_langinfo #endif namespace std @@ -78,11 +80,10 @@ namespace std _Use_facet_failure_handler(const locale&) { throw _Bad_use_facet(); } - // 22.2.1 The ctype category + // 22.2.1.1 Template class ctype // Include host-specific ctype enums for ctype_base. #include <bits/ctype_base.h> - // 22.2.1.1 Template class ctype // __ctype_abstract_base is the common base for ctype<_CharT>. template<typename _CharT> class __ctype_abstract_base : public locale::facet, public ctype_base @@ -208,6 +209,9 @@ namespace std ~ctype() { } }; + template<typename _CharT> + locale::id ctype<_CharT>::id; + // 22.2.1.3 ctype specializations template<> class ctype<char> : public __ctype_abstract_base<char> @@ -395,6 +399,9 @@ namespace std ctype_byname<char>::ctype_byname(const char*, size_t refs); + // 22.2.1.5 Template class codecvt + #include <bits/codecvt.h> + template<typename _CharT, typename _InIter> class _Numeric_get; // forward @@ -495,6 +502,13 @@ namespace std _S_callback(ios_base::event __event, ios_base& __ios, int __ix) throw(); }; + template<typename _CharT> + int _Format_cache<_CharT>::_S_pword_ix; + + template<typename _CharT> + const char _Format_cache<_CharT>:: + _S_literals[] = "-+xX0123456789abcdef0123456789ABCDEF"; + template<> _Format_cache<char>::_Format_cache(); #ifdef _GLIBCPP_USE_WCHAR_T template<> _Format_cache<wchar_t>::_Format_cache(); @@ -679,6 +693,9 @@ namespace std void*&) const; }; + template<typename _CharT, typename _InIter> + locale::id num_get<_CharT, _InIter>::id; + // Declare specialized extraction member function. template<> void @@ -788,6 +805,9 @@ namespace std do_put(iter_type, ios_base&, char_type __fill, const void* __v) const; }; + template <typename _CharT, typename _OutIter> + locale::id num_put<_CharT, _OutIter>::id; + template<typename _CharT> class _Punct : public locale::facet { @@ -841,7 +861,6 @@ namespace std _M_thousands_sep = __t; _M_grouping = __g; } - }; template<typename _CharT> @@ -887,7 +906,6 @@ namespace std _M_truename = __t; _M_falsename = __f; } - }; template<typename _CharT> @@ -901,12 +919,15 @@ namespace std explicit numpunct(size_t __refs = 0) : _Numpunct<_CharT>(__refs) { } - protected: + protected: virtual ~numpunct() { } }; + template<typename _CharT> + locale::id numpunct<_CharT>::id; + template<> numpunct<char>::numpunct(size_t __refs): _Numpunct<char>(__refs) { @@ -1001,6 +1022,9 @@ namespace std ~collate() { } }; + template<typename _CharT> + locale::id collate<_CharT>::id; + template<> class collate<char> : public _Collate<char> { @@ -1171,6 +1195,9 @@ namespace std }; template<typename _CharT, typename _InIter> + locale::id time_get<_CharT, _InIter>::id; + + template<typename _CharT, typename _InIter> class time_get_byname : public time_get<_CharT, _InIter> { public: @@ -1220,6 +1247,9 @@ namespace std }; template<typename _CharT, typename _OutIter> + locale::id time_put<_CharT, _OutIter>::id; + + template<typename _CharT, typename _OutIter> class time_put_byname : public time_put<_CharT, _OutIter> { public: @@ -1276,6 +1306,9 @@ namespace std { return __s; } }; + template<typename _CharT, typename _InIter> + locale::id money_get<_CharT, _InIter>::id; + template<typename _CharT, typename _OutIter> class money_put : public locale::facet { @@ -1314,6 +1347,9 @@ namespace std { return __s; } }; + template<typename _CharT, typename _OutIter> + locale::id money_put<_CharT, _OutIter>::id; + struct money_base { enum part { none, space, symbol, sign, value }; @@ -1405,6 +1441,12 @@ namespace std }; template<typename _CharT, bool _Intl> + locale::id moneypunct<_CharT, _Intl>::id; + + template<typename _CharT, bool _Intl> + const bool moneypunct<_CharT, _Intl>::intl; + + template<typename _CharT, bool _Intl> class moneypunct_byname : public moneypunct<_CharT,_Intl> { public: @@ -1420,6 +1462,9 @@ namespace std ~moneypunct_byname() { } }; + template<typename _CharT, bool _Intl> + const bool moneypunct_byname<_CharT, _Intl>::intl; + template<> moneypunct_byname<char, false>:: moneypunct_byname(const char*, size_t __refs); @@ -1496,6 +1541,9 @@ namespace std }; template<typename _CharT> + locale::id messages<_CharT>::id; + + template<typename _CharT> class messages_byname : public messages<_CharT> { public: @@ -1584,7 +1632,6 @@ namespace std inline _CharT tolower(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).tolower(__c); } - } // namespace std #endif /* _CPP_BITS_LOCFACETS_H */ @@ -1592,4 +1639,3 @@ namespace std // Local Variables: // mode:c++ // End: - diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc index ad45c3374df..e0a0dbdefb4 100644 --- a/libstdc++-v3/include/bits/locale_facets.tcc +++ b/libstdc++-v3/include/bits/locale_facets.tcc @@ -159,16 +159,6 @@ namespace std } template<typename _CharT> - locale::id ctype<_CharT>::id; - - template<typename _CharT> - int _Format_cache<_CharT>::_S_pword_ix; - - template<typename _CharT> - const char _Format_cache<_CharT>:: - _S_literals[] = "-+xX0123456789abcdef0123456789ABCDEF"; - - template<typename _CharT> _Format_cache<_CharT>::_Format_cache() : _M_valid(true), _M_use_grouping(false) { } @@ -244,9 +234,6 @@ namespace std return __ncp; } - template<typename _CharT, typename _InIter> - locale::id num_get<_CharT, _InIter>::id; - // This member function takes an (w)istreambuf_iterator object and // parses it into a generic char array suitable for parsing with // strto[l,ll,f,d]. The thought was to encapsulate the conversion @@ -729,9 +716,6 @@ namespace std return __beg; } - template <typename _CharT, typename _OutIter> - locale::id num_put<_CharT, _OutIter>::id; - // _S_fill is specialized for ostreambuf_iterator, random access iterator. template <typename _CharT, typename _OutIter> inline _OutIter @@ -1119,12 +1103,6 @@ namespace std } } - template<typename _CharT> - locale::id numpunct<_CharT>::id; - - template<typename _CharT> - locale::id collate<_CharT>::id; - // Support for time_get: // Note that these partial specializations could, and maybe should, // be changed to full specializations (by eliminating the _Dummy @@ -1194,9 +1172,6 @@ namespace std #endif template<typename _CharT, typename _InIter> - locale::id time_get<_CharT, _InIter>::id; - - template<typename _CharT, typename _InIter> _InIter time_get<_CharT, _InIter>:: do_get_weekday(iter_type __s, iter_type __end, @@ -1249,27 +1224,6 @@ namespace std __err |= __io.failbit; return __out; } - - template<typename _CharT, typename _OutIter> - locale::id time_put<_CharT, _OutIter>::id; - - template<typename _CharT, typename _InIter> - locale::id money_get<_CharT, _InIter>::id; - - template<typename _CharT, typename _OutIter> - locale::id money_put<_CharT, _OutIter>::id; - - template<typename _CharT, bool _Intl> - locale::id moneypunct<_CharT, _Intl>::id; - - template<typename _CharT, bool _Intl> - const bool moneypunct<_CharT, _Intl>::intl; - - template<typename _CharT, bool _Intl> - const bool moneypunct_byname<_CharT, _Intl>::intl; - - template<typename _CharT> - locale::id messages<_CharT>::id; } // std:: #endif /* _CPP_BITS_LOCFACETS_TCC */ diff --git a/libstdc++-v3/include/bits/localefwd.h b/libstdc++-v3/include/bits/localefwd.h index be2908c8042..fdbc1ce99cb 100644 --- a/libstdc++-v3/include/bits/localefwd.h +++ b/libstdc++-v3/include/bits/localefwd.h @@ -56,7 +56,7 @@ namespace std { enum { - _S_count = _Num + _M_count = _Num }; }; @@ -65,9 +65,9 @@ namespace std { enum { - _S_halfcount = _Count_ones<_Num, _Shift/2, - (_Mask^((~_Mask)>>(_Shift/2))) >::_S_count, - _S_count = (_S_halfcount&_Mask) + ((_S_halfcount>>_Shift)&_Mask) + _M_halfcount = _Count_ones<_Num, _Shift/2, + (_Mask^((~_Mask)>>(_Shift/2))) >::_M_count, + _M_count = (_M_halfcount&_Mask) + ((_M_halfcount>>_Shift)&_Mask) }; }; @@ -138,7 +138,6 @@ namespace std #ifdef _GLIBCPP_USE_WCHAR_T template<> class ctype<wchar_t>; #endif - template<typename _CharT> class ctype_byname; // NB: Specialized for char and wchar_t in locale_facets.h. @@ -150,7 +149,6 @@ namespace std #ifdef _GLIBCPP_USE_WCHAR_T template<> class codecvt<wchar_t, char, mbstate_t>; #endif - template<typename _InternT, typename _ExternT, typename _StateT> class codecvt_byname; @@ -207,7 +205,7 @@ namespace std { public: // Types: - typedef int category; + typedef unsigned int category; // Forward decls and friends: class facet; @@ -227,12 +225,12 @@ namespace std // Category values: // NB much depends on the order in which these appear: static const category none = 0; - static const category collate = 0x0100; - static const category ctype = 0x0200; - static const category monetary = 0x0400; - static const category numeric = 0x0800; - static const category time = 0x1000; - static const category messages = 0x2000; + static const category ctype = 1 << 0; + static const category numeric = 1 << 1; + static const category collate = 1 << 2; + static const category time = 1 << 3; + static const category monetary = 1 << 4; + static const category messages = 1 << 5; static const category all = (collate | ctype | monetary | numeric | time | messages); @@ -296,7 +294,7 @@ namespace std // Current global reference locale static _Impl* _S_global; - static const int _S_categories_num = _Count_ones<all>::_S_count; + static const int _S_categories_num = _Count_ones<all>::_M_count; static const int _S_facets_num = 26; explicit @@ -331,18 +329,19 @@ namespace std friend bool has_facet(const locale&) throw(); - private: + // private: + protected: // Data Members. size_t _M_references; __vec_facet* _M_facets; __vec_string* _M_category_names; bool _M_has_name; string _M_name; - static const locale::id* const _S_id_collate[]; static const locale::id* const _S_id_ctype[]; - static const locale::id* const _S_id_monetary[]; static const locale::id* const _S_id_numeric[]; + static const locale::id* const _S_id_collate[]; static const locale::id* const _S_id_time[]; + static const locale::id* const _S_id_monetary[]; static const locale::id* const _S_id_messages[]; static const locale::id* const* const _S_facet_categories[]; @@ -471,7 +470,7 @@ namespace std friend bool has_facet(const locale&) throw (); public: - id() {}; + id() { }; private: // NB: There is no accessor for _M_index because it may be used // before the constructor is run; the effect of calling a member diff --git a/libstdc++-v3/include/bits/std_locale.h b/libstdc++-v3/include/bits/std_locale.h index 7eaba90e7ea..739e755a826 100644 --- a/libstdc++-v3/include/bits/std_locale.h +++ b/libstdc++-v3/include/bits/std_locale.h @@ -37,7 +37,6 @@ #include <bits/localefwd.h> #include <bits/locale_facets.h> #include <bits/locale_facets.tcc> -#include <bits/codecvt.h> #endif diff --git a/libstdc++-v3/src/codecvt.cc b/libstdc++-v3/src/codecvt.cc index cfc76821ac2..515a035eab3 100644 --- a/libstdc++-v3/src/codecvt.cc +++ b/libstdc++-v3/src/codecvt.cc @@ -36,9 +36,6 @@ namespace std { const int __enc_traits::_S_max_size; #endif /* _GLIBCPP_USE_WCHAR_T */ - // codecvt<char, char, mbstate_t> required specialization - locale::id codecvt<char, char, mbstate_t>::id; - codecvt<char, char, mbstate_t>:: codecvt(size_t __refs) : __codecvt_abstract_base<char, char, mbstate_t>(__refs) @@ -107,8 +104,6 @@ namespace std { #ifdef _GLIBCPP_USE_WCHAR_T // codecvt<wchar_t, char, mbstate_t> required specialization - locale::id codecvt<wchar_t, char, mbstate_t>::id; - codecvt<wchar_t, char, mbstate_t>:: codecvt(size_t __refs) : __codecvt_abstract_base<wchar_t, char, mbstate_t>(__refs) { } diff --git a/libstdc++-v3/src/locale.cc b/libstdc++-v3/src/locale.cc index 29dcc378f76..83ca7c15ed9 100644 --- a/libstdc++-v3/src/locale.cc +++ b/libstdc++-v3/src/locale.cc @@ -41,15 +41,15 @@ # include <bits/std_cwctype.h> // for towupper, etc. #endif -namespace std { - +namespace std +{ // Definitions for static const data members of locale. const locale::category locale::none; - const locale::category locale::collate; const locale::category locale::ctype; - const locale::category locale::monetary; const locale::category locale::numeric; + const locale::category locale::collate; const locale::category locale::time; + const locale::category locale::monetary; const locale::category locale::messages; const locale::category locale::all; @@ -58,95 +58,111 @@ namespace std { const int locale::_S_categories_num; const int locale::_S_facets_num; - // Definitions for static const data members of locale::_Impl - const locale::id* const - locale::_Impl::_S_id_collate[] = - { - &std::collate<char>::id, -#ifdef _GLIBCPP_USE_WCHAR_T - &std::collate<wchar_t>::id, + // Definitions for locale::id of standard facets. + locale::id ctype<char>::id; + locale::id codecvt<char, char, mbstate_t>::id; + locale::id num_get<char>::id; + locale::id num_put<char>::id; + locale::id numpunct<char>::id; + locale::id collate<char>::id; + locale::id time_get<char>::id; + locale::id time_put<char>::id; + locale::id money_get<char>::id; + locale::id money_put<char>::id; + locale::id moneypunct<char, false>::id; + locale::id moneypunct<char, true>::id; + locale::id messages<char>::id; + +#ifdef _GLIBCPP_USE_WCHAR_T + locale::id ctype<wchar_t>::id; + locale::id codecvt<wchar_t, char, mbstate_t>::id; + locale::id num_get<wchar_t>::id; + locale::id num_put<wchar_t>::id; + locale::id numpunct<wchar_t>::id; + locale::id collate<wchar_t>::id; + locale::id time_get<wchar_t>::id; + locale::id time_put<wchar_t>::id; + locale::id money_get<wchar_t>::id; + locale::id money_put<wchar_t>::id; + locale::id moneypunct<wchar_t, false>::id; + locale::id moneypunct<wchar_t, true>::id; + locale::id messages<wchar_t>::id; #endif - 0 - }; - + + // Definitions for static const data members of locale::id + size_t locale::id::_S_highwater; // init'd to 0 by linker + + // Definitions for static const data members of locale::_Impl const locale::id* const locale::_Impl::_S_id_ctype[] = { &std::ctype<char>::id, -#ifdef _GLIBCPP_USE_WCHAR_T - &std::ctype<wchar_t>::id, -#endif &codecvt<char, char, mbstate_t>::id, #ifdef _GLIBCPP_USE_WCHAR_T + &std::ctype<wchar_t>::id, &codecvt<wchar_t, char, mbstate_t>::id, #endif 0 }; const locale::id* const - locale::_Impl::_S_id_monetary[] = + locale::_Impl::_S_id_numeric[] = { - &moneypunct<char, false>::id, -#ifdef _GLIBCPP_USE_WCHAR_T - &moneypunct<wchar_t, false>::id, -#endif - &std::moneypunct<char,true >::id, -#ifdef _GLIBCPP_USE_WCHAR_T - &moneypunct<wchar_t,true >::id, -#endif - &money_get<char>::id, -#ifdef _GLIBCPP_USE_WCHAR_T - &money_get<wchar_t>::id, -#endif - &money_put<char>::id, + &num_get<char>::id, + &num_put<char>::id, + &numpunct<char>::id, #ifdef _GLIBCPP_USE_WCHAR_T - &money_put<wchar_t>::id, + &num_get<wchar_t>::id, + &num_put<wchar_t>::id, + &numpunct<wchar_t>::id, #endif 0 }; - + const locale::id* const - locale::_Impl::_S_id_numeric[] = + locale::_Impl::_S_id_collate[] = { - &numpunct<char>::id, -#ifdef _GLIBCPP_USE_WCHAR_T - &numpunct<wchar_t>::id, -#endif - &num_get<char>::id, - #ifdef _GLIBCPP_USE_WCHAR_T - &num_get<wchar_t>::id, -#endif - &num_put<char>::id, + &std::collate<char>::id, #ifdef _GLIBCPP_USE_WCHAR_T - &num_put<wchar_t>::id, + &std::collate<wchar_t>::id, #endif 0 }; - + const locale::id* const locale::_Impl::_S_id_time[] = { &time_get<char>::id, -#ifdef _GLIBCPP_USE_WCHAR_T - &time_get<wchar_t>::id, -#endif &time_put<char>::id, #ifdef _GLIBCPP_USE_WCHAR_T + &time_get<wchar_t>::id, &time_put<wchar_t>::id, #endif 0 }; const locale::id* const - locale::_Impl::_S_id_messages[] = + locale::_Impl::_S_id_monetary[] = { - &time_get<char>::id, + &money_get<char>::id, + &money_put<char>::id, + &moneypunct<char, false>::id, + &moneypunct<char, true >::id, #ifdef _GLIBCPP_USE_WCHAR_T - &time_get<wchar_t>::id, + &money_get<wchar_t>::id, + &money_put<wchar_t>::id, + &moneypunct<wchar_t, false>::id, + &moneypunct<wchar_t, true >::id, #endif - &time_put<char>::id, + 0 + }; + + const locale::id* const + locale::_Impl::_S_id_messages[] = + { + &std::messages<char>::id, #ifdef _GLIBCPP_USE_WCHAR_T - &time_put<wchar_t>::id, + &std::messages<wchar_t>::id, #endif 0 }; @@ -155,18 +171,15 @@ namespace std { locale::_Impl::_S_facet_categories[] = { // Order must match the decl order in class locale. - locale::_Impl::_S_id_collate, locale::_Impl::_S_id_ctype, - locale::_Impl::_S_id_monetary, locale::_Impl::_S_id_numeric, + locale::_Impl::_S_id_collate, locale::_Impl::_S_id_time, + locale::_Impl::_S_id_monetary, locale::_Impl::_S_id_messages, 0 }; - // Definitions for static const data members of locale::id - size_t locale::id::_S_highwater; // init'd to 0 by linker - // Definitions for static const data members of money_base const money_base::pattern money_base::_S_default_pattern = {{symbol, sign, none, value}};; @@ -794,8 +807,6 @@ namespace std { // Platform-specific initialization code for ctype tables. #include <bits/ctype_noninline.h> - locale::id ctype<char>::id; - const size_t ctype<char>::table_size; ctype<char>::~ctype() @@ -846,8 +857,6 @@ namespace std { : ctype<char>(new mask[table_size], true, __refs) { } - locale::id collate<char>::id; - collate<char>::collate(size_t __refs) : _Collate<char>(__refs) { } @@ -903,8 +912,6 @@ namespace std { : messages<char>(__refs) { } #ifdef _GLIBCPP_USE_WCHAR_T - locale::id ctype<wchar_t>::id; - ctype<wchar_t>::__wmask_type ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const { @@ -1060,8 +1067,6 @@ namespace std { ctype_byname(const char* /*__s*/, size_t __refs) : ctype<wchar_t>(__refs) { } - locale::id collate<wchar_t>::id; - collate<wchar_t>:: collate(size_t __refs) : _Collate<wchar_t> (__refs) { } diff --git a/libstdc++-v3/src/localename.cc b/libstdc++-v3/src/localename.cc index ee422c779c8..066f0dd0868 100644 --- a/libstdc++-v3/src/localename.cc +++ b/libstdc++-v3/src/localename.cc @@ -122,11 +122,11 @@ namespace std { static void(_Impl::* ctors[]) (const char*) = { // NB: Order must match the decl order in class locale. - &locale::_Impl::_M_construct_collate, &locale::_Impl::_M_construct_ctype, - &locale::_Impl::_M_construct_monetary, &locale::_Impl::_M_construct_numeric, + &locale::_Impl::_M_construct_collate, &locale::_Impl::_M_construct_time, + &locale::_Impl::_M_construct_monetary, &locale::_Impl::_M_construct_messages, 0 }; @@ -166,7 +166,7 @@ namespace std { locale::_Impl:: _M_replace_categories(const _Impl* __other, category __cat) { - unsigned int __mask = locale::all & -static_cast<unsigned int>(locale::all); + category __mask = locale::all & -static_cast<unsigned int>(locale::all); for (unsigned int __ix = 0; (-__mask & __cat) != 0; ++__ix, (__mask <<= 1)) { if (__mask & __cat) @@ -225,73 +225,57 @@ namespace std { _M_facet_init(new collate_byname<char>(__name, 0)); #ifdef _GLIBCPP_USE_WCHAR_T _M_facet_init(new collate_byname<wchar_t>(__name, 0)); -#endif /* _GLIBCPP_USE_WCHAR_T */ +#endif } void locale::_Impl::_M_construct_ctype(const char* __name) { _M_facet_init(new ctype_byname<char>(__name, 0)); -#ifdef _GLIBCPP_USE_WCHAR_T - _M_facet_init(new ctype_byname<wchar_t>(__name, 0)); -#endif /* _GLIBCPP_USE_WCHAR_T */ _M_facet_init(new codecvt_byname<char, char, mbstate_t>(__name)); #ifdef _GLIBCPP_USE_WCHAR_T + _M_facet_init(new ctype_byname<wchar_t>(__name, 0)); _M_facet_init(new codecvt_byname<wchar_t, char, mbstate_t>(__name)); -#endif /* _GLIBCPP_USE_WCHAR_T */ +#endif } void locale::_Impl::_M_construct_monetary(const char* __name) { + _M_replace_facet(locale::_S_classic, &money_get<char>::id); + _M_replace_facet(locale::_S_classic, &money_put<char>::id); _M_facet_init(new moneypunct_byname<char, false>(__name, 0)); -#ifdef _GLIBCPP_USE_WCHAR_T - _M_facet_init(new moneypunct_byname<wchar_t, false>(__name, 0)); -#endif /* _GLIBCPP_USE_WCHAR_T */ _M_facet_init(new moneypunct_byname<char, true >(__name, 0)); #ifdef _GLIBCPP_USE_WCHAR_T - _M_facet_init(new moneypunct_byname<wchar_t, true >(__name, 0)); -#endif /* _GLIBCPP_USE_WCHAR_T */ - - _M_replace_facet(locale::_S_classic, &money_get<char>::id); -#ifdef _GLIBCPP_USE_WCHAR_T _M_replace_facet(locale::_S_classic, &money_get<wchar_t>::id); -#endif /* _GLIBCPP_USE_WCHAR_T */ - _M_replace_facet(locale::_S_classic, &money_put<char>::id); -#ifdef _GLIBCPP_USE_WCHAR_T _M_replace_facet(locale::_S_classic, &money_put<wchar_t>::id); -#endif /* _GLIBCPP_USE_WCHAR_T */ + _M_facet_init(new moneypunct_byname<wchar_t, false>(__name, 0)); + _M_facet_init(new moneypunct_byname<wchar_t, true >(__name, 0)); +#endif } void locale::_Impl::_M_construct_numeric(const char* __name) { - _M_facet_init(new numpunct_byname<char>(__name, 0)); -#ifdef _GLIBCPP_USE_WCHAR_T - _M_facet_init(new numpunct_byname<wchar_t>(__name, 0)); -#endif /* _GLIBCPP_USE_WCHAR_T */ - _M_replace_facet(locale::_S_classic, &num_get<char>::id); -#ifdef _GLIBCPP_USE_WCHAR_T - _M_replace_facet(locale::_S_classic, &num_get<wchar_t>::id); -#endif /* _GLIBCPP_USE_WCHAR_T */ _M_replace_facet(locale::_S_classic, &num_put<char>::id); + _M_facet_init(new numpunct_byname<char>(__name, 0)); #ifdef _GLIBCPP_USE_WCHAR_T + _M_replace_facet(locale::_S_classic, &num_get<wchar_t>::id); _M_replace_facet(locale::_S_classic, &num_put<wchar_t>::id); -#endif /* _GLIBCPP_USE_WCHAR_T */ + _M_facet_init(new numpunct_byname<wchar_t>(__name, 0)); +#endif } void locale::_Impl::_M_construct_time(const char* __name) { _M_facet_init(new time_get_byname<char>(__name, 0)); -#ifdef _GLIBCPP_USE_WCHAR_T - _M_facet_init(new time_get_byname<wchar_t>(__name, 0)); -#endif /* _GLIBCPP_USE_WCHAR_T */ _M_facet_init(new time_put_byname<char>(__name, 0)); #ifdef _GLIBCPP_USE_WCHAR_T + _M_facet_init(new time_get_byname<wchar_t>(__name, 0)); _M_facet_init(new time_put_byname<wchar_t>(__name, 0)); -#endif /* _GLIBCPP_USE_WCHAR_T */ +#endif } void @@ -300,7 +284,7 @@ namespace std { _M_facet_init(new messages_byname<char>(__name, 0)); #ifdef _GLIBCPP_USE_WCHAR_T _M_facet_init(new messages_byname<wchar_t>(__name, 0)); -#endif /* _GLIBCPP_USE_WCHAR_T */ +#endif } } |