1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
diff --git a/buildtools/third_party/libc++/trunk/include/locale b/buildtools/third_party/libc++/trunk/include/locale
index d29a2dc..53998bc 100644
--- buildtools/third_party/libc++/trunk/include/locale
+++ buildtools/third_party/libc++/trunk/include/locale
@@ -11,6 +11,15 @@
#ifndef _LIBCPP_LOCALE
#define _LIBCPP_LOCALE
+// musl doesn't define _l (with locale) variants of functions, as it only supports UTF-8.
+// we can simply make macros that will call the non-localated ones if we're using musl, or rather not-using something that has the _l ones.
+// couldn't find anything glibc #defines when it creates strtoull_l (that it doesn't undefine a few lines later), so let's test against glibc and glibc-likes.
+// almost all glibc-likes define __GNU_LIBRARY__ for compatibility
+#ifndef __GNU_LIBRARY__
+#define strtoull_l(A, B, C, LOC) strtoull(A,B,C)
+#define strtoll_l(A, B, C, LOC) strtoll(A,B,C)
+#endif
+
/*
locale synopsis
diff --git a/buildtools/third_party/libc++/trunk/src/locale.cpp b/buildtools/third_party/libc++/trunk/src/locale.cpp
index 4163c2c..3d1902a 100644
--- a/buildtools/third_party/libc++/trunk/src/locale.cpp
+++ buildtools/third_party/libc++/trunk/src/locale.cpp
@@ -1028,11 +1028,11 @@ ctype<char>::do_narrow(const char_type* low, const char_type* high, char dfault,
return low;
}
-#if defined(__EMSCRIPTEN__)
+//#if defined(__EMSCRIPTEN__)
extern "C" const unsigned short ** __ctype_b_loc();
extern "C" const int ** __ctype_tolower_loc();
extern "C" const int ** __ctype_toupper_loc();
-#endif
+//#endif
#ifdef _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
const ctype<char>::mask*
@@ -1136,12 +1136,10 @@ ctype<char>::classic_table() _NOEXCEPT
#elif defined(_AIX)
return (const unsigned int *)__lc_ctype_ptr->obj->mask;
#else
- // Platform not supported: abort so the person doing the port knows what to
- // fix
-# warning ctype<char>::classic_table() is not implemented
- printf("ctype<char>::classic_table() is not implemented\n");
- abort();
- return NULL;
+// not sure any other libc like this exists, but there is no way to differentiate musl as of right now
+// to be fair, with the change above, this should always work
+// also, #warning is a gcc extension
+ return (const unsigned long *)*__ctype_b_loc();
#endif
}
#endif
|