MinGW: Use __mingw_strtold instead of strtold.

The latter fails to parse hex floating point literals.
This commit is contained in:
David Nadlinger
2013-02-20 23:45:11 +01:00
parent 2d3de4a3d4
commit 6dc122b424
4 changed files with 22 additions and 0 deletions

View File

@@ -2620,6 +2620,8 @@ void floatToBuffer(OutBuffer *buf, Type *type, real_t value)
__locale_decpoint = ".";
real_t r = strtold(buffer, NULL);
__locale_decpoint = save;
#elif IN_LLVM
real_t r = Port::strtold(buffer, NULL);
#else
real_t r = strtold(buffer, NULL);
#endif

View File

@@ -2364,6 +2364,8 @@ done:
#endif
#ifdef IN_GCC
t->float80value = real_t::parse((char *)stringbuffer.data, real_t::LongDouble);
#elif IN_LLVM
t->float80value = Port::strtold((char *)stringbuffer.data, NULL);
#else
t->float80value = strtold((char *)stringbuffer.data, NULL);
#endif

View File

@@ -670,3 +670,18 @@ char *Port::strupr(char *s)
}
#endif
#if IN_LLVM
#if __MINGW32__
longdouble Port::strtold(const char *str, char **pend)
{
return __mingw_strtold(str, pend);
}
#else
longdouble Port::strtold(const char *str, char **pend)
{
return ::strtold(str, pend);
}
#endif
#endif

View File

@@ -61,6 +61,9 @@ struct Port
static longdouble fmodl(longdouble x, longdouble y);
static ulonglong strtoull(const char *p, char **pend, int base);
#if IN_LLVM
static longdouble strtold(const char *str, char **pend);
#endif
static char *ull_to_string(char *buffer, ulonglong ull);
static wchar_t *ull_to_string(wchar_t *buffer, ulonglong ull);