summaryrefslogtreecommitdiffstats
path: root/external/dtoa/include_header.patch
diff options
context:
space:
mode:
Diffstat (limited to 'external/dtoa/include_header.patch')
-rw-r--r--external/dtoa/include_header.patch100
1 files changed, 100 insertions, 0 deletions
diff --git a/external/dtoa/include_header.patch b/external/dtoa/include_header.patch
new file mode 100644
index 000000000..7cf0a8a21
--- /dev/null
+++ b/external/dtoa/include_header.patch
@@ -0,0 +1,100 @@
+--- /dev/null
++++ dtoa/include/dtoa.h
+@@ -0,0 +1,1 @@
++extern "C" double strtod_nolocale(const char *s00, char **se);
+--- dtoa/src/dtoa.c.orig
++++ dtoa/src/dtoa.c
+@@ -268,7 +268,7 @@ #ifndef PRIVATE_MEM
+ #define PRIVATE_MEM 2304
+ #endif
+ #define PRIVATE_mem ((PRIVATE_MEM+sizeof(double)-1)/sizeof(double))
+-static double private_mem[PRIVATE_mem], *pmem_next = private_mem;
++static thread_local double private_mem[PRIVATE_mem], *pmem_next = private_mem;
+ #endif
+
+ #undef IEEE_Arith
+@@ -1502,9 +1502,7 @@ static unsigned int maxthreads = 0;
+ #define Kmax 7
+
+ #ifdef __cplusplus
+-extern "C" double strtod(const char *s00, char **se);
+-extern "C" char *dtoa(double d, int mode, int ndigits,
+- int *decpt, int *sign, char **rve);
++extern "C" double strtod_nolocale(const char *s00, char **se);
+ #endif
+
+ struct
+@@ -1521,7 +1519,7 @@ ThInfo {
+ Bigint *P5s;
+ } ThInfo;
+
+- static ThInfo TI0;
++ static thread_local ThInfo TI0;
+
+ #ifdef MULTIPLE_THREADS
+ static ThInfo *TI1;
+@@ -1529,7 +1527,7 @@ #ifdef MULTIPLE_THREADS
+ static ThInfo *TI1;
+ static int TI0_used;
+
+- void
++ static void
+ set_max_dtoa_threads(unsigned int n)
+ {
+ size_t L;
+@@ -2717,7 +2715,7 @@ enum { /* rounding values: same as FLT_ROUNDS */
+ Round_down = 3
+ };
+
+- void
++ static void
+ gethex( const char **sp, U *rvp, int rounding, int sign MTd)
+ {
+ Bigint *b;
+@@ -3429,7 +3427,7 @@ retlow1:
+ #endif /* NO_STRTOD_BIGCOMP */
+
+ double
+-strtod(const char *s00, char **se)
++strtod_nolocale(const char *s00, char **se)
+ {
+ int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, e, e1;
+ int esign, i, j, k, nd, nd0, nf, nz, nz0, nz1, sign;
+@@ -4851,7 +4849,7 @@ strtod_nolocale(const char *s00, char **se)
+ }
+
+ #ifndef MULTIPLE_THREADS
+- static char *dtoa_result;
++ static thread_local char *dtoa_result;
+ #endif
+
+ static char *
+@@ -4902,7 +4900,7 @@ nrv_alloc(const char *s, char *s0, size_t s0len, char **rve, int n MTd)
+ * when MULTIPLE_THREADS is not defined.
+ */
+
+- void
++ static void
+ freedtoa(char *s)
+ {
+ #ifdef MULTIPLE_THREADS
+@@ -4951,7 +4949,7 @@ freedtoa(char *s)
+ * calculation.
+ */
+
+- char *
++ static char *
+ dtoa_r(double dd, int mode, int ndigits, int *decpt, int *sign, char **rve, char *buf, size_t blen)
+ {
+ /* Arguments ndigits, decpt, sign are similar to those
+@@ -6184,8 +6182,8 @@ dtoa_r(double dd, int mode, int ndigits, int *decpt, int *sign, char **rve, char
+ return buf;
+ }
+
+- char *
+-dtoa(double dd, int mode, int ndigits, int *decpt, int *sign, char **rve)
++ static char *
++dtoa_nolocale(double dd, int mode, int ndigits, int *decpt, int *sign, char **rve)
+ {
+ /* Sufficient space is allocated to the return value
+ to hold the suppressed trailing zeros.