mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-21 07:13:13 +01:00
MinGW: Use actually working strtold.
Like their whole runtime in general, the MSVC version does not handle 80 bit reals/long doubles.
This commit is contained in:
@@ -2567,7 +2567,7 @@ void floatToBuffer(OutBuffer *buf, Type *type, real_t value)
|
||||
real_t r = strtold(buffer, NULL);
|
||||
__locale_decpoint = save;
|
||||
#else
|
||||
real_t r = strtold(buffer, NULL);
|
||||
real_t r = Port::strtold(buffer, NULL);
|
||||
#endif
|
||||
#if IN_LLVM
|
||||
if (r == value) // if exact duplication
|
||||
|
||||
@@ -2365,7 +2365,7 @@ done:
|
||||
#ifdef IN_GCC
|
||||
t->float80value = real_t::parse((char *)stringbuffer.data, real_t::LongDouble);
|
||||
#else
|
||||
t->float80value = strtold((char *)stringbuffer.data, NULL);
|
||||
t->float80value = Port::strtold((char *)stringbuffer.data, NULL);
|
||||
#endif
|
||||
errno = 0;
|
||||
float strtofres;
|
||||
|
||||
@@ -348,6 +348,14 @@ int Port::stricmp(const char *s1, const char *s2)
|
||||
return ::stricmp(s1, s2);
|
||||
}
|
||||
|
||||
// See vcbuild/strtold.c.
|
||||
longdouble strtold(const char *p, char **endp);
|
||||
|
||||
longdouble Port::strtold(const char *p, char **endp)
|
||||
{
|
||||
return ::strtold(p, endp);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if __MINGW32__
|
||||
@@ -527,6 +535,11 @@ int Port::stricmp(const char *s1, const char *s2)
|
||||
return result;
|
||||
}
|
||||
|
||||
longdouble Port::strtold(const char *p, char **endp)
|
||||
{
|
||||
return ::__mingw_strtold(p, endp);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if linux || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __HAIKU__
|
||||
@@ -765,6 +778,11 @@ int Port::stricmp(const char *s1, const char *s2)
|
||||
return result;
|
||||
}
|
||||
|
||||
longdouble Port::strtold(const char *p, char **endp)
|
||||
{
|
||||
return ::strtold(p, endp);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if __sun
|
||||
@@ -910,4 +928,9 @@ char *Port::strupr(char *s)
|
||||
return t;
|
||||
}
|
||||
|
||||
longdouble Port::strtold(const char *p, char **endp)
|
||||
{
|
||||
return ::strtold(p, endp);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
#if _MSC_VER
|
||||
#include <float.h> // for _isnan
|
||||
#include <malloc.h> // for alloca
|
||||
// According to VC 8.0 docs, long double is the same as double
|
||||
longdouble strtold(const char *p,char **endp);
|
||||
#define strtof strtod
|
||||
#define isnan _isnan
|
||||
|
||||
@@ -72,6 +70,8 @@ struct Port
|
||||
|
||||
static int memicmp(const char *s1, const char *s2, int n);
|
||||
static int stricmp(const char *s1, const char *s2);
|
||||
|
||||
static longdouble strtold(const char *p, char **endp);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user