~ubuntu-branches/ubuntu/trusty/eglibc/trusty-security

« back to all changes in this revision

Viewing changes to debian/patches/any/CVE-2014-9761-1.diff

  • Committer: Package Import Robot
  • Author(s): Steve Beattie
  • Date: 2016-04-08 23:26:02 UTC
  • Revision ID: package-import@ubuntu.com-20160408232602-694337pzn1m5xgc3
Tags: 2.19-0ubuntu6.8
* SECURITY UPDATE: buffer overflow in gethostbyname_r and related
  functions
  - debian/patches/any/CVE-2015-1781.diff: take alignment padding
    into account when computing if buffer is too small.
  - CVE-2015-1781
* SECURITY UPDATE: glibc Name Service Switch (NSS) denial of sevice
  - debian/patches/any/CVE-2014-8121-1.diff: do not close NSS files
    database during iteration.
  - debian/patches/any/CVE-2014-8121-2.diff: Separate internal state
    between getXXent and getXXbyYY NSS calls.
  - CVE-2014-8121
* SECURITY UPDATE: glibc unbounded stack usage in NaN strtod
  conversion
  - debian/patches/any/CVE-2014-9761-1.diff: Refactor strtod parsing
    of NaN payloads.
  - debian/patches/any/CVE-2014-9761-1.diff:  Fix nan functions
    handling of payload strings
  - CVE-2014-9761
* SECURITY UPDATE: NSS files long line buffer overflow
  - debian/patches/any/CVE-2015-5277.diff: Don't ignore too long
    lines in nss_files
  - CVE-2015-5277
* SECURITY UPDATE: out of range data to strftime() causes segfault
  (denial of service)
  - debian/patches/any/CVE-2015-8776.diff: add range checks to
    strftime() processing
  - CVE-2015-8776
* SECURITY UPDATE: glibc honors LD_POINTER_GUARD env for setuid
  AT_SECURE programs (e.g. setuid), allowing disabling of pointer
  mangling
  - debian/patches/any/CVE-2015-8777.diff: Always enable pointer
    guard
  - CVE-2015-8777
* SECURITY UPDATE: integer overflow in hcreate and hcreate_r
  - debian/patches/any/CVE-2015-8778.diff: check for large inputs
  - CVE-2015-8778
* SECURITY UPDATE: unbounded stack allocation in catopen()
  - debian/patches/any/CVE-2015-8779.diff: stop using unbounded
    alloca()
  - CVE-2015-8779
* SECURITY UPDATE: Stack overflow in _nss_dns_getnetbyname_r
  - debian/patches/any/CVE-2016-3075.diff: do not make unneeded
    memory copy on the stack.
  - CVE-2016-3075
* SECURITY UPDATE: pt_chown privilege escalation
  - debian/patches/any/CVE-2016-2856.diff: grantpt: trust the kernel
    about pty group and permission mode
  - debian/sysdeps/linux.mk: don't build pt_chown
  - debian/rules.d/debhelper.mk: only install pt_chown when built.
  - CVE-2016-2856, CVE-2013-2207
