public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/6410: Trouble with non-Ascii monetary symbols and wchar_t
@ 2002-05-06  8:16 Paolo Carlini
  0 siblings, 0 replies; 5+ messages in thread
From: Paolo Carlini @ 2002-05-06  8:16 UTC (permalink / raw)
  To: bkoz; +Cc: gcc-prs

The following reply was made to PR libstdc++/6410; it has been noted by GNATS.

From: Paolo Carlini <pcarlini@unitus.it>
To: bkoz@gcc.gnu.org,  bkoz@gcc.gnu.org,  gcc-bugs@gcc.gnu.org, 
 gcc-prs@gcc.gnu.org,  nobody@gcc.gnu.org,  pcarlini@unitus.it, 
 gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: libstdc++/6410: Trouble with non-Ascii monetary symbols and wchar_t
Date: Mon, 06 May 2002 17:08:05 +0200

 bkoz@gcc.gnu.org wrote:
 
 >Synopsis: Trouble with non-Ascii monetary symbols and wchar_t
 >
 >Responsible-Changed-From-To: unassigned->bkoz
 >Responsible-Changed-By: bkoz
 >Responsible-Changed-When: Mon May  6 07:54:31 2002
 >Responsible-Changed-Why:
 >    Perhaps not really mine, but I'll pretend.
 >
 No, no... Definitely yours! ;-)
 
 >State-Changed-From-To: open->analyzed
 >State-Changed-By: bkoz
 >State-Changed-When: Mon May  6 07:54:31 2002
 >State-Changed-Why:
 >    According to Ulrich's comments here:
 >    http://gcc.gnu.org/ml/libstdc++/2002-04/msg00244.html
 >    
 >    One solution would be to setlocale to de_DE@euro, for instance, in your testcase.
 >    
 >    I tried that, and it didn't work really well. Here's the patch I'm currently using. I don't really like it, one because it breaks the current library API, and two because it's not MT-safe. I think something like this might be useful just to the testsuites can be cleaned up, and then a solution for glibc 2.3/uselocale can be used (which won't break the API for 3.1)
 >    
 >    Sound like a plan?
 >
 
 Excellent! If you could read in my mind you would find exactly that 
 reasoning!
 
 Please commit this, and I will finish cleaning up 
 22_locale/money_*_members.cc, as agreed, in the next few days.
 
 Thanks!
 Paolo.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6410
 
 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: libstdc++/6410: Trouble with non-Ascii monetary symbols and wchar_t
@ 2002-10-27  3:06 paolo
  0 siblings, 0 replies; 5+ messages in thread
From: paolo @ 2002-10-27  3:06 UTC (permalink / raw)
  To: bkoz, gcc-bugs, gcc-prs, pcarlini

Synopsis: Trouble with non-Ascii monetary symbols and wchar_t

State-Changed-From-To: suspended->closed
State-Changed-By: paolo
State-Changed-When: Sun Oct 27 03:06:50 2002
State-Changed-Why:
    Now fixed both 3_2-branch and mainline.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6410


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: libstdc++/6410: Trouble with non-Ascii monetary symbols and wchar_t
@ 2002-07-03  9:13 bkoz
  0 siblings, 0 replies; 5+ messages in thread
From: bkoz @ 2002-07-03  9:13 UTC (permalink / raw)
  To: bkoz, gcc-bugs, gcc-prs, pcarlini

Synopsis: Trouble with non-Ascii monetary symbols and wchar_t

State-Changed-From-To: analyzed->suspended
State-Changed-By: bkoz
State-Changed-When: Wed Jul  3 09:13:48 2002
State-Changed-Why:
    This patch now in 3.2. Pathes to fixe this in 3.1 need glibc 2.3: when this is released this bug report should be re visited.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6410


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: libstdc++/6410: Trouble with non-Ascii monetary symbols and wchar_t
@ 2002-05-13  5:56 Paolo Carlini
  0 siblings, 0 replies; 5+ messages in thread
