PR 13631 Problems in messages

François Dumont frs.dumont@gmail.com
Thu Nov 27 22:19:00 GMT 2014


Hi

     Here is a revisited version. I finally go without compiling in 
C++11 as I prefer to use __builtin_alloca instead of using 
std::unique_ptr and heap memory. I also realized that I could use 
codecvt::max_length to know the max number of multibytes.

     Tested under Linux x86_64 with all locales installed. There are 
some failures but not coming from this patch, will surely be the subject 
of another mail.

2014-11-28  François Dumont  <fdumont@gcc.gnu.org>

     DR libstdc++/13631
     * include/bits/codecvt.h (__get_c_locale): New.
     * config/locale/gnu/messages_member.h, messages_member.cc: Prefer
     dgettext usage to gettext to allow usage of several catalogs at the
     same time. Add an internal cache to make catalog names to catalog ids.
     Add charset management.
     * testsuite/22_locale/messages/13631.cc: New.
     * testsuite/22_locale/messages/members/char/2.cc: Use also fr_FR locale
     for charset conversion to get the expected accentuated character.

Do we need any abi tag ? Do we need to wait ?

François


On 24/11/2014 01:23, Jonathan Wakely wrote:
> On 24/11/14 00:13 +0100, François Dumont wrote:
>> Hello
>>
>>    As we are at doing some evolution in the ABI I would like to take 
>> the opportunity to merge branch libstdcxx_so_7-2. The first fix was 
>
> I don't think we want to merge everything, but it's certainly worth
> looking to see if there are some fixes on that branch worth taking.
>
> It would have been better to do during stage 1 though :-\
>
>> about a messages facet issue. So here is the version for the trunk 
>> which is the one from the branch plus management of the charset part. 
>> This way messages<wchar_t> works too.
>>
>>    There are still some uncovered points in this patch:
>> - I had to make codecvt _M_c_locale_codecvt public to access it from 
>> the messages facet code. How do you want to handle it properly ? A 
>> friend function to access it or do I make messages facet friend ?
>> - I haven't use the ABI tag yet. I know that there is a plan to tag 
>> locale facets, will it work for what I am doing ?
>
> Unless I'm missing something you're not making any ABI changes to
> std::messages, just making the definitiosn of some functions no longer
> inline.
>
>>    Note that I could use std::tuple instead of combination of 
>> std::pair and std::unique_ptr instead of wchar_buffer if we were 
>> building it in C++11 mode. Is it possible ?
>
> Yes, the symlink to the messages_members.cc file would need to be
> moved from src/c++98/Makefile.am to src/c++11/Makefile.am
>
>> Index: include/bits/locale_facets_nonio.h
>> ===================================================================
>> --- include/bits/locale_facets_nonio.h    (revision 217816)
>> +++ include/bits/locale_facets_nonio.h    (working copy)
>> @@ -1842,22 +1842,6 @@
>>       */
>>       virtual void
>>       do_close(catalog) const;
>> -
>> -      // Returns a locale and codeset-converted string, given a 
>> char* message.
>> -      char*
>> -      _M_convert_to_char(const string_type& __msg) const
>> -      {
>> -    // XXX
>> -    return reinterpret_cast<char*>(const_cast<_CharT*>(__msg.c_str()));
>> -      }
>> -
>> -      // Returns a locale and codeset-converted string, given a 
>> char* message.
>> -      string_type
>> -      _M_convert_from_char(char*) const
>> -      {
>> -    // XXX
>> -    return string_type();
>> -      }
>>      };
>
> Those members are used by the ieee_1003.1-2001 locale.
>
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: messages.patch
Type: text/x-patch
Size: 15446 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20141127/77da1ab5/attachment.bin>


More information about the Libstdc++ mailing list