mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-11 18:33:14 +01:00
MinGW: Use __mingw_strtold instead of strtold.
The latter fails to parse hex floating point literals.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user