This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: [v3] libstdc++/7811


Jakub Jelinek wrote:

For #ifndef _GLIBCPP_C_LOCALE_GNU you should do:
old = strdup(setlocale(LC_ALL, NULL));
ret = strdup(setlocale(LC_ALL, ""));
setlocale(LC_ALL, old);
free(old);
or some such, for _GLIBCPP_C_LOCALE_GNU maybe "" should be passed directly
to _Impl constructor...

... as Roland McGrath explained to me privately setlocale(LC_ALL, "") *cannot* be used in a MT environment.

That's true, but without uselocale you basically have no other option.
Even when you have some _l routines, lots of others are still missing.

I see, but I don't think we can afford the risk of crashes in a MT environment only for this kind of QoI issue in the inizialization from the environment.
On the other hand...

So IMHO at least with glibc 2.3+ we should DTRT (provided that we allow
libstdc++-v3 to use __names[] members of struct __locale_struct), which
is pass "" as locale name down to _Impl down to _S_create_locale in that
case and if we really need accurate _M_names, set them
from __cloc->__names[x].

... this is an interesting, indeed, but much more complex and invasive proposal. If you can work out a patch I think Benjamin would be happy to review it! ;-)

Benjamin, what do you believe?

Paolo.


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