* debian/debhelper.in/libc.postinst: add reboot notifications for
  security updates (LP: #1546457)
* debian/patches/ubuntu/submitted-no-stack-backtrace.diff: update
  patch to eliminate compiler warning.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From e02cabecf0d025ec4f4ddee290bdf7aadb873bb3 Mon Sep 17 00:00:00 2001
 
2
From: Joseph Myers <joseph@codesourcery.com>
 
3
Date: Tue, 24 Nov 2015 22:24:52 +0000
 
4
Subject: [PATCH] Refactor strtod parsing of NaN payloads.
 
5
 
 
6
The nan* functions handle their string argument by constructing a
 
7
NAN(...) string on the stack as a VLA and passing it to strtod
 
8
functions.
 
9
 
 
10
This approach has problems discussed in bug 16961 and bug 16962: the
 
11
stack usage is unbounded, and it gives incorrect results in certain
 
12
cases where the argument is not a valid n-char-sequence.
 
13
 
 
14
The natural fix for both issues is to refactor the NaN payload parsing
 
15
out of strtod into a separate function that the nan* functions can
 
16
call directly, so that no temporary string needs constructing on the
 
17
stack at all.  This patch does that refactoring in preparation for
 
18
fixing those bugs (but without actually using the new functions from
 
19
nan* - which will also require exporting them from libc at version
 
20
GLIBC_PRIVATE).  This patch is not intended to change any user-visible
 
21
behavior, so no tests are added (fixes for the above bugs will of
 
22
course add tests for them).
 
23
 
 
24
This patch builds on my recent fixes for strtol and strtod issues in
 
25
Turkish locales.  Given those fixes, the parsing of NaN payloads is
 
26
locale-independent; thus, the new functions do not need to take a
 
27
locale_t argument.
 
28
 
 
29
Tested for x86_64, x86, mips64 and powerpc.
 
30
 
 
31
        * stdlib/strtod_nan.c: New file.
 
32
        * stdlib/strtod_nan_double.h: Likewise.
 
33
        * stdlib/strtod_nan_float.h: Likewise.
 
34
        * stdlib/strtod_nan_main.c: Likewise.
 
35
        * stdlib/strtod_nan_narrow.h: Likewise.
 
36
        * stdlib/strtod_nan_wide.h: Likewise.
 
37
        * stdlib/strtof_nan.c: Likewise.
 
38
        * stdlib/strtold_nan.c: Likewise.
 
39
        * sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h: Likewise.
 
40
        * sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h: Likewise.
 
41
        * sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h: Likewise.
 
42
        * wcsmbs/wcstod_nan.c: Likewise.
 
43
        * wcsmbs/wcstof_nan.c: Likewise.
 
44
        * wcsmbs/wcstold_nan.c: Likewise.
 
45
        * stdlib/Makefile (routines): Add strtof_nan, strtod_nan and
 
46
        strtold_nan.
 
47
        * wcsmbs/Makefile (routines): Add wcstod_nan, wcstold_nan and
 
48
        wcstof_nan.
 
49
        * include/stdlib.h (__strtof_nan): Declare and use
 
50
        libc_hidden_proto.
 
51
        (__strtod_nan): Likewise.
 
52
        (__strtold_nan): Likewise.
 
53
        (__wcstof_nan): Likewise.
 
54
        (__wcstod_nan): Likewise.
 
55
        (__wcstold_nan): Likewise.
 
56
        * include/wchar.h (____wcstoull_l_internal): Declare.
 
57
        * stdlib/strtod_l.c: Do not include <ieee754.h>.
 
58
        (____strtoull_l_internal): Remove declaration.
 
59
        (STRTOF_NAN): Define macro.
 
60
        (SET_MANTISSA): Remove macro.
 
61
        (STRTOULL): Likewise.
 
62
        (____STRTOF_INTERNAL): Use STRTOF_NAN to parse NaN payload.
 
63
        * stdlib/strtof_l.c (____strtoull_l_internal): Remove declaration.
 
64
        (STRTOF_NAN): Define macro.
 
65
        (SET_MANTISSA): Remove macro.
 
66
        * sysdeps/ieee754/ldbl-128/strtold_l.c (STRTOF_NAN): Define macro.
 
67
        (SET_MANTISSA): Remove macro.
 
68
        * sysdeps/ieee754/ldbl-128ibm/strtold_l.c (STRTOF_NAN): Define
 
69
        macro.
 
70
        (SET_MANTISSA): Remove macro.
 
71
        * sysdeps/ieee754/ldbl-64-128/strtold_l.c (STRTOF_NAN): Define
 
72
        macro.
 
73
        (SET_MANTISSA): Remove macro.
 
74
        * sysdeps/ieee754/ldbl-96/strtold_l.c (STRTOF_NAN): Define macro.
 
75
        (SET_MANTISSA): Remove macro.
 
76
        * wcsmbs/wcstod_l.c (____wcstoull_l_internal): Remove declaration.
 
77
        * wcsmbs/wcstof_l.c (____wcstoull_l_internal): Likewise.
 
78
        * wcsmbs/wcstold_l.c (____wcstoull_l_internal): Likewise.
 
79
 
 
80
[Note: patch differs from upstream commit in that the entries in the
 
81
Changelog were dropped to avoid patch conflicts, and adjust
 
82
stdlib/strtod_l.c hunk 5 change to match existing code. -- sbeattie]
 
83
 
 
84
---
 
85
 include/stdlib.h                                 |   18 ++++++
 
86
 include/wchar.h                                  |    3 +
 
87
 stdlib/Makefile                                  |    1 
 
88
 stdlib/strtod_l.c                                |   48 +++--------------
 
89
 stdlib/strtod_nan.c                              |   24 ++++++++
 
90
 stdlib/strtod_nan_double.h                       |   30 ++++++++++
 
91
 stdlib/strtod_nan_float.h                        |   29 ++++++++++
 
92
 stdlib/strtod_nan_main.c                         |   63 +++++++++++++++++++++++
 
93
 stdlib/strtod_nan_narrow.h                       |   22 ++++++++
 
94
 stdlib/strtod_nan_wide.h                         |   22 ++++++++
 
95
 stdlib/strtof_l.c                                |   11 ----
 
96
 stdlib/strtof_nan.c                              |   24 ++++++++
 
97
 stdlib/strtold_nan.c                             |   30 ++++++++++
 
98
 sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h    |   33 ++++++++++++
 
99
 sysdeps/ieee754/ldbl-128/strtold_l.c             |   13 ----
 
100
 sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h |   30 ++++++++++
 
101
 sysdeps/ieee754/ldbl-128ibm/strtold_l.c          |   10 ---
 
102
 sysdeps/ieee754/ldbl-64-128/strtold_l.c          |   13 ----
 
103
 sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h     |   30 ++++++++++
 
104
 sysdeps/ieee754/ldbl-96/strtold_l.c              |   10 ---
 
105
 wcsmbs/Makefile                                  |    1 
 
106
 wcsmbs/wcstod_l.c                                |    3 -
 
107
 wcsmbs/wcstod_nan.c                              |   23 ++++++++
 
108
 wcsmbs/wcstof_l.c                                |    3 -
 
109
 wcsmbs/wcstof_nan.c                              |   23 ++++++++
 
110
 wcsmbs/wcstold_l.c                               |    3 -
 
111
 wcsmbs/wcstold_nan.c                             |   30 ++++++++++
 
112
 27 files changed, 455 insertions(+), 95 deletions(-)
 
113
 create mode 100644 stdlib/strtod_nan.c
 
114
 create mode 100644 stdlib/strtod_nan_double.h
 
115
 create mode 100644 stdlib/strtod_nan_float.h
 
116
 create mode 100644 stdlib/strtod_nan_main.c
 
117
 create mode 100644 stdlib/strtod_nan_narrow.h
 
118
 create mode 100644 stdlib/strtod_nan_wide.h
 
119
 create mode 100644 stdlib/strtof_nan.c
 
120
 create mode 100644 stdlib/strtold_nan.c
 
121
 create mode 100644 sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h
 
122
 create mode 100644 sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h
 
123
 create mode 100644 sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h
 
124
 create mode 100644 wcsmbs/wcstod_nan.c
 
125
 create mode 100644 wcsmbs/wcstof_nan.c
 
126
 create mode 100644 wcsmbs/wcstold_nan.c
 
127
 
 
128
Index: b/include/stdlib.h
 
129
===================================================================
 
130
--- a/include/stdlib.h
 
131
+++ b/include/stdlib.h
 
132
@@ -203,6 +203,24 @@ libc_hidden_proto (strtoll)
 
133
 libc_hidden_proto (strtoul)
 
134
 libc_hidden_proto (strtoull)
 
135
 
 
136
+extern float __strtof_nan (const char *, char **, char) internal_function;
 
137
+extern double __strtod_nan (const char *, char **, char) internal_function;
 
138
+extern long double __strtold_nan (const char *, char **, char)
 
139
+     internal_function;
 
140
+extern float __wcstof_nan (const wchar_t *, wchar_t **, wchar_t)
 
141
+     internal_function;
 
142
+extern double __wcstod_nan (const wchar_t *, wchar_t **, wchar_t)
 
143
+     internal_function;
 
144
+extern long double __wcstold_nan (const wchar_t *, wchar_t **, wchar_t)
 
145
+     internal_function;
 
146
+
 
147
+libc_hidden_proto (__strtof_nan)
 
148
+libc_hidden_proto (__strtod_nan)
 
149
+libc_hidden_proto (__strtold_nan)
 
150
+libc_hidden_proto (__wcstof_nan)
 
151
+libc_hidden_proto (__wcstod_nan)
 
152
+libc_hidden_proto (__wcstold_nan)
 
153
+
 
154
 extern char *__ecvt (double __value, int __ndigit, int *__restrict __decpt,
 
155
                     int *__restrict __sign);
 
156
 extern char *__fcvt (double __value, int __ndigit, int *__restrict __decpt,
 
157
Index: b/include/wchar.h
 
158
===================================================================
 
159
--- a/include/wchar.h
 
160
+++ b/include/wchar.h
 
161
@@ -52,6 +52,9 @@ extern unsigned long long int __wcstoull
 
162
                                                   __restrict __endptr,
 
163
                                                   int __base,
 
164
                                                   int __group) __THROW;
 
165
+extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
 
166
+                                                      wchar_t **, int, int,
 
167
+                                                      __locale_t);
 
