locale.cc (locale::locale(const char*)): Make sure global locales are initialized.
2001-07-02 Benjamin Kosnik <bkoz@redhat.com> * src/locale.cc (locale::locale(const char*)): Make sure global locales are initialized. * include/bits/locale_facets.tcc (locale::combine): Refcout should be zero, not one as it's return-by-value. * testsuite/27_io/ios_base_callbacks.cc (test01): Don't check for named locales here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Instead, check for it here. (test02): Add test. * libsupc++/eh_alloc.cc: Use climits, not limits.h. From-SVN: r43713
This commit is contained in:
parent
30b3a033af
commit
213c2316b6
@ -1,9 +1,15 @@
|
|||||||
2001-07-02 Loren J. Rittle <ljrittle@acm.org>
|
2001-07-02 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
|
||||||
libstdc++/3284
|
* src/locale.cc (locale::locale(const char*)): Make sure global
|
||||||
* acinclude.m4 (GLIBCPP_ENABLE_THREADS): Portability enhancement.
|
locales are initialized.
|
||||||
* aclocal.m4: Regenerate.
|
* include/bits/locale_facets.tcc (locale::combine): Refcout should
|
||||||
* configure: Regenerate.
|
be zero, not one as it's return-by-value.
|
||||||
|
* testsuite/27_io/ios_base_callbacks.cc (test01): Don't check for
|
||||||
|
named locales here.
|
||||||
|
* testsuite/22_locale/ctor_copy_dtor.cc (test01): Instead, check
|
||||||
|
for it here.
|
||||||
|
(test02): Add test.
|
||||||
|
* libsupc++/eh_alloc.cc: Use climits, not limits.h.
|
||||||
|
|
||||||
2001-07-02 Loren J. Rittle <ljrittle@acm.org>
|
2001-07-02 Loren J. Rittle <ljrittle@acm.org>
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ namespace std
|
|||||||
locale
|
locale
|
||||||
locale::combine(const locale& __other)
|
locale::combine(const locale& __other)
|
||||||
{
|
{
|
||||||
_Impl* __tmp = new _Impl(*_M_impl, 1);
|
_Impl* __tmp = new _Impl(*_M_impl, 0);
|
||||||
__tmp->_M_replace_facet(__other._M_impl, &_Facet::id);
|
__tmp->_M_replace_facet(__other._M_impl, &_Facet::id);
|
||||||
return locale(__tmp);
|
return locale(__tmp);
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include <exception>
|
#include <exception>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <limits.h>
|
#include <climits>
|
||||||
#include "unwind-cxx.h"
|
#include "unwind-cxx.h"
|
||||||
#include "bits/c++config.h"
|
#include "bits/c++config.h"
|
||||||
#include "bits/gthr.h"
|
#include "bits/gthr.h"
|
||||||
|
@ -371,6 +371,7 @@ namespace std
|
|||||||
{
|
{
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
|
_S_initialize();
|
||||||
if (strcmp(__s, "C") == 0 || strcmp(__s, "POSIX") == 0)
|
if (strcmp(__s, "C") == 0 || strcmp(__s, "POSIX") == 0)
|
||||||
(_M_impl = _S_classic)->_M_add_reference();
|
(_M_impl = _S_classic)->_M_add_reference();
|
||||||
else
|
else
|
||||||
|
@ -25,6 +25,14 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <debug_assert.h>
|
#include <debug_assert.h>
|
||||||
|
|
||||||
|
|
||||||
|
void test00()
|
||||||
|
{
|
||||||
|
// Should be able to do this as the first thing that happens in a
|
||||||
|
// file and have it not crash.
|
||||||
|
std::locale loc("C");
|
||||||
|
}
|
||||||
|
|
||||||
#if _GLIBCPP_USE_WCHAR_T
|
#if _GLIBCPP_USE_WCHAR_T
|
||||||
typedef std::codecvt<char, char, std::mbstate_t> c_codecvt;
|
typedef std::codecvt<char, char, std::mbstate_t> c_codecvt;
|
||||||
typedef std::codecvt_byname<char, char, std::mbstate_t> c_codecvt_byname;
|
typedef std::codecvt_byname<char, char, std::mbstate_t> c_codecvt_byname;
|
||||||
@ -126,6 +134,13 @@ void test01()
|
|||||||
catch(...)
|
catch(...)
|
||||||
{ VERIFY (false); }
|
{ VERIFY (false); }
|
||||||
|
|
||||||
|
try
|
||||||
|
{ locale loc08("saturn_SUN*RA"); }
|
||||||
|
catch(runtime_error& obj)
|
||||||
|
{ VERIFY (true); }
|
||||||
|
catch(...)
|
||||||
|
{ VERIFY (false); }
|
||||||
|
|
||||||
// 4
|
// 4
|
||||||
// locale(const locale& other, const char* std_name, category)
|
// locale(const locale& other, const char* std_name, category)
|
||||||
{
|
{
|
||||||
@ -226,6 +241,8 @@ void test01()
|
|||||||
|
|
||||||
int main ()
|
int main ()
|
||||||
{
|
{
|
||||||
|
test00();
|
||||||
|
|
||||||
#if _GLIBCPP_USE_WCHAR_T
|
#if _GLIBCPP_USE_WCHAR_T
|
||||||
test01();
|
test01();
|
||||||
#endif
|
#endif
|
||||||
|
@ -42,14 +42,14 @@ callb03(std::ios_base::event e, std::ios_base& b, int i)
|
|||||||
bool test01()
|
bool test01()
|
||||||
{
|
{
|
||||||
bool test = true;
|
bool test = true;
|
||||||
std::locale locco("saturn_SUN*RA");
|
std::locale loc("C");
|
||||||
std::stringbuf strbuf01;
|
std::stringbuf strbuf01;
|
||||||
std::ios ios01(&strbuf01);
|
std::ios ios01(&strbuf01);
|
||||||
|
|
||||||
ios01.register_callback(callb03, 1);
|
ios01.register_callback(callb03, 1);
|
||||||
ios01.register_callback(callb02, 1);
|
ios01.register_callback(callb02, 1);
|
||||||
ios01.register_callback(callb01, 1);
|
ios01.register_callback(callb01, 1);
|
||||||
ios01.imbue(locco);
|
ios01.imbue(loc);
|
||||||
VERIFY( str01 == str02 );
|
VERIFY( str01 == str02 );
|
||||||
|
|
||||||
#ifdef DEBUG_ASSERT
|
#ifdef DEBUG_ASSERT
|
||||||
@ -66,3 +66,4 @@ int main(void)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user