summaryrefslogtreecommitdiff
path: root/repo/apps/chromium/musl-libc++.patch
blob: 4316a7bda82886c774f7089aeeeb93a47bc6d49c (plain)
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
--- ./buildtools/third_party/libc++/trunk/include/locale
+++ ./buildtools/third_party/libc++/trunk/include/locale
@@ -10,6 +10,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
 
--- ./buildtools/third_party/libc++/trunk/src/locale.cpp
+++ ./buildtools/third_party/libc++/trunk/src/locale.cpp
@@ -1019,11 +1019,11 @@
     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*
@@ -1127,12 +1127,10 @@
 #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