168
 libc_hidden_proto (__wcstof_internal)
 
169
 libc_hidden_proto (__wcstod_internal)
 
170
 libc_hidden_proto (__wcstold_internal)
 
171
Index: b/stdlib/Makefile
 
172
===================================================================
 
173
--- a/stdlib/Makefile
 
174
+++ b/stdlib/Makefile
 
175
@@ -49,6 +49,7 @@ routines-y    :=                                                            \
 
176
        strtol_l strtoul_l strtoll_l strtoull_l                               \
 
177
        strtof strtod strtold                                                 \
 
178
        strtof_l strtod_l strtold_l                                           \
 
179
+       strtof_nan strtod_nan strtold_nan                                     \
 
180
        system canonicalize                                                   \
 
181
        a64l l64a                                                             \
 
182
        getsubopt xpg_basename                                                \
 
183
Index: b/stdlib/strtod_l.c
 
184
===================================================================
 
185
--- a/stdlib/strtod_l.c
 
186
+++ b/stdlib/strtod_l.c
 
187
@@ -21,8 +21,6 @@
 
188
 #include <xlocale.h>
 
189
 
 
190
 extern double ____strtod_l_internal (const char *, char **, int, __locale_t);
 
191
-extern unsigned long long int ____strtoull_l_internal (const char *, char **,
 
192
-                                                      int, int, __locale_t);
 
193
 
 
194
 /* Configuration part.  These macros are defined by `strtold.c',
 
195
    `strtof.c', `wcstod.c', `wcstold.c', and `wcstof.c' to produce the
 
196
@@ -34,27 +32,20 @@ extern unsigned long long int ____strtou
 
197
 # ifdef USE_WIDE_CHAR
 
198
 #  define STRTOF       wcstod_l
 
199
 #  define __STRTOF     __wcstod_l
 
200
+#  define STRTOF_NAN   __wcstod_nan
 
201
 # else
 
202
 #  define STRTOF       strtod_l
 
203
 #  define __STRTOF     __strtod_l
 
204
+#  define STRTOF_NAN   __strtod_nan
 
205
 # endif
 
206
 # define MPN2FLOAT     __mpn_construct_double
 
207
 # define FLOAT_HUGE_VAL        HUGE_VAL
 
208
-# define SET_MANTISSA(flt, mant) \
 
209
-  do { union ieee754_double u;                                               \
 
210
-       u.d = (flt);                                                          \
 
211
-       u.ieee_nan.mantissa0 = (mant) >> 32;                                  \
 
212
-       u.ieee_nan.mantissa1 = (mant);                                        \
 
213
-       if ((u.ieee.mantissa0 | u.ieee.mantissa1) != 0)                       \
 
214
-        (flt) = u.d;                                                         \
 
215
-  } while (0)
 
216
 #endif
 
217
 /* End of configuration part.  */
 
218
 
 
219
 #include <ctype.h>
 
220
 #include <errno.h>
 
221
 #include <float.h>
 
222
-#include <ieee754.h>
 
223
 #include "../locale/localeinfo.h"
 
224
 #include <locale.h>
 
225
 #include <math.h>
 
226
@@ -105,7 +96,6 @@ extern unsigned long long int ____strtou
 
227
 # define TOLOWER_C(Ch) __towlower_l ((Ch), _nl_C_locobj_ptr)
 
228
 # define STRNCASECMP(S1, S2, N) \
 
229
   __wcsncasecmp_l ((S1), (S2), (N), _nl_C_locobj_ptr)
 
230
-# define STRTOULL(S, E, B) ____wcstoull_l_internal ((S), (E), (B), 0, loc)
 
231
 #else
 
232
 # define STRING_TYPE char
 
233
 # define CHAR_TYPE char
 
234
@@ -117,7 +107,6 @@ extern unsigned long long int ____strtou
 
235
 # define TOLOWER_C(Ch) __tolower_l ((Ch), _nl_C_locobj_ptr)
 
236
 # define STRNCASECMP(S1, S2, N) \
 
237
   __strncasecmp_l ((S1), (S2), (N), _nl_C_locobj_ptr)
 
238
-# define STRTOULL(S, E, B) ____strtoull_l_internal ((S), (E), (B), 0, loc)
 
239
 #endif
 
