The previous method was very dependent on how the ctype masks were defined. For example, Android has print defined as (punct | upper | lower | digit | blank). When calling do_is(upper, L'a'), result would be set to true by if (upper & print) result |= iswprint_l(L'a', __l);
Details
Diff Detail
Event Timeline
src/locale.cpp | ||
---|---|---|
1208 | I don't think _LIBCPP_ASSERT() is actually what I want here (since it's usually compiled out). Do we already have something akin to this for _LIBCPP_DEBUG_LEVEL < 1? |
I don't think this is correct. IIRC, the value of 'm' coming in is a mask. To
fix this, all of the tests need to be of this form:
if ((m & space) == space) result |= (iswspace_l(ch, __l) != 0);
Newlib also has this problem... Sorry I didn't bring this up sooner.
Cheers,
Jon
Here's the patch I just mentioned: https://gist.github.com/jroelofs/8c6091f79ae2327f1ccb
Yes, you're right. I had thought this was just one of our implementation details, but it is exposed by ctype::is().
This is a behavior change. Today, if you pass in a mask that is not one listed, it returned false. With your change, it aborts.
That seems .. harsh.
Here's v2 of this patch: http://reviews.llvm.org/D5081
(This is a rebased version of: https://gist.github.com/jroelofs/8c6091f79ae2327f1ccb)
I don't think _LIBCPP_ASSERT() is actually what I want here (since it's usually compiled out). Do we already have something akin to this for _LIBCPP_DEBUG_LEVEL < 1?