summaryrefslogtreecommitdiffstats
path: root/newlib/libc/stdio
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2015-11-20 18:14:58 +0100
committerCorinna Vinschen <corinna@vinschen.de>2015-11-20 18:14:58 +0100
commitfbace81684f8cbb80a2048c01dc545af247f5cb7 (patch)
tree01de6c0263b16465d7904f2cf6710cfc64925f88 /newlib/libc/stdio
parent51bf1b81f3c4c7c02d8101f8ab6eb5609892e728 (diff)
downloadcygnal-fbace81684f8cbb80a2048c01dc545af247f5cb7.tar.gz
cygnal-fbace81684f8cbb80a2048c01dc545af247f5cb7.tar.bz2
cygnal-fbace81684f8cbb80a2048c01dc545af247f5cb7.zip
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 <corinna@vinschen.de>
Diffstat (limited to 'newlib/libc/stdio')
-rw-r--r--newlib/libc/stdio/vfscanf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c
index 5fd153de6..e2e08db0e 100644
--- a/newlib/libc/stdio/vfscanf.c
+++ b/newlib/libc/stdio/vfscanf.c
@@ -170,7 +170,6 @@ Supporting OS subroutines required:
#define _NO_LONGDBL
#if defined _WANT_IO_LONG_DOUBLE && (LDBL_MANT_DIG > DBL_MANT_DIG)
#undef _NO_LONGDBL
-extern _LONG_DOUBLE _strtold _PARAMS((char *s, char **sptr));
#endif
#include "floatio.h"
@@ -1596,12 +1595,13 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
sprintf (exp_start, "e%ld", new_exp);
}
- /* Current _strtold routine is markedly slower than
+ /* FIXME: Is that still true?
+ Current _strtold routine is markedly slower than
_strtod_r. Only use it if we have a long double
result. */
#ifndef _NO_LONGDBL /* !_NO_LONGDBL */
if (flags & LONGDBL)
- qres = _strtold (buf, NULL);
+ qres = _strtold_r (rptr, buf, NULL);
else
#endif
res = _strtod_r (rptr, buf, NULL);