240
 
 
241
 
 
242
@@ -663,33 +652,14 @@ ____STRTOF_INTERNAL (nptr, endptr, group
 
243
          if (*cp == L_('('))
 
244
            {
 
245
              const STRING_TYPE *startp = cp;
 
246
-             do
 
247
-               ++cp;
 
248
-             while ((*cp >= L_('0') && *cp <= L_('9'))
 
249
-                    || ({ CHAR_TYPE lo = TOLOWER (*cp);
 
250
-                          lo >= L_('a') && lo <= L_('z'); })
 
251
-                    || *cp == L_('_'));
 
252
-
 
253
-             if (*cp != L_(')'))
 
254
-               /* The closing brace is missing.  Only match the NAN
 
255
-                  part.  */
 
256
-               cp = startp;
 
257
+             STRING_TYPE *endp;
 
258
+             retval = STRTOF_NAN (cp + 1, &endp, L_(')'));
 
259
+             if (*endp == L_(')'))
 
260
+               /* Consume the closing parenthesis.  */
 
261
+               cp = endp + 1;
 
262
              else
 
263
-               {
 
264
-                 /* This is a system-dependent way to specify the
 
265
-                    bitmask used for the NaN.  We expect it to be
 
266
-                    a number which is put in the mantissa of the
 
267
-                    number.  */
 
268
-                 STRING_TYPE *endp;
 
269
-                 unsigned long long int mant;
 
270
-
 
271
-                 mant = STRTOULL (startp + 1, &endp, 0);
 
272
-                 if (endp == cp)
 
273
-                   SET_MANTISSA (retval, mant);
 
274
-
 
275
-                 /* Consume the closing brace.  */
 
276
-                 ++cp;
 
277
-               }
 
278
+               /* Only match the NAN part.  */
 
279
+               cp = startp;
 
280
            }
 
281
 
 
282
          if (endptr != NULL)
 
283
Index: b/stdlib/strtod_nan.c
 
284
===================================================================
 
285
--- /dev/null
 
286
+++ b/stdlib/strtod_nan.c
 
287
@@ -0,0 +1,24 @@
 
288
+/* Convert string for NaN payload to corresponding NaN.  Narrow
 
289
+   strings, double.
 
290
+   Copyright (C) 2015 Free Software Foundation, Inc.
 
291
+   This file is part of the GNU C Library.
 
292
+
 
293
+   The GNU C Library is free software; you can redistribute it and/or
 
294
+   modify it under the terms of the GNU Lesser General Public
 
295
+   License as published by the Free Software Foundation; either
 
296
+   version 2.1 of the License, or (at your option) any later version.
 
297
+
 
298
+   The GNU C Library is distributed in the hope that it will be useful,
 
299
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
300
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
301
+   Lesser General Public License for more details.
 
302
+
 
303
+   You should have received a copy of the GNU Lesser General Public
 
304
+   License along with the GNU C Library; if not, see
 
305
+   <http://www.gnu.org/licenses/>.  */
 
306
+
 
307
+#include <strtod_nan_narrow.h>
 
308
+#include <strtod_nan_double.h>
 
309
+
 
310
+#define STRTOD_NAN __strtod_nan
 
311
+#include <strtod_nan_main.c>
 
312
Index: b/stdlib/strtod_nan_double.h
 
313
===================================================================
 
314
--- /dev/null
 
315
+++ b/stdlib/strtod_nan_double.h
 
316
@@ -0,0 +1,30 @@
 
317
+/* Convert string for NaN payload to corresponding NaN.  For double.
 
318
+   Copyright (C) 1997-2015 Free Software Foundation, Inc.
 
319
+   This file is part of the GNU C Library.
 
320
+
 
321
+   The GNU C Library is free software; you can redistribute it and/or
 
322
+   modify it under the terms of the GNU Lesser General Public
 
323
+   License as published by the Free Software Foundation; either
 
324
+   version 2.1 of the License, or (at your option) any later version.
 
325
+
 
326
+   The GNU C Library is distributed in the hope that it will be useful,
 
327
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
328
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
329
+   Lesser General Public License for more details.
 
330
+
 
331
+   You should have received a copy of the GNU Lesser General Public
 
332
+   License along with the GNU C Library; if not, see
 
333
+   <http://www.gnu.org/licenses/>.  */
 
334
+
 
335
+#define FLOAT          double
 
336
+#define SET_MANTISSA(flt, mant)                                \
 
337
+  do                                                   \
 
338
+    {                                                  \
 
339
+      union ieee754_double u;                          \
 
340
+      u.d = (flt);                                     \
 
341
+      u.ieee_nan.mantissa0 = (mant) >> 32;             \
 
342
+      u.ieee_nan.mantissa1 = (mant);                   \
 
343
+      if ((u.ieee.mantissa0 | u.ieee.mantissa1) != 0)  \
 
344
+       (flt) = u.d;                                    \
 
345
+    }                                                  \
 
346
+  while (0)
 
347
Index: b/stdlib/strtod_nan_float.h
 
348
===================================================================
 
349
--- /dev/null
 
350
+++ b/stdlib/strtod_nan_float.h
 
351
@@ -0,0 +1,29 @@
 
352
+/* Convert string for NaN payload to corresponding NaN.  For float.
 
353
+   Copyright (C) 1997-2015 Free Software Foundation, Inc.
 
354
+   This file is part of the GNU C Library.
 
355
+
 
356
+   The GNU C Library is free software; you can redistribute it and/or
 
357
+   modify it under the terms of the GNU Lesser General Public
 
358
+   License as published by the Free Software Foundation; either
 
359
+   version 2.1 of the License, or (at your option) any later version.
 
360
+
 
361
+   The GNU C Library is distributed in the hope that it will be useful,
 
362
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
363
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
364
+   Lesser General Public License for more details.
 
365
+
 
366
+   You should have received a copy of the GNU Lesser General Public
 
367
+   License along with the GNU C Library; if not, see
 
368
+   <http://www.gnu.org/licenses/>.  */
 
369
+
 
370
+#define        FLOAT           float
 
371
+#define SET_MANTISSA(flt, mant)                        \
 
372
+  do                                           \
 
373
+    {                                          \
 
374
+      union ieee754_float u;                   \
 
375
+      u.f = (flt);                             \
 
376
+      u.ieee_nan.mantissa = (mant);            \
 
377
+      if (u.ieee.mantissa != 0)                        \
 
378
+       (flt) = u.f;                            \
 
379
+    }                                          \
 
380
+  while (0)
 
381
Index: b/stdlib/strtod_nan_main.c
 
382
===================================================================
 
383
--- /dev/null
 
384
+++ b/stdlib/strtod_nan_main.c
 
385
@@ -0,0 +1,63 @@
 
386
+/* Convert string for NaN payload to corresponding NaN.
 
387
+   Copyright (C) 1997-2015 Free Software Foundation, Inc.
 
388
+   This file is part of the GNU C Library.
 
389
+
 
390
+   The GNU C Library is free software; you can redistribute it and/or
 
391
+   modify it under the terms of the GNU Lesser General Public
 
392
+   License as published by the Free Software Foundation; either
 
393
+   version 2.1 of the License, or (at your option) any later version.
 
394
+
 
395
+   The GNU C Library is distributed in the hope that it will be useful,
 
396
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
397
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
398
+   Lesser General Public License for more details.
 
399
+
 
400
+   You should have received a copy of the GNU Lesser General Public
 
401
+   License along with the GNU C Library; if not, see
 
402
+   <http://www.gnu.org/licenses/>.  */
 
403
+
 
404
+#include <ieee754.h>
 
405
+#include <locale.h>
 
406
+#include <math.h>
 
407
+#include <stdlib.h>
 
408
+#include <wchar.h>
 
409
+
 
410
+
 
411
+/* If STR starts with an optional n-char-sequence as defined by ISO C
 
412
+   (a sequence of ASCII letters, digits and underscores), followed by
 
413
+   ENDC, return a NaN whose payload is set based on STR.  Otherwise,
 
414
+   return a default NAN.  If ENDPTR is not NULL, set *ENDPTR to point
 
415
+   to the character after the initial n-char-sequence.  */
 
416
+
 
417
+internal_function
 
418
+FLOAT
 
419
+STRTOD_NAN (const STRING_TYPE *str, STRING_TYPE **endptr, STRING_TYPE endc)
 
420
+{
 
421
+  const STRING_TYPE *cp = str;
 
422
+
 
423
+  while ((*cp >= L_('0') && *cp <= L_('9'))
 
424
+        || (*cp >= L_('A') && *cp <= L_('Z'))
 
425
+        || (*cp >= L_('a') && *cp <= L_('z'))
 
426
+        || *cp == L_('_'))
 
427
+    ++cp;
 
428
+
 
429
+  FLOAT retval = NAN;
 
430
+  if (*cp != endc)
 
431
+    goto out;
 
432
+
 
433
+  /* This is a system-dependent way to specify the bitmask used for
 
434
+     the NaN.  We expect it to be a number which is put in the
 
435
+     mantissa of the number.  */
 
436
+  STRING_TYPE *endp;
 
437
+  unsigned long long int mant;
 
438
+
 
439
+  mant = STRTOULL (str, &endp, 0);
 
440
+  if (endp == cp)
 
441
+    SET_MANTISSA (retval, mant);
 
442
+
 
443
+ out:
 
444
+  if (endptr != NULL)
 
445
+    *endptr = (STRING_TYPE *) cp;
 
446
+  return retval;
 
447
+}
 
448
+libc_hidden_def (STRTOD_NAN)
 
449
Index: b/stdlib/strtod_nan_narrow.h
 
450
===================================================================
 
451
--- /dev/null
 
452
+++ b/stdlib/strtod_nan_narrow.h
 
453
@@ -0,0 +1,22 @@
 
454
+/* Convert string for NaN payload to corresponding NaN.  Narrow strings.
 
455
+   Copyright (C) 1997-2015 Free Software Foundation, Inc.
 
456
+   This file is part of the GNU C Library.
 
457
+
 
458
+   The GNU C Library is free software; you can redistribute it and/or
 
459
+   modify it under the terms of the GNU Lesser General Public
 
460
+   License as published by the Free Software Foundation; either
 
461
+   version 2.1 of the License, or (at your option) any later version.
 
462
+
 
463
+   The GNU C Library is distributed in the hope that it will be useful,
 
464
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
465
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
466
+   Lesser General Public License for more details.
 
467
+
 
468
+   You should have received a copy of the GNU Lesser General Public
 
469
+   License along with the GNU C Library; if not, see
 
470
+   <http://www.gnu.org/licenses/>.  */
 
471
+
 
472
+#define STRING_TYPE char
 
473
+#define L_(Ch) Ch
 
474
+#define STRTOULL(S, E, B) ____strtoull_l_internal ((S), (E), (B), 0,   \
 
475
+                                                  _nl_C_locobj_ptr)
 
476
Index: b/stdlib/strtod_nan_wide.h
 
477
===================================================================
 
478
--- /dev/null
 
479
+++ b/stdlib/strtod_nan_wide.h
 
480
@@ -0,0 +1,22 @@
 
481
+/* Convert string for NaN payload to corresponding NaN.  Wide strings.
 
482
+   Copyright (C) 1997-2015 Free Software Foundation, Inc.
 
483
+   This file is part of the GNU C Library.
 
484
+
 
485
+   The GNU C Library is free software; you can redistribute it and/or
 
486
+   modify it under the terms of the GNU Lesser General Public
 
487
+   License as published by the Free Software Foundation; either
 
488
+   version 2.1 of the License, or (at your option) any later version.
 
489
+
 
490
+   The GNU C Library is distributed in the hope that it will be useful,
 
491
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
492
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
493
+   Lesser General Public License for more details.
 
494
+
 
495
+   You should have received a copy of the GNU Lesser General Public
 
496
+   License along with the GNU C Library; if not, see
 
497
+   <http://www.gnu.org/licenses/>.  */
 
498
+
 
499
+#define STRING_TYPE wchar_t
 
500
+#define L_(Ch) L##Ch
 
501
+#define STRTOULL(S, E, B) ____wcstoull_l_internal ((S), (E), (B), 0,   \
 
502
+                                                  _nl_C_locobj_ptr)
 
503
Index: b/stdlib/strtof_l.c
 
504
===================================================================
 
505
--- a/stdlib/strtof_l.c
 
506
+++ b/stdlib/strtof_l.c
 
507
@@ -20,26 +20,19 @@
 
508
 #include <xlocale.h>
 
509
 
 
510
 extern float ____strtof_l_internal (const char *, char **, int, __locale_t);
 
511
-extern unsigned long long int ____strtoull_l_internal (const char *, char **,
 
512
-                                                      int, int, __locale_t);
 
513
 
 
514
 #define        FLOAT           float
 
515
 #define        FLT             FLT
 
516
 #ifdef USE_WIDE_CHAR
 
517
 # define STRTOF                wcstof_l
 
518
 # define __STRTOF      __wcstof_l
 
519
+# define STRTOF_NAN    __wcstof_nan
 
520
 #else
 
521
 # define STRTOF                strtof_l
 
522
 # define __STRTOF      __strtof_l
 
523
+# define STRTOF_NAN    __strtof_nan
 
524
 #endif
 
525
 #define        MPN2FLOAT       __mpn_construct_float
 
526
 #define        FLOAT_HUGE_VAL  HUGE_VALF
 
527
-#define SET_MANTISSA(flt, mant) \
 
528
-  do { union ieee754_float u;                                                \
 
529
-       u.f = (flt);                                                          \
 
530
-       u.ieee_nan.mantissa = (mant);                                         \
 
531
-       if (u.ieee.mantissa != 0)                                             \
 
532
-        (flt) = u.f;                                                         \
 
533
-  } while (0)
 
534
 
 
535
 #include "strtod_l.c"
 
536
Index: b/stdlib/strtof_nan.c
 
537
===================================================================
 
538
--- /dev/null
 
539
+++ b/stdlib/strtof_nan.c
 
540
@@ -0,0 +1,24 @@
 
541
+/* Convert string for NaN payload to corresponding NaN.  Narrow
 
542
+   strings, float.
 
543
+   Copyright (C) 2015 Free Software Foundation, Inc.
 
544
+   This file is part of the GNU C Library.
 
545
+
 
546
+   The GNU C Library is free software; you can redistribute it and/or
 
547
+   modify it under the terms of the GNU Lesser General Public
 
548
+   License as published by the Free Software Foundation; either
 
549
+   version 2.1 of the License, or (at your option) any later version.
 
550
+
 
551
+   The GNU C Library is distributed in the hope that it will be useful,
 
552
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
553
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
554
+   Lesser General Public License for more details.
 
555
+
 
556
+   You should have received a copy of the GNU Lesser General Public
 
557
+   License along with the GNU C Library; if not, see
 
558
+   <http://www.gnu.org/licenses/>.  */
 
559
+
 
560
+#include <strtod_nan_narrow.h>
 
561
+#include <strtod_nan_float.h>
 
562
+
 
563
+#define STRTOD_NAN __strtof_nan
 
564
+#include <strtod_nan_main.c>
 
565
Index: b/stdlib/strtold_nan.c
 
566
===================================================================
 
567
--- /dev/null
 
568
+++ b/stdlib/strtold_nan.c
 
569
@@ -0,0 +1,30 @@
 
570
+/* Convert string for NaN payload to corresponding NaN.  Narrow
 
571
+   strings, long double.
 
572
+   Copyright (C) 2015 Free Software Foundation, Inc.
 
573
+   This file is part of the GNU C Library.
 
574
+
 
575
+   The GNU C Library is free software; you can redistribute it and/or
 
576
+   modify it under the terms of the GNU Lesser General Public
 
577
+   License as published by the Free Software Foundation; either
 
578
+   version 2.1 of the License, or (at your option) any later version.
 
579
+
 
580
+   The GNU C Library is distributed in the hope that it will be useful,
 
581
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
582
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
583
+   Lesser General Public License for more details.
 
584
+
 
585
+   You should have received a copy of the GNU Lesser General Public
 
586
+   License along with the GNU C Library; if not, see
 
587
+   <http://www.gnu.org/licenses/>.  */
 
