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

JF Bastien jfb at chromium.org
Wed Sep 17 11:20:13 PDT 2014


================
Comment at: include/locale:197
@@ +196,3 @@
+#define __has_include(x) 0
+#endif
+#if __has_include(<newlib.h>)
----------------
This is only done in `.cpp` files, putting it here means it leaks to users.

================
Comment at: include/support/newlib/xlocale.h:27
@@ +26,3 @@
+// TODO(jroelofs): so newlib has this, but it's guarded out in c++. Would it be
+// better to put the declaration for that here?
+static inline int isascii(int c) {
----------------
It's only guarded out if `__STRICT_ANSI__`, which seems correct? It's a C extension AFAICT, it's not in C11.

`isascii.c` defines it as return `return c >= 0 && c< 128;` unconditionally, so it should still be linked in?

================
Comment at: include/support/newlib/xlocale.h:64
@@ +63,3 @@
+
+static inline int isdigit_l(char c, locale_t l) {
+   (void) l;
----------------
mclow.lists wrote:
> Comment lost the first time. Sigh.
> 
> this should be written as:
>      `static inline int isdigit_l(char c, locale_t)`
> 
> You can't use the second parameter if you don't name it.
> 
Cleaner to just not give a name to `locale_t l` here and below instead of `(void) l;`?

http://reviews.llvm.org/D5385






More information about the cfe-commits mailing list