[libcxx] r213785 - Fix ctype_base::xdigit for Android.

Nico Weber thakis at chromium.org
Wed Jul 23 17:02:40 PDT 2014


On Wed, Jul 23, 2014 at 12:51 PM, Dan Albert <danalbert at google.com> wrote:

> Without this patch only a-f get matched as hex digits, and 0-9 do not. IMO
> this is a deficiency in the C library, but for backward compatibility
> reasons we can't change our ctype implementation.
>

Is this function used heavily? Since it seems to be broken, apps probably
can't rely on it – and the ones that do probably don't know that the
function is broken and would work better if this changed. Do you have data
on how many apps call this function?


>
> One other idea I had toyed with was just adding a less broken ctable
> implementation (probably netbsd's) to bionic for use with libc++ (and
> perhaps the LP64 ABIs?) while still leaving the openbsd one around for
> compatibility, but I don't think having two ctype implementations in bionic
> is a very good solution either.
>
> - Dan
>
>
> On Wed, Jul 23, 2014 at 12:45 PM, Nico Weber <thakis at chromium.org> wrote:
>
>> On Wed, Jul 23, 2014 at 12:32 PM, Dan Albert <danalbert at google.com>
>> wrote:
>>
>>> Author: danalbert
>>> Date: Wed Jul 23 14:32:03 2014
>>> New Revision: 213785
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=213785&view=rev
>>> Log:
>>> Fix ctype_base::xdigit for Android.
>>>
>>> Android's ctype implementation comes from openbsd, which for some reason
>>> doesn't consider numbers to be hex digits.
>>>
>>
>> That seems broken. What happens without this patch? libc++ and C library
>> don't agree on what hex digits are?
>>
>>
>>>
>>> Modified:
>>>     libcxx/trunk/include/__locale
>>>
>>> Modified: libcxx/trunk/include/__locale
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__locale?rev=213785&r1=213784&r2=213785&view=diff
>>>
>>> ==============================================================================
>>> --- libcxx/trunk/include/__locale (original)
>>> +++ libcxx/trunk/include/__locale Wed Jul 23 14:32:03 2014
>>> @@ -366,7 +366,12 @@ public:
>>>      static const mask alpha  = _CTYPE_A;
>>>      static const mask digit  = _CTYPE_D;
>>>      static const mask punct  = _CTYPE_P;
>>> +# if defined(__ANDROID__)
>>> +    static const mask xdigit = _CTYPE_X | _CTYPE_D;
>>> +# else
>>>      static const mask xdigit = _CTYPE_X;
>>> +# endif
>>> +
>>>  # if defined(__NetBSD__)
>>>      static const mask blank  = _CTYPE_BL;
>>>  # else
>>>
>>>
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140723/7bee541a/attachment.html>


More information about the cfe-commits mailing list