588
+
 
589
+#include <math.h>
 
590
+
 
591
+/* This function is unused if long double and double have the same
 
592
+   representation.  */
 
593
+#ifndef __NO_LONG_DOUBLE_MATH
 
594
+# include <strtod_nan_narrow.h>
 
595
+# include <strtod_nan_ldouble.h>
 
596
+
 
597
+# define STRTOD_NAN __strtold_nan
 
598
+# include <strtod_nan_main.c>
 
599
+#endif
 
600
Index: b/sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h
 
601
===================================================================
 
602
--- /dev/null
 
603
+++ b/sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h
 
604
@@ -0,0 +1,33 @@
 
605
+/* Convert string for NaN payload to corresponding NaN.  For ldbl-128.
 
606
+   Copyright (C) 1997-2015 Free Software Foundation, Inc.
 
607
+   This file is part of the GNU C Library.
 
608
+
 
609
+   The GNU C Library is free software; you can redistribute it and/or
 
610
+   modify it under the terms of the GNU Lesser General Public
 
611
+   License as published by the Free Software Foundation; either
 
612
+   version 2.1 of the License, or (at your option) any later version.
 
613
+
 
614
+   The GNU C Library is distributed in the hope that it will be useful,
 
615
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
616
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
617
+   Lesser General Public License for more details.
 
618
+
 
619
+   You should have received a copy of the GNU Lesser General Public
 
620
+   License along with the GNU C Library; if not, see
 
621
+   <http://www.gnu.org/licenses/>.  */
 
622
+
 
623
+#define FLOAT          long double
 
624
+#define SET_MANTISSA(flt, mant)                                \
 
625
+  do                                                   \
 
626
+    {                                                  \
 
627
+      union ieee854_long_double u;                     \
 
628
+      u.d = (flt);                                     \
 
629
+      u.ieee_nan.mantissa0 = 0;                                \
 
630
+      u.ieee_nan.mantissa1 = 0;                                \
 
631
+      u.ieee_nan.mantissa2 = (mant) >> 32;             \
 
632
+      u.ieee_nan.mantissa3 = (mant);                   \
 
633
+      if ((u.ieee.mantissa0 | u.ieee.mantissa1         \
 
634
+          | u.ieee.mantissa2 | u.ieee.mantissa3) != 0) \
 
635
+       (flt) = u.d;                                    \
 
636
+    }                                                  \
 
637
+  while (0)
 
638
Index: b/sysdeps/ieee754/ldbl-128/strtold_l.c
 
639
===================================================================
 
640
--- a/sysdeps/ieee754/ldbl-128/strtold_l.c
 
641
+++ b/sysdeps/ieee754/ldbl-128/strtold_l.c
 
642
@@ -25,22 +25,13 @@
 
643
 #ifdef USE_WIDE_CHAR
 
644
 # define STRTOF                wcstold_l
 
645
 # define __STRTOF      __wcstold_l
 
646
+# define STRTOF_NAN    __wcstold_nan
 
647
 #else
 
648
 # define STRTOF                strtold_l
 
649
 # define __STRTOF      __strtold_l
 
650
+# define STRTOF_NAN    __strtold_nan
 
651
 #endif
 
652
 #define MPN2FLOAT      __mpn_construct_long_double
 
653
 #define FLOAT_HUGE_VAL HUGE_VALL
 
654
-#define SET_MANTISSA(flt, mant) \
 
655
-  do { union ieee854_long_double u;                                          \
 
656
-       u.d = (flt);                                                          \
 
657
-       u.ieee_nan.mantissa0 = 0;                                             \
 
658
-       u.ieee_nan.mantissa1 = 0;                                             \
 
659
-       u.ieee_nan.mantissa2 = (mant) >> 32;                                  \
 
660
-       u.ieee_nan.mantissa3 = (mant);                                        \
 
661
-       if ((u.ieee.mantissa0 | u.ieee.mantissa1                                      \
 
662
-           | u.ieee.mantissa2 | u.ieee.mantissa3) != 0)                      \
 
663
-        (flt) = u.d;                                                         \
 
664
-  } while (0)
 
665
 
 
666
 #include <strtod_l.c>
 
667
Index: b/sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h
 
668
===================================================================
 
669
--- /dev/null
 
670
+++ b/sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h
 
671
@@ -0,0 +1,30 @@
 
672
+/* Convert string for NaN payload to corresponding NaN.  For ldbl-128ibm.
 
673
+   Copyright (C) 1997-2015 Free Software Foundation, Inc.
 
674
+   This file is part of the GNU C Library.
 
675
+
 
676
+   The GNU C Library is free software; you can redistribute it and/or
 
677
+   modify it under the terms of the GNU Lesser General Public
 
678
+   License as published by the Free Software Foundation; either
 
679
+   version 2.1 of the License, or (at your option) any later version.
 
680
+
 
681
+   The GNU C Library is distributed in the hope that it will be useful,
 
682
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
683
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
684
+   Lesser General Public License for more details.
 
685
+
 
686
+   You should have received a copy of the GNU Lesser General Public
 
687
+   License along with the GNU C Library; if not, see
 
688
+   <http://www.gnu.org/licenses/>.  */
 
689
+
 
690
+#define FLOAT          long double
 
691
+#define SET_MANTISSA(flt, mant)                                        \
 
692
+  do                                                           \
 
693
+    {                                                          \
 
694
+      union ibm_extended_long_double u;                                \
 
695
+      u.ld = (flt);                                            \
 
696
+      u.d[0].ieee_nan.mantissa0 = (mant) >> 32;                        \
 
697
+      u.d[0].ieee_nan.mantissa1 = (mant);                      \
 
698
+      if ((u.d[0].ieee.mantissa0 | u.d[0].ieee.mantissa1) != 0)        \
 
699
+       (flt) = u.ld;                                           \
 
700
+    }                                                          \
 
701
+  while (0)
 
702
Index: b/sysdeps/ieee754/ldbl-128ibm/strtold_l.c
 
703
===================================================================
 
704
--- a/sysdeps/ieee754/ldbl-128ibm/strtold_l.c
 
705
+++ b/sysdeps/ieee754/ldbl-128ibm/strtold_l.c
 
