summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorBenjamin Kosnik <bkoz@redhat.com>2002-10-15 01:05:30 +0000
committerBenjamin Kosnik <bkoz@gcc.gnu.org>2002-10-15 01:05:30 +0000
commit51502ebc130ebef2a7febc060784c42ac120b754 (patch)
treef246406619fb350bed7c266a64cb993393128a01 /libstdc++-v3
parent9fead1f53ba58a53640120443d958aef005ac6d5 (diff)
downloadgcc-51502ebc130ebef2a7febc060784c42ac120b754.tar.gz
static_members.cc (test02): Less provincial.
2002-10-14 Benjamin Kosnik <bkoz@redhat.com> * testsuite/22_locale/static_members.cc (test02): Less provincial. From-SVN: r58144
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog4
-rw-r--r--libstdc++-v3/testsuite/22_locale/static_members.cc51
2 files changed, 32 insertions, 23 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 6c2f3f28150..b4bf7700ae5 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,9 @@
2002-10-14 Benjamin Kosnik <bkoz@redhat.com>
+ * testsuite/22_locale/static_members.cc (test02): Less provincial.
+
+2002-10-14 Benjamin Kosnik <bkoz@redhat.com>
+
* testsuite/22_locale/static_members.cc (test02): Disable for
systems without named locale support.
* testsuite/22_locale/ctor_copy_dtor.cc (test04): Don't assume
diff --git a/libstdc++-v3/testsuite/22_locale/static_members.cc b/libstdc++-v3/testsuite/22_locale/static_members.cc
index 936e8b8e1cf..9811dd9a806 100644
--- a/libstdc++-v3/testsuite/22_locale/static_members.cc
+++ b/libstdc++-v3/testsuite/22_locale/static_members.cc
@@ -67,34 +67,39 @@ void test02()
using namespace std;
bool test = true;
- // If the underlying locale doesn't support these names, setlocale
- // won't be reset. Therefore, disable unless we know named locales work.
-#if _GLIBCPP_C_LOCALE_GNU
-
const string ph("en_PH");
const string mx("es_MX");
+ const char* orig = setlocale(LC_ALL, NULL);
+ const char* testph = setlocale(LC_ALL, ph.c_str());
+ const char* testmx = setlocale(LC_ALL, mx.c_str());
+ setlocale(LC_ALL, orig);
- const locale loc_ph(ph.c_str());
- const locale loc_mx(mx.c_str());
-
- // Use setlocale between two calls to locale("")
- const locale loc_env_1("");
- setlocale(LC_ALL, ph.c_str());
- const locale loc_env_2("");
- VERIFY( loc_env_1 == loc_env_2 );
-
- // Change global locale.
- locale global_orig = locale::global(loc_mx);
- const char* lc_all_mx = setlocale(LC_ALL, NULL);
- if (lc_all_mx)
+ // If the underlying locale doesn't support these names, setlocale
+ // won't be reset. Therefore, disable unless we know these specific
+ // named locales work.
+ if (testph && testmx)
{
- cout << "lc_all_mx is " << lc_all_mx << endl;
- VERIFY( mx == lc_all_mx );
+ const locale loc_ph(ph.c_str());
+ const locale loc_mx(mx.c_str());
+
+ // Use setlocale between two calls to locale("")
+ const locale loc_env_1("");
+ setlocale(LC_ALL, ph.c_str());
+ const locale loc_env_2("");
+ VERIFY( loc_env_1 == loc_env_2 );
+
+ // Change global locale.
+ locale global_orig = locale::global(loc_mx);
+ const char* lc_all_mx = setlocale(LC_ALL, NULL);
+ if (lc_all_mx)
+ {
+ cout << "lc_all_mx is " << lc_all_mx << endl;
+ VERIFY( mx == lc_all_mx );
+ }
+
+ // Restore global settings.
+ locale::global(global_orig);
}
-
- // Restore global settings.
- locale::global(global_orig);
-#endif
}
// Static counter for use in checking ctors/dtors.