wok-4.x view glibc/stuff/patches/glibc-2.22-CVE-2014-9761.patch @ rev 12476

Up glibc (2.22) with CVE patchs
author Stanislas Leduc <shann@slitaz.org>
date Wed Mar 15 11:41:38 2023 +0000 (16 months ago)
parents
children
line source
1 Based on:
3 https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=patch;h=e02cabecf0d025ec4f4ddee290bdf7aadb873bb3
4 https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=patch;h=8f5e8b01a1da2a207228f2072c934fa5918554b8
6 From e02cabecf0d025ec4f4ddee290bdf7aadb873bb3 Mon Sep 17 00:00:00 2001
7 From: Joseph Myers <joseph@codesourcery.com>
8 Date: Tue, 24 Nov 2015 22:24:52 +0000
9 Subject: [PATCH] Refactor strtod parsing of NaN payloads.
11 The nan* functions handle their string argument by constructing a
12 NAN(...) string on the stack as a VLA and passing it to strtod
13 functions.
15 This approach has problems discussed in bug 16961 and bug 16962: the
16 stack usage is unbounded, and it gives incorrect results in certain
17 cases where the argument is not a valid n-char-sequence.
19 The natural fix for both issues is to refactor the NaN payload parsing
20 out of strtod into a separate function that the nan* functions can
21 call directly, so that no temporary string needs constructing on the
22 stack at all. This patch does that refactoring in preparation for
23 fixing those bugs (but without actually using the new functions from
24 nan* - which will also require exporting them from libc at version
25 GLIBC_PRIVATE). This patch is not intended to change any user-visible
26 behavior, so no tests are added (fixes for the above bugs will of
27 course add tests for them).
29 This patch builds on my recent fixes for strtol and strtod issues in
30 Turkish locales. Given those fixes, the parsing of NaN payloads is
31 locale-independent; thus, the new functions do not need to take a
32 locale_t argument.
34 diff -Naur a/include/stdlib.h b/include/stdlib.h
35 --- a/include/stdlib.h 2017-09-15 15:37:06.011900628 +0530
36 +++ b/include/stdlib.h 2017-09-15 15:37:13.851729724 +0530
37 @@ -203,6 +203,24 @@
38 libc_hidden_proto (strtoul)
39 libc_hidden_proto (strtoull)
41 +extern float __strtof_nan (const char *, char **, char) internal_function;
42 +extern double __strtod_nan (const char *, char **, char) internal_function;
43 +extern long double __strtold_nan (const char *, char **, char)
44 + internal_function;
45 +extern float __wcstof_nan (const wchar_t *, wchar_t **, wchar_t)
46 + internal_function;
47 +extern double __wcstod_nan (const wchar_t *, wchar_t **, wchar_t)
48 + internal_function;
49 +extern long double __wcstold_nan (const wchar_t *, wchar_t **, wchar_t)
50 + internal_function;
51 +
52 +libc_hidden_proto (__strtof_nan)
53 +libc_hidden_proto (__strtod_nan)
54 +libc_hidden_proto (__strtold_nan)
55 +libc_hidden_proto (__wcstof_nan)
56 +libc_hidden_proto (__wcstod_nan)
57 +libc_hidden_proto (__wcstold_nan)
58 +
59 extern char *__ecvt (double __value, int __ndigit, int *__restrict __decpt,
60 int *__restrict __sign);
61 extern char *__fcvt (double __value, int __ndigit, int *__restrict __decpt,
62 diff -Naur a/include/wchar.h b/include/wchar.h
63 --- a/include/wchar.h 2017-09-15 15:37:06.011900628 +0530
64 +++ b/include/wchar.h 2017-09-15 15:37:13.851729724 +0530
65 @@ -52,6 +52,9 @@
66 __restrict __endptr,
67 int __base,
68 int __group) __THROW;
69 +extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
70 + wchar_t **, int, int,
71 + __locale_t);
72 libc_hidden_proto (__wcstof_internal)
73 libc_hidden_proto (__wcstod_internal)
74 libc_hidden_proto (__wcstold_internal)
75 diff -Naur a/math/Makefile b/math/Makefile
76 --- a/math/Makefile 2017-09-15 15:37:06.039900018 +0530
77 +++ b/math/Makefile 2017-09-15 15:41:38.669965657 +0530
78 @@ -108,6 +108,7 @@
79 test-tgmath-ret bug-nextafter bug-nexttoward bug-tgmath1 \
80 test-tgmath-int test-tgmath2 test-powl tst-CMPLX tst-CMPLX2 test-snan \
81 test-fenv-tls test-fenv-preserve test-fenv-return test-fenvinline \
82 + test-signgam-ullong-init test-nan-overflow test-nan-payload \
83 $(tests-static)
84 tests-static = test-fpucw-static test-fpucw-ieee-static
85 # We do the `long double' tests only if this data type is available and
86 diff -Naur a/math/s_nan.c b/math/s_nan.c
87 --- a/math/s_nan.c 2017-09-15 15:37:06.051899756 +0530
88 +++ b/math/s_nan.c 2017-09-15 15:38:10.122503550 +0530
89 @@ -28,14 +28,7 @@
90 double
91 __nan (const char *tagp)
92 {
93 - if (tagp[0] != '\0')
94 - {
95 - char buf[6 + strlen (tagp)];
96 - sprintf (buf, "NAN(%s)", tagp);
97 - return strtod (buf, NULL);
98 - }
99 -
100 - return NAN;
101 + return __strtod_nan (tagp, NULL, 0);
102 }
103 weak_alias (__nan, nan)
104 #ifdef NO_LONG_DOUBLE
105 diff -Naur a/math/s_nanf.c b/math/s_nanf.c
106 --- a/math/s_nanf.c 2017-09-15 15:37:06.051899756 +0530
107 +++ b/math/s_nanf.c 2017-09-15 15:38:10.122503550 +0530
108 @@ -28,13 +28,6 @@
109 float
110 __nanf (const char *tagp)
111 {
112 - if (tagp[0] != '\0')
113 - {
114 - char buf[6 + strlen (tagp)];
115 - sprintf (buf, "NAN(%s)", tagp);
116 - return strtof (buf, NULL);
117 - }
118 -
119 - return NAN;
120 + return __strtof_nan (tagp, NULL, 0);
121 }
122 weak_alias (__nanf, nanf)
123 diff -Naur a/math/s_nanl.c b/math/s_nanl.c
124 --- a/math/s_nanl.c 2017-09-15 15:37:06.051899756 +0530
125 +++ b/math/s_nanl.c 2017-09-15 15:38:10.122503550 +0530
126 @@ -28,13 +28,6 @@
127 long double
128 __nanl (const char *tagp)
129 {
130 - if (tagp[0] != '\0')
131 - {
132 - char buf[6 + strlen (tagp)];
133 - sprintf (buf, "NAN(%s)", tagp);
134 - return strtold (buf, NULL);
135 - }
136 -
137 - return NAN;
138 + return __strtold_nan (tagp, NULL, 0);
139 }
140 weak_alias (__nanl, nanl)
141 diff -Naur a/math/test-nan-overflow.c b/math/test-nan-overflow.c
142 --- a/math/test-nan-overflow.c 1970-01-01 05:30:00.000000000 +0530
143 +++ b/math/test-nan-overflow.c 2017-09-15 15:38:10.122503550 +0530
144 @@ -0,0 +1,66 @@
145 +/* Test nan functions stack overflow (bug 16962).
146 + Copyright (C) 2015 Free Software Foundation, Inc.
147 + This file is part of the GNU C Library.
148 +
149 + The GNU C Library is free software; you can redistribute it and/or
150 + modify it under the terms of the GNU Lesser General Public
151 + License as published by the Free Software Foundation; either
152 + version 2.1 of the License, or (at your option) any later version.
153 +
154 + The GNU C Library is distributed in the hope that it will be useful,
155 + but WITHOUT ANY WARRANTY; without even the implied warranty of
156 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
157 + Lesser General Public License for more details.
158 +
159 + You should have received a copy of the GNU Lesser General Public
160 + License along with the GNU C Library; if not, see
161 + <http://www.gnu.org/licenses/>. */
162 +
163 +#include <math.h>
164 +#include <stdio.h>
165 +#include <string.h>
166 +#include <sys/resource.h>
167 +
168 +#define STACK_LIM 1048576
169 +#define STRING_SIZE (2 * STACK_LIM)
170 +
171 +static int
172 +do_test (void)
173 +{
174 + int result = 0;
175 + struct rlimit lim;
176 + getrlimit (RLIMIT_STACK, &lim);
177 + lim.rlim_cur = STACK_LIM;
178 + setrlimit (RLIMIT_STACK, &lim);
179 + char *nanstr = malloc (STRING_SIZE);
180 + if (nanstr == NULL)
181 + {
182 + puts ("malloc failed, cannot test");
183 + return 77;
184 + }
185 + memset (nanstr, '0', STRING_SIZE - 1);
186 + nanstr[STRING_SIZE - 1] = 0;
187 +#define NAN_TEST(TYPE, FUNC) \
188 + do \
189 + { \
190 + char *volatile p = nanstr; \
191 + volatile TYPE v = FUNC (p); \
192 + if (isnan (v)) \
193 + puts ("PASS: " #FUNC); \
194 + else \
195 + { \
196 + puts ("FAIL: " #FUNC); \
197 + result = 1; \
198 + } \
199 + } \
200 + while (0)
201 + NAN_TEST (float, nanf);
202 + NAN_TEST (double, nan);
203 +#ifndef NO_LONG_DOUBLE
204 + NAN_TEST (long double, nanl);
205 +#endif
206 + return result;
207 +}
208 +
209 +#define TEST_FUNCTION do_test ()
210 +#include "../test-skeleton.c"
211 diff -Naur a/math/test-nan-payload.c b/math/test-nan-payload.c
212 --- a/math/test-nan-payload.c 1970-01-01 05:30:00.000000000 +0530
213 +++ b/math/test-nan-payload.c 2017-09-15 15:38:10.122503550 +0530
214 @@ -0,0 +1,122 @@
215 +/* Test nan functions payload handling (bug 16961).
216 + Copyright (C) 2015 Free Software Foundation, Inc.
217 + This file is part of the GNU C Library.
218 +
219 + The GNU C Library is free software; you can redistribute it and/or
220 + modify it under the terms of the GNU Lesser General Public
221 + License as published by the Free Software Foundation; either
222 + version 2.1 of the License, or (at your option) any later version.
223 +
224 + The GNU C Library is distributed in the hope that it will be useful,
225 + but WITHOUT ANY WARRANTY; without even the implied warranty of
226 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
227 + Lesser General Public License for more details.
228 +
229 + You should have received a copy of the GNU Lesser General Public
230 + License along with the GNU C Library; if not, see
231 + <http://www.gnu.org/licenses/>. */
232 +
233 +#include <float.h>
234 +#include <math.h>
235 +#include <stdio.h>
236 +#include <stdlib.h>
237 +#include <string.h>
238 +
239 +/* Avoid built-in functions. */
240 +#define WRAP_NAN(FUNC, STR) \
241 + ({ const char *volatile wns = (STR); FUNC (wns); })
242 +#define WRAP_STRTO(FUNC, STR) \
243 + ({ const char *volatile wss = (STR); FUNC (wss, NULL); })
244 +
245 +#define CHECK_IS_NAN(TYPE, A) \
246 + do \
247 + { \
248 + if (isnan (A)) \
249 + puts ("PASS: " #TYPE " " #A); \
250 + else \
251 + { \
252 + puts ("FAIL: " #TYPE " " #A); \
253 + result = 1; \
254 + } \
255 + } \
256 + while (0)
257 +
258 +#define CHECK_SAME_NAN(TYPE, A, B) \
259 + do \
260 + { \
261 + if (memcmp (&(A), &(B), sizeof (A)) == 0) \
262 + puts ("PASS: " #TYPE " " #A " = " #B); \
263 + else \
264 + { \
265 + puts ("FAIL: " #TYPE " " #A " = " #B); \
266 + result = 1; \
267 + } \
268 + } \
269 + while (0)
270 +
271 +#define CHECK_DIFF_NAN(TYPE, A, B) \
272 + do \
273 + { \
274 + if (memcmp (&(A), &(B), sizeof (A)) != 0) \
275 + puts ("PASS: " #TYPE " " #A " != " #B); \
276 + else \
277 + { \
278 + puts ("FAIL: " #TYPE " " #A " != " #B); \
279 + result = 1; \
280 + } \
281 + } \
282 + while (0)
283 +
284 +/* Cannot test payloads by memcmp for formats where NaNs have padding
285 + bits. */
286 +#define CAN_TEST_EQ(MANT_DIG) ((MANT_DIG) != 64 && (MANT_DIG) != 106)
287 +
288 +#define RUN_TESTS(TYPE, SFUNC, FUNC, MANT_DIG) \
289 + do \
290 + { \
291 + TYPE n123 = WRAP_NAN (FUNC, "123"); \
292 + CHECK_IS_NAN (TYPE, n123); \
293 + TYPE s123 = WRAP_STRTO (SFUNC, "NAN(123)"); \
294 + CHECK_IS_NAN (TYPE, s123); \
295 + TYPE n456 = WRAP_NAN (FUNC, "456"); \
296 + CHECK_IS_NAN (TYPE, n456); \
297 + TYPE s456 = WRAP_STRTO (SFUNC, "NAN(456)"); \
298 + CHECK_IS_NAN (TYPE, s456); \
299 + TYPE n123x = WRAP_NAN (FUNC, "123)"); \
300 + CHECK_IS_NAN (TYPE, n123x); \
301 + TYPE nemp = WRAP_NAN (FUNC, ""); \
302 + CHECK_IS_NAN (TYPE, nemp); \
303 + TYPE semp = WRAP_STRTO (SFUNC, "NAN()"); \
304 + CHECK_IS_NAN (TYPE, semp); \
305 + TYPE sx = WRAP_STRTO (SFUNC, "NAN"); \
306 + CHECK_IS_NAN (TYPE, sx); \
307 + if (CAN_TEST_EQ (MANT_DIG)) \
308 + CHECK_SAME_NAN (TYPE, n123, s123); \
309 + if (CAN_TEST_EQ (MANT_DIG)) \
310 + CHECK_SAME_NAN (TYPE, n456, s456); \
311 + if (CAN_TEST_EQ (MANT_DIG)) \
312 + CHECK_SAME_NAN (TYPE, nemp, semp); \
313 + if (CAN_TEST_EQ (MANT_DIG)) \
314 + CHECK_SAME_NAN (TYPE, n123x, sx); \
315 + CHECK_DIFF_NAN (TYPE, n123, n456); \
316 + CHECK_DIFF_NAN (TYPE, n123, nemp); \
317 + CHECK_DIFF_NAN (TYPE, n123, n123x); \
318 + CHECK_DIFF_NAN (TYPE, n456, nemp); \
319 + CHECK_DIFF_NAN (TYPE, n456, n123x); \
320 + } \
321 + while (0)
322 +
323 +static int
324 +do_test (void)
325 +{
326 + int result = 0;
327 + RUN_TESTS (float, strtof, nanf, FLT_MANT_DIG);
328 + RUN_TESTS (double, strtod, nan, DBL_MANT_DIG);
329 +#ifndef NO_LONG_DOUBLE
330 + RUN_TESTS (long double, strtold, nanl, LDBL_MANT_DIG);
331 +#endif
332 + return result;
333 +}
334 +
335 +#define TEST_FUNCTION do_test ()
336 +#include "../test-skeleton.c"
337 diff -Naur a/stdlib/Makefile b/stdlib/Makefile
338 --- a/stdlib/Makefile 2017-09-15 15:37:06.079899146 +0530
339 +++ b/stdlib/Makefile 2017-09-15 15:37:13.851729724 +0530
340 @@ -50,6 +50,7 @@
341 strtol_l strtoul_l strtoll_l strtoull_l \
342 strtof strtod strtold \
343 strtof_l strtod_l strtold_l \
344 + strtof_nan strtod_nan strtold_nan \
345 system canonicalize \
346 a64l l64a \
347 rpmatch strfmon strfmon_l getsubopt xpg_basename fmtmsg \
348 diff -Naur a/stdlib/strtod_l.c b/stdlib/strtod_l.c
349 --- a/stdlib/strtod_l.c 2017-09-15 15:37:06.079899146 +0530
350 +++ b/stdlib/strtod_l.c 2017-09-15 15:37:13.851729724 +0530
351 @@ -20,8 +20,6 @@
352 #include <xlocale.h>
354 extern double ____strtod_l_internal (const char *, char **, int, __locale_t);
355 -extern unsigned long long int ____strtoull_l_internal (const char *, char **,
356 - int, int, __locale_t);
358 /* Configuration part. These macros are defined by `strtold.c',
359 `strtof.c', `wcstod.c', `wcstold.c', and `wcstof.c' to produce the
360 @@ -33,27 +31,20 @@
361 # ifdef USE_WIDE_CHAR
362 # define STRTOF wcstod_l
363 # define __STRTOF __wcstod_l
364 +# define STRTOF_NAN __wcstod_nan
365 # else
366 # define STRTOF strtod_l
367 # define __STRTOF __strtod_l
368 +# define STRTOF_NAN __strtod_nan
369 # endif
370 # define MPN2FLOAT __mpn_construct_double
371 # define FLOAT_HUGE_VAL HUGE_VAL
372 -# define SET_MANTISSA(flt, mant) \
373 - do { union ieee754_double u; \
374 - u.d = (flt); \
375 - u.ieee_nan.mantissa0 = (mant) >> 32; \
376 - u.ieee_nan.mantissa1 = (mant); \
377 - if ((u.ieee.mantissa0 | u.ieee.mantissa1) != 0) \
378 - (flt) = u.d; \
379 - } while (0)
380 #endif
381 /* End of configuration part. */
383 #include <ctype.h>
384 #include <errno.h>
385 #include <float.h>
386 -#include <ieee754.h>
387 #include "../locale/localeinfo.h"
388 #include <locale.h>
389 #include <math.h>
390 @@ -104,7 +95,6 @@
391 # define TOLOWER_C(Ch) __towlower_l ((Ch), _nl_C_locobj_ptr)
392 # define STRNCASECMP(S1, S2, N) \
393 __wcsncasecmp_l ((S1), (S2), (N), _nl_C_locobj_ptr)
394 -# define STRTOULL(S, E, B) ____wcstoull_l_internal ((S), (E), (B), 0, loc)
395 #else
396 # define STRING_TYPE char
397 # define CHAR_TYPE char
398 @@ -116,7 +106,6 @@
399 # define TOLOWER_C(Ch) __tolower_l ((Ch), _nl_C_locobj_ptr)
400 # define STRNCASECMP(S1, S2, N) \
401 __strncasecmp_l ((S1), (S2), (N), _nl_C_locobj_ptr)
402 -# define STRTOULL(S, E, B) ____strtoull_l_internal ((S), (E), (B), 0, loc)
403 #endif
406 @@ -655,33 +644,14 @@
407 if (*cp == L_('('))
408 {
409 const STRING_TYPE *startp = cp;
410 - do
411 - ++cp;
412 - while ((*cp >= L_('0') && *cp <= L_('9'))
413 - || ({ CHAR_TYPE lo = TOLOWER (*cp);
414 - lo >= L_('a') && lo <= L_('z'); })
415 - || *cp == L_('_'));
416 -
417 - if (*cp != L_(')'))
418 - /* The closing brace is missing. Only match the NAN
419 - part. */
420 - cp = startp;
421 + STRING_TYPE *endp;
422 + retval = STRTOF_NAN (cp + 1, &endp, L_(')'));
423 + if (*endp == L_(')'))
424 + /* Consume the closing parenthesis. */
425 + cp = endp + 1;
426 else
427 - {
428 - /* This is a system-dependent way to specify the
429 - bitmask used for the NaN. We expect it to be
430 - a number which is put in the mantissa of the
431 - number. */
432 - STRING_TYPE *endp;
433 - unsigned long long int mant;
434 -
435 - mant = STRTOULL (startp + 1, &endp, 0);
436 - if (endp == cp)
437 - SET_MANTISSA (retval, mant);
438 -
439 - /* Consume the closing brace. */
440 - ++cp;
441 - }
442 + /* Only match the NAN part. */
443 + cp = startp;
444 }
446 if (endptr != NULL)
447 diff -Naur a/stdlib/strtod_nan.c b/stdlib/strtod_nan.c
448 --- a/stdlib/strtod_nan.c 1970-01-01 05:30:00.000000000 +0530
449 +++ b/stdlib/strtod_nan.c 2017-09-15 15:37:13.851729724 +0530
450 @@ -0,0 +1,24 @@
451 +/* Convert string for NaN payload to corresponding NaN. Narrow
452 + strings, double.
453 + Copyright (C) 2015 Free Software Foundation, Inc.
454 + This file is part of the GNU C Library.
455 +
456 + The GNU C Library is free software; you can redistribute it and/or
457 + modify it under the terms of the GNU Lesser General Public
458 + License as published by the Free Software Foundation; either
459 + version 2.1 of the License, or (at your option) any later version.
460 +
461 + The GNU C Library is distributed in the hope that it will be useful,
462 + but WITHOUT ANY WARRANTY; without even the implied warranty of
463 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
464 + Lesser General Public License for more details.
465 +
466 + You should have received a copy of the GNU Lesser General Public
467 + License along with the GNU C Library; if not, see
468 + <http://www.gnu.org/licenses/>. */
469 +
470 +#include <strtod_nan_narrow.h>
471 +#include <strtod_nan_double.h>
472 +
473 +#define STRTOD_NAN __strtod_nan
474 +#include <strtod_nan_main.c>
475 diff -Naur a/stdlib/strtod_nan_double.h b/stdlib/strtod_nan_double.h
476 --- a/stdlib/strtod_nan_double.h 1970-01-01 05:30:00.000000000 +0530
477 +++ b/stdlib/strtod_nan_double.h 2017-09-15 15:37:13.851729724 +0530
478 @@ -0,0 +1,30 @@
479 +/* Convert string for NaN payload to corresponding NaN. For double.
480 + Copyright (C) 1997-2015 Free Software Foundation, Inc.
481 + This file is part of the GNU C Library.
482 +
483 + The GNU C Library is free software; you can redistribute it and/or
484 + modify it under the terms of the GNU Lesser General Public
485 + License as published by the Free Software Foundation; either
486 + version 2.1 of the License, or (at your option) any later version.
487 +
488 + The GNU C Library is distributed in the hope that it will be useful,
489 + but WITHOUT ANY WARRANTY; without even the implied warranty of
490 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
491 + Lesser General Public License for more details.
492 +
493 + You should have received a copy of the GNU Lesser General Public
494 + License along with the GNU C Library; if not, see
495 + <http://www.gnu.org/licenses/>. */
496 +
497 +#define FLOAT double
498 +#define SET_MANTISSA(flt, mant) \
499 + do \
500 + { \
501 + union ieee754_double u; \
502 + u.d = (flt); \
503 + u.ieee_nan.mantissa0 = (mant) >> 32; \
504 + u.ieee_nan.mantissa1 = (mant); \
505 + if ((u.ieee.mantissa0 | u.ieee.mantissa1) != 0) \
506 + (flt) = u.d; \
507 + } \
508 + while (0)
509 diff -Naur a/stdlib/strtod_nan_float.h b/stdlib/strtod_nan_float.h
510 --- a/stdlib/strtod_nan_float.h 1970-01-01 05:30:00.000000000 +0530
511 +++ b/stdlib/strtod_nan_float.h 2017-09-15 15:37:13.851729724 +0530
512 @@ -0,0 +1,29 @@
513 +/* Convert string for NaN payload to corresponding NaN. For float.
514 + Copyright (C) 1997-2015 Free Software Foundation, Inc.
515 + This file is part of the GNU C Library.
516 +
517 + The GNU C Library is free software; you can redistribute it and/or
518 + modify it under the terms of the GNU Lesser General Public
519 + License as published by the Free Software Foundation; either
520 + version 2.1 of the License, or (at your option) any later version.
521 +
522 + The GNU C Library is distributed in the hope that it will be useful,
523 + but WITHOUT ANY WARRANTY; without even the implied warranty of
524 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
525 + Lesser General Public License for more details.
526 +
527 + You should have received a copy of the GNU Lesser General Public
528 + License along with the GNU C Library; if not, see
529 + <http://www.gnu.org/licenses/>. */
530 +
531 +#define FLOAT float
532 +#define SET_MANTISSA(flt, mant) \
533 + do \
534 + { \
535 + union ieee754_float u; \
536 + u.f = (flt); \
537 + u.ieee_nan.mantissa = (mant); \
538 + if (u.ieee.mantissa != 0) \
539 + (flt) = u.f; \
540 + } \
541 + while (0)
542 diff -Naur a/stdlib/strtod_nan_main.c b/stdlib/strtod_nan_main.c
543 --- a/stdlib/strtod_nan_main.c 1970-01-01 05:30:00.000000000 +0530
544 +++ b/stdlib/strtod_nan_main.c 2017-09-15 15:37:13.851729724 +0530
545 @@ -0,0 +1,63 @@
546 +/* Convert string for NaN payload to corresponding NaN.
547 + Copyright (C) 1997-2015 Free Software Foundation, Inc.
548 + This file is part of the GNU C Library.
549 +
550 + The GNU C Library is free software; you can redistribute it and/or
551 + modify it under the terms of the GNU Lesser General Public
552 + License as published by the Free Software Foundation; either
553 + version 2.1 of the License, or (at your option) any later version.
554 +
555 + The GNU C Library is distributed in the hope that it will be useful,
556 + but WITHOUT ANY WARRANTY; without even the implied warranty of
557 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
558 + Lesser General Public License for more details.
559 +
560 + You should have received a copy of the GNU Lesser General Public
561 + License along with the GNU C Library; if not, see
562 + <http://www.gnu.org/licenses/>. */
563 +
564 +#include <ieee754.h>
565 +#include <locale.h>
566 +#include <math.h>
567 +#include <stdlib.h>
568 +#include <wchar.h>
569 +
570 +
571 +/* If STR starts with an optional n-char-sequence as defined by ISO C
572 + (a sequence of ASCII letters, digits and underscores), followed by
573 + ENDC, return a NaN whose payload is set based on STR. Otherwise,
574 + return a default NAN. If ENDPTR is not NULL, set *ENDPTR to point
575 + to the character after the initial n-char-sequence. */
576 +
577 +internal_function
578 +FLOAT
579 +STRTOD_NAN (const STRING_TYPE *str, STRING_TYPE **endptr, STRING_TYPE endc)
580 +{
581 + const STRING_TYPE *cp = str;
582 +
583 + while ((*cp >= L_('0') && *cp <= L_('9'))
584 + || (*cp >= L_('A') && *cp <= L_('Z'))
585 + || (*cp >= L_('a') && *cp <= L_('z'))
586 + || *cp == L_('_'))
587 + ++cp;
588 +
589 + FLOAT retval = NAN;
590 + if (*cp != endc)
591 + goto out;
592 +
593 + /* This is a system-dependent way to specify the bitmask used for
594 + the NaN. We expect it to be a number which is put in the
595 + mantissa of the number. */
596 + STRING_TYPE *endp;
597 + unsigned long long int mant;
598 +
599 + mant = STRTOULL (str, &endp, 0);
600 + if (endp == cp)
601 + SET_MANTISSA (retval, mant);
602 +
603 + out:
604 + if (endptr != NULL)
605 + *endptr = (STRING_TYPE *) cp;
606 + return retval;
607 +}
608 +libc_hidden_def (STRTOD_NAN)
609 diff -Naur a/stdlib/strtod_nan_narrow.h b/stdlib/strtod_nan_narrow.h
610 --- a/stdlib/strtod_nan_narrow.h 1970-01-01 05:30:00.000000000 +0530
611 +++ b/stdlib/strtod_nan_narrow.h 2017-09-15 15:37:13.851729724 +0530
612 @@ -0,0 +1,22 @@
613 +/* Convert string for NaN payload to corresponding NaN. Narrow strings.
614 + Copyright (C) 1997-2015 Free Software Foundation, Inc.
615 + This file is part of the GNU C Library.
616 +
617 + The GNU C Library is free software; you can redistribute it and/or
618 + modify it under the terms of the GNU Lesser General Public
619 + License as published by the Free Software Foundation; either
620 + version 2.1 of the License, or (at your option) any later version.
621 +
622 + The GNU C Library is distributed in the hope that it will be useful,
623 + but WITHOUT ANY WARRANTY; without even the implied warranty of
624 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
625 + Lesser General Public License for more details.
626 +
627 + You should have received a copy of the GNU Lesser General Public
628 + License along with the GNU C Library; if not, see
629 + <http://www.gnu.org/licenses/>. */
630 +
631 +#define STRING_TYPE char
632 +#define L_(Ch) Ch
633 +#define STRTOULL(S, E, B) ____strtoull_l_internal ((S), (E), (B), 0, \
634 + _nl_C_locobj_ptr)
635 diff -Naur a/stdlib/strtod_nan_wide.h b/stdlib/strtod_nan_wide.h
636 --- a/stdlib/strtod_nan_wide.h 1970-01-01 05:30:00.000000000 +0530
637 +++ b/stdlib/strtod_nan_wide.h 2017-09-15 15:37:13.851729724 +0530
638 @@ -0,0 +1,22 @@
639 +/* Convert string for NaN payload to corresponding NaN. Wide strings.
640 + Copyright (C) 1997-2015 Free Software Foundation, Inc.
641 + This file is part of the GNU C Library.
642 +
643 + The GNU C Library is free software; you can redistribute it and/or
644 + modify it under the terms of the GNU Lesser General Public
645 + License as published by the Free Software Foundation; either
646 + version 2.1 of the License, or (at your option) any later version.
647 +
648 + The GNU C Library is distributed in the hope that it will be useful,
649 + but WITHOUT ANY WARRANTY; without even the implied warranty of
650 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
651 + Lesser General Public License for more details.
652 +
653 + You should have received a copy of the GNU Lesser General Public
654 + License along with the GNU C Library; if not, see
655 + <http://www.gnu.org/licenses/>. */
656 +
657 +#define STRING_TYPE wchar_t
658 +#define L_(Ch) L##Ch
659 +#define STRTOULL(S, E, B) ____wcstoull_l_internal ((S), (E), (B), 0, \
660 + _nl_C_locobj_ptr)
661 diff -Naur a/stdlib/strtof_l.c b/stdlib/strtof_l.c
662 --- a/stdlib/strtof_l.c 2017-09-15 15:37:06.079899146 +0530
663 +++ b/stdlib/strtof_l.c 2017-09-15 15:37:13.855729636 +0530
664 @@ -20,26 +20,19 @@
665 #include <xlocale.h>
667 extern float ____strtof_l_internal (const char *, char **, int, __locale_t);
668 -extern unsigned long long int ____strtoull_l_internal (const char *, char **,
669 - int, int, __locale_t);
671 #define FLOAT float
672 #define FLT FLT
673 #ifdef USE_WIDE_CHAR
674 # define STRTOF wcstof_l
675 # define __STRTOF __wcstof_l
676 +# define STRTOF_NAN __wcstof_nan
677 #else
678 # define STRTOF strtof_l
679 # define __STRTOF __strtof_l
680 +# define STRTOF_NAN __strtof_nan
681 #endif
682 #define MPN2FLOAT __mpn_construct_float
683 #define FLOAT_HUGE_VAL HUGE_VALF
684 -#define SET_MANTISSA(flt, mant) \
685 - do { union ieee754_float u; \
686 - u.f = (flt); \
687 - u.ieee_nan.mantissa = (mant); \
688 - if (u.ieee.mantissa != 0) \
689 - (flt) = u.f; \
690 - } while (0)
692 #include "strtod_l.c"
693 diff -Naur a/stdlib/strtof_nan.c b/stdlib/strtof_nan.c
694 --- a/stdlib/strtof_nan.c 1970-01-01 05:30:00.000000000 +0530
695 +++ b/stdlib/strtof_nan.c 2017-09-15 15:37:13.855729636 +0530
696 @@ -0,0 +1,24 @@
697 +/* Convert string for NaN payload to corresponding NaN. Narrow
698 + strings, float.
699 + Copyright (C) 2015 Free Software Foundation, Inc.
700 + This file is part of the GNU C Library.
701 +
702 + The GNU C Library is free software; you can redistribute it and/or
703 + modify it under the terms of the GNU Lesser General Public
704 + License as published by the Free Software Foundation; either
705 + version 2.1 of the License, or (at your option) any later version.
706 +
707 + The GNU C Library is distributed in the hope that it will be useful,
708 + but WITHOUT ANY WARRANTY; without even the implied warranty of
709 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
710 + Lesser General Public License for more details.
711 +
712 + You should have received a copy of the GNU Lesser General Public
713 + License along with the GNU C Library; if not, see
714 + <http://www.gnu.org/licenses/>. */
715 +
716 +#include <strtod_nan_narrow.h>
717 +#include <strtod_nan_float.h>
718 +
719 +#define STRTOD_NAN __strtof_nan
720 +#include <strtod_nan_main.c>
721 diff -Naur a/stdlib/strtold_nan.c b/stdlib/strtold_nan.c
722 --- a/stdlib/strtold_nan.c 1970-01-01 05:30:00.000000000 +0530
723 +++ b/stdlib/strtold_nan.c 2017-09-15 15:37:13.855729636 +0530
724 @@ -0,0 +1,30 @@
725 +/* Convert string for NaN payload to corresponding NaN. Narrow
726 + strings, long double.
727 + Copyright (C) 2015 Free Software Foundation, Inc.
728 + This file is part of the GNU C Library.
729 +
730 + The GNU C Library is free software; you can redistribute it and/or
731 + modify it under the terms of the GNU Lesser General Public
732 + License as published by the Free Software Foundation; either
733 + version 2.1 of the License, or (at your option) any later version.
734 +
735 + The GNU C Library is distributed in the hope that it will be useful,
736 + but WITHOUT ANY WARRANTY; without even the implied warranty of
737 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
738 + Lesser General Public License for more details.
739 +
740 + You should have received a copy of the GNU Lesser General Public
741 + License along with the GNU C Library; if not, see
742 + <http://www.gnu.org/licenses/>. */
743 +
744 +#include <math.h>
745 +
746 +/* This function is unused if long double and double have the same
747 + representation. */
748 +#ifndef __NO_LONG_DOUBLE_MATH
749 +# include <strtod_nan_narrow.h>
750 +# include <strtod_nan_ldouble.h>
751 +
752 +# define STRTOD_NAN __strtold_nan
753 +# include <strtod_nan_main.c>
754 +#endif
755 diff -Naur a/stdlib/Versions b/stdlib/Versions
756 --- a/stdlib/Versions 2017-09-15 15:37:06.079899146 +0530
757 +++ b/stdlib/Versions 2017-09-15 15:38:10.122503550 +0530
758 @@ -118,5 +118,6 @@
759 # Used from other libraries
760 __libc_secure_getenv;
761 __call_tls_dtors;
762 + __strtof_nan; __strtod_nan; __strtold_nan;
763 }
764 }
765 diff -Naur a/sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h b/sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h
766 --- a/sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h 1970-01-01 05:30:00.000000000 +0530
767 +++ b/sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h 2017-09-15 15:37:13.855729636 +0530
768 @@ -0,0 +1,33 @@
769 +/* Convert string for NaN payload to corresponding NaN. For ldbl-128.
770 + Copyright (C) 1997-2015 Free Software Foundation, Inc.
771 + This file is part of the GNU C Library.
772 +
773 + The GNU C Library is free software; you can redistribute it and/or
774 + modify it under the terms of the GNU Lesser General Public
775 + License as published by the Free Software Foundation; either
776 + version 2.1 of the License, or (at your option) any later version.
777 +
778 + The GNU C Library is distributed in the hope that it will be useful,
779 + but WITHOUT ANY WARRANTY; without even the implied warranty of
780 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
781 + Lesser General Public License for more details.
782 +
783 + You should have received a copy of the GNU Lesser General Public
784 + License along with the GNU C Library; if not, see
785 + <http://www.gnu.org/licenses/>. */
786 +
787 +#define FLOAT long double
788 +#define SET_MANTISSA(flt, mant) \
789 + do \
790 + { \
791 + union ieee854_long_double u; \
792 + u.d = (flt); \
793 + u.ieee_nan.mantissa0 = 0; \
794 + u.ieee_nan.mantissa1 = 0; \
795 + u.ieee_nan.mantissa2 = (mant) >> 32; \
796 + u.ieee_nan.mantissa3 = (mant); \
797 + if ((u.ieee.mantissa0 | u.ieee.mantissa1 \
798 + | u.ieee.mantissa2 | u.ieee.mantissa3) != 0) \
799 + (flt) = u.d; \
800 + } \
801 + while (0)
802 diff -Naur a/sysdeps/ieee754/ldbl-128/strtold_l.c b/sysdeps/ieee754/ldbl-128/strtold_l.c
803 --- a/sysdeps/ieee754/ldbl-128/strtold_l.c 2017-09-15 15:37:06.107898535 +0530
804 +++ b/sysdeps/ieee754/ldbl-128/strtold_l.c 2017-09-15 15:37:13.855729636 +0530
805 @@ -25,22 +25,13 @@
806 #ifdef USE_WIDE_CHAR
807 # define STRTOF wcstold_l
808 # define __STRTOF __wcstold_l
809 +# define STRTOF_NAN __wcstold_nan
810 #else
811 # define STRTOF strtold_l
812 # define __STRTOF __strtold_l
813 +# define STRTOF_NAN __strtold_nan
814 #endif
815 #define MPN2FLOAT __mpn_construct_long_double
816 #define FLOAT_HUGE_VAL HUGE_VALL
817 -#define SET_MANTISSA(flt, mant) \
818 - do { union ieee854_long_double u; \
819 - u.d = (flt); \
820 - u.ieee_nan.mantissa0 = 0; \
821 - u.ieee_nan.mantissa1 = 0; \
822 - u.ieee_nan.mantissa2 = (mant) >> 32; \
823 - u.ieee_nan.mantissa3 = (mant); \
824 - if ((u.ieee.mantissa0 | u.ieee.mantissa1 \
825 - | u.ieee.mantissa2 | u.ieee.mantissa3) != 0) \
826 - (flt) = u.d; \
827 - } while (0)
829 #include <strtod_l.c>
830 diff -Naur a/sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h b/sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h
831 --- a/sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h 1970-01-01 05:30:00.000000000 +0530
832 +++ b/sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h 2017-09-15 15:37:13.855729636 +0530
833 @@ -0,0 +1,30 @@
834 +/* Convert string for NaN payload to corresponding NaN. For ldbl-128ibm.
835 + Copyright (C) 1997-2015 Free Software Foundation, Inc.
836 + This file is part of the GNU C Library.
837 +
838 + The GNU C Library is free software; you can redistribute it and/or
839 + modify it under the terms of the GNU Lesser General Public
840 + License as published by the Free Software Foundation; either
841 + version 2.1 of the License, or (at your option) any later version.
842 +
843 + The GNU C Library is distributed in the hope that it will be useful,
844 + but WITHOUT ANY WARRANTY; without even the implied warranty of
845 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
846 + Lesser General Public License for more details.
847 +
848 + You should have received a copy of the GNU Lesser General Public
849 + License along with the GNU C Library; if not, see
850 + <http://www.gnu.org/licenses/>. */
851 +
852 +#define FLOAT long double
853 +#define SET_MANTISSA(flt, mant) \
854 + do \
855 + { \
856 + union ibm_extended_long_double u; \
857 + u.ld = (flt); \
858 + u.d[0].ieee_nan.mantissa0 = (mant) >> 32; \
859 + u.d[0].ieee_nan.mantissa1 = (mant); \
860 + if ((u.d[0].ieee.mantissa0 | u.d[0].ieee.mantissa1) != 0) \
861 + (flt) = u.ld; \
862 + } \
863 + while (0)
864 diff -Naur a/sysdeps/ieee754/ldbl-128ibm/strtold_l.c b/sysdeps/ieee754/ldbl-128ibm/strtold_l.c
865 --- a/sysdeps/ieee754/ldbl-128ibm/strtold_l.c 2017-09-15 15:37:06.107898535 +0530
866 +++ b/sysdeps/ieee754/ldbl-128ibm/strtold_l.c 2017-09-15 15:37:13.855729636 +0530
867 @@ -30,25 +30,19 @@
868 # define STRTOF __new_wcstold_l
869 # define __STRTOF ____new_wcstold_l
870 # define ____STRTOF_INTERNAL ____wcstold_l_internal
871 +# define STRTOF_NAN __wcstold_nan
872 #else
873 extern long double ____new_strtold_l (const char *, char **, __locale_t);
874 # define STRTOF __new_strtold_l
875 # define __STRTOF ____new_strtold_l
876 # define ____STRTOF_INTERNAL ____strtold_l_internal
877 +# define STRTOF_NAN __strtold_nan
878 #endif
879 extern __typeof (__STRTOF) STRTOF;
880 libc_hidden_proto (__STRTOF)
881 libc_hidden_proto (STRTOF)
882 #define MPN2FLOAT __mpn_construct_long_double
883 #define FLOAT_HUGE_VAL HUGE_VALL
884 -# define SET_MANTISSA(flt, mant) \
885 - do { union ibm_extended_long_double u; \
886 - u.ld = (flt); \
887 - u.d[0].ieee_nan.mantissa0 = (mant) >> 32; \
888 - u.d[0].ieee_nan.mantissa1 = (mant); \
889 - if ((u.d[0].ieee.mantissa0 | u.d[0].ieee.mantissa1) != 0) \
890 - (flt) = u.ld; \
891 - } while (0)
893 #include <strtod_l.c>
895 diff -Naur a/sysdeps/ieee754/ldbl-64-128/strtold_l.c b/sysdeps/ieee754/ldbl-64-128/strtold_l.c
896 --- a/sysdeps/ieee754/ldbl-64-128/strtold_l.c 2017-09-15 15:37:06.111898448 +0530
897 +++ b/sysdeps/ieee754/ldbl-64-128/strtold_l.c 2017-09-15 15:37:13.855729636 +0530
898 @@ -30,28 +30,19 @@
899 # define STRTOF __new_wcstold_l
900 # define __STRTOF ____new_wcstold_l
901 # define ____STRTOF_INTERNAL ____wcstold_l_internal
902 +# define STRTOF_NAN __wcstold_nan
903 #else
904 extern long double ____new_strtold_l (const char *, char **, __locale_t);
905 # define STRTOF __new_strtold_l
906 # define __STRTOF ____new_strtold_l
907 # define ____STRTOF_INTERNAL ____strtold_l_internal
908 +# define STRTOF_NAN __strtold_nan
909 #endif
910 extern __typeof (__STRTOF) STRTOF;
911 libc_hidden_proto (__STRTOF)
912 libc_hidden_proto (STRTOF)
913 #define MPN2FLOAT __mpn_construct_long_double
914 #define FLOAT_HUGE_VAL HUGE_VALL
915 -#define SET_MANTISSA(flt, mant) \
916 - do { union ieee854_long_double u; \
917 - u.d = (flt); \
918 - u.ieee_nan.mantissa0 = 0; \
919 - u.ieee_nan.mantissa1 = 0; \
920 - u.ieee_nan.mantissa2 = (mant) >> 32; \
921 - u.ieee_nan.mantissa3 = (mant); \
922 - if ((u.ieee.mantissa0 | u.ieee.mantissa1 \
923 - | u.ieee.mantissa2 | u.ieee.mantissa3) != 0) \
924 - (flt) = u.d; \
925 - } while (0)
927 #include <strtod_l.c>
929 diff -Naur a/sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h b/sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h
930 --- a/sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h 1970-01-01 05:30:00.000000000 +0530
931 +++ b/sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h 2017-09-15 15:37:13.855729636 +0530
932 @@ -0,0 +1,30 @@
933 +/* Convert string for NaN payload to corresponding NaN. For ldbl-96.
934 + Copyright (C) 1997-2015 Free Software Foundation, Inc.
935 + This file is part of the GNU C Library.
936 +
937 + The GNU C Library is free software; you can redistribute it and/or
938 + modify it under the terms of the GNU Lesser General Public
939 + License as published by the Free Software Foundation; either
940 + version 2.1 of the License, or (at your option) any later version.
941 +
942 + The GNU C Library is distributed in the hope that it will be useful,
943 + but WITHOUT ANY WARRANTY; without even the implied warranty of
944 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
945 + Lesser General Public License for more details.
946 +
947 + You should have received a copy of the GNU Lesser General Public
948 + License along with the GNU C Library; if not, see
949 + <http://www.gnu.org/licenses/>. */
950 +
951 +#define FLOAT long double
952 +#define SET_MANTISSA(flt, mant) \
953 + do \
954 + { \
955 + union ieee854_long_double u; \
956 + u.d = (flt); \
957 + u.ieee_nan.mantissa0 = (mant) >> 32; \
958 + u.ieee_nan.mantissa1 = (mant); \
959 + if ((u.ieee.mantissa0 | u.ieee.mantissa1) != 0) \
960 + (flt) = u.d; \
961 + } \
962 + while (0)
963 diff -Naur a/sysdeps/ieee754/ldbl-96/strtold_l.c b/sysdeps/ieee754/ldbl-96/strtold_l.c
964 --- a/sysdeps/ieee754/ldbl-96/strtold_l.c 2017-09-15 15:37:06.111898448 +0530
965 +++ b/sysdeps/ieee754/ldbl-96/strtold_l.c 2017-09-15 15:37:13.855729636 +0530
966 @@ -25,19 +25,13 @@
967 #ifdef USE_WIDE_CHAR
968 # define STRTOF wcstold_l
969 # define __STRTOF __wcstold_l
970 +# define STRTOF_NAN __wcstold_nan
971 #else
972 # define STRTOF strtold_l
973 # define __STRTOF __strtold_l
974 +# define STRTOF_NAN __strtold_nan
975 #endif
976 #define MPN2FLOAT __mpn_construct_long_double
977 #define FLOAT_HUGE_VAL HUGE_VALL
978 -#define SET_MANTISSA(flt, mant) \
979 - do { union ieee854_long_double u; \
980 - u.d = (flt); \
981 - u.ieee_nan.mantissa0 = (mant) >> 32; \
982 - u.ieee_nan.mantissa1 = (mant); \
983 - if ((u.ieee.mantissa0 | u.ieee.mantissa1) != 0) \
984 - (flt) = u.d; \
985 - } while (0)
987 #include <stdlib/strtod_l.c>
988 diff -Naur a/wcsmbs/Makefile b/wcsmbs/Makefile
989 --- a/wcsmbs/Makefile 2017-09-15 15:37:06.219896093 +0530
990 +++ b/wcsmbs/Makefile 2017-09-15 15:37:13.855729636 +0530
991 @@ -33,6 +33,7 @@
992 wcstol wcstoul wcstoll wcstoull wcstod wcstold wcstof \
993 wcstol_l wcstoul_l wcstoll_l wcstoull_l \
994 wcstod_l wcstold_l wcstof_l \
995 + wcstod_nan wcstold_nan wcstof_nan \
996 wcscoll wcsxfrm \
997 wcwidth wcswidth \
998 wcscoll_l wcsxfrm_l \
999 diff -Naur a/wcsmbs/wcstod_l.c b/wcsmbs/wcstod_l.c
1000 --- a/wcsmbs/wcstod_l.c 2017-09-15 15:37:06.211896267 +0530
1001 +++ b/wcsmbs/wcstod_l.c 2017-09-15 15:37:13.855729636 +0530
1002 @@ -23,9 +23,6 @@
1004 extern double ____wcstod_l_internal (const wchar_t *, wchar_t **, int,
1005 __locale_t);
1006 -extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
1007 - wchar_t **, int, int,
1008 - __locale_t);
1010 #define USE_WIDE_CHAR 1
1012 diff -Naur a/wcsmbs/wcstod_nan.c b/wcsmbs/wcstod_nan.c
1013 --- a/wcsmbs/wcstod_nan.c 1970-01-01 05:30:00.000000000 +0530
1014 +++ b/wcsmbs/wcstod_nan.c 2017-09-15 15:37:13.855729636 +0530
1015 @@ -0,0 +1,23 @@
1016 +/* Convert string for NaN payload to corresponding NaN. Wide strings, double.
1017 + Copyright (C) 2015 Free Software Foundation, Inc.
1018 + This file is part of the GNU C Library.
1020 + The GNU C Library is free software; you can redistribute it and/or
1021 + modify it under the terms of the GNU Lesser General Public
1022 + License as published by the Free Software Foundation; either
1023 + version 2.1 of the License, or (at your option) any later version.
1025 + The GNU C Library is distributed in the hope that it will be useful,
1026 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1027 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1028 + Lesser General Public License for more details.
1030 + You should have received a copy of the GNU Lesser General Public
1031 + License along with the GNU C Library; if not, see
1032 + <http://www.gnu.org/licenses/>. */
1034 +#include "../stdlib/strtod_nan_wide.h"
1035 +#include "../stdlib/strtod_nan_double.h"
1037 +#define STRTOD_NAN __wcstod_nan
1038 +#include "../stdlib/strtod_nan_main.c"
1039 diff -Naur a/wcsmbs/wcstof_l.c b/wcsmbs/wcstof_l.c
1040 --- a/wcsmbs/wcstof_l.c 2017-09-15 15:37:06.211896267 +0530
1041 +++ b/wcsmbs/wcstof_l.c 2017-09-15 15:37:13.855729636 +0530
1042 @@ -25,8 +25,5 @@
1044 extern float ____wcstof_l_internal (const wchar_t *, wchar_t **, int,
1045 __locale_t);
1046 -extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
1047 - wchar_t **, int, int,
1048 - __locale_t);
1050 #include <stdlib/strtof_l.c>
1051 diff -Naur a/wcsmbs/wcstof_nan.c b/wcsmbs/wcstof_nan.c
1052 --- a/wcsmbs/wcstof_nan.c 1970-01-01 05:30:00.000000000 +0530
1053 +++ b/wcsmbs/wcstof_nan.c 2017-09-15 15:37:13.855729636 +0530
1054 @@ -0,0 +1,23 @@
1055 +/* Convert string for NaN payload to corresponding NaN. Wide strings, float.
1056 + Copyright (C) 2015 Free Software Foundation, Inc.
1057 + This file is part of the GNU C Library.
1059 + The GNU C Library is free software; you can redistribute it and/or
1060 + modify it under the terms of the GNU Lesser General Public
1061 + License as published by the Free Software Foundation; either
1062 + version 2.1 of the License, or (at your option) any later version.
1064 + The GNU C Library is distributed in the hope that it will be useful,
1065 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1066 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1067 + Lesser General Public License for more details.
1069 + You should have received a copy of the GNU Lesser General Public
1070 + License along with the GNU C Library; if not, see
1071 + <http://www.gnu.org/licenses/>. */
1073 +#include "../stdlib/strtod_nan_wide.h"
1074 +#include "../stdlib/strtod_nan_float.h"
1076 +#define STRTOD_NAN __wcstof_nan
1077 +#include "../stdlib/strtod_nan_main.c"
1078 diff -Naur a/wcsmbs/wcstold_l.c b/wcsmbs/wcstold_l.c
1079 --- a/wcsmbs/wcstold_l.c 2017-09-15 15:37:06.219896093 +0530
1080 +++ b/wcsmbs/wcstold_l.c 2017-09-15 15:37:13.859729550 +0530
1081 @@ -24,8 +24,5 @@
1083 extern long double ____wcstold_l_internal (const wchar_t *, wchar_t **, int,
1084 __locale_t);
1085 -extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
1086 - wchar_t **, int, int,
1087 - __locale_t);
1089 #include <strtold_l.c>
1090 diff -Naur a/wcsmbs/wcstold_nan.c b/wcsmbs/wcstold_nan.c
1091 --- a/wcsmbs/wcstold_nan.c 1970-01-01 05:30:00.000000000 +0530
1092 +++ b/wcsmbs/wcstold_nan.c 2017-09-15 15:37:13.859729550 +0530
1093 @@ -0,0 +1,30 @@
1094 +/* Convert string for NaN payload to corresponding NaN. Wide strings,
1095 + long double.
1096 + Copyright (C) 2015 Free Software Foundation, Inc.
1097 + This file is part of the GNU C Library.
1099 + The GNU C Library is free software; you can redistribute it and/or
1100 + modify it under the terms of the GNU Lesser General Public
1101 + License as published by the Free Software Foundation; either
1102 + version 2.1 of the License, or (at your option) any later version.
1104 + The GNU C Library is distributed in the hope that it will be useful,
1105 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1106 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1107 + Lesser General Public License for more details.
1109 + You should have received a copy of the GNU Lesser General Public
1110 + License along with the GNU C Library; if not, see
1111 + <http://www.gnu.org/licenses/>. */
1113 +#include <math.h>
1115 +/* This function is unused if long double and double have the same
1116 + representation. */
1117 +#ifndef __NO_LONG_DOUBLE_MATH
1118 +# include "../stdlib/strtod_nan_wide.h"
1119 +# include <strtod_nan_ldouble.h>
1121 +# define STRTOD_NAN __wcstold_nan
1122 +# include "../stdlib/strtod_nan_main.c"
1123 +#endif