706
@@ -30,25 +30,19 @@ extern long double ____new_wcstold_l (co
 
707
 # define STRTOF                __new_wcstold_l
 
708
 # define __STRTOF      ____new_wcstold_l
 
709
 # define ____STRTOF_INTERNAL ____wcstold_l_internal
 
710
+# define STRTOF_NAN    __wcstold_nan
 
711
 #else
 
712
 extern long double ____new_strtold_l (const char *, char **, __locale_t);
 
713
 # define STRTOF                __new_strtold_l
 
714
 # define __STRTOF      ____new_strtold_l
 
715
 # define ____STRTOF_INTERNAL ____strtold_l_internal
 
716
+# define STRTOF_NAN    __strtold_nan
 
717
 #endif
 
718
 extern __typeof (__STRTOF) STRTOF;
 
719
 libc_hidden_proto (__STRTOF)
 
720
 libc_hidden_proto (STRTOF)
 
721
 #define MPN2FLOAT      __mpn_construct_long_double
 
722
 #define FLOAT_HUGE_VAL HUGE_VALL
 
723
-# define SET_MANTISSA(flt, mant) \
 
724
-  do { union ibm_extended_long_double u;                                     \
 
725
-       u.ld = (flt);                                                         \
 
726
-       u.d[0].ieee_nan.mantissa0 = (mant) >> 32;                             \
 
727
-       u.d[0].ieee_nan.mantissa1 = (mant);                                   \
 
728
-       if ((u.d[0].ieee.mantissa0 | u.d[0].ieee.mantissa1) != 0)             \
 
729
-        (flt) = u.ld;                                                        \
 
730
-  } while (0)
 
731
 
 
732
 #include <strtod_l.c>
 
733
 
 
734
Index: b/sysdeps/ieee754/ldbl-64-128/strtold_l.c
 
735
===================================================================
 
736
--- a/sysdeps/ieee754/ldbl-64-128/strtold_l.c
 
737
+++ b/sysdeps/ieee754/ldbl-64-128/strtold_l.c
 
738
@@ -30,28 +30,19 @@ extern long double ____new_wcstold_l (co
 
739
 # define STRTOF                __new_wcstold_l
 
740
 # define __STRTOF      ____new_wcstold_l
 
741
 # define ____STRTOF_INTERNAL ____wcstold_l_internal
 
742
+# define STRTOF_NAN    __wcstold_nan
 
743
 #else
 
744
 extern long double ____new_strtold_l (const char *, char **, __locale_t);
 
745
 # define STRTOF                __new_strtold_l
 
746
 # define __STRTOF      ____new_strtold_l
 
747
 # define ____STRTOF_INTERNAL ____strtold_l_internal
 
748
+# define STRTOF_NAN    __strtold_nan
 
749
 #endif
 
750
 extern __typeof (__STRTOF) STRTOF;
 
751
 libc_hidden_proto (__STRTOF)
 
752
 libc_hidden_proto (STRTOF)
 
753
 #define MPN2FLOAT      __mpn_construct_long_double
 
754
 #define FLOAT_HUGE_VAL HUGE_VALL
 
755
-#define SET_MANTISSA(flt, mant) \
 
756
-  do { union ieee854_long_double u;                                          \
 
757
-       u.d = (flt);                                                          \
 
758
-       u.ieee_nan.mantissa0 = 0;                                             \
 
759
-       u.ieee_nan.mantissa1 = 0;                                             \
 
760
-       u.ieee_nan.mantissa2 = (mant) >> 32;                                  \
 
761
-       u.ieee_nan.mantissa3 = (mant);                                        \
 
762
-       if ((u.ieee.mantissa0 | u.ieee.mantissa1                                      \
 
763
-           | u.ieee.mantissa2 | u.ieee.mantissa3) != 0)                      \
 
764
-        (flt) = u.d;                                                         \
 
765
-  } while (0)
 
766
 
 
767
 #include <strtod_l.c>
 
768
 
 
769
Index: b/sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h
 
770
===================================================================
 
771
--- /dev/null
 
772
+++ b/sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h
 
773
@@ -0,0 +1,30 @@
 
774
+/* Convert string for NaN payload to corresponding NaN.  For ldbl-96.
 
775
+   Copyright (C) 1997-2015 Free Software Foundation, Inc.
 
776
+   This file is part of the GNU C Library.
 
777
+
 
778
+   The GNU C Library is free software; you can redistribute it and/or
 
779
+   modify it under the terms of the GNU Lesser General Public
 
780
+   License as published by the Free Software Foundation; either
 
781
+   version 2.1 of the License, or (at your option) any later version.
 
782
+
 
783
+   The GNU C Library is distributed in the hope that it will be useful,
 
784
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
785
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
786
+   Lesser General Public License for more details.
 
787
+
 
788
+   You should have received a copy of the GNU Lesser General Public
 
789
+   License along with the GNU C Library; if not, see
 
790
+   <http://www.gnu.org/licenses/>.  */
 
791
+
 
792
+#define FLOAT          long double
 
793
+#define SET_MANTISSA(flt, mant)                                \
 
794
+  do                                                   \
 
795
+    {                                                  \
 
796
+      union ieee854_long_double u;                     \
 
797
+      u.d = (flt);                                     \
 
798
+      u.ieee_nan.mantissa0 = (mant) >> 32;             \
 
799
+      u.ieee_nan.mantissa1 = (mant);                   \
 
800
+      if ((u.ieee.mantissa0 | u.ieee.mantissa1) != 0)  \
 
801
+       (flt) = u.d;                                    \
 
802
+    }                                                  \
 
803
+  while (0)
 
804
Index: b/sysdeps/ieee754/ldbl-96/strtold_l.c
 
805
===================================================================
 
806
--- a/sysdeps/ieee754/ldbl-96/strtold_l.c
 
807
+++ b/sysdeps/ieee754/ldbl-96/strtold_l.c
 
808
@@ -25,19 +25,13 @@
 
809
 #ifdef USE_WIDE_CHAR
 
810
 # define STRTOF                wcstold_l
 
811
 # define __STRTOF      __wcstold_l
 
812
+# define STRTOF_NAN    __wcstold_nan
 
813
 #else
 
814
 # define STRTOF                strtold_l
 
815
 # define __STRTOF      __strtold_l
 
816
+# define STRTOF_NAN    __strtold_nan
 
817
 #endif
 
818
 #define MPN2FLOAT      __mpn_construct_long_double
 
819
 #define FLOAT_HUGE_VAL HUGE_VALL
 
820
-#define SET_MANTISSA(flt, mant) \
 
821
-  do { union ieee854_long_double u;                                          \
 
822
-       u.d = (flt);                                                          \
 
823
-       u.ieee_nan.mantissa0 = (mant) >> 32;                                  \
 
824
-       u.ieee_nan.mantissa1 = (mant);                                        \
 
825
-       if ((u.ieee.mantissa0 | u.ieee.mantissa1) != 0)                       \
 
826
-        (flt) = u.d;                                                         \
 
827
-  } while (0)
 
828
 
 
829
 #include <stdlib/strtod_l.c>
 
830
Index: b/wcsmbs/Makefile
 
831
===================================================================
 
832
--- a/wcsmbs/Makefile
 
833
+++ b/wcsmbs/Makefile
 
834
@@ -37,6 +37,7 @@ routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR
 
835
            wcstol wcstoul wcstoll wcstoull wcstod wcstold wcstof \
 
836
            wcstol_l wcstoul_l wcstoll_l wcstoull_l \
 
837
            wcstod_l wcstold_l wcstof_l \
 
838
+           wcstod_nan wcstold_nan wcstof_nan \
 
839
            wcscoll wcsxfrm \
 
840
            wcwidth wcswidth \
 
841
            wcscoll_l wcsxfrm_l \
 
842
Index: b/wcsmbs/wcstod_l.c
 
843
===================================================================
 
844
--- a/wcsmbs/wcstod_l.c
 
845
+++ b/wcsmbs/wcstod_l.c
 
846
@@ -23,9 +23,6 @@
 
847
 
 
848
 extern double ____wcstod_l_internal (const wchar_t *, wchar_t **, int,
 
849
                                     __locale_t);
 
850
-extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
 
851
-                                                      wchar_t **, int, int,
 
852
-                                                      __locale_t);
 
853
 
 
854
 #define        USE_WIDE_CHAR   1
 
855
 
 
856
Index: b/wcsmbs/wcstod_nan.c
 
857
===================================================================
 
858
--- /dev/null
 
859
+++ b/wcsmbs/wcstod_nan.c
 
860
@@ -0,0 +1,23 @@
 
861
+/* Convert string for NaN payload to corresponding NaN.  Wide strings, double.
 
862
+   Copyright (C) 2015 Free Software Foundation, Inc.
 
863
+   This file is part of the GNU C Library.
 
864
+
 
865
+   The GNU C Library is free software; you can redistribute it and/or
 
866
+   modify it under the terms of the GNU Lesser General Public
 
867
+   License as published by the Free Software Foundation; either
 
868
+   version 2.1 of the License, or (at your option) any later version.
 
869
+
 
870
+   The GNU C Library is distributed in the hope that it will be useful,
 
871
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
872
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
873
+   Lesser General Public License for more details.
 
874
+
 
875
+   You should have received a copy of the GNU Lesser General Public
 
876
+   License along with the GNU C Library; if not, see
 
877
+   <http://www.gnu.org/licenses/>.  */
 
878
+
 
879
+#include "../stdlib/strtod_nan_wide.h"
 
880
+#include "../stdlib/strtod_nan_double.h"
 
881
+
 
882
+#define STRTOD_NAN __wcstod_nan
 
883
+#include "../stdlib/strtod_nan_main.c"
 
884
Index: b/wcsmbs/wcstof_l.c
 
885
===================================================================
 
886
--- a/wcsmbs/wcstof_l.c
 
887
+++ b/wcsmbs/wcstof_l.c
 
888
@@ -25,8 +25,5 @@
 
889
 
 
890
 extern float ____wcstof_l_internal (const wchar_t *, wchar_t **, int,
 
891
                                    __locale_t);
 
892
-extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
 
893
-                                                      wchar_t **, int, int,
 
894
-                                                      __locale_t);
 
