This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, RFC] Codecvt and _M_c_locale_codecvt


> as noticed by Jakub a few days ago, a wcsrtombs and a mbsrtowcs call
> in src/codecvt.cc are still not wrapped in __uselocale.
> 
> In order to fix this, it seems to me that a _M_c_locale_codecvt member
> must be added to the codecvt specializations.
> 
> Is this unavoidable? Then, most probably the patch may qualify only for 3.3.

If all you need is the "C" locale, you could just use _S_c_locale.
In your current patch, for instance, only the "C" locale is used. Is
this intentional? 

If you need to use more than the "C" locale, then the member
_M_c_locale_codecvt will be necessary. Also, ctor for codecvt that
accepts this argument. Also, tweaks to src/localename.cc initialization
so that the _Impl ctor for named locales passes it down.

As you probably noticed, your patch, even though it adds a data member,
supposedly doesn't change the library ABI. This seems to be because
codecvt isn't instantiated, only specialized. Because of this, and the
fact that there are no embedded cvt facets, only references, and the
includes are versioned, I'd think this would be ok.

> I'm also unsure if the _M_c_locale_codecvt member is really necessary also
> for the codecvt<_InternT, _ExternT, __enc_traits> specialization: it seems
> so, however, due to the structure of codecvt_byname.

This kind of member data is in other generic locale facets, so it would
probably be good to add them as well to the generic codecvt.

-benjamin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]