[cfe-dev] [libcxx]handling missing linux implementations

Larry Evans cppljevans at suddenlink.net
Mon Feb 14 20:26:28 PST 2011


On 02/14/11 14:12, Matthieu Monrocq wrote:
> Hi Larry,
>
> Perhaps that a `#warning` along the return NULL would be sufficient?

Yes.  That's better than '#pragma message ...'

>
> It seems to me that the user should definitely take care not to use
> (even if the result is "coherent") until it's properly implemented.
>
> Matthieu.
>
[snip]
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)?

-regards,
Larry





More information about the cfe-dev mailing list