895
 
 
896
 #include <stdlib/strtof_l.c>
 
897
Index: b/wcsmbs/wcstof_nan.c
 
898
===================================================================
 
899
--- /dev/null
 
900
+++ b/wcsmbs/wcstof_nan.c
 
901
@@ -0,0 +1,23 @@
 
902
+/* Convert string for NaN payload to corresponding NaN.  Wide strings, float.
 
903
+   Copyright (C) 2015 Free Software Foundation, Inc.
 
904
+   This file is part of the GNU C Library.
 
905
+
 
906
+   The GNU C Library is free software; you can redistribute it and/or
 
907
+   modify it under the terms of the GNU Lesser General Public
 
908
+   License as published by the Free Software Foundation; either
 
909
+   version 2.1 of the License, or (at your option) any later version.
 
910
+
 
911
+   The GNU C Library is distributed in the hope that it will be useful,
 
912
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
913
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
914
+   Lesser General Public License for more details.
 
915
+
 
916
+   You should have received a copy of the GNU Lesser General Public
 
917
+   License along with the GNU C Library; if not, see
 
918
+   <http://www.gnu.org/licenses/>.  */
 
919
+
 
920
+#include "../stdlib/strtod_nan_wide.h"
 
921
+#include "../stdlib/strtod_nan_float.h"
 
922
+
 
923
+#define STRTOD_NAN __wcstof_nan
 
924
+#include "../stdlib/strtod_nan_main.c"
 
925
Index: b/wcsmbs/wcstold_l.c
 
926
===================================================================
 
927
--- a/wcsmbs/wcstold_l.c
 
928
+++ b/wcsmbs/wcstold_l.c
 
929
@@ -24,8 +24,5 @@
 
930
 
 
931
 extern long double ____wcstold_l_internal (const wchar_t *, wchar_t **, int,
 
932
                                           __locale_t);
 
933
-extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
 
934
-                                                      wchar_t **, int, int,
 
935
-                                                      __locale_t);
 
936
 
 
937
 #include <strtold_l.c>
 
938
Index: b/wcsmbs/wcstold_nan.c
 
939
===================================================================
 
940
--- /dev/null
 
941
+++ b/wcsmbs/wcstold_nan.c
 
942
@@ -0,0 +1,30 @@
 
943
+/* Convert string for NaN payload to corresponding NaN.  Wide strings,
 
944
+   long double.
 
945
+   Copyright (C) 2015 Free Software Foundation, Inc.
 
946
+   This file is part of the GNU C Library.
 
947
+
 
948
+   The GNU C Library is free software; you can redistribute it and/or
 
949
+   modify it under the terms of the GNU Lesser General Public
 
950
+   License as published by the Free Software Foundation; either
 
951
+   version 2.1 of the License, or (at your option) any later version.
 
952
+
 
953
+   The GNU C Library is distributed in the hope that it will be useful,
 
954
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
955
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
956
+   Lesser General Public License for more details.
 
957
+
 
958
+   You should have received a copy of the GNU Lesser General Public
 
959
+   License along with the GNU C Library; if not, see
 
960
+   <http://www.gnu.org/licenses/>.  */
 
961
+
 
962
+#include <math.h>
 
963
+
 
964
+/* This function is unused if long double and double have the same
 
965
+   representation.  */
 
966
+#ifndef __NO_LONG_DOUBLE_MATH
 
967
+# include "../stdlib/strtod_nan_wide.h"
 
968
+# include <strtod_nan_ldouble.h>
 
969
+
 
970
+# define STRTOD_NAN __wcstold_nan
 
971
+# include "../stdlib/strtod_nan_main.c"
 
972
+#endif