[cfe-dev] [libcxx]handling missing linux implementations
Howard Hinnant
hhinnant at apple.com
Tue Feb 15 10:03:00 PST 2011
On Feb 14, 2011, at 11:26 PM, Larry Evans wrote:
> Mybe a proper implementation could be done using the 'uselocale'
> described on p. 131 of:
>
> http://people.redhat.com/drepper/tllocale.ps.gz
>
> (Thanks to Marc Glisse for suggesting uselocale here:
>
> http://llvm.org/bugs/show_bug.cgi?id=8992#c11
>
> )
>
>
> Uselocale could be used something like in the following code:
>
> #ifdef __linux__
> namespace std
> {
> size_t
> wcrtomb_l
> ( char* et
> , wchar_t it
> , mbstate_t* ps
> , locale_t locale_new
> )
> {
> locale_t locale_old uselocale(locale_new);
> wcrtomb(et,it,st);
> uselocale(locale_old);
> }
> }
> #endif
>
> The above could be inserted just after the #include's in:
>
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/locale.cpp?annotate=121510
>
> Some similar could be done for other "missing _l suffixed functions".
>
> Anyone have any alternatives to this solution to the missing _l
> suffixed functions on linus (or really, in glibc)?
I think this is a really promising direction. What we need to know now is: How available is uselocale on the platforms that this audience wants to port libc++ to? Does just Ubuntu have it? Other linux platforms? Windows?
The next question, assuming (at least Ubuntu-interested) people are happy with this approach, is where to implement missing functionality such as wcrtomb_l? It could go in the <locale> header as an inlined function. It could go in libc++'s locale.cpp source. Or it could go in the C library (for example) on the Ubuntu platform (thus being available to clients other than libc++).
Personally I'm only looking after the Darwin (Apple) implementation which already has wcrtomb_l et. al. and doesn't need this work. But I am very interested in getting this discussion started among those seeking to port libc++ to platforms other than Apple.
-Howard
More information about the cfe-dev
mailing list