From fbace81684f8cbb80a2048c01dc545af247f5cb7 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 20 Nov 2015 18:14:58 +0100 Subject: Import correctly working strtold from David M. Gay. * libc/stdlib/Makefile.am (GENERAL_SOURCES): Add strtodg.c and strtorx.c. * libc/stdlib/Makefile.in: Regenerate. * libc/stdlib/strtodg.c: New file implementing generic string to long double conversion. * libc/stdlib/strtorx.c: New file, implementing IEEE format string to long double conversion. * libc/stdlib/mprec.h (_strtodg_r): Declare. (_strtorx_r): Declare. * libc/stdlib/gdtoa.h (__UShort): Define. * libc/stdlib/strtold.c (__flt_rounds): Define for i386 and x86_64 target. (FLT_ROUNDS): Define, as 0 on platforms missing a __flt_rounds function. (_strtold_r): Converted from strtold. Call _strtorx_r on targets supporting distinct long doubles. (strtold): Just call _strtold_r. * libc/include/stdlib.h (_strtold_r): Declare. * libc/stdlib/ldtoa.c (_strtold): Comment out. Explain why. * libc/stdio/vfscanf.c (__SVFSCANF_R): Call _strtold_r instead of _strtold. * libc/machine/powerpc/vfscanf.c (__svfscanf_r): Ditto. * common.din (strtold): Drop redirection to _strtold. Signed-off-by: Corinna Vinschen --- newlib/libc/include/stdlib.h | 1 + 1 file changed, 1 insertion(+) (limited to 'newlib/libc/include/stdlib.h') diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h index afdde3f96..fd6315b06 100644 --- a/newlib/libc/include/stdlib.h +++ b/newlib/libc/include/stdlib.h @@ -274,6 +274,7 @@ _VOID _EXFUN(qsort_r,(_PTR __base, size_t __nmemb, size_t __size, int (*_compar) /* On platforms where long double equals double. */ #ifdef _HAVE_LONG_DOUBLE +extern long double _strtold_r (struct _reent *, const char *__restrict, char **__restrict); #if !defined(__STRICT_ANSI__) || \ (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ (defined(__cplusplus) && __cplusplus >= 201103L) -- cgit v1.2.3