This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Reorganize locale extension fallbacks. NFCI
ClosedPublic

Authored by bcraig on Feb 18 2016, 2:32 PM.

Details

Summary

This is one part of many of a locale refactor. See http://reviews.llvm.org/D17146 for an idea of where this is going.

The various _l locale extension functions originate from very different places. Some come from POSIX, some are BSD extensions, and some are shared BSD and GLIBC extensions. This patch tries to group the local extension reimplementations by source. This should make it easier to make libcxx work with POSIX compliant C libraries that lack these extensions.

The fallback locale functions are also useful on their own for other lightweight platforms. Putting these fallback implementations in support/xlocale should enable code sharing.

I have no access to a newlib system or an android system to build and test with. I _do_ have access to a system without any of the _l locale extensions though, and I was able to ensure that the new posix_l_fallback.h and strtonum_fallback.h didn't have any massive problems.

Diff Detail

Event Timeline

bcraig updated this revision to Diff 48403.Feb 18 2016, 2:32 PM
bcraig retitled this revision from to [libcxx] Reorganize locale extension fallbacks.
bcraig updated this object.
bcraig added reviewers: jroelofs, danalbert, mclow.lists.
bcraig added a subscriber: cfe-commits.
bcraig retitled this revision from [libcxx] Reorganize locale extension fallbacks to [libcxx] Reorganize locale extension fallbacks. NFCI.Feb 18 2016, 2:32 PM
mclow.lists edited edge metadata.Feb 22 2016, 7:49 AM

This looks fine to me; but I want to hear from @danalbert.

A couple of packaging comments. In general, this looks fine to me - still waiting on someone from Android to chime in. -- I'll ping Dan.

include/support/xlocale/__posix_l_fallback.h
13

extra comma

23

Instead of static inline, how about you mark these as _LIBCPP_ALWAYS_INLINE?

Also, do you want to write them as return ::isalnum(c);
(I don't know the answer here, but they're definitely not in namespace std)

include/support/xlocale/__strtonum_fallback.h
22

Again with the inline and :: bits.

danalbert accepted this revision.May 16 2016, 10:14 AM
danalbert edited edge metadata.

LGTM. Sorry for the delay in response.

This revision is now accepted and ready to land.May 16 2016, 10:14 AM
bcraig updated this revision to Diff 57520.May 17 2016, 2:30 PM
bcraig updated this revision to Diff 57521.
bcraig edited edge metadata.
bcraig marked 2 inline comments as done.

I'll be submitting this Friday morning, barring any objections (I'm out of the office the next couple of days).

bcraig closed this revision.May 20 2016, 6:06 AM

r270213

include/support/xlocale/__strtonum_fallback.h