Skip to content

Instantly share code, notes, and snippets.

@vvavrychuk
Created July 5, 2014 10:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vvavrychuk/150f2571c0a29b231408 to your computer and use it in GitHub Desktop.
Save vvavrychuk/150f2571c0a29b231408 to your computer and use it in GitHub Desktop.
libcxx-3.4.2-musl_compat.patch
diff --git a/include/__config b/include/__config
index aa8bc44..d04464e 100644
--- a/include/__config
+++ b/include/__config
@@ -314,14 +314,10 @@ typedef __char32_t char32_t;
#define _LIBCPP_HAS_C11_FEATURES
#elif defined(__linux__)
#include <features.h>
-#if __GLIBC_PREREQ(2, 15)
#define _LIBCPP_HAS_QUICK_EXIT
-#endif
-#if __GLIBC_PREREQ(2, 17)
#define _LIBCPP_HAS_C11_FEATURES
#endif
#endif
-#endif
#if (__has_feature(cxx_noexcept))
# define _NOEXCEPT noexcept
diff --git a/include/locale b/include/locale
index ac3ae7e..93019e2 100644
--- a/include/locale
+++ b/include/locale
@@ -864,7 +864,7 @@ __num_get_signed_integral(const char* __a, const char* __a_end,
typename remove_reference<decltype(errno)>::type __save_errno = errno;
errno = 0;
char *__p2;
- long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
+ long long __ll = strtoll(__a, &__p2, __base);
typename remove_reference<decltype(errno)>::type __current_errno = errno;
if (__current_errno == 0)
errno = __save_errno;
@@ -904,7 +904,7 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
typename remove_reference<decltype(errno)>::type __save_errno = errno;
errno = 0;
char *__p2;
- unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
+ unsigned long long __ll = strtoull(__a, &__p2, __base);
typename remove_reference<decltype(errno)>::type __current_errno = errno;
if (__current_errno == 0)
errno = __save_errno;
@@ -934,7 +934,7 @@ __num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err)
typename remove_reference<decltype(errno)>::type __save_errno = errno;
errno = 0;
char *__p2;
- long double __ld = strtold_l(__a, &__p2, _LIBCPP_GET_C_LOCALE);
+ long double __ld = strtold(__a, &__p2);
typename remove_reference<decltype(errno)>::type __current_errno = errno;
if (__current_errno == 0)
errno = __save_errno;
diff --git a/src/locale.cpp b/src/locale.cpp
index a326323..5dd021b 100644
--- a/src/locale.cpp
+++ b/src/locale.cpp
@@ -1012,11 +1012,9 @@ ctype<char>::do_narrow(const char_type* low, const char_type* high, char dfault,
return low;
}
-#ifdef __EMSCRIPTEN__
extern "C" const unsigned short ** __ctype_b_loc();
extern "C" const int ** __ctype_tolower_loc();
extern "C" const int ** __ctype_toupper_loc();
-#endif
const ctype<char>::mask*
ctype<char>::classic_table() _NOEXCEPT
@@ -1038,12 +1036,7 @@ ctype<char>::classic_table() _NOEXCEPT
#elif defined(_AIX)
return (const unsigned long *)__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;
+ return (const unsigned long *)*__ctype_b_loc();
#endif
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment