This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.22-555-ge02cabe


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  e02cabecf0d025ec4f4ddee290bdf7aadb873bb3 (commit)
      from  a7f0c5ae4184916f0e145de3aefc794bf2e280ad (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e02cabecf0d025ec4f4ddee290bdf7aadb873bb3

commit e02cabecf0d025ec4f4ddee290bdf7aadb873bb3
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Tue Nov 24 22:24:52 2015 +0000

    Refactor strtod parsing of NaN payloads.
    
    The nan* functions handle their string argument by constructing a
    NAN(...) string on the stack as a VLA and passing it to strtod
    functions.
    
    This approach has problems discussed in bug 16961 and bug 16962: the
    stack usage is unbounded, and it gives incorrect results in certain
    cases where the argument is not a valid n-char-sequence.
    
    The natural fix for both issues is to refactor the NaN payload parsing
    out of strtod into a separate function that the nan* functions can
    call directly, so that no temporary string needs constructing on the
    stack at all.  This patch does that refactoring in preparation for
    fixing those bugs (but without actually using the new functions from
    nan* - which will also require exporting them from libc at version
    GLIBC_PRIVATE).  This patch is not intended to change any user-visible
    behavior, so no tests are added (fixes for the above bugs will of
    course add tests for them).
    
    This patch builds on my recent fixes for strtol and strtod issues in
    Turkish locales.  Given those fixes, the parsing of NaN payloads is
    locale-independent; thus, the new functions do not need to take a
    locale_t argument.
    
    Tested for x86_64, x86, mips64 and powerpc.
    
    	* stdlib/strtod_nan.c: New file.
    	* stdlib/strtod_nan_double.h: Likewise.
    	* stdlib/strtod_nan_float.h: Likewise.
    	* stdlib/strtod_nan_main.c: Likewise.
    	* stdlib/strtod_nan_narrow.h: Likewise.
    	* stdlib/strtod_nan_wide.h: Likewise.
    	* stdlib/strtof_nan.c: Likewise.
    	* stdlib/strtold_nan.c: Likewise.
    	* sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h: Likewise.
    	* sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h: Likewise.
    	* sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h: Likewise.
    	* wcsmbs/wcstod_nan.c: Likewise.
    	* wcsmbs/wcstof_nan.c: Likewise.
    	* wcsmbs/wcstold_nan.c: Likewise.
    	* stdlib/Makefile (routines): Add strtof_nan, strtod_nan and
    	strtold_nan.
    	* wcsmbs/Makefile (routines): Add wcstod_nan, wcstold_nan and
    	wcstof_nan.
    	* include/stdlib.h (__strtof_nan): Declare and use
    	libc_hidden_proto.
    	(__strtod_nan): Likewise.
    	(__strtold_nan): Likewise.
    	(__wcstof_nan): Likewise.
    	(__wcstod_nan): Likewise.
    	(__wcstold_nan): Likewise.
    	* include/wchar.h (____wcstoull_l_internal): Declare.
    	* stdlib/strtod_l.c: Do not include <ieee754.h>.
    	(____strtoull_l_internal): Remove declaration.
    	(STRTOF_NAN): Define macro.
    	(SET_MANTISSA): Remove macro.
    	(STRTOULL): Likewise.
    	(____STRTOF_INTERNAL): Use STRTOF_NAN to parse NaN payload.
    	* stdlib/strtof_l.c (____strtoull_l_internal): Remove declaration.
    	(STRTOF_NAN): Define macro.
    	(SET_MANTISSA): Remove macro.
    	* sysdeps/ieee754/ldbl-128/strtold_l.c (STRTOF_NAN): Define macro.
    	(SET_MANTISSA): Remove macro.
    	* sysdeps/ieee754/ldbl-128ibm/strtold_l.c (STRTOF_NAN): Define
    	macro.
    	(SET_MANTISSA): Remove macro.
    	* sysdeps/ieee754/ldbl-64-128/strtold_l.c (STRTOF_NAN): Define
    	macro.
    	(SET_MANTISSA): Remove macro.
    	* sysdeps/ieee754/ldbl-96/strtold_l.c (STRTOF_NAN): Define macro.
    	(SET_MANTISSA): Remove macro.
    	* wcsmbs/wcstod_l.c (____wcstoull_l_internal): Remove declaration.
    	* wcsmbs/wcstof_l.c (____wcstoull_l_internal): Likewise.
    	* wcsmbs/wcstold_l.c (____wcstoull_l_internal): Likewise.

diff --git a/ChangeLog b/ChangeLog
index 78ba1f9..343a936 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,54 @@
 2015-11-24  Joseph Myers  <joseph@codesourcery.com>
 
+	* stdlib/strtod_nan.c: New file.
+	* stdlib/strtod_nan_double.h: Likewise.
+	* stdlib/strtod_nan_float.h: Likewise.
+	* stdlib/strtod_nan_main.c: Likewise.
+	* stdlib/strtod_nan_narrow.h: Likewise.
+	* stdlib/strtod_nan_wide.h: Likewise.
+	* stdlib/strtof_nan.c: Likewise.
+	* stdlib/strtold_nan.c: Likewise.
+	* sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h: Likewise.
+	* sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h: Likewise.
+	* sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h: Likewise.
+	* wcsmbs/wcstod_nan.c: Likewise.
+	* wcsmbs/wcstof_nan.c: Likewise.
+	* wcsmbs/wcstold_nan.c: Likewise.
+	* stdlib/Makefile (routines): Add strtof_nan, strtod_nan and
+	strtold_nan.
+	* wcsmbs/Makefile (routines): Add wcstod_nan, wcstold_nan and
+	wcstof_nan.
+	* include/stdlib.h (__strtof_nan): Declare and use
+	libc_hidden_proto.
+	(__strtod_nan): Likewise.
+	(__strtold_nan): Likewise.
+	(__wcstof_nan): Likewise.
+	(__wcstod_nan): Likewise.
+	(__wcstold_nan): Likewise.
+	* include/wchar.h (____wcstoull_l_internal): Declare.
+	* stdlib/strtod_l.c: Do not include <ieee754.h>.
+	(____strtoull_l_internal): Remove declaration.
+	(STRTOF_NAN): Define macro.
+	(SET_MANTISSA): Remove macro.
+	(STRTOULL): Likewise.
+	(____STRTOF_INTERNAL): Use STRTOF_NAN to parse NaN payload.
+	* stdlib/strtof_l.c (____strtoull_l_internal): Remove declaration.
+	(STRTOF_NAN): Define macro.
+	(SET_MANTISSA): Remove macro.
+	* sysdeps/ieee754/ldbl-128/strtold_l.c (STRTOF_NAN): Define macro.
+	(SET_MANTISSA): Remove macro.
+	* sysdeps/ieee754/ldbl-128ibm/strtold_l.c (STRTOF_NAN): Define
+	macro.
+	(SET_MANTISSA): Remove macro.
+	* sysdeps/ieee754/ldbl-64-128/strtold_l.c (STRTOF_NAN): Define
+	macro.
+	(SET_MANTISSA): Remove macro.
+	* sysdeps/ieee754/ldbl-96/strtold_l.c (STRTOF_NAN): Define macro.
+	(SET_MANTISSA): Remove macro.
+	* wcsmbs/wcstod_l.c (____wcstoull_l_internal): Remove declaration.
+	* wcsmbs/wcstof_l.c (____wcstoull_l_internal): Likewise.
+	* wcsmbs/wcstold_l.c (____wcstoull_l_internal): Likewise.
+
 	[BZ #19266]
 	* stdlib/strtod_l.c (____STRTOF_INTERNAL): Check directly for
 	upper case and lower case letters inside NAN(), not using TOLOWER.
diff --git a/include/stdlib.h b/include/stdlib.h
index dcb83a5..352339e 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -203,6 +203,24 @@ libc_hidden_proto (strtoll)
 libc_hidden_proto (strtoul)
 libc_hidden_proto (strtoull)
 
+extern float __strtof_nan (const char *, char **, char) internal_function;
+extern double __strtod_nan (const char *, char **, char) internal_function;
+extern long double __strtold_nan (const char *, char **, char)
+     internal_function;
+extern float __wcstof_nan (const wchar_t *, wchar_t **, wchar_t)
+     internal_function;
+extern double __wcstod_nan (const wchar_t *, wchar_t **, wchar_t)
+     internal_function;
+extern long double __wcstold_nan (const wchar_t *, wchar_t **, wchar_t)
+     internal_function;
+
+libc_hidden_proto (__strtof_nan)
+libc_hidden_proto (__strtod_nan)
+libc_hidden_proto (__strtold_nan)
+libc_hidden_proto (__wcstof_nan)
+libc_hidden_proto (__wcstod_nan)
+libc_hidden_proto (__wcstold_nan)
+
 extern char *__ecvt (double __value, int __ndigit, int *__restrict __decpt,
 		     int *__restrict __sign);
 extern char *__fcvt (double __value, int __ndigit, int *__restrict __decpt,
diff --git a/include/wchar.h b/include/wchar.h
index 67d0248..0f33d09 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -52,6 +52,9 @@ extern unsigned long long int __wcstoull_internal (const wchar_t *
 						   __restrict __endptr,
 						   int __base,
 						   int __group) __THROW;
+extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
+						       wchar_t **, int, int,
+						       __locale_t);
 libc_hidden_proto (__wcstof_internal)
 libc_hidden_proto (__wcstod_internal)
 libc_hidden_proto (__wcstold_internal)
diff --git a/stdlib/Makefile b/stdlib/Makefile
index 10d9406..d7ae165 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -50,6 +50,7 @@ routines	:=							      \
 	strtol_l strtoul_l strtoll_l strtoull_l				      \
 	strtof strtod strtold						      \
 	strtof_l strtod_l strtold_l					      \
+	strtof_nan strtod_nan strtold_nan				      \
 	system canonicalize						      \
 	a64l l64a							      \
 	rpmatch strfmon strfmon_l getsubopt xpg_basename fmtmsg		      \
diff --git a/stdlib/strtod_l.c b/stdlib/strtod_l.c
index 7307d98..2169291 100644
--- a/stdlib/strtod_l.c
+++ b/stdlib/strtod_l.c
@@ -20,8 +20,6 @@
 #include <xlocale.h>
 
 extern double ____strtod_l_internal (const char *, char **, int, __locale_t);
-extern unsigned long long int ____strtoull_l_internal (const char *, char **,
-						       int, int, __locale_t);
 
 /* Configuration part.  These macros are defined by `strtold.c',
    `strtof.c', `wcstod.c', `wcstold.c', and `wcstof.c' to produce the
@@ -33,27 +31,20 @@ extern unsigned long long int ____strtoull_l_internal (const char *, char **,
 # ifdef USE_WIDE_CHAR
 #  define STRTOF	wcstod_l
 #  define __STRTOF	__wcstod_l
+#  define STRTOF_NAN	__wcstod_nan
 # else
 #  define STRTOF	strtod_l
 #  define __STRTOF	__strtod_l
+#  define STRTOF_NAN	__strtod_nan
 # endif
 # define MPN2FLOAT	__mpn_construct_double
 # define FLOAT_HUGE_VAL	HUGE_VAL
-# define SET_MANTISSA(flt, mant) \
-  do { union ieee754_double u;						      \
-       u.d = (flt);							      \
-       u.ieee_nan.mantissa0 = (mant) >> 32;				      \
-       u.ieee_nan.mantissa1 = (mant);					      \
-       if ((u.ieee.mantissa0 | u.ieee.mantissa1) != 0)			      \
-	 (flt) = u.d;							      \
-  } while (0)
 #endif
 /* End of configuration part.  */
 
 #include <ctype.h>
 #include <errno.h>
 #include <float.h>
-#include <ieee754.h>
 #include "../locale/localeinfo.h"
 #include <locale.h>
 #include <math.h>
@@ -105,7 +96,6 @@ extern unsigned long long int ____strtoull_l_internal (const char *, char **,
 # define TOLOWER_C(Ch) __towlower_l ((Ch), _nl_C_locobj_ptr)
 # define STRNCASECMP(S1, S2, N) \
   __wcsncasecmp_l ((S1), (S2), (N), _nl_C_locobj_ptr)
-# define STRTOULL(S, E, B) ____wcstoull_l_internal ((S), (E), (B), 0, loc)
 #else
 # define STRING_TYPE char
 # define CHAR_TYPE char
@@ -117,7 +107,6 @@ extern unsigned long long int ____strtoull_l_internal (const char *, char **,
 # define TOLOWER_C(Ch) __tolower_l ((Ch), _nl_C_locobj_ptr)
 # define STRNCASECMP(S1, S2, N) \
   __strncasecmp_l ((S1), (S2), (N), _nl_C_locobj_ptr)
-# define STRTOULL(S, E, B) ____strtoull_l_internal ((S), (E), (B), 0, loc)
 #endif
 
 
@@ -649,33 +638,14 @@ ____STRTOF_INTERNAL (const STRING_TYPE *nptr, STRING_TYPE **endptr, int group,
 	  if (*cp == L_('('))
 	    {
 	      const STRING_TYPE *startp = cp;
-	      do
-		++cp;
-	      while ((*cp >= L_('0') && *cp <= L_('9'))
-		     || (*cp >= L_('A') && *cp <= L_('Z'))
-		     || (*cp >= L_('a') && *cp <= L_('z'))
-		     || *cp == L_('_'));
-
-	      if (*cp != L_(')'))
-		/* The closing brace is missing.  Only match the NAN
-		   part.  */
-		cp = startp;
+	      STRING_TYPE *endp;
+	      retval = STRTOF_NAN (cp + 1, &endp, L_(')'));
+	      if (*endp == L_(')'))
+		/* Consume the closing parenthesis.  */
+		cp = endp + 1;
 	      else
-		{
-		  /* This is a system-dependent way to specify the
-		     bitmask used for the NaN.  We expect it to be
-		     a number which is put in the mantissa of the
-		     number.  */
-		  STRING_TYPE *endp;
-		  unsigned long long int mant;
-
-		  mant = STRTOULL (startp + 1, &endp, 0);
-		  if (endp == cp)
-		    SET_MANTISSA (retval, mant);
-
-		  /* Consume the closing brace.  */
-		  ++cp;
-		}
+		/* Only match the NAN part.  */
+		cp = startp;
 	    }
 
 	  if (endptr != NULL)
diff --git a/wcsmbs/wcstof_l.c b/stdlib/strtod_nan.c
similarity index 58%
copy from wcsmbs/wcstof_l.c
copy to stdlib/strtod_nan.c
index bcf9834..2a0a89f 100644
--- a/wcsmbs/wcstof_l.c
+++ b/stdlib/strtod_nan.c
@@ -1,7 +1,7 @@
-/* Convert string representing a number to integer value, using given locale.
-   Copyright (C) 1997-2015 Free Software Foundation, Inc.
+/* Convert string for NaN payload to corresponding NaN.  Narrow
+   strings, double.
+   Copyright (C) 2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -17,16 +17,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <stddef.h>
-#include <xlocale.h>
+#include <strtod_nan_narrow.h>
+#include <strtod_nan_double.h>
 
-
-#define	USE_WIDE_CHAR	1
-
-extern float ____wcstof_l_internal (const wchar_t *, wchar_t **, int,
-				    __locale_t);
-extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
-						       wchar_t **, int, int,
-						       __locale_t);
-
-#include <stdlib/strtof_l.c>
+#define STRTOD_NAN __strtod_nan
+#include <strtod_nan_main.c>
diff --git a/wcsmbs/wcstof_l.c b/stdlib/strtod_nan_double.h
similarity index 63%
copy from wcsmbs/wcstof_l.c
copy to stdlib/strtod_nan_double.h
index bcf9834..f5bdb03 100644
--- a/wcsmbs/wcstof_l.c
+++ b/stdlib/strtod_nan_double.h
@@ -1,7 +1,6 @@
-/* Convert string representing a number to integer value, using given locale.
+/* Convert string for NaN payload to corresponding NaN.  For double.
    Copyright (C) 1997-2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -17,16 +16,15 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <stddef.h>
-#include <xlocale.h>
-
-
-#define	USE_WIDE_CHAR	1
-
-extern float ____wcstof_l_internal (const wchar_t *, wchar_t **, int,
-				    __locale_t);
-extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
-						       wchar_t **, int, int,
-						       __locale_t);
-
-#include <stdlib/strtof_l.c>
+#define FLOAT		double
+#define SET_MANTISSA(flt, mant)				\
+  do							\
+    {							\
+      union ieee754_double u;				\
+      u.d = (flt);					\
+      u.ieee_nan.mantissa0 = (mant) >> 32;		\
+      u.ieee_nan.mantissa1 = (mant);			\
+      if ((u.ieee.mantissa0 | u.ieee.mantissa1) != 0)	\
+	(flt) = u.d;					\
+    }							\
+  while (0)
diff --git a/wcsmbs/wcstold_l.c b/stdlib/strtod_nan_float.h
similarity index 63%
copy from wcsmbs/wcstold_l.c
copy to stdlib/strtod_nan_float.h
index 8df93af..4c52de8 100644
--- a/wcsmbs/wcstold_l.c
+++ b/stdlib/strtod_nan_float.h
@@ -1,7 +1,6 @@
-/* Convert string representing a number to integer value, using given locale.
+/* Convert string for NaN payload to corresponding NaN.  For float.
    Copyright (C) 1997-2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -17,15 +16,14 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <stddef.h>
-#include <xlocale.h>
-
-#define USE_WIDE_CHAR	1
-
-extern long double ____wcstold_l_internal (const wchar_t *, wchar_t **, int,
-					   __locale_t);
-extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
-						       wchar_t **, int, int,
-						       __locale_t);
-
-#include <strtold_l.c>
+#define	FLOAT		float
+#define SET_MANTISSA(flt, mant)			\
+  do						\
+    {						\
+      union ieee754_float u;			\
+      u.f = (flt);				\
+      u.ieee_nan.mantissa = (mant);		\
+      if (u.ieee.mantissa != 0)			\
+	(flt) = u.f;				\
+    }						\
+  while (0)
diff --git a/stdlib/strtod_nan_main.c b/stdlib/strtod_nan_main.c
new file mode 100644
index 0000000..bc37a63
--- /dev/null
+++ b/stdlib/strtod_nan_main.c
@@ -0,0 +1,63 @@
+/* Convert string for NaN payload to corresponding NaN.
+   Copyright (C) 1997-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <ieee754.h>
+#include <locale.h>
+#include <math.h>
+#include <stdlib.h>
+#include <wchar.h>
+
+
+/* If STR starts with an optional n-char-sequence as defined by ISO C
+   (a sequence of ASCII letters, digits and underscores), followed by
+   ENDC, return a NaN whose payload is set based on STR.  Otherwise,
+   return a default NAN.  If ENDPTR is not NULL, set *ENDPTR to point
+   to the character after the initial n-char-sequence.  */
+
+internal_function
+FLOAT
+STRTOD_NAN (const STRING_TYPE *str, STRING_TYPE **endptr, STRING_TYPE endc)
+{
+  const STRING_TYPE *cp = str;
+
+  while ((*cp >= L_('0') && *cp <= L_('9'))
+	 || (*cp >= L_('A') && *cp <= L_('Z'))
+	 || (*cp >= L_('a') && *cp <= L_('z'))
+	 || *cp == L_('_'))
+    ++cp;
+
+  FLOAT retval = NAN;
+  if (*cp != endc)
+    goto out;
+
+  /* This is a system-dependent way to specify the bitmask used for
+     the NaN.  We expect it to be a number which is put in the
+     mantissa of the number.  */
+  STRING_TYPE *endp;
+  unsigned long long int mant;
+
+  mant = STRTOULL (str, &endp, 0);
+  if (endp == cp)
+    SET_MANTISSA (retval, mant);
+
+ out:
+  if (endptr != NULL)
+    *endptr = (STRING_TYPE *) cp;
+  return retval;
+}
+libc_hidden_def (STRTOD_NAN)
diff --git a/wcsmbs/wcstof_l.c b/stdlib/strtod_nan_narrow.h
similarity index 63%
copy from wcsmbs/wcstof_l.c
copy to stdlib/strtod_nan_narrow.h
index bcf9834..bd77045 100644
--- a/wcsmbs/wcstof_l.c
+++ b/stdlib/strtod_nan_narrow.h
@@ -1,7 +1,6 @@
-/* Convert string representing a number to integer value, using given locale.
+/* Convert string for NaN payload to corresponding NaN.  Narrow strings.
    Copyright (C) 1997-2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -17,16 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <stddef.h>
-#include <xlocale.h>
-
-
-#define	USE_WIDE_CHAR	1
-
-extern float ____wcstof_l_internal (const wchar_t *, wchar_t **, int,
-				    __locale_t);
-extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
-						       wchar_t **, int, int,
-						       __locale_t);
-
-#include <stdlib/strtof_l.c>
+#define STRING_TYPE char
+#define L_(Ch) Ch
+#define STRTOULL(S, E, B) ____strtoull_l_internal ((S), (E), (B), 0,	\
+						   _nl_C_locobj_ptr)
diff --git a/wcsmbs/wcstof_l.c b/stdlib/strtod_nan_wide.h
similarity index 63%
copy from wcsmbs/wcstof_l.c
copy to stdlib/strtod_nan_wide.h
index bcf9834..783fbf4 100644
--- a/wcsmbs/wcstof_l.c
+++ b/stdlib/strtod_nan_wide.h
@@ -1,7 +1,6 @@
-/* Convert string representing a number to integer value, using given locale.
+/* Convert string for NaN payload to corresponding NaN.  Wide strings.
    Copyright (C) 1997-2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -17,16 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <stddef.h>
-#include <xlocale.h>
-
-
-#define	USE_WIDE_CHAR	1
-
-extern float ____wcstof_l_internal (const wchar_t *, wchar_t **, int,
-				    __locale_t);
-extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
-						       wchar_t **, int, int,
-						       __locale_t);
-
-#include <stdlib/strtof_l.c>
+#define STRING_TYPE wchar_t
+#define L_(Ch) L##Ch
+#define STRTOULL(S, E, B) ____wcstoull_l_internal ((S), (E), (B), 0,	\
+						   _nl_C_locobj_ptr)
diff --git a/stdlib/strtof_l.c b/stdlib/strtof_l.c
index 2a8646a..491256f 100644
--- a/stdlib/strtof_l.c
+++ b/stdlib/strtof_l.c
@@ -20,26 +20,19 @@
 #include <xlocale.h>
 
 extern float ____strtof_l_internal (const char *, char **, int, __locale_t);
-extern unsigned long long int ____strtoull_l_internal (const char *, char **,
-						       int, int, __locale_t);
 
 #define	FLOAT		float
 #define	FLT		FLT
 #ifdef USE_WIDE_CHAR
 # define STRTOF		wcstof_l
 # define __STRTOF	__wcstof_l
+# define STRTOF_NAN	__wcstof_nan
 #else
 # define STRTOF		strtof_l
 # define __STRTOF	__strtof_l
+# define STRTOF_NAN	__strtof_nan
 #endif
 #define	MPN2FLOAT	__mpn_construct_float
 #define	FLOAT_HUGE_VAL	HUGE_VALF
-#define SET_MANTISSA(flt, mant) \
-  do { union ieee754_float u;						      \
-       u.f = (flt);							      \
-       u.ieee_nan.mantissa = (mant);					      \
-       if (u.ieee.mantissa != 0)					      \
-	 (flt) = u.f;							      \
-  } while (0)
 
 #include "strtod_l.c"
diff --git a/wcsmbs/wcstof_l.c b/stdlib/strtof_nan.c
similarity index 58%
copy from wcsmbs/wcstof_l.c
copy to stdlib/strtof_nan.c
index bcf9834..b971310 100644
--- a/wcsmbs/wcstof_l.c
+++ b/stdlib/strtof_nan.c
@@ -1,7 +1,7 @@
-/* Convert string representing a number to integer value, using given locale.
-   Copyright (C) 1997-2015 Free Software Foundation, Inc.
+/* Convert string for NaN payload to corresponding NaN.  Narrow
+   strings, float.
+   Copyright (C) 2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -17,16 +17,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <stddef.h>
-#include <xlocale.h>
+#include <strtod_nan_narrow.h>
+#include <strtod_nan_float.h>
 
-
-#define	USE_WIDE_CHAR	1
-
-extern float ____wcstof_l_internal (const wchar_t *, wchar_t **, int,
-				    __locale_t);
-extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
-						       wchar_t **, int, int,
-						       __locale_t);
-
-#include <stdlib/strtof_l.c>
+#define STRTOD_NAN __strtof_nan
+#include <strtod_nan_main.c>
diff --git a/wcsmbs/wcstold_l.c b/stdlib/strtold_nan.c
similarity index 58%
copy from wcsmbs/wcstold_l.c
copy to stdlib/strtold_nan.c
index 8df93af..dd43032 100644
--- a/wcsmbs/wcstold_l.c
+++ b/stdlib/strtold_nan.c
@@ -1,7 +1,7 @@
-/* Convert string representing a number to integer value, using given locale.
-   Copyright (C) 1997-2015 Free Software Foundation, Inc.
+/* Convert string for NaN payload to corresponding NaN.  Narrow
+   strings, long double.
+   Copyright (C) 2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -17,15 +17,14 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <stddef.h>
-#include <xlocale.h>
+#include <math.h>
 
-#define USE_WIDE_CHAR	1
+/* This function is unused if long double and double have the same
+   representation.  */
+#ifndef __NO_LONG_DOUBLE_MATH
+# include <strtod_nan_narrow.h>
+# include <strtod_nan_ldouble.h>
 
-extern long double ____wcstold_l_internal (const wchar_t *, wchar_t **, int,
-					   __locale_t);
-extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
-						       wchar_t **, int, int,
-						       __locale_t);
-
-#include <strtold_l.c>
+# define STRTOD_NAN __strtold_nan
+# include <strtod_nan_main.c>
+#endif
diff --git a/wcsmbs/wcstold_l.c b/sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h
similarity index 59%
copy from wcsmbs/wcstold_l.c
copy to sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h
index 8df93af..e0da4e2 100644
--- a/wcsmbs/wcstold_l.c
+++ b/sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h
@@ -1,7 +1,6 @@
-/* Convert string representing a number to integer value, using given locale.
+/* Convert string for NaN payload to corresponding NaN.  For ldbl-128.
    Copyright (C) 1997-2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -17,15 +16,18 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <stddef.h>
-#include <xlocale.h>
-
-#define USE_WIDE_CHAR	1
-
-extern long double ____wcstold_l_internal (const wchar_t *, wchar_t **, int,
-					   __locale_t);
-extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
-						       wchar_t **, int, int,
-						       __locale_t);
-
-#include <strtold_l.c>
+#define FLOAT		long double
+#define SET_MANTISSA(flt, mant)				\
+  do							\
+    {							\
+      union ieee854_long_double u;			\
+      u.d = (flt);					\
+      u.ieee_nan.mantissa0 = 0;				\
+      u.ieee_nan.mantissa1 = 0;				\
+      u.ieee_nan.mantissa2 = (mant) >> 32;		\
+      u.ieee_nan.mantissa3 = (mant);			\
+      if ((u.ieee.mantissa0 | u.ieee.mantissa1		\
+	   | u.ieee.mantissa2 | u.ieee.mantissa3) != 0)	\
+	(flt) = u.d;					\
+    }							\
+  while (0)
diff --git a/sysdeps/ieee754/ldbl-128/strtold_l.c b/sysdeps/ieee754/ldbl-128/strtold_l.c
index d1ae57e..0b2ed27 100644
--- a/sysdeps/ieee754/ldbl-128/strtold_l.c
+++ b/sysdeps/ieee754/ldbl-128/strtold_l.c
@@ -25,22 +25,13 @@
 #ifdef USE_WIDE_CHAR
 # define STRTOF		wcstold_l
 # define __STRTOF	__wcstold_l
+# define STRTOF_NAN	__wcstold_nan
 #else
 # define STRTOF		strtold_l
 # define __STRTOF	__strtold_l
+# define STRTOF_NAN	__strtold_nan
 #endif
 #define MPN2FLOAT	__mpn_construct_long_double
 #define FLOAT_HUGE_VAL	HUGE_VALL
-#define SET_MANTISSA(flt, mant) \
-  do { union ieee854_long_double u;					      \
-       u.d = (flt);							      \
-       u.ieee_nan.mantissa0 = 0;					      \
-       u.ieee_nan.mantissa1 = 0;					      \
-       u.ieee_nan.mantissa2 = (mant) >> 32;				      \
-       u.ieee_nan.mantissa3 = (mant);					      \
-       if ((u.ieee.mantissa0 | u.ieee.mantissa1				      \
-	    | u.ieee.mantissa2 | u.ieee.mantissa3) != 0)		      \
-	 (flt) = u.d;							      \
-  } while (0)
 
 #include <strtod_l.c>
diff --git a/wcsmbs/wcstold_l.c b/sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h
similarity index 63%
copy from wcsmbs/wcstold_l.c
copy to sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h
index 8df93af..876a4bb 100644
--- a/wcsmbs/wcstold_l.c
+++ b/sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h
@@ -1,7 +1,6 @@
-/* Convert string representing a number to integer value, using given locale.
+/* Convert string for NaN payload to corresponding NaN.  For ldbl-128ibm.
    Copyright (C) 1997-2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -17,15 +16,15 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <stddef.h>
-#include <xlocale.h>
-
-#define USE_WIDE_CHAR	1
-
-extern long double ____wcstold_l_internal (const wchar_t *, wchar_t **, int,
-					   __locale_t);
-extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
-						       wchar_t **, int, int,
-						       __locale_t);
-
-#include <strtold_l.c>
+#define FLOAT		long double
+#define SET_MANTISSA(flt, mant)					\
+  do								\
+    {								\
+      union ibm_extended_long_double u;				\
+      u.ld = (flt);						\
+      u.d[0].ieee_nan.mantissa0 = (mant) >> 32;			\
+      u.d[0].ieee_nan.mantissa1 = (mant);			\
+      if ((u.d[0].ieee.mantissa0 | u.d[0].ieee.mantissa1) != 0)	\
+	(flt) = u.ld;						\
+    }								\
+  while (0)
diff --git a/sysdeps/ieee754/ldbl-128ibm/strtold_l.c b/sysdeps/ieee754/ldbl-128ibm/strtold_l.c
index 3e2f69e..6cd963b 100644
--- a/sysdeps/ieee754/ldbl-128ibm/strtold_l.c
+++ b/sysdeps/ieee754/ldbl-128ibm/strtold_l.c
@@ -30,25 +30,19 @@ extern long double ____new_wcstold_l (const wchar_t *, wchar_t **, __locale_t);
 # define STRTOF		__new_wcstold_l
 # define __STRTOF	____new_wcstold_l
 # define ____STRTOF_INTERNAL ____wcstold_l_internal
+# define STRTOF_NAN	__wcstold_nan
 #else
 extern long double ____new_strtold_l (const char *, char **, __locale_t);
 # define STRTOF		__new_strtold_l
 # define __STRTOF	____new_strtold_l
 # define ____STRTOF_INTERNAL ____strtold_l_internal
+# define STRTOF_NAN	__strtold_nan
 #endif
 extern __typeof (__STRTOF) STRTOF;
 libc_hidden_proto (__STRTOF)
 libc_hidden_proto (STRTOF)
 #define MPN2FLOAT	__mpn_construct_long_double
 #define FLOAT_HUGE_VAL	HUGE_VALL
-# define SET_MANTISSA(flt, mant) \
-  do { union ibm_extended_long_double u;				      \
-       u.ld = (flt);							      \
-       u.d[0].ieee_nan.mantissa0 = (mant) >> 32;			      \
-       u.d[0].ieee_nan.mantissa1 = (mant);				      \
-       if ((u.d[0].ieee.mantissa0 | u.d[0].ieee.mantissa1) != 0)	      \
-	 (flt) = u.ld;							      \
-  } while (0)
 
 #include <strtod_l.c>
 
diff --git a/sysdeps/ieee754/ldbl-64-128/strtold_l.c b/sysdeps/ieee754/ldbl-64-128/strtold_l.c
index 3944a43..6cd963b 100644
--- a/sysdeps/ieee754/ldbl-64-128/strtold_l.c
+++ b/sysdeps/ieee754/ldbl-64-128/strtold_l.c
@@ -30,28 +30,19 @@ extern long double ____new_wcstold_l (const wchar_t *, wchar_t **, __locale_t);
 # define STRTOF		__new_wcstold_l
 # define __STRTOF	____new_wcstold_l
 # define ____STRTOF_INTERNAL ____wcstold_l_internal
+# define STRTOF_NAN	__wcstold_nan
 #else
 extern long double ____new_strtold_l (const char *, char **, __locale_t);
 # define STRTOF		__new_strtold_l
 # define __STRTOF	____new_strtold_l
 # define ____STRTOF_INTERNAL ____strtold_l_internal
+# define STRTOF_NAN	__strtold_nan
 #endif
 extern __typeof (__STRTOF) STRTOF;
 libc_hidden_proto (__STRTOF)
 libc_hidden_proto (STRTOF)
 #define MPN2FLOAT	__mpn_construct_long_double
 #define FLOAT_HUGE_VAL	HUGE_VALL
-#define SET_MANTISSA(flt, mant) \
-  do { union ieee854_long_double u;					      \
-       u.d = (flt);							      \
-       u.ieee_nan.mantissa0 = 0;					      \
-       u.ieee_nan.mantissa1 = 0;					      \
-       u.ieee_nan.mantissa2 = (mant) >> 32;				      \
-       u.ieee_nan.mantissa3 = (mant);					      \
-       if ((u.ieee.mantissa0 | u.ieee.mantissa1				      \
-	    | u.ieee.mantissa2 | u.ieee.mantissa3) != 0)		      \
-	 (flt) = u.d;							      \
-  } while (0)
 
 #include <strtod_l.c>
 
diff --git a/wcsmbs/wcstold_l.c b/sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h
similarity index 63%
copy from wcsmbs/wcstold_l.c
copy to sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h
index 8df93af..6f03359 100644
--- a/wcsmbs/wcstold_l.c
+++ b/sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h
@@ -1,7 +1,6 @@
-/* Convert string representing a number to integer value, using given locale.
+/* Convert string for NaN payload to corresponding NaN.  For ldbl-96.
    Copyright (C) 1997-2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -17,15 +16,15 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <stddef.h>
-#include <xlocale.h>
-
-#define USE_WIDE_CHAR	1
-
-extern long double ____wcstold_l_internal (const wchar_t *, wchar_t **, int,
-					   __locale_t);
-extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
-						       wchar_t **, int, int,
-						       __locale_t);
-
-#include <strtold_l.c>
+#define FLOAT		long double
+#define SET_MANTISSA(flt, mant)				\
+  do							\
+    {							\
+      union ieee854_long_double u;			\
+      u.d = (flt);					\
+      u.ieee_nan.mantissa0 = (mant) >> 32;		\
+      u.ieee_nan.mantissa1 = (mant);			\
+      if ((u.ieee.mantissa0 | u.ieee.mantissa1) != 0)	\
+	(flt) = u.d;					\
+    }							\
+  while (0)
diff --git a/sysdeps/ieee754/ldbl-96/strtold_l.c b/sysdeps/ieee754/ldbl-96/strtold_l.c
index c082e74..db92242 100644
--- a/sysdeps/ieee754/ldbl-96/strtold_l.c
+++ b/sysdeps/ieee754/ldbl-96/strtold_l.c
@@ -25,19 +25,13 @@
 #ifdef USE_WIDE_CHAR
 # define STRTOF		wcstold_l
 # define __STRTOF	__wcstold_l
+# define STRTOF_NAN	__wcstold_nan
 #else
 # define STRTOF		strtold_l
 # define __STRTOF	__strtold_l
+# define STRTOF_NAN	__strtold_nan
 #endif
 #define MPN2FLOAT	__mpn_construct_long_double
 #define FLOAT_HUGE_VAL	HUGE_VALL
-#define SET_MANTISSA(flt, mant) \
-  do { union ieee854_long_double u;					      \
-       u.d = (flt);							      \
-       u.ieee_nan.mantissa0 = (mant) >> 32;				      \
-       u.ieee_nan.mantissa1 = (mant);					      \
-       if ((u.ieee.mantissa0 | u.ieee.mantissa1) != 0)			      \
-	 (flt) = u.d;							      \
-  } while (0)
 
 #include <stdlib/strtod_l.c>
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index 773cfdb..e5de439 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -33,6 +33,7 @@ routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
 	    wcstol wcstoul wcstoll wcstoull wcstod wcstold wcstof \
 	    wcstol_l wcstoul_l wcstoll_l wcstoull_l \
 	    wcstod_l wcstold_l wcstof_l \
+	    wcstod_nan wcstold_nan wcstof_nan \
 	    wcscoll wcsxfrm \
 	    wcwidth wcswidth \
 	    wcscoll_l wcsxfrm_l \
diff --git a/wcsmbs/wcstod_l.c b/wcsmbs/wcstod_l.c
index 9c026d8..0fe820c 100644
--- a/wcsmbs/wcstod_l.c
+++ b/wcsmbs/wcstod_l.c
@@ -23,9 +23,6 @@
 
 extern double ____wcstod_l_internal (const wchar_t *, wchar_t **, int,
 				     __locale_t);
-extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
-						       wchar_t **, int, int,
-						       __locale_t);
 
 #define	USE_WIDE_CHAR	1
 
diff --git a/wcsmbs/wcstof_l.c b/wcsmbs/wcstod_nan.c
similarity index 58%
copy from wcsmbs/wcstof_l.c
copy to wcsmbs/wcstod_nan.c
index bcf9834..b3dd6af 100644
--- a/wcsmbs/wcstof_l.c
+++ b/wcsmbs/wcstod_nan.c
@@ -1,7 +1,6 @@
-/* Convert string representing a number to integer value, using given locale.
-   Copyright (C) 1997-2015 Free Software Foundation, Inc.
+/* Convert string for NaN payload to corresponding NaN.  Wide strings, double.
+   Copyright (C) 2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -17,16 +16,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <stddef.h>
-#include <xlocale.h>
+#include "../stdlib/strtod_nan_wide.h"
+#include "../stdlib/strtod_nan_double.h"
 
-
-#define	USE_WIDE_CHAR	1
-
-extern float ____wcstof_l_internal (const wchar_t *, wchar_t **, int,
-				    __locale_t);
-extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
-						       wchar_t **, int, int,
-						       __locale_t);
-
-#include <stdlib/strtof_l.c>
+#define STRTOD_NAN __wcstod_nan
+#include "../stdlib/strtod_nan_main.c"
diff --git a/wcsmbs/wcstof_l.c b/wcsmbs/wcstof_l.c
index bcf9834..392ea49 100644
--- a/wcsmbs/wcstof_l.c
+++ b/wcsmbs/wcstof_l.c
@@ -25,8 +25,5 @@
 
 extern float ____wcstof_l_internal (const wchar_t *, wchar_t **, int,
 				    __locale_t);
-extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
-						       wchar_t **, int, int,
-						       __locale_t);
 
 #include <stdlib/strtof_l.c>
diff --git a/wcsmbs/wcstof_l.c b/wcsmbs/wcstof_nan.c
similarity index 58%
copy from wcsmbs/wcstof_l.c
copy to wcsmbs/wcstof_nan.c
index bcf9834..c5f667a 100644
--- a/wcsmbs/wcstof_l.c
+++ b/wcsmbs/wcstof_nan.c
@@ -1,7 +1,6 @@
-/* Convert string representing a number to integer value, using given locale.
-   Copyright (C) 1997-2015 Free Software Foundation, Inc.
+/* Convert string for NaN payload to corresponding NaN.  Wide strings, float.
+   Copyright (C) 2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -17,16 +16,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <stddef.h>
-#include <xlocale.h>
+#include "../stdlib/strtod_nan_wide.h"
+#include "../stdlib/strtod_nan_float.h"
 
-
-#define	USE_WIDE_CHAR	1
-
-extern float ____wcstof_l_internal (const wchar_t *, wchar_t **, int,
-				    __locale_t);
-extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
-						       wchar_t **, int, int,
-						       __locale_t);
-
-#include <stdlib/strtof_l.c>
+#define STRTOD_NAN __wcstof_nan
+#include "../stdlib/strtod_nan_main.c"
diff --git a/wcsmbs/wcstold_l.c b/wcsmbs/wcstold_l.c
index 8df93af..f5d0554 100644
--- a/wcsmbs/wcstold_l.c
+++ b/wcsmbs/wcstold_l.c
@@ -24,8 +24,5 @@
 
 extern long double ____wcstold_l_internal (const wchar_t *, wchar_t **, int,
 					   __locale_t);
-extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
-						       wchar_t **, int, int,
-						       __locale_t);
 
 #include <strtold_l.c>
diff --git a/wcsmbs/wcstold_l.c b/wcsmbs/wcstold_nan.c
similarity index 58%
copy from wcsmbs/wcstold_l.c
copy to wcsmbs/wcstold_nan.c
index 8df93af..ef905d3 100644
--- a/wcsmbs/wcstold_l.c
+++ b/wcsmbs/wcstold_nan.c
@@ -1,7 +1,7 @@
-/* Convert string representing a number to integer value, using given locale.
-   Copyright (C) 1997-2015 Free Software Foundation, Inc.
+/* Convert string for NaN payload to corresponding NaN.  Wide strings,
+   long double.
+   Copyright (C) 2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -17,15 +17,14 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <stddef.h>
-#include <xlocale.h>
+#include <math.h>
 
-#define USE_WIDE_CHAR	1
+/* This function is unused if long double and double have the same
+   representation.  */
+#ifndef __NO_LONG_DOUBLE_MATH
+# include "../stdlib/strtod_nan_wide.h"
+# include <strtod_nan_ldouble.h>
 
-extern long double ____wcstold_l_internal (const wchar_t *, wchar_t **, int,
-					   __locale_t);
-extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
-						       wchar_t **, int, int,
-						       __locale_t);
-
-#include <strtold_l.c>
+# define STRTOD_NAN __wcstold_nan
+# include "../stdlib/strtod_nan_main.c"
+#endif

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                        |   49 +++++++++++++++++
 include/stdlib.h                                 |   18 ++++++
 include/wchar.h                                  |    3 +
 stdlib/Makefile                                  |    1 +
 stdlib/strtod_l.c                                |   48 +++-------------
 stdlib/strtod_nan.c                              |   24 ++++++++
 stdlib/strtod_nan_double.h                       |   30 ++++++++++
 stdlib/strtod_nan_float.h                        |   29 ++++++++++
 stdlib/strtod_nan_main.c                         |   63 ++++++++++++++++++++++
 stdlib/strtod_nan_narrow.h                       |   22 ++++++++
 stdlib/strtod_nan_wide.h                         |   22 ++++++++
 stdlib/strtof_l.c                                |   11 +---
 stdlib/strtof_nan.c                              |   24 ++++++++
 stdlib/strtold_nan.c                             |   30 ++++++++++
 sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h    |   33 +++++++++++
 sysdeps/ieee754/ldbl-128/strtold_l.c             |   13 +----
 sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h |   30 ++++++++++
 sysdeps/ieee754/ldbl-128ibm/strtold_l.c          |   10 +---
 sysdeps/ieee754/ldbl-64-128/strtold_l.c          |   13 +----
 sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h     |   30 ++++++++++
 sysdeps/ieee754/ldbl-96/strtold_l.c              |   10 +---
 wcsmbs/Makefile                                  |    1 +
 wcsmbs/wcstod_l.c                                |    3 -
 wcsmbs/wcstod_nan.c                              |   23 ++++++++
 wcsmbs/wcstof_l.c                                |    3 -
 wcsmbs/wcstof_nan.c                              |   23 ++++++++
 wcsmbs/wcstold_l.c                               |    3 -
 wcsmbs/wcstold_nan.c                             |   30 ++++++++++
 28 files changed, 504 insertions(+), 95 deletions(-)
 create mode 100644 stdlib/strtod_nan.c
 create mode 100644 stdlib/strtod_nan_double.h
 create mode 100644 stdlib/strtod_nan_float.h
 create mode 100644 stdlib/strtod_nan_main.c
 create mode 100644 stdlib/strtod_nan_narrow.h
 create mode 100644 stdlib/strtod_nan_wide.h
 create mode 100644 stdlib/strtof_nan.c
 create mode 100644 stdlib/strtold_nan.c
 create mode 100644 sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h
 create mode 100644 sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h
 create mode 100644 sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h
 create mode 100644 wcsmbs/wcstod_nan.c
 create mode 100644 wcsmbs/wcstof_nan.c
 create mode 100644 wcsmbs/wcstold_nan.c


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]