mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-21 16:09:34 +08:00
re PR libstdc++/7811 (default locale not taken from environment)
2002-09-05 Paolo Carlini <pcarlini@unitus.it> Roland McGrath <roland@redhat.com> PR libstdc++/7811 * src/locale.cc (locale::locale(__s)): Use getenv instead of setenv for the environment locale. * testsuite/22_locale/ctor_copy_dtor.cc (test03): New. Co-Authored-By: Roland McGrath <roland@redhat.com> From-SVN: r56865
This commit is contained in:
parent
b3fbfc0766
commit
e2cbee7fd1
@ -1,3 +1,11 @@
|
||||
2002-09-05 Paolo Carlini <pcarlini@unitus.it>
|
||||
Roland McGrath <roland@redhat.com>
|
||||
|
||||
PR libstdc++/7811
|
||||
* src/locale.cc (locale::locale(__s)): Use getenv instead
|
||||
of setenv for the environment locale.
|
||||
* testsuite/22_locale/ctor_copy_dtor.cc (test03): New.
|
||||
|
||||
2002-09-05 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* config/abi/ia64-unknown-linux-gnu: Add.
|
||||
|
@ -202,7 +202,15 @@ namespace std
|
||||
if (strcmp(__s, "C") == 0 || strcmp(__s, "POSIX") == 0)
|
||||
(_M_impl = _S_classic)->_M_add_reference();
|
||||
else if (strcmp(__s, "") == 0)
|
||||
_M_impl = new _Impl(setlocale(LC_ALL, NULL), 1);
|
||||
{
|
||||
char* __env = getenv("LC_ALL");
|
||||
if (__env)
|
||||
_M_impl = new _Impl(__env, 1);
|
||||
else if ((__env = getenv("LANG")))
|
||||
_M_impl = new _Impl(__env, 1);
|
||||
else
|
||||
(_M_impl = _S_classic)->_M_add_reference();
|
||||
}
|
||||
else
|
||||
_M_impl = new _Impl(__s, 1);
|
||||
}
|
||||
|
@ -310,6 +310,21 @@ void test02()
|
||||
VERIFY( loc_1 == loc_2 );
|
||||
}
|
||||
|
||||
// libstdc++/7811
|
||||
void test03()
|
||||
{
|
||||
bool test = true;
|
||||
#ifdef _GLIBCPP_HAVE_SETENV
|
||||
const char* oldLANG = getenv("LANG");
|
||||
if (!setenv("LANG", "it_IT", 1))
|
||||
{
|
||||
std::locale loc("");
|
||||
VERIFY( loc.name() == "it_IT" );
|
||||
setenv("LANG", oldLANG ? oldLANG : "", 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test00();
|
||||
@ -319,6 +334,7 @@ int main()
|
||||
#endif
|
||||
|
||||
test02();
|
||||
test03();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user