sparc64: Remove unwind information from signal return stubs [BZ#31244]
[glibc.git] / sysdeps / ieee754 / ldbl-opt / nldbl-compat.c
blobf0bfb1e8a1432df1c1f90b8b5f5d2b8611f2bc4c
1 /* *printf* family compatibility routines for IEEE double as long double
2 Copyright (C) 2006-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 /* This file may define some of the deprecated scanf variants. */
20 #include <features.h>
21 #undef __GLIBC_USE_DEPRECATED_SCANF
22 #define __GLIBC_USE_DEPRECATED_SCANF 1
24 #include <argp.h>
25 #include <err.h>
26 #include <error.h>
27 #include <stdarg.h>
28 #include <stdio.h>
29 #include <libio/strfile.h>
30 #include <math.h>
31 #include <wchar.h>
32 #include <printf.h>
33 #include <monetary.h>
34 #include <locale/localeinfo.h>
35 #include <sys/syslog.h>
36 #include <libc-lock.h>
38 #include "nldbl-compat.h"
40 libc_hidden_proto (__nldbl_vsscanf)
41 libc_hidden_proto (__nldbl_vfscanf)
42 libc_hidden_proto (__nldbl_vfwscanf)
43 libc_hidden_proto (__nldbl_vswscanf)
44 libc_hidden_proto (__nldbl___isoc99_vsscanf)
45 libc_hidden_proto (__nldbl___isoc99_vfscanf)
46 libc_hidden_proto (__nldbl___isoc99_vswscanf)
47 libc_hidden_proto (__nldbl___isoc99_vfwscanf)
48 libc_hidden_proto (__nldbl___isoc23_vsscanf)
49 libc_hidden_proto (__nldbl___isoc23_vfscanf)
50 libc_hidden_proto (__nldbl___isoc23_vswscanf)
51 libc_hidden_proto (__nldbl___isoc23_vfwscanf)
53 /* Compatibility with IEEE double as long double.
54 IEEE quad long double is used by default for most programs, so
55 we don't need to split this into one file per function for the
56 sake of statically linked programs. */
58 int
59 attribute_compat_text_section
60 __nldbl___asprintf (char **string_ptr, const char *fmt, ...)
62 va_list ap;
63 int ret;
65 va_start (ap, fmt);
66 ret = __vasprintf_internal (string_ptr, fmt, ap, PRINTF_LDBL_IS_DBL);
67 va_end (ap);
69 return ret;
71 weak_alias (__nldbl___asprintf, __nldbl_asprintf)
73 int
74 attribute_compat_text_section
75 __nldbl_dprintf (int d, const char *fmt, ...)
77 va_list ap;
78 int ret;
80 va_start (ap, fmt);
81 ret = __vdprintf_internal (d, fmt, ap, PRINTF_LDBL_IS_DBL);
82 va_end (ap);
84 return ret;
87 int
88 attribute_compat_text_section
89 __nldbl_fprintf (FILE *stream, const char *fmt, ...)
91 va_list ap;
92 int ret;
94 va_start (ap, fmt);
95 ret = __vfprintf_internal (stream, fmt, ap, PRINTF_LDBL_IS_DBL);
96 va_end (ap);
98 return ret;
100 weak_alias (__nldbl_fprintf, __nldbl__IO_fprintf)
103 attribute_compat_text_section weak_function
104 __nldbl_fwprintf (FILE *stream, const wchar_t *fmt, ...)
106 va_list ap;
107 int ret;
109 va_start (ap, fmt);
110 ret = __vfwprintf_internal (stream, fmt, ap, PRINTF_LDBL_IS_DBL);
111 va_end (ap);
113 return ret;
117 attribute_compat_text_section
118 __nldbl_printf (const char *fmt, ...)
120 va_list ap;
121 int ret;
123 va_start (ap, fmt);
124 ret = __vfprintf_internal (stdout, fmt, ap, PRINTF_LDBL_IS_DBL);
125 va_end (ap);
127 return ret;
129 strong_alias (__nldbl_printf, __nldbl__IO_printf)
132 attribute_compat_text_section
133 __nldbl_sprintf (char *s, const char *fmt, ...)
135 va_list ap;
136 int ret;
138 va_start (ap, fmt);
139 ret = __vsprintf_internal (s, -1, fmt, ap, PRINTF_LDBL_IS_DBL);
140 va_end (ap);
142 return ret;
144 strong_alias (__nldbl_sprintf, __nldbl__IO_sprintf)
147 attribute_compat_text_section
148 __nldbl_vfprintf (FILE *s, const char *fmt, va_list ap)
150 return __vfprintf_internal (s, fmt, ap, PRINTF_LDBL_IS_DBL);
152 strong_alias (__nldbl_vfprintf, __nldbl__IO_vfprintf)
155 attribute_compat_text_section
156 __nldbl___vsprintf (char *string, const char *fmt, va_list ap)
158 return __vsprintf_internal (string, -1, fmt, ap, PRINTF_LDBL_IS_DBL);
160 strong_alias (__nldbl___vsprintf, __nldbl__IO_vsprintf)
161 weak_alias (__nldbl___vsprintf, __nldbl_vsprintf)
164 attribute_compat_text_section
165 __nldbl_obstack_vprintf (struct obstack *obstack, const char *fmt,
166 va_list ap)
168 return __obstack_vprintf_internal (obstack, fmt, ap, PRINTF_LDBL_IS_DBL);
172 attribute_compat_text_section
173 __nldbl_obstack_printf (struct obstack *obstack, const char *fmt, ...)
175 int ret;
176 va_list ap;
177 va_start (ap, fmt);
178 ret = __obstack_vprintf_internal (obstack, fmt, ap, PRINTF_LDBL_IS_DBL);
179 va_end (ap);
180 return ret;
184 attribute_compat_text_section weak_function
185 __nldbl_snprintf (char *s, size_t maxlen, const char *fmt, ...)
187 va_list ap;
188 int ret;
190 va_start (ap, fmt);
191 ret = __vsnprintf_internal (s, maxlen, fmt, ap, PRINTF_LDBL_IS_DBL);
192 va_end (ap);
194 return ret;
198 attribute_compat_text_section
199 __nldbl_swprintf (wchar_t *s, size_t n, const wchar_t *fmt, ...)
201 va_list ap;
202 int ret;
204 va_start (ap, fmt);
205 ret = __vswprintf_internal (s, n, fmt, ap, PRINTF_LDBL_IS_DBL);
206 va_end (ap);
208 return ret;
212 attribute_compat_text_section weak_function
213 __nldbl_vasprintf (char **result_ptr, const char *fmt, va_list ap)
215 return __vasprintf_internal (result_ptr, fmt, ap, PRINTF_LDBL_IS_DBL);
219 attribute_compat_text_section
220 __nldbl_vdprintf (int d, const char *fmt, va_list ap)
222 return __vdprintf_internal (d, fmt, ap, PRINTF_LDBL_IS_DBL);
226 attribute_compat_text_section weak_function
227 __nldbl_vfwprintf (FILE *s, const wchar_t *fmt, va_list ap)
229 return __vfwprintf_internal (s, fmt, ap, PRINTF_LDBL_IS_DBL);
233 attribute_compat_text_section
234 __nldbl_vprintf (const char *fmt, va_list ap)
236 return __vfprintf_internal (stdout, fmt, ap, PRINTF_LDBL_IS_DBL);
240 attribute_compat_text_section
241 __nldbl_vsnprintf (char *string, size_t maxlen, const char *fmt,
242 va_list ap)
244 return __vsnprintf_internal (string, maxlen, fmt, ap, PRINTF_LDBL_IS_DBL);
246 weak_alias (__nldbl_vsnprintf, __nldbl___vsnprintf)
249 attribute_compat_text_section weak_function
250 __nldbl_vswprintf (wchar_t *string, size_t maxlen, const wchar_t *fmt,
251 va_list ap)
253 return __vswprintf_internal (string, maxlen, fmt, ap, PRINTF_LDBL_IS_DBL);
257 attribute_compat_text_section
258 __nldbl_vwprintf (const wchar_t *fmt, va_list ap)
260 return __vfwprintf_internal (stdout, fmt, ap, PRINTF_LDBL_IS_DBL);
264 attribute_compat_text_section
265 __nldbl_wprintf (const wchar_t *fmt, ...)
267 va_list ap;
268 int ret;
270 va_start (ap, fmt);
271 ret = __vfwprintf_internal (stdout, fmt, ap, PRINTF_LDBL_IS_DBL);
272 va_end (ap);
274 return ret;
277 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_29)
279 attribute_compat_text_section
280 __nldbl__IO_vfscanf (FILE *s, const char *fmt, va_list ap, int *errp)
282 int ret = __vfscanf_internal (s, fmt, ap, SCANF_LDBL_IS_DBL);
283 if (__glibc_unlikely (errp != 0))
284 *errp = (ret == -1);
285 return ret;
287 #endif
290 attribute_compat_text_section
291 __nldbl___vfscanf (FILE *s, const char *fmt, va_list ap)
293 return __vfscanf_internal (s, fmt, ap, SCANF_LDBL_IS_DBL);
295 weak_alias (__nldbl___vfscanf, __nldbl_vfscanf)
296 libc_hidden_def (__nldbl_vfscanf)
299 attribute_compat_text_section
300 __nldbl_sscanf (const char *s, const char *fmt, ...)
302 _IO_strfile sf;
303 FILE *f = _IO_strfile_read (&sf, s);
304 va_list ap;
305 int ret;
307 va_start (ap, fmt);
308 ret = __vfscanf_internal (f, fmt, ap, SCANF_LDBL_IS_DBL);
309 va_end (ap);
311 return ret;
313 strong_alias (__nldbl_sscanf, __nldbl__IO_sscanf)
316 attribute_compat_text_section
317 __nldbl___vsscanf (const char *s, const char *fmt, va_list ap)
319 _IO_strfile sf;
320 FILE *f = _IO_strfile_read (&sf, s);
321 return __vfscanf_internal (f, fmt, ap, SCANF_LDBL_IS_DBL);
323 weak_alias (__nldbl___vsscanf, __nldbl_vsscanf)
324 libc_hidden_def (__nldbl_vsscanf)
327 attribute_compat_text_section weak_function
328 __nldbl_vscanf (const char *fmt, va_list ap)
330 return __vfscanf_internal (stdin, fmt, ap, SCANF_LDBL_IS_DBL);
334 attribute_compat_text_section
335 __nldbl_fscanf (FILE *stream, const char *fmt, ...)
337 va_list ap;
338 int ret;
340 va_start (ap, fmt);
341 ret = __vfscanf_internal (stream, fmt, ap, SCANF_LDBL_IS_DBL);
342 va_end (ap);
344 return ret;
348 attribute_compat_text_section
349 __nldbl_scanf (const char *fmt, ...)
351 va_list ap;
352 int ret;
354 va_start (ap, fmt);
355 ret = __vfscanf_internal (stdin, fmt, ap, SCANF_LDBL_IS_DBL);
356 va_end (ap);
358 return ret;
362 attribute_compat_text_section
363 __nldbl_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
365 return __vfwscanf_internal (s, fmt, ap, SCANF_LDBL_IS_DBL);
367 libc_hidden_def (__nldbl_vfwscanf)
370 attribute_compat_text_section
371 __nldbl_swscanf (const wchar_t *s, const wchar_t *fmt, ...)
373 _IO_strfile sf;
374 struct _IO_wide_data wd;
375 FILE *f = _IO_strfile_readw (&sf, &wd, s);
376 va_list ap;
377 int ret;
379 va_start (ap, fmt);
380 ret = __vfwscanf_internal (f, fmt, ap, SCANF_LDBL_IS_DBL);
381 va_end (ap);
383 return ret;
387 attribute_compat_text_section
388 __nldbl_vswscanf (const wchar_t *s, const wchar_t *fmt, va_list ap)
390 _IO_strfile sf;
391 struct _IO_wide_data wd;
392 FILE *f = _IO_strfile_readw (&sf, &wd, s);
394 return __vfwscanf_internal (f, fmt, ap, SCANF_LDBL_IS_DBL);
396 libc_hidden_def (__nldbl_vswscanf)
399 attribute_compat_text_section weak_function
400 __nldbl_vwscanf (const wchar_t *fmt, va_list ap)
402 return __vfwscanf_internal (stdin, fmt, ap, SCANF_LDBL_IS_DBL);
406 attribute_compat_text_section
407 __nldbl_fwscanf (FILE *stream, const wchar_t *fmt, ...)
409 va_list ap;
410 int ret;
412 va_start (ap, fmt);
413 ret = __vfwscanf_internal (stream, fmt, ap, SCANF_LDBL_IS_DBL);
414 va_end (ap);
416 return ret;
420 attribute_compat_text_section
421 __nldbl_wscanf (const wchar_t *fmt, ...)
423 va_list ap;
424 int ret;
426 va_start (ap, fmt);
427 ret = __vfwscanf_internal (stdin, fmt, ap, SCANF_LDBL_IS_DBL);
428 va_end (ap);
430 return ret;
434 attribute_compat_text_section
435 __nldbl___fprintf_chk (FILE *stream, int flag, const char *fmt, ...)
437 va_list ap;
438 int ret;
439 unsigned int mode = PRINTF_LDBL_IS_DBL;
440 if (flag > 0)
441 mode |= PRINTF_FORTIFY;
443 va_start (ap, fmt);
444 ret = __vfprintf_internal (stream, fmt, ap, mode);
445 va_end (ap);
447 return ret;
451 attribute_compat_text_section
452 __nldbl___fwprintf_chk (FILE *stream, int flag, const wchar_t *fmt, ...)
454 va_list ap;
455 int ret;
456 unsigned int mode = PRINTF_LDBL_IS_DBL;
457 if (flag > 0)
458 mode |= PRINTF_FORTIFY;
460 va_start (ap, fmt);
461 ret = __vfwprintf_internal (stream, fmt, ap, mode);
462 va_end (ap);
464 return ret;
468 attribute_compat_text_section
469 __nldbl___printf_chk (int flag, const char *fmt, ...)
471 va_list ap;
472 int ret;
473 unsigned int mode = PRINTF_LDBL_IS_DBL;
474 if (flag > 0)
475 mode |= PRINTF_FORTIFY;
477 va_start (ap, fmt);
478 ret = __vfprintf_internal (stdout, fmt, ap, mode);
479 va_end (ap);
481 return ret;
485 attribute_compat_text_section
486 __nldbl___snprintf_chk (char *s, size_t maxlen, int flag, size_t slen,
487 const char *fmt, ...)
489 if (__glibc_unlikely (slen < maxlen))
490 __chk_fail ();
492 va_list ap;
493 int ret;
494 unsigned int mode = PRINTF_LDBL_IS_DBL;
495 if (flag > 0)
496 mode |= PRINTF_FORTIFY;
498 va_start (ap, fmt);
499 ret = __vsnprintf_internal (s, maxlen, fmt, ap, mode);
500 va_end (ap);
502 return ret;
506 attribute_compat_text_section
507 __nldbl___sprintf_chk (char *s, int flag, size_t slen, const char *fmt, ...)
509 if (slen == 0)
510 __chk_fail ();
512 va_list ap;
513 int ret;
514 unsigned int mode = PRINTF_LDBL_IS_DBL;
515 if (flag > 0)
516 mode |= PRINTF_FORTIFY;
518 va_start (ap, fmt);
519 ret = __vsprintf_internal (s, slen, fmt, ap, mode);
520 va_end (ap);
522 return ret;
526 attribute_compat_text_section
527 __nldbl___swprintf_chk (wchar_t *s, size_t maxlen, int flag, size_t slen,
528 const wchar_t *fmt, ...)
530 if (__glibc_unlikely (slen < maxlen))
531 __chk_fail ();
533 va_list ap;
534 int ret;
535 unsigned int mode = PRINTF_LDBL_IS_DBL;
536 if (flag > 0)
537 mode |= PRINTF_FORTIFY;
539 va_start (ap, fmt);
540 ret = __vswprintf_internal (s, maxlen, fmt, ap, mode);
541 va_end (ap);
543 return ret;
547 attribute_compat_text_section
548 __nldbl___vfprintf_chk (FILE *s, int flag, const char *fmt, va_list ap)
550 unsigned int mode = PRINTF_LDBL_IS_DBL;
551 if (flag > 0)
552 mode |= PRINTF_FORTIFY;
554 return __vfprintf_internal (s, fmt, ap, mode);
558 attribute_compat_text_section
559 __nldbl___vfwprintf_chk (FILE *s, int flag, const wchar_t *fmt, va_list ap)
561 unsigned int mode = PRINTF_LDBL_IS_DBL;
562 if (flag > 0)
563 mode |= PRINTF_FORTIFY;
565 return __vfwprintf_internal (s, fmt, ap, mode);
569 attribute_compat_text_section
570 __nldbl___vprintf_chk (int flag, const char *fmt, va_list ap)
572 unsigned int mode = PRINTF_LDBL_IS_DBL;
573 if (flag > 0)
574 mode |= PRINTF_FORTIFY;
576 return __vfprintf_internal (stdout, fmt, ap, mode);
580 attribute_compat_text_section
581 __nldbl___vsnprintf_chk (char *string, size_t maxlen, int flag, size_t slen,
582 const char *fmt, va_list ap)
584 if (__glibc_unlikely (slen < maxlen))
585 __chk_fail ();
587 unsigned int mode = PRINTF_LDBL_IS_DBL;
588 if (flag > 0)
589 mode |= PRINTF_FORTIFY;
591 return __vsnprintf_internal (string, maxlen, fmt, ap, mode);
595 attribute_compat_text_section
596 __nldbl___vsprintf_chk (char *string, int flag, size_t slen, const char *fmt,
597 va_list ap)
599 if (slen == 0)
600 __chk_fail ();
602 unsigned int mode = PRINTF_LDBL_IS_DBL;
603 if (flag > 0)
604 mode |= PRINTF_FORTIFY;
606 return __vsprintf_internal (string, slen, fmt, ap, mode);
610 attribute_compat_text_section
611 __nldbl___vswprintf_chk (wchar_t *string, size_t maxlen, int flag, size_t slen,
612 const wchar_t *fmt, va_list ap)
614 if (__glibc_unlikely (slen < maxlen))
615 __chk_fail ();
617 unsigned int mode = PRINTF_LDBL_IS_DBL;
618 if (flag > 0)
619 mode |= PRINTF_FORTIFY;
621 return __vswprintf_internal (string, maxlen, fmt, ap, mode);
625 attribute_compat_text_section
626 __nldbl___vwprintf_chk (int flag, const wchar_t *fmt, va_list ap)
628 unsigned int mode = PRINTF_LDBL_IS_DBL;
629 if (flag > 0)
630 mode |= PRINTF_FORTIFY;
632 return __vfwprintf_internal (stdout, fmt, ap, mode);
636 attribute_compat_text_section
637 __nldbl___wprintf_chk (int flag, const wchar_t *fmt, ...)
639 va_list ap;
640 int ret;
641 unsigned int mode = PRINTF_LDBL_IS_DBL;
642 if (flag > 0)
643 mode |= PRINTF_FORTIFY;
645 va_start (ap, fmt);
646 ret = __vfwprintf_internal (stdout, fmt, ap, mode);
647 va_end (ap);
649 return ret;
653 attribute_compat_text_section
654 __nldbl___vasprintf_chk (char **ptr, int flag, const char *fmt, va_list ap)
656 unsigned int mode = PRINTF_LDBL_IS_DBL;
657 if (flag > 0)
658 mode |= PRINTF_FORTIFY;
660 return __vasprintf_internal (ptr, fmt, ap, mode);
664 attribute_compat_text_section
665 __nldbl___asprintf_chk (char **ptr, int flag, const char *fmt, ...)
667 va_list ap;
668 int ret;
669 unsigned int mode = PRINTF_LDBL_IS_DBL;
670 if (flag > 0)
671 mode |= PRINTF_FORTIFY;
673 va_start (ap, fmt);
674 ret = __vasprintf_internal (ptr, fmt, ap, mode);
675 va_end (ap);
677 return ret;
681 attribute_compat_text_section
682 __nldbl___vdprintf_chk (int d, int flag, const char *fmt, va_list ap)
684 unsigned int mode = PRINTF_LDBL_IS_DBL;
685 if (flag > 0)
686 mode |= PRINTF_FORTIFY;
688 return __vdprintf_internal (d, fmt, ap, mode);
692 attribute_compat_text_section
693 __nldbl___dprintf_chk (int d, int flag, const char *fmt, ...)
695 va_list ap;
696 int ret;
697 unsigned int mode = PRINTF_LDBL_IS_DBL;
698 if (flag > 0)
699 mode |= PRINTF_FORTIFY;
701 va_start (ap, fmt);
702 ret = __vdprintf_internal (d, fmt, ap, mode);
703 va_end (ap);
705 return ret;
709 attribute_compat_text_section
710 __nldbl___obstack_vprintf_chk (struct obstack *obstack, int flag,
711 const char *fmt, va_list ap)
713 unsigned int mode = PRINTF_LDBL_IS_DBL;
714 if (flag > 0)
715 mode |= PRINTF_FORTIFY;
717 return __obstack_vprintf_internal (obstack, fmt, ap, mode);
721 attribute_compat_text_section
722 __nldbl___obstack_printf_chk (struct obstack *obstack, int flag,
723 const char *fmt, ...)
725 va_list ap;
726 int ret;
727 unsigned int mode = PRINTF_LDBL_IS_DBL;
728 if (flag > 0)
729 mode |= PRINTF_FORTIFY;
731 va_start (ap, fmt);
732 ret = __obstack_vprintf_internal (obstack, fmt, ap, mode);
733 va_end (ap);
735 return ret;
738 extern __typeof (printf_size) __printf_size;
741 attribute_compat_text_section
742 __nldbl_printf_size (FILE *fp, const struct printf_info *info,
743 const void *const *args)
745 struct printf_info info_no_ldbl = *info;
747 info_no_ldbl.is_long_double = 0;
748 return __printf_size (fp, &info_no_ldbl, args);
751 extern __typeof (__printf_fp) ___printf_fp;
754 attribute_compat_text_section
755 __nldbl___printf_fp (FILE *fp, const struct printf_info *info,
756 const void *const *args)
758 struct printf_info info_no_ldbl = *info;
760 info_no_ldbl.is_long_double = 0;
761 return ___printf_fp (fp, &info_no_ldbl, args);
764 ssize_t
765 attribute_compat_text_section
766 __nldbl_strfmon (char *s, size_t maxsize, const char *format, ...)
768 va_list ap;
769 ssize_t ret;
771 va_start (ap, format);
772 ret = __vstrfmon_l_internal (s, maxsize, _NL_CURRENT_LOCALE, format, ap,
773 STRFMON_LDBL_IS_DBL);
774 va_end (ap);
775 return ret;
778 ssize_t
779 attribute_compat_text_section
780 __nldbl___strfmon_l (char *s, size_t maxsize, locale_t loc,
781 const char *format, ...)
783 va_list ap;
784 ssize_t ret;
786 va_start (ap, format);
787 ret = __vstrfmon_l_internal (s, maxsize, loc, format, ap,
788 STRFMON_LDBL_IS_DBL);
789 va_end (ap);
790 return ret;
792 weak_alias (__nldbl___strfmon_l, __nldbl_strfmon_l)
794 ssize_t
795 attribute_compat_text_section
796 __nldbl___vstrfmon (char *s, size_t maxsize, const char *format, va_list ap)
798 return __vstrfmon_l_internal (s, maxsize, _NL_CURRENT_LOCALE, format, ap,
799 STRFMON_LDBL_IS_DBL);
802 ssize_t
803 attribute_compat_text_section
804 __nldbl___vstrfmon_l (char *s, size_t maxsize, locale_t loc,
805 const char *format, va_list ap)
807 return __vstrfmon_l_internal (s, maxsize, loc, format, ap,
808 STRFMON_LDBL_IS_DBL);
811 void
812 attribute_compat_text_section
813 __nldbl_syslog (int pri, const char *fmt, ...)
815 va_list ap;
816 va_start (ap, fmt);
817 __vsyslog_internal (pri, fmt, ap, PRINTF_LDBL_IS_DBL);
818 va_end (ap);
821 void
822 attribute_compat_text_section
823 __nldbl_vsyslog (int pri, const char *fmt, va_list ap)
825 __vsyslog_internal (pri, fmt, ap, PRINTF_LDBL_IS_DBL);
828 void
829 attribute_compat_text_section
830 __nldbl___syslog_chk (int pri, int flag, const char *fmt, ...)
832 va_list ap;
833 unsigned int mode = PRINTF_LDBL_IS_DBL;
834 if (flag > 0)
835 mode |= PRINTF_FORTIFY;
837 va_start (ap, fmt);
838 __vsyslog_internal (pri, fmt, ap, mode);
839 va_end(ap);
842 void
843 attribute_compat_text_section
844 __nldbl___vsyslog_chk (int pri, int flag, const char *fmt, va_list ap)
846 unsigned int mode = PRINTF_LDBL_IS_DBL;
847 if (flag > 0)
848 mode |= PRINTF_FORTIFY;
850 __vsyslog_internal (pri, fmt, ap, mode);
854 attribute_compat_text_section
855 __nldbl___isoc99_vfscanf (FILE *s, const char *fmt, va_list ap)
857 return __vfscanf_internal (s, fmt, ap, SCANF_LDBL_IS_DBL | SCANF_ISOC99_A);
859 libc_hidden_def (__nldbl___isoc99_vfscanf)
862 attribute_compat_text_section
863 __nldbl___isoc99_sscanf (const char *s, const char *fmt, ...)
865 _IO_strfile sf;
866 FILE *f = _IO_strfile_read (&sf, s);
867 va_list ap;
868 int ret;
870 va_start (ap, fmt);
871 ret = __vfscanf_internal (f, fmt, ap, SCANF_LDBL_IS_DBL | SCANF_ISOC99_A);
872 va_end (ap);
874 return ret;
878 attribute_compat_text_section
879 __nldbl___isoc99_vsscanf (const char *s, const char *fmt, va_list ap)
881 _IO_strfile sf;
882 FILE *f = _IO_strfile_read (&sf, s);
884 return __vfscanf_internal (f, fmt, ap, SCANF_LDBL_IS_DBL | SCANF_ISOC99_A);
886 libc_hidden_def (__nldbl___isoc99_vsscanf)
889 attribute_compat_text_section
890 __nldbl___isoc99_vscanf (const char *fmt, va_list ap)
892 return __vfscanf_internal (stdin, fmt, ap,
893 SCANF_LDBL_IS_DBL | SCANF_ISOC99_A);
897 attribute_compat_text_section
898 __nldbl___isoc99_fscanf (FILE *s, const char *fmt, ...)
900 va_list ap;
901 int ret;
903 va_start (ap, fmt);
904 ret = __vfscanf_internal (s, fmt, ap, SCANF_LDBL_IS_DBL | SCANF_ISOC99_A);
905 va_end (ap);
907 return ret;
911 attribute_compat_text_section
912 __nldbl___isoc99_scanf (const char *fmt, ...)
914 va_list ap;
915 int ret;
917 va_start (ap, fmt);
918 ret = __vfscanf_internal (stdin, fmt, ap,
919 SCANF_LDBL_IS_DBL | SCANF_ISOC99_A);
920 va_end (ap);
922 return ret;
926 attribute_compat_text_section
927 __nldbl___isoc99_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
929 return __vfwscanf_internal (s, fmt, ap, SCANF_LDBL_IS_DBL | SCANF_ISOC99_A);
931 libc_hidden_def (__nldbl___isoc99_vfwscanf)
934 attribute_compat_text_section
935 __nldbl___isoc99_swscanf (const wchar_t *s, const wchar_t *fmt, ...)
937 _IO_strfile sf;
938 struct _IO_wide_data wd;
939 FILE *f = _IO_strfile_readw (&sf, &wd, s);
940 va_list ap;
941 int ret;
943 va_start (ap, fmt);
944 ret = __vfwscanf_internal (f, fmt, ap, SCANF_LDBL_IS_DBL | SCANF_ISOC99_A);
945 va_end (ap);
947 return ret;
951 attribute_compat_text_section
952 __nldbl___isoc99_vswscanf (const wchar_t *s, const wchar_t *fmt, va_list ap)
954 _IO_strfile sf;
955 struct _IO_wide_data wd;
956 FILE *f = _IO_strfile_readw (&sf, &wd, s);
958 return __vfwscanf_internal (f, fmt, ap, SCANF_LDBL_IS_DBL | SCANF_ISOC99_A);
960 libc_hidden_def (__nldbl___isoc99_vswscanf)
963 attribute_compat_text_section
964 __nldbl___isoc99_vwscanf (const wchar_t *fmt, va_list ap)
966 return __vfwscanf_internal (stdin, fmt, ap,
967 SCANF_LDBL_IS_DBL | SCANF_ISOC99_A);
971 attribute_compat_text_section
972 __nldbl___isoc99_fwscanf (FILE *s, const wchar_t *fmt, ...)
974 va_list ap;
975 int ret;
977 va_start (ap, fmt);
978 ret = __vfwscanf_internal (s, fmt, ap, SCANF_LDBL_IS_DBL | SCANF_ISOC99_A);
979 va_end (ap);
981 return ret;
985 attribute_compat_text_section
986 __nldbl___isoc99_wscanf (const wchar_t *fmt, ...)
988 va_list ap;
989 int ret;
991 va_start (ap, fmt);
992 ret = __vfwscanf_internal (stdin, fmt, ap,
993 SCANF_LDBL_IS_DBL | SCANF_ISOC99_A);
994 va_end (ap);
996 return ret;
1000 attribute_compat_text_section
1001 __nldbl___isoc23_vfscanf (FILE *s, const char *fmt, va_list ap)
1003 return __vfscanf_internal (s, fmt, ap,
1004 SCANF_LDBL_IS_DBL | SCANF_ISOC99_A
1005 | SCANF_ISOC23_BIN_CST);
1007 libc_hidden_def (__nldbl___isoc23_vfscanf)
1010 attribute_compat_text_section
1011 __nldbl___isoc23_sscanf (const char *s, const char *fmt, ...)
1013 _IO_strfile sf;
1014 FILE *f = _IO_strfile_read (&sf, s);
1015 va_list ap;
1016 int ret;
1018 va_start (ap, fmt);
1019 ret = __vfscanf_internal (f, fmt, ap,
1020 SCANF_LDBL_IS_DBL | SCANF_ISOC99_A
1021 | SCANF_ISOC23_BIN_CST);
1022 va_end (ap);
1024 return ret;
1028 attribute_compat_text_section
1029 __nldbl___isoc23_vsscanf (const char *s, const char *fmt, va_list ap)
1031 _IO_strfile sf;
1032 FILE *f = _IO_strfile_read (&sf, s);
1034 return __vfscanf_internal (f, fmt, ap,
1035 SCANF_LDBL_IS_DBL | SCANF_ISOC99_A
1036 | SCANF_ISOC23_BIN_CST);
1038 libc_hidden_def (__nldbl___isoc23_vsscanf)
1041 attribute_compat_text_section
1042 __nldbl___isoc23_vscanf (const char *fmt, va_list ap)
1044 return __vfscanf_internal (stdin, fmt, ap,
1045 SCANF_LDBL_IS_DBL | SCANF_ISOC99_A
1046 | SCANF_ISOC23_BIN_CST);
1050 attribute_compat_text_section
1051 __nldbl___isoc23_fscanf (FILE *s, const char *fmt, ...)
1053 va_list ap;
1054 int ret;
1056 va_start (ap, fmt);
1057 ret = __vfscanf_internal (s, fmt, ap,
1058 SCANF_LDBL_IS_DBL | SCANF_ISOC99_A
1059 | SCANF_ISOC23_BIN_CST);
1060 va_end (ap);
1062 return ret;
1066 attribute_compat_text_section
1067 __nldbl___isoc23_scanf (const char *fmt, ...)
1069 va_list ap;
1070 int ret;
1072 va_start (ap, fmt);
1073 ret = __vfscanf_internal (stdin, fmt, ap,
1074 SCANF_LDBL_IS_DBL | SCANF_ISOC99_A
1075 | SCANF_ISOC23_BIN_CST);
1076 va_end (ap);
1078 return ret;
1082 attribute_compat_text_section
1083 __nldbl___isoc23_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
1085 return __vfwscanf_internal (s, fmt, ap,
1086 SCANF_LDBL_IS_DBL | SCANF_ISOC99_A
1087 | SCANF_ISOC23_BIN_CST);
1089 libc_hidden_def (__nldbl___isoc23_vfwscanf)
1092 attribute_compat_text_section
1093 __nldbl___isoc23_swscanf (const wchar_t *s, const wchar_t *fmt, ...)
1095 _IO_strfile sf;
1096 struct _IO_wide_data wd;
1097 FILE *f = _IO_strfile_readw (&sf, &wd, s);
1098 va_list ap;
1099 int ret;
1101 va_start (ap, fmt);
1102 ret = __vfwscanf_internal (f, fmt, ap,
1103 SCANF_LDBL_IS_DBL | SCANF_ISOC99_A
1104 | SCANF_ISOC23_BIN_CST);
1105 va_end (ap);
1107 return ret;
1111 attribute_compat_text_section
1112 __nldbl___isoc23_vswscanf (const wchar_t *s, const wchar_t *fmt, va_list ap)
1114 _IO_strfile sf;
1115 struct _IO_wide_data wd;
1116 FILE *f = _IO_strfile_readw (&sf, &wd, s);
1118 return __vfwscanf_internal (f, fmt, ap,
1119 SCANF_LDBL_IS_DBL | SCANF_ISOC99_A
1120 | SCANF_ISOC23_BIN_CST);
1122 libc_hidden_def (__nldbl___isoc23_vswscanf)
1125 attribute_compat_text_section
1126 __nldbl___isoc23_vwscanf (const wchar_t *fmt, va_list ap)
1128 return __vfwscanf_internal (stdin, fmt, ap,
1129 SCANF_LDBL_IS_DBL | SCANF_ISOC99_A
1130 | SCANF_ISOC23_BIN_CST);
1134 attribute_compat_text_section
1135 __nldbl___isoc23_fwscanf (FILE *s, const wchar_t *fmt, ...)
1137 va_list ap;
1138 int ret;
1140 va_start (ap, fmt);
1141 ret = __vfwscanf_internal (s, fmt, ap,
1142 SCANF_LDBL_IS_DBL | SCANF_ISOC99_A
1143 | SCANF_ISOC23_BIN_CST);
1144 va_end (ap);
1146 return ret;
1150 attribute_compat_text_section
1151 __nldbl___isoc23_wscanf (const wchar_t *fmt, ...)
1153 va_list ap;
1154 int ret;
1156 va_start (ap, fmt);
1157 ret = __vfwscanf_internal (stdin, fmt, ap,
1158 SCANF_LDBL_IS_DBL | SCANF_ISOC99_A
1159 | SCANF_ISOC23_BIN_CST);
1160 va_end (ap);
1162 return ret;
1165 void
1166 __nldbl_argp_error (const struct argp_state *state, const char *fmt, ...)
1168 va_list ap;
1169 va_start (ap, fmt);
1170 __argp_error_internal (state, fmt, ap, PRINTF_LDBL_IS_DBL);
1171 va_end (ap);
1174 void
1175 __nldbl_argp_failure (const struct argp_state *state, int status,
1176 int errnum, const char *fmt, ...)
1178 va_list ap;
1179 va_start (ap, fmt);
1180 __argp_failure_internal (state, status, errnum, fmt, ap,
1181 PRINTF_LDBL_IS_DBL);
1182 va_end (ap);
1185 #define VA_CALL(call) \
1187 va_list ap; \
1188 va_start (ap, format); \
1189 call (format, ap, PRINTF_LDBL_IS_DBL); \
1190 va_end (ap); \
1193 void
1194 __nldbl_err (int status, const char *format, ...)
1196 VA_CALL (__vwarn_internal)
1197 exit (status);
1200 void
1201 __nldbl_errx (int status, const char *format, ...)
1203 VA_CALL (__vwarnx_internal)
1204 exit (status);
1207 void
1208 __nldbl_verr (int status, const char *format, __gnuc_va_list ap)
1210 __vwarn_internal (format, ap, PRINTF_LDBL_IS_DBL);
1211 exit (status);
1214 void
1215 __nldbl_verrx (int status, const char *format, __gnuc_va_list ap)
1217 __vwarnx_internal (format, ap, PRINTF_LDBL_IS_DBL);
1218 exit (status);
1221 void
1222 __nldbl_warn (const char *format, ...)
1224 VA_CALL (__vwarn_internal)
1227 void
1228 __nldbl_warnx (const char *format, ...)
1230 VA_CALL (__vwarnx_internal)
1233 void
1234 __nldbl_vwarn (const char *format, __gnuc_va_list ap)
1236 __vwarn_internal (format, ap, PRINTF_LDBL_IS_DBL);
1239 void
1240 __nldbl_vwarnx (const char *format, __gnuc_va_list ap)
1242 __vwarnx_internal (format, ap, PRINTF_LDBL_IS_DBL);
1245 void
1246 __nldbl_error (int status, int errnum, const char *message, ...)
1248 va_list ap;
1249 va_start (ap, message);
1250 __error_internal (status, errnum, message, ap, PRINTF_LDBL_IS_DBL);
1251 va_end (ap);
1254 void
1255 __nldbl_error_at_line (int status, int errnum, const char *file_name,
1256 unsigned int line_number, const char *message,
1257 ...)
1259 va_list ap;
1260 va_start (ap, message);
1261 __error_at_line_internal (status, errnum, file_name, line_number,
1262 message, ap, PRINTF_LDBL_IS_DBL);
1263 va_end (ap);
1266 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
1267 compat_symbol (libc, __nldbl__IO_printf, _IO_printf, GLIBC_2_0);
1268 compat_symbol (libc, __nldbl__IO_sprintf, _IO_sprintf, GLIBC_2_0);
1269 compat_symbol (libc, __nldbl__IO_vfprintf, _IO_vfprintf, GLIBC_2_0);
1270 compat_symbol (libc, __nldbl__IO_vsprintf, _IO_vsprintf, GLIBC_2_0);
1271 compat_symbol (libc, __nldbl_dprintf, dprintf, GLIBC_2_0);
1272 compat_symbol (libc, __nldbl_fprintf, fprintf, GLIBC_2_0);
1273 compat_symbol (libc, __nldbl_printf, printf, GLIBC_2_0);
1274 compat_symbol (libc, __nldbl_sprintf, sprintf, GLIBC_2_0);
1275 compat_symbol (libc, __nldbl_vfprintf, vfprintf, GLIBC_2_0);
1276 compat_symbol (libc, __nldbl_vprintf, vprintf, GLIBC_2_0);
1277 compat_symbol (libc, __nldbl__IO_fprintf, _IO_fprintf, GLIBC_2_0);
1278 compat_symbol (libc, __nldbl___vsnprintf, __vsnprintf, GLIBC_2_0);
1279 compat_symbol (libc, __nldbl_asprintf, asprintf, GLIBC_2_0);
1280 compat_symbol (libc, __nldbl_obstack_printf, obstack_printf, GLIBC_2_0);
1281 compat_symbol (libc, __nldbl_obstack_vprintf, obstack_vprintf, GLIBC_2_0);
1282 compat_symbol (libc, __nldbl_snprintf, snprintf, GLIBC_2_0);
1283 compat_symbol (libc, __nldbl_vasprintf, vasprintf, GLIBC_2_0);
1284 compat_symbol (libc, __nldbl_vdprintf, vdprintf, GLIBC_2_0);
1285 compat_symbol (libc, __nldbl_vsnprintf, vsnprintf, GLIBC_2_0);
1286 compat_symbol (libc, __nldbl_vsprintf, vsprintf, GLIBC_2_0);
1287 compat_symbol (libc, __nldbl__IO_sscanf, _IO_sscanf, GLIBC_2_0);
1288 compat_symbol (libc, __nldbl___vfscanf, __vfscanf, GLIBC_2_0);
1289 compat_symbol (libc, __nldbl___vsscanf, __vsscanf, GLIBC_2_0);
1290 compat_symbol (libc, __nldbl_fscanf, fscanf, GLIBC_2_0);
1291 compat_symbol (libc, __nldbl_scanf, scanf, GLIBC_2_0);
1292 compat_symbol (libc, __nldbl_sscanf, sscanf, GLIBC_2_0);
1293 compat_symbol (libc, __nldbl_vfscanf, vfscanf, GLIBC_2_0);
1294 compat_symbol (libc, __nldbl_vscanf, vscanf, GLIBC_2_0);
1295 compat_symbol (libc, __nldbl_vsscanf, vsscanf, GLIBC_2_0);
1296 compat_symbol (libc, __nldbl___printf_fp, __printf_fp, GLIBC_2_0);
1297 compat_symbol (libc, __nldbl_strfmon, strfmon, GLIBC_2_0);
1298 compat_symbol (libc, __nldbl_syslog, syslog, GLIBC_2_0);
1299 compat_symbol (libc, __nldbl_vsyslog, vsyslog, GLIBC_2_0);
1300 /* This function is not in public headers, but was exported until
1301 version 2.29. For platforms that are newer than that, there's no
1302 need to expose the symbol. */
1303 # if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_29)
1304 compat_symbol (libc, __nldbl__IO_vfscanf, _IO_vfscanf, GLIBC_2_0);
1305 # endif
1306 #endif
1307 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_1)
1308 compat_symbol (libc, __nldbl___asprintf, __asprintf, GLIBC_2_1);
1309 compat_symbol (libc, __nldbl_printf_size, printf_size, GLIBC_2_1);
1310 compat_symbol (libc, __nldbl___strfmon_l, __strfmon_l, GLIBC_2_1);
1311 #endif
1312 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_2)
1313 compat_symbol (libc, __nldbl_swprintf, swprintf, GLIBC_2_2);
1314 compat_symbol (libc, __nldbl_vwprintf, vwprintf, GLIBC_2_2);
1315 compat_symbol (libc, __nldbl_wprintf, wprintf, GLIBC_2_2);
1316 compat_symbol (libc, __nldbl_fwprintf, fwprintf, GLIBC_2_2);
1317 compat_symbol (libc, __nldbl_vfwprintf, vfwprintf, GLIBC_2_2);
1318 compat_symbol (libc, __nldbl_vswprintf, vswprintf, GLIBC_2_2);
1319 compat_symbol (libc, __nldbl_fwscanf, fwscanf, GLIBC_2_2);
1320 compat_symbol (libc, __nldbl_swscanf, swscanf, GLIBC_2_2);
1321 compat_symbol (libc, __nldbl_vfwscanf, vfwscanf, GLIBC_2_2);
1322 compat_symbol (libc, __nldbl_vswscanf, vswscanf, GLIBC_2_2);
1323 compat_symbol (libc, __nldbl_vwscanf, vwscanf, GLIBC_2_2);
1324 compat_symbol (libc, __nldbl_wscanf, wscanf, GLIBC_2_2);
1325 #endif
1326 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_3)
1327 compat_symbol (libc, __nldbl_strfmon_l, strfmon_l, GLIBC_2_3);
1328 #endif
1329 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_3_4)
1330 compat_symbol (libc, __nldbl___sprintf_chk, __sprintf_chk, GLIBC_2_3_4);
1331 compat_symbol (libc, __nldbl___vsprintf_chk, __vsprintf_chk, GLIBC_2_3_4);
1332 compat_symbol (libc, __nldbl___snprintf_chk, __snprintf_chk, GLIBC_2_3_4);
1333 compat_symbol (libc, __nldbl___vsnprintf_chk, __vsnprintf_chk, GLIBC_2_3_4);
1334 compat_symbol (libc, __nldbl___printf_chk, __printf_chk, GLIBC_2_3_4);
1335 compat_symbol (libc, __nldbl___fprintf_chk, __fprintf_chk, GLIBC_2_3_4);
1336 compat_symbol (libc, __nldbl___vprintf_chk, __vprintf_chk, GLIBC_2_3_4);
1337 compat_symbol (libc, __nldbl___vfprintf_chk, __vfprintf_chk, GLIBC_2_3_4);
1338 #endif