stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: [PATCH] 22.locale.ctype.is.cpp
Date Mon, 19 Nov 2007 05:39:32 GMT

Seems reasonable. We should also guard the calls to the the wchar_t
specializations of the function with _RWSTD_NO_WCHAR_T.

Martin


Farid Zaripov-2 wrote:
> 
>   The 22.locale.ctype.is.cpp test contains two functions: test_libc<>()
> and test_libstd<>().
> 
>   If I understand correctly, the test_libc<>() designed to check the
> system locales (it
> iterates the all locales, returned by rw_locales()), and test_libstd<>()
> designed to
> check the "test-locale" locale (created by rw_create_locale()).
> 
>   First invoked test_libstd<char>(). From there invoked
> rw_create_locale() function,
> which set RWSTD_LOCALE_ROOT environment variable to the temporary
> directory
> with "test-locale" locale.
> 
>   Then invoked test_libc<char>(). It invokes rw_locales(), which uses
> "locale -a" command.
> But locale utility, if RWSTD_LOCALE_ROOT environment variable is
> defined, returns
> list of the library locales. In this case it returns "C" and
> "test-locale". Also rw_locales()
> checks the locale names by invoking std::setlocale(). Of course
> std::setlocale(LC_ALL, "test-locale")
> fails and as a result the rw_locales returns "C\0\0" string.
> 
>   The patch below resolves this situation by invoking first both
> test_libc<char> and test_libc<wchar_t>
> and then test_libstd<char> and test_libstd<wchar_t>.
> 
> 
>   ChangeLog:
>   * 22.locale.ctype.is.cpp (run_test<>): The compile time
>   checks moved to test_libstd(); The function run_test<>()
>   removed; The test_libstd() and test_libc() funtions are
>   invoked from non-template run_test() to invoke them in
>   the following order: test_libc<char>(), test_libc<wchar_t>(),
>   test_libstd<char>(), test_libstd<wchar_t>().
> 
> 
> Index: 22.locale.ctype.is.cpp
> ===================================================================
> --- 22.locale.ctype.is.cpp	(revision 594578)
> +++ 22.locale.ctype.is.cpp	(working copy)
> @@ -840,6 +840,12 @@
>  template <class charT>
>  void test_libstd (charT, const char *cname)
>  {
> +    if (0) {
> +        // do a compile time only test on use_facet and has_facet
> +        _STD_HAS_FACET (std::ctype_byname<charT>, std::locale ());
> +        _STD_USE_FACET (std::ctype_byname<charT>, std::locale ());
> +    }
> +
>      const char cmap_1[] = {
>          "<code_set_name> \"ANSI_X3.4-1968\"\n"
>          "<mb_cur_max> 1\n"
> @@ -1025,27 +1031,15 @@
>  
>  
> /***********************************************************************
> ***/
>  
> -template <class charT>
> -void run_test (charT, const char *cname)
> -{
> -    if (0) {
> -        // do a compile time only test on use_facet and has_facet
> -        _STD_HAS_FACET (std::ctype_byname<charT>, std::locale ());
> -        _STD_USE_FACET (std::ctype_byname<charT>, std::locale ());
> -    }
> -
> -    test_libstd (charT (), cname);
> -    test_libc (charT (), cname);
> -}
> -
> -/**********************************************************************
> ****/
> -
>  static int
>  run_test (int, char**)
>  {
> -    run_test (char (), "char");
> -    run_test (wchar_t (), "wchar_t");
> +    test_libc (char (), "char");
> +    test_libc (wchar_t (), "wchar_t");
>  
> +    test_libstd (char (), "char");
> +    test_libstd (wchar_t (), "wchar_t");
> +
>      return 0;
>  }
>  
>   
> 
> Farid.
> 
> 

-- 
View this message in context: http://www.nabble.com/-PATCH--22.locale.ctype.is.cpp-tf4807057.html#a13828139
Sent from the stdcxx-dev mailing list archive at Nabble.com.


Mime
View raw message