Commit 85c39c6d by Loren J. Rittle Committed by Loren J. Rittle

c_locale.cc (locale::facet::_S_create_c_locale): Throw runtime exception when…

c_locale.cc (locale::facet::_S_create_c_locale): Throw runtime exception when unsupported language is specified.

	* config/locale/generic/c_locale.cc (locale::facet::_S_create_c_locale):
	Throw runtime exception when unsupported language is specified.
	* testsuite/testsuite_hooks.h
	(run_test_wrapped_generic_locale_exception_catcher): New function.
	* testsuite/testsuite_hooks.cc (run_tests_wrapped_locale):
	Suppress runtime exception thrown by generic implementation.
	(run_tests_wrapped_env): Likewise.
	(run_test_wrapped_generic_locale_exception_catcher): New function.
	* testsuite/22_locale/collate/compare/char/1.cc: New test wrap.
	* testsuite/22_locale/collate/compare/char/2.cc: New test wrap.
	* testsuite/22_locale/collate/compare/char/3.cc: New test wrap.
	* testsuite/22_locale/collate/hash/char/2.cc: New test wrap.
	* testsuite/22_locale/collate/transform/char/2.cc: New test wrap.
	* testsuite/22_locale/collate/transform/char/3.cc: New test wrap.
	* testsuite/22_locale/collate_byname/1.cc: New test wrap.
	* testsuite/22_locale/ctype/is/char/2.cc: New test wrap.
	* testsuite/22_locale/facet/2.cc: New test wrap.
	* testsuite/22_locale/locale/cons/4.cc: New test wrap.
	* testsuite/22_locale/locale/cons/5.cc: New test wrap.
	* testsuite/22_locale/locale/cons/7.cc: New test wrap.
	* testsuite/22_locale/messages/members/char/1.cc: New test wrap.
	* testsuite/22_locale/messages/members/char/2.cc: New test wrap.
	* testsuite/22_locale/messages/members/char/3.cc: New test wrap.
	* testsuite/22_locale/messages_byname/1.cc: New test wrap.
	* testsuite/22_locale/money_get/get/char/1.cc: New test wrap.
	* testsuite/22_locale/money_get/get/char/2.cc: New test wrap.
	* testsuite/22_locale/money_get/get/char/3.cc: New test wrap.
	* testsuite/22_locale/money_get/get/char/4.cc: New test wrap.
	* testsuite/22_locale/money_put/put/char/1.cc: New test wrap.
	* testsuite/22_locale/money_put/put/char/2.cc: New test wrap.
	* testsuite/22_locale/money_put/put/char/3.cc: New test wrap.
	* testsuite/22_locale/moneypunct/members/char/2.cc: New test wrap.
	* testsuite/22_locale/moneypunct_byname/1.cc: New test wrap.
	* testsuite/22_locale/num_get/get/char/1.cc: New test wrap.
	* testsuite/22_locale/num_get/get/char/2.cc: New test wrap.
	* testsuite/22_locale/num_get/get/char/3.cc: New test wrap.
	* testsuite/22_locale/num_get/get/char/5.cc: New test wrap.
	* testsuite/22_locale/num_get/get/char/6.cc: New test wrap.
	* testsuite/22_locale/num_put/put/char/1.cc: New test wrap.
	* testsuite/22_locale/num_put/put/char/2.cc: New test wrap.
	* testsuite/22_locale/num_put/put/char/3.cc: New test wrap.
	* testsuite/22_locale/num_put/put/char/5.cc: New test wrap.
	* testsuite/22_locale/numpunct/members/char/1.cc: New test wrap.
	* testsuite/22_locale/numpunct/members/char/2.cc: New test wrap.
	* testsuite/22_locale/numpunct_byname/1.cc: New test wrap.
	* testsuite/22_locale/numpunct_byname/2.cc: New test wrap.
	* testsuite/22_locale/time_get/date_order/char/1.cc: New test wrap.
	* testsuite/22_locale/time_get/get_date/char/1.cc: New test wrap.
	* testsuite/22_locale/time_get/get_date/char/2.cc: New test wrap.
	* testsuite/22_locale/time_get/get_monthname/char/1.cc: New test wrap.
	* testsuite/22_locale/time_get/get_monthname/char/2.cc: New test wrap.
	* testsuite/22_locale/time_get/get_time/char/1.cc: New test wrap.
	* testsuite/22_locale/time_get/get_time/char/2.cc: New test wrap.
	* testsuite/22_locale/time_get/get_weekday/char/1.cc: New test wrap.
	* testsuite/22_locale/time_get/get_weekday/char/2.cc: New test wrap.
	* testsuite/22_locale/time_get/get_year/char/1.cc: New test wrap.
	* testsuite/22_locale/time_put/put/char/1.cc: New test wrap.
	* testsuite/22_locale/time_put/put/char/2.cc: New test wrap.
	* testsuite/22_locale/time_put/put/char/3.cc: New test wrap.
	* testsuite/22_locale/time_put/put/char/4.cc: New test wrap.
	* testsuite/22_locale/time_put/put/char/5.cc: New test wrap.
	* testsuite/22_locale/time_put/put/char/6.cc: New test wrap.
	* testsuite/22_locale/time_put/put/char/7.cc: New test wrap.
	* testsuite/22_locale/time_put/put/char/8.cc: New test wrap.
	* testsuite/27_io/filebuf_virtuals.cc: New test wrap.
	* testsuite/27_io/ios_members.cc: New test wrap.
	* testsuite/27_io/ostream_inserter_arith.cc (test02): Make void.
	New test wrap.
	* testsuite/27_io/streambuf_members.cc: New test wrap.
	* testsuite/27_io/stringbuf_virtuals.cc: New test wrap.

From-SVN: r63975
parent feecf614
2003-03-08 Loren J. Rittle <ljrittle@acm.org>
* config/locale/generic/c_locale.cc (locale::facet::_S_create_c_locale):
Throw runtime exception when unsupported language is specified.
* testsuite/testsuite_hooks.h
(run_test_wrapped_generic_locale_exception_catcher): New function.
* testsuite/testsuite_hooks.cc (run_tests_wrapped_locale):
Suppress runtime exception thrown by generic implementation.
(run_tests_wrapped_env): Likewise.
(run_test_wrapped_generic_locale_exception_catcher): New function.
* testsuite/22_locale/collate/compare/char/1.cc: New test wrap.
* testsuite/22_locale/collate/compare/char/2.cc: New test wrap.
* testsuite/22_locale/collate/compare/char/3.cc: New test wrap.
* testsuite/22_locale/collate/hash/char/2.cc: New test wrap.
* testsuite/22_locale/collate/transform/char/2.cc: New test wrap.
* testsuite/22_locale/collate/transform/char/3.cc: New test wrap.
* testsuite/22_locale/collate_byname/1.cc: New test wrap.
* testsuite/22_locale/ctype/is/char/2.cc: New test wrap.
* testsuite/22_locale/facet/2.cc: New test wrap.
* testsuite/22_locale/locale/cons/4.cc: New test wrap.
* testsuite/22_locale/locale/cons/5.cc: New test wrap.
* testsuite/22_locale/locale/cons/7.cc: New test wrap.
* testsuite/22_locale/messages/members/char/1.cc: New test wrap.
* testsuite/22_locale/messages/members/char/2.cc: New test wrap.
* testsuite/22_locale/messages/members/char/3.cc: New test wrap.
* testsuite/22_locale/messages_byname/1.cc: New test wrap.
* testsuite/22_locale/money_get/get/char/1.cc: New test wrap.
* testsuite/22_locale/money_get/get/char/2.cc: New test wrap.
* testsuite/22_locale/money_get/get/char/3.cc: New test wrap.
* testsuite/22_locale/money_get/get/char/4.cc: New test wrap.
* testsuite/22_locale/money_put/put/char/1.cc: New test wrap.
* testsuite/22_locale/money_put/put/char/2.cc: New test wrap.
* testsuite/22_locale/money_put/put/char/3.cc: New test wrap.
* testsuite/22_locale/moneypunct/members/char/2.cc: New test wrap.
* testsuite/22_locale/moneypunct_byname/1.cc: New test wrap.
* testsuite/22_locale/num_get/get/char/1.cc: New test wrap.
* testsuite/22_locale/num_get/get/char/2.cc: New test wrap.
* testsuite/22_locale/num_get/get/char/3.cc: New test wrap.
* testsuite/22_locale/num_get/get/char/5.cc: New test wrap.
* testsuite/22_locale/num_get/get/char/6.cc: New test wrap.
* testsuite/22_locale/num_put/put/char/1.cc: New test wrap.
* testsuite/22_locale/num_put/put/char/2.cc: New test wrap.
* testsuite/22_locale/num_put/put/char/3.cc: New test wrap.
* testsuite/22_locale/num_put/put/char/5.cc: New test wrap.
* testsuite/22_locale/numpunct/members/char/1.cc: New test wrap.
* testsuite/22_locale/numpunct/members/char/2.cc: New test wrap.
* testsuite/22_locale/numpunct_byname/1.cc: New test wrap.
* testsuite/22_locale/numpunct_byname/2.cc: New test wrap.
* testsuite/22_locale/time_get/date_order/char/1.cc: New test wrap.
* testsuite/22_locale/time_get/get_date/char/1.cc: New test wrap.
* testsuite/22_locale/time_get/get_date/char/2.cc: New test wrap.
* testsuite/22_locale/time_get/get_monthname/char/1.cc: New test wrap.
* testsuite/22_locale/time_get/get_monthname/char/2.cc: New test wrap.
* testsuite/22_locale/time_get/get_time/char/1.cc: New test wrap.
* testsuite/22_locale/time_get/get_time/char/2.cc: New test wrap.
* testsuite/22_locale/time_get/get_weekday/char/1.cc: New test wrap.
* testsuite/22_locale/time_get/get_weekday/char/2.cc: New test wrap.
* testsuite/22_locale/time_get/get_year/char/1.cc: New test wrap.
* testsuite/22_locale/time_put/put/char/1.cc: New test wrap.
* testsuite/22_locale/time_put/put/char/2.cc: New test wrap.
* testsuite/22_locale/time_put/put/char/3.cc: New test wrap.
* testsuite/22_locale/time_put/put/char/4.cc: New test wrap.
* testsuite/22_locale/time_put/put/char/5.cc: New test wrap.
* testsuite/22_locale/time_put/put/char/6.cc: New test wrap.
* testsuite/22_locale/time_put/put/char/7.cc: New test wrap.
* testsuite/22_locale/time_put/put/char/8.cc: New test wrap.
* testsuite/27_io/filebuf_virtuals.cc: New test wrap.
* testsuite/27_io/ios_members.cc: New test wrap.
* testsuite/27_io/ostream_inserter_arith.cc (test02): Make void.
New test wrap.
* testsuite/27_io/streambuf_members.cc: New test wrap.
* testsuite/27_io/stringbuf_virtuals.cc: New test wrap.
2003-03-08 Paolo Carlini <pcarlini@unitus.it> 2003-03-08 Paolo Carlini <pcarlini@unitus.it>
Petur Runolfsson <peturr02@ru.is> Petur Runolfsson <peturr02@ru.is>
......
...@@ -212,9 +212,13 @@ namespace std ...@@ -212,9 +212,13 @@ namespace std
} }
void void
locale::facet::_S_create_c_locale(__c_locale& __cloc, const char*, locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
__c_locale) __c_locale)
{ __cloc = NULL; } {
__cloc = NULL;
if (strcmp (__s, "C"))
__throw_runtime_error("attempt to create locale from unhandled name in generic implementation; see http://gcc.gnu.org/ml/libstdc++/2003-02/msg00345.html");
}
void void
locale::facet::_S_destroy_c_locale(__c_locale& __cloc) locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
......
...@@ -74,6 +74,6 @@ void test01() ...@@ -74,6 +74,6 @@ void test01()
int main() int main()
{ {
test01(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01);
return 0; return 0;
} }
...@@ -81,6 +81,6 @@ void test02() ...@@ -81,6 +81,6 @@ void test02()
int main() int main()
{ {
test02(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02);
return 0; return 0;
} }
...@@ -85,6 +85,6 @@ void test03() ...@@ -85,6 +85,6 @@ void test03()
int main() int main()
{ {
test03(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test03);
return 0; return 0;
} }
...@@ -70,6 +70,6 @@ void test02() ...@@ -70,6 +70,6 @@ void test02()
int main() int main()
{ {
test02(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02);
return 0; return 0;
} }
...@@ -67,6 +67,6 @@ void test02() ...@@ -67,6 +67,6 @@ void test02()
int main() int main()
{ {
test02(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02);
return 0; return 0;
} }
...@@ -88,6 +88,6 @@ void test03() ...@@ -88,6 +88,6 @@ void test03()
int main() int main()
{ {
test03(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test03);
return 0; return 0;
} }
...@@ -131,6 +131,6 @@ void test01() ...@@ -131,6 +131,6 @@ void test01()
int main() int main()
{ {
test01(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01);
return 0; return 0;
} }
...@@ -99,6 +99,6 @@ void test02() ...@@ -99,6 +99,6 @@ void test02()
int main() int main()
{ {
test02(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02);
return 0; return 0;
} }
...@@ -89,6 +89,6 @@ void test02() ...@@ -89,6 +89,6 @@ void test02()
int main () int main ()
{ {
test02(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02);
return 0; return 0;
} }
...@@ -42,6 +42,6 @@ void test03() ...@@ -42,6 +42,6 @@ void test03()
int main() int main()
{ {
test03(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test03);
return 0; return 0;
} }
...@@ -193,6 +193,6 @@ void test04() ...@@ -193,6 +193,6 @@ void test04()
int main() int main()
{ {
test04(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test04);
return 0; return 0;
} }
...@@ -99,6 +99,6 @@ test02() ...@@ -99,6 +99,6 @@ test02()
int main() int main()
{ {
test02(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02);
return 0; return 0;
} }
...@@ -64,6 +64,6 @@ void test01() ...@@ -64,6 +64,6 @@ void test01()
int main() int main()
{ {
test01(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01);
return 0; return 0;
} }
...@@ -64,6 +64,6 @@ void test02() ...@@ -64,6 +64,6 @@ void test02()
int main() int main()
{ {
test02(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02);
return 0; return 0;
} }
...@@ -64,6 +64,6 @@ void test03() ...@@ -64,6 +64,6 @@ void test03()
int main() int main()
{ {
test03(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test03);
return 0; return 0;
} }
...@@ -73,6 +73,6 @@ void test01() ...@@ -73,6 +73,6 @@ void test01()
int main() int main()
{ {
test01(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01);
return 0; return 0;
} }
...@@ -146,6 +146,6 @@ void test01() ...@@ -146,6 +146,6 @@ void test01()
int main() int main()
{ {
test01(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01);
return 0; return 0;
} }
...@@ -135,6 +135,6 @@ void test02() ...@@ -135,6 +135,6 @@ void test02()
int main() int main()
{ {
test02(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02);
return 0; return 0;
} }
...@@ -91,6 +91,6 @@ void test03() ...@@ -91,6 +91,6 @@ void test03()
int main() int main()
{ {
test03(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test03);
return 0; return 0;
} }
...@@ -86,6 +86,6 @@ void test04() ...@@ -86,6 +86,6 @@ void test04()
int main() int main()
{ {
test04(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test04);
return 0; return 0;
} }
...@@ -124,6 +124,6 @@ void test01() ...@@ -124,6 +124,6 @@ void test01()
int main() int main()
{ {
test01(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01);
return 0; return 0;
} }
...@@ -115,6 +115,6 @@ void test02() ...@@ -115,6 +115,6 @@ void test02()
int main() int main()
{ {
test02(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02);
return 0; return 0;
} }
...@@ -104,6 +104,6 @@ void test03() ...@@ -104,6 +104,6 @@ void test03()
int main() int main()
{ {
test03(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test03);
return 0; return 0;
} }
...@@ -95,6 +95,6 @@ void test02() ...@@ -95,6 +95,6 @@ void test02()
int main() int main()
{ {
test02(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02);
return 0; return 0;
} }
...@@ -93,7 +93,7 @@ void test01() ...@@ -93,7 +93,7 @@ void test01()
int main() int main()
{ {
test01(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01);
return 0; return 0;
} }
...@@ -162,7 +162,7 @@ void test01() ...@@ -162,7 +162,7 @@ void test01()
int main() int main()
{ {
test01(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01);
return 0; return 0;
} }
......
...@@ -132,7 +132,7 @@ void test02() ...@@ -132,7 +132,7 @@ void test02()
int main() int main()
{ {
test02(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02);
return 0; return 0;
} }
......
...@@ -94,7 +94,7 @@ void test03() ...@@ -94,7 +94,7 @@ void test03()
int main() int main()
{ {
test03(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test03);
return 0; return 0;
} }
......
...@@ -84,7 +84,7 @@ void test05() ...@@ -84,7 +84,7 @@ void test05()
int main() int main()
{ {
test05(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test05);
return 0; return 0;
} }
......
...@@ -49,7 +49,7 @@ void test06() ...@@ -49,7 +49,7 @@ void test06()
int main() int main()
{ {
test06(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test06);
return 0; return 0;
} }
......
...@@ -169,7 +169,7 @@ void test01() ...@@ -169,7 +169,7 @@ void test01()
int main() int main()
{ {
test01(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01);
return 0; return 0;
} }
......
...@@ -105,7 +105,7 @@ void test02() ...@@ -105,7 +105,7 @@ void test02()
int main() int main()
{ {
test02(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02);
return 0; return 0;
} }
......
...@@ -88,7 +88,7 @@ void test03() ...@@ -88,7 +88,7 @@ void test03()
int main() int main()
{ {
test03(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test03);
return 0; return 0;
} }
......
...@@ -63,7 +63,7 @@ void test05() ...@@ -63,7 +63,7 @@ void test05()
int main() int main()
{ {
test05(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test05);
return 0; return 0;
} }
......
...@@ -60,6 +60,6 @@ void test01() ...@@ -60,6 +60,6 @@ void test01()
int main() int main()
{ {
test01(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01);
return 0; return 0;
} }
...@@ -82,6 +82,6 @@ void test02() ...@@ -82,6 +82,6 @@ void test02()
int main() int main()
{ {
test02(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02);
return 0; return 0;
} }
...@@ -71,6 +71,6 @@ void test01() ...@@ -71,6 +71,6 @@ void test01()
int main() int main()
{ {
test01(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01);
return 0; return 0;
} }
...@@ -40,6 +40,6 @@ void test02() ...@@ -40,6 +40,6 @@ void test02()
int main() int main()
{ {
test02(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02);
return 0; return 0;
} }
...@@ -64,6 +64,6 @@ void test01() ...@@ -64,6 +64,6 @@ void test01()
int main() int main()
{ {
test01(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01);
return 0; return 0;
} }
...@@ -107,6 +107,6 @@ void test01() ...@@ -107,6 +107,6 @@ void test01()
int main() int main()
{ {
test01(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01);
return 0; return 0;
} }
...@@ -103,6 +103,6 @@ void test02() ...@@ -103,6 +103,6 @@ void test02()
int main() int main()
{ {
test02(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02);
return 0; return 0;
} }
...@@ -121,6 +121,6 @@ void test01() ...@@ -121,6 +121,6 @@ void test01()
int main() int main()
{ {
test01(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01);
return 0; return 0;
} }
...@@ -85,6 +85,6 @@ void test02() ...@@ -85,6 +85,6 @@ void test02()
int main() int main()
{ {
test02(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02);
return 0; return 0;
} }
...@@ -122,6 +122,6 @@ void test01() ...@@ -122,6 +122,6 @@ void test01()
int main() int main()
{ {
test01(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01);
return 0; return 0;
} }
...@@ -75,6 +75,6 @@ void test02() ...@@ -75,6 +75,6 @@ void test02()
int main() int main()
{ {
test02(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02);
return 0; return 0;
} }
...@@ -129,6 +129,6 @@ void test01() ...@@ -129,6 +129,6 @@ void test01()
int main() int main()
{ {
test01(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01);
return 0; return 0;
} }
...@@ -85,6 +85,6 @@ void test02() ...@@ -85,6 +85,6 @@ void test02()
int main() int main()
{ {
test02(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02);
return 0; return 0;
} }
...@@ -118,6 +118,6 @@ void test01() ...@@ -118,6 +118,6 @@ void test01()
int main() int main()
{ {
test01(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01);
return 0; return 0;
} }
...@@ -85,6 +85,6 @@ void test01() ...@@ -85,6 +85,6 @@ void test01()
int main() int main()
{ {
test01(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test01);
return 0; return 0;
} }
...@@ -80,6 +80,6 @@ void test02() ...@@ -80,6 +80,6 @@ void test02()
int main() int main()
{ {
test02(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02);
return 0; return 0;
} }
...@@ -80,6 +80,6 @@ void test03() ...@@ -80,6 +80,6 @@ void test03()
int main() int main()
{ {
test03(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test03);
return 0; return 0;
} }
...@@ -79,6 +79,6 @@ void test04() ...@@ -79,6 +79,6 @@ void test04()
int main() int main()
{ {
test04(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test04);
return 0; return 0;
} }
...@@ -75,6 +75,6 @@ void test05() ...@@ -75,6 +75,6 @@ void test05()
int main() int main()
{ {
test05(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test05);
return 0; return 0;
} }
...@@ -73,6 +73,6 @@ void test06() ...@@ -73,6 +73,6 @@ void test06()
int main() int main()
{ {
test06(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test06);
return 0; return 0;
} }
...@@ -74,6 +74,6 @@ void test07() ...@@ -74,6 +74,6 @@ void test07()
int main() int main()
{ {
test07(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test07);
return 0; return 0;
} }
...@@ -72,6 +72,6 @@ void test08() ...@@ -72,6 +72,6 @@ void test08()
int main() int main()
{ {
test08(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test08);
return 0; return 0;
} }
...@@ -769,7 +769,7 @@ main() ...@@ -769,7 +769,7 @@ main()
test05(); test05();
test06(); test06();
test07(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test07);
test08(); test08();
test09(); test09();
test10(); test10();
......
...@@ -168,6 +168,6 @@ int main() ...@@ -168,6 +168,6 @@ int main()
{ {
test01(); test01();
test02(); test02();
test03(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test03);
return 0; return 0;
} }
...@@ -253,7 +253,7 @@ test01() ...@@ -253,7 +253,7 @@ test01()
return 0; return 0;
} }
int void
test02() test02()
{ {
bool test = true; bool test = true;
...@@ -297,7 +297,7 @@ test02() ...@@ -297,7 +297,7 @@ test02()
os2 << endl; os2 << endl;
os2 << fixed << setprecision(1) << val2 << endl; os2 << fixed << setprecision(1) << val2 << endl;
return 0; return;
} }
template<typename T> template<typename T>
...@@ -395,7 +395,7 @@ int ...@@ -395,7 +395,7 @@ int
main() main()
{ {
test01(); test01();
test02(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test02);
test03(); test03();
test04(); test04();
test05(); test05();
......
...@@ -526,7 +526,7 @@ int main() ...@@ -526,7 +526,7 @@ int main()
test05(); test05();
test07(); test07();
test08(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test08);
test09(); test09();
test10(); test10();
......
...@@ -160,7 +160,7 @@ int main() ...@@ -160,7 +160,7 @@ int main()
test02(in2, false); test02(in2, false);
test02(in3, false); test02(in3, false);
test08(); __gnu_cxx_test::run_test_wrapped_generic_locale_exception_catcher(test08);
test09(); test09();
return 0; return 0;
} }
...@@ -148,9 +148,19 @@ namespace __gnu_cxx_test ...@@ -148,9 +148,19 @@ namespace __gnu_cxx_test
bool test = true; bool test = true;
// Set the global locale. // Set the global locale.
locale loc_name(name); try
locale orig = locale::global(loc_name); {
locale loc_name(name);
locale orig = locale::global(loc_name);
}
catch (std::runtime_error& ex)
{
if (std::strstr (ex.what(), "unhandled name in generic implementation"))
return;
else
throw;
}
const char* res = setlocale(LC_ALL, name); const char* res = setlocale(LC_ALL, name);
if (res != NULL) if (res != NULL)
{ {
...@@ -173,9 +183,18 @@ namespace __gnu_cxx_test ...@@ -173,9 +183,18 @@ namespace __gnu_cxx_test
#ifdef _GLIBCPP_HAVE_SETENV #ifdef _GLIBCPP_HAVE_SETENV
// Set the global locale. // Set the global locale.
locale loc_name(name); try
locale orig = locale::global(loc_name); {
locale loc_name(name);
locale orig = locale::global(loc_name);
}
catch (std::runtime_error& ex)
{
if (std::strstr (ex.what(), "unhandled name in generic implementation"))
return;
else
throw;
}
// Set environment variable env to value in name. // Set environment variable env to value in name.
const char* oldENV = getenv(env); const char* oldENV = getenv(env);
if (!setenv(env, name, 1)) if (!setenv(env, name, 1))
...@@ -191,6 +210,22 @@ namespace __gnu_cxx_test ...@@ -191,6 +210,22 @@ namespace __gnu_cxx_test
#endif #endif
} }
void
run_test_wrapped_generic_locale_exception_catcher(const test_func f)
{
try
{
f();
}
catch (std::runtime_error& ex)
{
if (std::strstr (ex.what(), "unhandled name in generic implementation"))
return;
else
throw;
}
}
counter::size_type counter::count = 0; counter::size_type counter::count = 0;
unsigned int copy_constructor::count_ = 0; unsigned int copy_constructor::count_ = 0;
unsigned int copy_constructor::throw_on_ = 0; unsigned int copy_constructor::throw_on_ = 0;
......
...@@ -105,6 +105,9 @@ namespace __gnu_cxx_test ...@@ -105,6 +105,9 @@ namespace __gnu_cxx_test
void void
run_tests_wrapped_env(const char*, const char*, const func_callback&); run_tests_wrapped_env(const char*, const char*, const func_callback&);
// Run select unit test inside exception catcher for non-C named locale
void
run_test_wrapped_generic_locale_exception_catcher(const test_func);
// Test data types. // Test data types.
struct pod_char struct pod_char
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment