[PATCH] [libc++] Support newlib as libc++'s C library [locale part]

Marshall Clow mclow.lists at gmail.com
Wed Sep 17 12:06:20 PDT 2014


================
Comment at: include/support/newlib/xlocale.h:36
@@ +35,3 @@
+static inline locale_t duplocale(locale_t) {
+  return nullptr;
+}
----------------
danalbert wrote:
> jroelofs wrote:
> > jroelofs wrote:
> > > danalbert wrote:
> > > > Can't use nullptr here (need to be able to include from pre-C++11 code).
> > > Good point. I'll change that to NULL for the time being.
> > > 
> > > In a separate patch I've got some "healthier" stubs which fix a few of the libc++ tests that want the C locale (i.e. localization/locales/locale/locale.statics/classic.pass.cpp ).
> > The failure being the:
> > 
> > ```
> > 
> > terminating with uncaught exception of type std::runtime_error: collate_byname<char>::collate_byname failed to construct for C
> > ```
> > 
> > one.
> Good idea. iirc even the basic streams don't work if the implementation can't support the C locale.
Note that libc++ emulates nullptr in C++03 mode.

================
Comment at: include/support/newlib/xlocale.h:66
@@ +65,3 @@
+   (void) l;
+   return isdigit(c);
+}
----------------
Should all of these explicitly specify the global namespace?

    return ::isdigit(c);

That's not good if isdigit is a macro, but I don't know if that is true for newlib.

http://reviews.llvm.org/D5385






More information about the cfe-commits mailing list