107 lines
3.8 KiB
Diff
107 lines
3.8 KiB
Diff
From b9c1e25e5e60ffd6417a498824349815694a6c45 Mon Sep 17 00:00:00 2001
|
|
From: Travis Tilley <ttilley@gmail.com>
|
|
Date: Sat, 9 May 2015 04:21:27 -0400
|
|
Subject: [PATCH] musl fixes/hacks
|
|
|
|
---
|
|
include/__config | 4 ----
|
|
include/locale | 7 +++----
|
|
src/locale.cpp | 16 ++--------------
|
|
3 files changed, 5 insertions(+), 22 deletions(-)
|
|
|
|
diff --git a/include/__config b/include/__config
|
|
index 97c66c8..a65e991 100644
|
|
--- a/include/__config
|
|
+++ b/include/__config
|
|
@@ -348,14 +348,10 @@ typedef __char32_t char32_t;
|
|
#define _LIBCPP_HAS_QUICK_EXIT
|
|
#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 ca468d5..f3016bb 100644
|
|
--- a/include/locale
|
|
+++ b/include/locale
|
|
@@ -10,7 +10,6 @@
|
|
|
|
#ifndef _LIBCPP_LOCALE
|
|
#define _LIBCPP_LOCALE
|
|
-
|
|
/*
|
|
locale synopsis
|
|
|
|
@@ -871,7 +870,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;
|
|
@@ -911,7 +910,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;
|
|
@@ -941,7 +940,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 2842bfc..4301b5f 100644
|
|
--- a/src/locale.cpp
|
|
+++ b/src/locale.cpp
|
|
@@ -1010,7 +1010,7 @@ ctype<char>::do_narrow(const char_type* low, const char_type* high, char dfault,
|
|
return low;
|
|
}
|
|
|
|
-#ifdef __EMSCRIPTEN__
|
|
+#ifdef __linux__
|
|
extern "C" const unsigned short ** __ctype_b_loc();
|
|
extern "C" const int ** __ctype_tolower_loc();
|
|
extern "C" const int ** __ctype_toupper_loc();
|
|
@@ -1112,20 +1112,8 @@ ctype<char>::classic_table() _NOEXCEPT
|
|
return _ctype+1; // internal ctype mask table defined in msvcrt.dll
|
|
// This is assumed to be safe, which is a nonsense assumption because we're
|
|
// going to end up dereferencing it later...
|
|
-#elif defined(__EMSCRIPTEN__)
|
|
- return *__ctype_b_loc();
|
|
-#elif defined(_NEWLIB_VERSION)
|
|
- // Newlib has a 257-entry table in ctype_.c, where (char)0 starts at [1].
|
|
- return _ctype_ + 1;
|
|
-#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;
|
|
+ return (const unsigned long *)*__ctype_b_loc();
|
|
#endif
|
|
}
|
|
#endif
|
|
--
|
|
2.1.4
|
|
|