Implement LWG issue 1169. num_get not fully compatible with strto*

Use strtof and strtod for floats and doubles respectively instead of
always using strtold. The other parts of the change are already implemented
in libc++.

This patch also has a drive by fix to wbuffer_convert::underflow() which
prevents it from calling memmove(buff, null, 0).


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273106 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2016-06-19 06:58:22 +00:00
parent 57254f448f
commit fe6d50fcaa
7 changed files with 130 additions and 9 deletions

View File

@@ -44,11 +44,6 @@ long strtol_l(const char *__nptr, char **__endptr,
return strtol(__nptr, __endptr, __base);
}
static inline
long double strtold_l(const char *__nptr, char **__endptr,
locale_t __loc) {
return strtold(__nptr, __endptr);
}
static inline
unsigned long long strtoull_l(const char *__nptr, char **__endptr,
int __base, locale_t __loc) {
return strtoull(__nptr, __endptr, __base);
@@ -58,6 +53,21 @@ unsigned long strtoul_l(const char *__nptr, char **__endptr,
int __base, locale_t __loc) {
return strtoul(__nptr, __endptr, __base);
}
static inline
float strtof_l(const char *__nptr, char **__endptr,
locale_t __loc) {
return strtof(__nptr, __endptr);
}
static inline
double strtod_l(const char *__nptr, char **__endptr,
locale_t __loc) {
return strtod(__nptr, __endptr);
}
static inline
long double strtold_l(const char *__nptr, char **__endptr,
locale_t __loc) {
return strtold(__nptr, __endptr);
}
#ifdef __cplusplus