summaryrefslogtreecommitdiff
path: root/libstdc++-v3/src/localename.cc
diff options
context:
space:
mode:
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2001-12-15 07:05:04 +0000
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2001-12-15 07:05:04 +0000
commit3ab6bad2dbe83a7cf6e0e2983cd9104b43e7ed06 (patch)
tree8de54c61193922ab77a998c6f31861fa57869582 /libstdc++-v3/src/localename.cc
parent7cc1628dc8ce029afc72194d0453c430bfab0db6 (diff)
downloadgcc-3ab6bad2dbe83a7cf6e0e2983cd9104b43e7ed06.tar.gz
2001-12-14 Benjamin Kosnik <bkoz@redhat.com>
Clean up initialization and simplfy caching of underlying "C" locale objects. * src/localename.cc (locale::_Impl::_Impl(string, size_t): Unconditionally create __clocale object for all named locales, including "C" and "POSIX". * config/locale/c_locale_generic.cc (locale::facet::_S_create_c_locale): Always set __cloc to zero. * config/locale/c_locale_gnu.cc: Always delete. * include/bits/localefwd.h (locale::facet::_S_c_locale): New. * src/locale.cc (locale::classic()): Initialize locale::facet::_S_c_locale. (locale::facet::_S_c_locale): Define. * include/bits/locale_facets.h: Add ctype_byname<wchar_t> ctor specialization. * src/locale.cc: Add definition here. * config/os/gnu-linux/bits/ctype_inline.h: Tweak. * config/os/gnu-linux/bits/ctype_noninline.h: Adjust initializations. * include/bits/locale_facets.h (ctype<char>::_M_c_locale_ctype): Add. Adjust ctors, dtors. (ctype<char>::_M_toupper): Remove const&. (ctype<char>::_M_tolower): Remove const&. (ctype<char>::_M_ctable): Remove const&. * include/bits/locale_facets.h (collate): Clean up initialization of _M_c_locale_collate in ctors and dtors. * config/locale/collate_members_gnu.cc: Always use extended functions. * include/bits/locale_facets.h (messages): Clean up inits in ctor/dtor. (messages_byname): Same. * config/locale/messages_members_generic.h (messages::~messages): Remove. * config/locale/messages_members_gnu.h: Same. * include/bits/localefwd.h: Clean. Move dtor definitions to * src/locale.cc: Here. * testsuite/22_locale/facet.cc: Fix spelling. Named locale support for ctype<wchar_t>. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): Add variable ctype_members_* bits. * aclocal.m4: Regenerate. * configure: Regenerate. * src/Makefile.am (sources): Add ctype.cc. * src/Makefile.in: Regenerate. * config/locale/ctype_members_generic.cc: New file. * config/locale/ctype_members_gnu.cc: New file. * src/locale.cc: Remove ctype<wchart_t> definitions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@48034 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/src/localename.cc')
-rw-r--r--libstdc++-v3/src/localename.cc26
1 files changed, 15 insertions, 11 deletions
diff --git a/libstdc++-v3/src/localename.cc b/libstdc++-v3/src/localename.cc
index 2bd34cd4ac8..8c2db9da7c8 100644
--- a/libstdc++-v3/src/localename.cc
+++ b/libstdc++-v3/src/localename.cc
@@ -72,9 +72,14 @@ namespace std
{
// Initialize the underlying locale model, which also checks to
// see if the given name is valid.
- __c_locale __cloc = NULL;
+ __c_locale __cloc;
+ locale::facet::_S_create_c_locale(__cloc, __str.c_str());
+
+ // This is needed as presently "C" locales != required data in
+ // __timepunct, numpunct, and moneypunct.
+ __c_locale __cloc_c = NULL;
if (__str != "C" && __str != "POSIX")
- locale::facet::_S_create_c_locale(__cloc, __str.c_str());
+ __cloc_c = __cloc;
// Allocate facet container.
try
@@ -90,18 +95,17 @@ namespace std
_M_names[i] = __str;
// Construct all standard facets and add them to _M_facets.
- // XXX How to deal cleanly, consistently with null ("C") __cloc?
_M_init_facet(new std::collate<char>(__cloc));
_M_init_facet(new std::ctype<char>(__cloc));
_M_init_facet(new codecvt<char, char, mbstate_t>);
- _M_init_facet(new moneypunct<char, false>(__cloc));
- _M_init_facet(new moneypunct<char, true>(__cloc));
+ _M_init_facet(new moneypunct<char, false>(__cloc_c));
+ _M_init_facet(new moneypunct<char, true>(__cloc_c));
_M_init_facet(new money_get<char>);
_M_init_facet(new money_put<char>);
- _M_init_facet(new numpunct<char>(__cloc));
+ _M_init_facet(new numpunct<char>(__cloc_c));
_M_init_facet(new num_get<char>);
_M_init_facet(new num_put<char>);
- _M_init_facet(new __timepunct<char>(__cloc, __str.c_str()));
+ _M_init_facet(new __timepunct<char>(__cloc_c, __str.c_str()));
_M_init_facet(new time_get<char>);
_M_init_facet(new time_put<char>);
_M_init_facet(new std::messages<char>(__cloc, __str.c_str()));
@@ -110,14 +114,14 @@ namespace std
_M_init_facet(new std::collate<wchar_t>(__cloc));
_M_init_facet(new std::ctype<wchar_t>(__cloc));
_M_init_facet(new codecvt<wchar_t, char, mbstate_t>);
- _M_init_facet(new moneypunct<wchar_t, false>(__cloc));
- _M_init_facet(new moneypunct<wchar_t, true>(__cloc));
+ _M_init_facet(new moneypunct<wchar_t, false>(__cloc_c));
+ _M_init_facet(new moneypunct<wchar_t, true>(__cloc_c));
_M_init_facet(new money_get<wchar_t>);
_M_init_facet(new money_put<wchar_t>);
- _M_init_facet(new numpunct<wchar_t>(__cloc));
+ _M_init_facet(new numpunct<wchar_t>(__cloc_c));
_M_init_facet(new num_get<wchar_t>);
_M_init_facet(new num_put<wchar_t>);
- _M_init_facet(new __timepunct<wchar_t>(__cloc, __str.c_str()));
+ _M_init_facet(new __timepunct<wchar_t>(__cloc_c, __str.c_str()));
_M_init_facet(new time_get<wchar_t>);
_M_init_facet(new time_put<wchar_t>);
_M_init_facet(new std::messages<wchar_t>(__cloc, __str.c_str()));