From: Paolo Carlini @ 2002-05-13  5:56 UTC (permalink / raw)
  To: bkoz; +Cc: gcc-prs

The following reply was made to PR libstdc++/6410; it has been noted by GNATS.

From: Paolo Carlini <pcarlini@unitus.it>
To: bkoz@gcc.gnu.org,  gcc-gnats@gcc.gnu.org,  gcc-prs@gcc.gnu.org, 
 pcarlini@unitus.it
Cc:  
Subject: Re: libstdc++/6410: Trouble with non-Ascii monetary symbols and wchar_t
Date: Mon, 13 May 2002 14:50:09 +0200

 2002-05-13 Update: the testcase turns out to be malformed:
 
     http://sources.redhat.com/ml/libc-alpha/2002-05/msg00076.html
 
 The problem is real, however, and fixed (at the cost of breaking the 
 API) by the patch above.
 
 Paolo.
 
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6410 
 
 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: libstdc++/6410: Trouble with non-Ascii monetary symbols and wchar_t
@ 2002-05-06  7:54 bkoz
  0 siblings, 0 replies; 5+ messages in thread
From: bkoz @ 2002-05-06  7:54 UTC (permalink / raw)
  To: bkoz, gcc-bugs, gcc-prs, nobody, pcarlini

Synopsis: Trouble with non-Ascii monetary symbols and wchar_t

Responsible-Changed-From-To: unassigned->bkoz
Responsible-Changed-By: bkoz
Responsible-Changed-When: Mon May  6 07:54:31 2002
Responsible-Changed-Why:
    Perhaps not really mine, but I'll pretend.
State-Changed-From-To: open->analyzed
State-Changed-By: bkoz
State-Changed-When: Mon May  6 07:54:31 2002
State-Changed-Why:
    According to Ulrich's comments here:
    http://gcc.gnu.org/ml/libstdc++/2002-04/msg00244.html
    
    One solution would be to setlocale to de_DE@euro, for instance, in your testcase.
    
    I tried that, and it didn't work really well. Here's the patch I'm currently using. I don't really like it, one because it breaks the current library API, and two because it's not MT-safe. I think something like this might be useful just to the testsuites can be cleaned up, and then a solution for glibc 2.3/uselocale can be used (which won't break the API for 3.1)
    
    Sound like a plan?
    
    Here's the patch:
    
    2002-05-06  Benjamin Kosnik  <bkoz@redhat.com>
    
    	PR libstdc++/6410
    	* include/bits/locale_facets.h (moneypunct::moneypunct): Add const
    	char* name parameter.
    	* config/locale/gnu/monetary_members.cc: Use it.
    	* src/localename.cc (_Impl::_Impl(const char*, size_t)): Use it.
    
    Index: include/bits/locale_facets.h
    ===================================================================
    RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/locale_facets.h,v
    retrieving revision 1.43
    diff -c -p -r1.43 locale_facets.h
    *** include/bits/locale_facets.h	16 Apr 2002 00:45:25 -0000	1.43
    --- include/bits/locale_facets.h	6 May 2002 14:49:05 -0000
    *************** namespace std
    *** 1357,1364 ****
            { _M_initialize_moneypunct(); }
      
            explicit 
    !       moneypunct(__c_locale __cloc, size_t __refs = 0) : locale::facet(__refs)
    !       { _M_initialize_moneypunct(__cloc); }
      
            char_type
            decimal_point() const
    --- 1357,1365 ----
            { _M_initialize_moneypunct(); }
      
            explicit 
    !       moneypunct(__c_locale __cloc, const char* __name, size_t __refs = 0) 
    !       : locale::facet(__refs)
    !       { _M_initialize_moneypunct(__cloc, __name); }
      
            char_type
            decimal_point() const
    *************** namespace std
    *** 1438,1444 ****
      
            // For use at construction time only.
             void 
    !        _M_initialize_moneypunct(__c_locale __cloc = _S_c_locale);
          };
      
        template<typename _CharT, bool _Intl>
    --- 1439,1446 ----
      
            // For use at construction time only.
             void 
    !        _M_initialize_moneypunct(__c_locale __cloc = _S_c_locale, 
    ! 				const char* __name = NULL);
          };
      
        template<typename _CharT, bool _Intl>
    *************** namespace std
    *** 1455,1465 ****
      
        template<> 
          void
    !     moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc);
      
        template<> 
          void
    !     moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc);
      
      #ifdef _GLIBCPP_USE_WCHAR_T
        template<>
    --- 1457,1467 ----
      
        template<> 
          void
    !     moneypunct<char, true>::_M_initialize_moneypunct(__c_locale, const char*);
      
        template<> 
          void
    !     moneypunct<char, false>::_M_initialize_moneypunct(__c_locale, const char*);
      
      #ifdef _GLIBCPP_USE_WCHAR_T
        template<>
    *************** namespace std
    *** 1470,1480 ****
      
        template<> 
          void
    !     moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc);
      
        template<> 
          void
    !     moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc);
      #endif
      
        template<typename _CharT, bool _Intl>
    --- 1472,1484 ----
      
        template<> 
          void
    !     moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale, 
    ! 							const char*);
      
        template<> 
          void
    !     moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale, 
    ! 							 const char*);
      #endif
      
        template<typename _CharT, bool _Intl>
    Index: config/locale/gnu/monetary_members.cc
    ===================================================================
    RCS file: /cvs/gcc/gcc/libstdc++-v3/config/locale/gnu/monetary_members.cc,v
    retrieving revision 1.2
    diff -c -p -r1.2 monetary_members.cc
    *** config/locale/gnu/monetary_members.cc	16 Apr 2002 00:45:18 -0000	1.2
    --- config/locale/gnu/monetary_members.cc	6 May 2002 14:49:06 -0000
    *************** namespace std
    *** 216,222 ****
      
        template<> 
          void
    !     moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc)
          {
            if (__cloc == _S_c_locale)
      	{
    --- 216,223 ----
      
        template<> 
          void
    !     moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc, 
    ! 						     const char*)
          {
            if (__cloc == _S_c_locale)
      	{
    *************** namespace std
    *** 260,266 ****
      
        template<> 
          void
    !     moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc)
          {
            if (__cloc == _S_c_locale)
      	{
    --- 261,268 ----
      
        template<> 
          void
    !     moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc, 
    ! 						      const char*)
          {
            if (__cloc == _S_c_locale)
      	{
    *************** namespace std
    *** 313,319 ****
      #ifdef _GLIBCPP_USE_WCHAR_T
        template<> 
          void
    !     moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc)
          {
            if (__cloc == _S_c_locale)
      	{
    --- 315,322 ----
      #ifdef _GLIBCPP_USE_WCHAR_T
        template<> 
          void
    !     moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc, 
    ! 							const char* __name)
          {
            if (__cloc == _S_c_locale)
      	{
    *************** namespace std
    *** 331,336 ****
    --- 334,343 ----
            else
      	{
      	  // Named locale.
    + 	  // XXX Fix me. Switch to named locale so that mbsrtowcs will work.
    + 	  char* __old = strdup(setlocale(LC_ALL, NULL));
    + 	  setlocale(LC_ALL, __name);
    + 
      	  _M_decimal_point = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc)}).__w);
      
      	  _M_thousands_sep = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w);
    *************** namespace std
    *** 391,402 ****
      	  char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
      	  char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
      	  _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn);
      	}
          }
      
        template<> 
          void
    !     moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc)
          {
            if (__cloc == _S_c_locale)
      	{
    --- 398,414 ----
      	  char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
      	  char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
      	  _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn);
    + 
    + 	  // XXX
    + 	  setlocale(LC_ALL, __old);
    + 	  free(__old);
      	}
          }
      
        template<> 
          void
    !     moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc, 
    ! 							 const char* __name)
          {
            if (__cloc == _S_c_locale)
      	{
    *************** namespace std
    *** 414,419 ****
    --- 426,435 ----
            else
      	{
      	  // Named locale.
    + 	  // XXX Fix me. Switch to named locale so that mbsrtowcs will work.
    + 	  char* __old = strdup(setlocale(LC_ALL, NULL));
    + 	  setlocale(LC_ALL, __name);
    + 
      	  _M_decimal_point = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc)}).__w);
      	  _M_thousands_sep = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w);
      	  _M_grouping = __nl_langinfo_l(GROUPING, __cloc);
    *************** namespace std
    *** 473,478 ****
    --- 489,498 ----
      	  char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
      	  char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
      	  _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn);
    + 
    + 	  // XXX
    + 	  setlocale(LC_ALL, __old);
    + 	  free(__old);
      	}
          }
      
    Index: src/localename.cc
    ===================================================================
    RCS file: /cvs/gcc/gcc/libstdc++-v3/src/localename.cc,v
    retrieving revision 1.26
    diff -c -p -r1.26 localename.cc
    *** src/localename.cc	16 Apr 2002 00:45:32 -0000	1.26
    --- src/localename.cc	6 May 2002 14:49:06 -0000
    *************** namespace std
    *** 132,139 ****
          _M_init_facet(new num_get<char>);
          _M_init_facet(new num_put<char>);
          _M_init_facet(new std::collate<char>(__cloc));
    !     _M_init_facet(new moneypunct<char, false>(__cloc));
    !     _M_init_facet(new moneypunct<char, true>(__cloc));
          _M_init_facet(new money_get<char>);
          _M_init_facet(new money_put<char>);
          _M_init_facet(new __timepunct<char>(__cloc, __s));
    --- 132,139 ----
          _M_init_facet(new num_get<char>);
          _M_init_facet(new num_put<char>);
          _M_init_facet(new std::collate<char>(__cloc));
    !     _M_init_facet(new moneypunct<char, false>(__cloc, __s));
    !     _M_init_facet(new moneypunct<char, true>(__cloc, __s));
          _M_init_facet(new money_get<char>);
          _M_init_facet(new money_put<char>);
          _M_init_facet(new __timepunct<char>(__cloc, __s));
    *************** namespace std
    *** 148,155 ****
          _M_init_facet(new num_get<wchar_t>);
          _M_init_facet(new num_put<wchar_t>);
          _M_init_facet(new std::collate<wchar_t>(__cloc));
    !     _M_init_facet(new moneypunct<wchar_t, false>(__cloc));
    !     _M_init_facet(new moneypunct<wchar_t, true>(__cloc));
          _M_init_facet(new money_get<wchar_t>);
          _M_init_facet(new money_put<wchar_t>);
          _M_init_facet(new __timepunct<wchar_t>(__cloc, __s));
    --- 148,155 ----
          _M_init_facet(new num_get<wchar_t>);
          _M_init_facet(new num_put<wchar_t>);
          _M_init_facet(new std::collate<wchar_t>(__cloc));
    !     _M_init_facet(new moneypunct<wchar_t, false>(__cloc, __s));
    !     _M_init_facet(new moneypunct<wchar_t, true>(__cloc, __s));
          _M_init_facet(new money_get<wchar_t>);
          _M_init_facet(new money_put<wchar_t>);
          _M_init_facet(new __timepunct<wchar_t>(__cloc, __s));

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6410


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-10-27 11:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-06  8:16 libstdc++/6410: Trouble with non-Ascii monetary symbols and wchar_t Paolo Carlini
  -- strict thread matches above, loose matches on Subject: below --
2002-10-27  3:06 paolo
2002-07-03  9:13 bkoz
2002-05-13  5:56 Paolo Carlini
2002-05-06  7:54 bkoz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).