]> git.armaanb.net Git - asd-repo.git/blob - extra/chromium/patches/musl-libc++.patch
Switch browser to Chromium
[asd-repo.git] / extra / chromium / patches / musl-libc++.patch
1 diff --git a/buildtools/third_party/libc++/trunk/include/locale b/buildtools/third_party/libc++/trunk/include/locale
2 index 9a705c7..3605a85 100644
3 --- a/buildtools/third_party/libc++/trunk/include/locale
4 +++ b/buildtools/third_party/libc++/trunk/include/locale
5 @@ -10,6 +10,15 @@
6  #ifndef _LIBCPP_LOCALE
7  #define _LIBCPP_LOCALE
8  
9 +// musl doesn't define _l (with locale) variants of functions, as it only supports UTF-8.
10 +// 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.
11 +// 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.
12 +// almost all glibc-likes define __GNU_LIBRARY__ for compatibility
13 +#ifndef __GNU_LIBRARY__
14 +#define strtoull_l(A, B, C, LOC) strtoull(A,B,C)
15 +#define strtoll_l(A, B, C, LOC) strtoll(A,B,C)
16 +#endif
17 +
18  /*
19      locale synopsis
20  
21 diff --git a/buildtools/third_party/libc++/trunk/src/locale.cpp b/buildtools/third_party/libc++/trunk/src/locale.cpp
22 index a0209d0..ca8044e 100644
23 --- a/buildtools/third_party/libc++/trunk/src/locale.cpp
24 +++ b/buildtools/third_party/libc++/trunk/src/locale.cpp
25 @@ -1043,11 +1043,11 @@ ctype<char>::do_narrow(const char_type* low, const char_type* high, char dfault,
26      return low;
27  }
28  
29 -#if defined(__EMSCRIPTEN__)
30 +//#if defined(__EMSCRIPTEN__)
31  extern "C" const unsigned short ** __ctype_b_loc();
32  extern "C" const int ** __ctype_tolower_loc();
33  extern "C" const int ** __ctype_toupper_loc();
34 -#endif
35 +//#endif
36  
37  #ifdef _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
38  const ctype<char>::mask*
39 @@ -1151,12 +1151,10 @@ ctype<char>::classic_table()  _NOEXCEPT
40  #elif defined(_AIX)
41      return (const unsigned int *)__lc_ctype_ptr->obj->mask;
42  #else
43 -    // Platform not supported: abort so the person doing the port knows what to
44 -    // fix
45 -# warning  ctype<char>::classic_table() is not implemented
46 -    printf("ctype<char>::classic_table() is not implemented\n");
47 -    abort();
48 -    return NULL;
49 +// not sure any other libc like this exists, but there is no way to differentiate musl as of right now
50 +// to be fair, with the change above, this should always work
51 +// also, #warning is a gcc extension
52 +    return (const unsigned long *)*__ctype_b_loc();
53  #endif
54  }
55  #endif