public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/azanella/clang] Remove stdio-ldbl.h
@ 2022-03-31 19:03 Adhemerval Zanella
0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-03-31 19:03 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ee3f012f55dab707f09ee5522ce21c2e39d69180
commit ee3f012f55dab707f09ee5522ce21c2e39d69180
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Thu Feb 24 14:13:12 2022 -0300
Remove stdio-ldbl.h
The functions which require different alias to long double depending
of the ABI now uses a set os macros that defines the expected alias
on the function prototype, instead of redefine them using the
__LDBL_REDIR_DEC macros.
The __REDIRECT_LDBL, __REDIRECT_LDBL_NTH, __REDIRECT_LDBL_NTHNL
are refactores to be similar to __REDIRECT with the difference it
now expects the aliases for binary128 and for the long double being
double (which __LDBL_REDIR_DEC does).
All printf internal usage are also replaced to use internal alias
instead.
Diff:
---
argp/argp-parse.c | 4 +-
debug/backtracesyms.c | 18 +-
grp/putgrent.c | 6 +-
gshadow/putsgent.c | 6 +-
include/bits/stdio-ldbl.h | 1 -
include/stdio.h | 34 ++-
inet/ether_ntoa_r.c | 8 +-
inet/rexec.c | 2 +-
libio/Makefile | 2 +-
libio/bits/stdio-ldbl.h | 108 --------
libio/bits/stdio2.h | 115 ++++++---
libio/stdio.h | 286 +++++++++++++--------
malloc/malloc-check.c | 1 +
malloc/malloc.c | 32 +--
misc/efgcvt-template.c | 2 +-
misc/mntent_r.c | 2 +-
misc/sys/cdefs.h | 70 +++--
misc/syslog.c | 4 +-
nis/nis_subr.c | 8 +-
nptl/pthread_getname.c | 2 +-
nptl/pthread_setname.c | 2 +-
pwd/getpw.c | 6 +-
pwd/putpwent.c | 4 +-
resolv/inet_ntop.c | 4 +-
resolv/nss_dns/dns-host.c | 4 +-
resolv/nss_dns/dns-network.c | 12 +-
shadow/putspent.c | 16 +-
stdio-common/dprintf.c | 1 -
stdio-common/fprintf.c | 2 +-
stdio-common/psiginfo.c | 32 +--
stdio-common/sprintf.c | 2 +-
stdio-common/vfprintf.c | 2 +-
sunrpc/netname.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-asprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-dprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-fprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-snprintf.c | 6 +-
.../ieee754/ldbl-128ibm-compat/ieee128-sprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c | 7 +-
sysdeps/posix/tempname.c | 2 +-
sysdeps/unix/sysv/linux/ia64/makecontext.c | 2 +-
wcsmbs/bits/wchar2.h | 22 +-
44 files changed, 450 insertions(+), 427 deletions(-)
diff --git a/argp/argp-parse.c b/argp/argp-parse.c
index 13cd84dd33..c26c0fc27f 100644
--- a/argp/argp-parse.c
+++ b/argp/argp-parse.c
@@ -177,7 +177,7 @@ argp_version_parser (int key, char *arg, struct argp_state *state)
if (argp_program_version_hook)
(*argp_program_version_hook) (state->out_stream, state);
else if (argp_program_version)
- fprintf (state->out_stream, "%s\n", argp_program_version);
+ __fprintf (state->out_stream, "%s\n", argp_program_version);
else
__argp_error (state, dgettext (state->root_argp->argp_domain,
"(PROGRAM ERROR) No version known!?"));
@@ -618,7 +618,7 @@ parser_finalize (struct parser *parser,
{
if (!(parser->state.flags & ARGP_NO_ERRS)
&& parser->state.err_stream)
- fprintf (parser->state.err_stream,
+ __fprintf (parser->state.err_stream,
dgettext (parser->argp->argp_domain,
"%s: Too many arguments\n"),
parser->state.name);
diff --git a/debug/backtracesyms.c b/debug/backtracesyms.c
index 17e0626df8..adb939f888 100644
--- a/debug/backtracesyms.c
+++ b/debug/backtracesyms.c
@@ -83,10 +83,10 @@ __backtrace_symbols (void *const *array, int size)
info[cnt].dli_saddr = info[cnt].dli_fbase;
if (info[cnt].dli_sname == NULL && info[cnt].dli_saddr == 0)
- last += 1 + sprintf (last, "%s(%s) [%p]",
- info[cnt].dli_fname ?: "",
- info[cnt].dli_sname ?: "",
- array[cnt]);
+ last += 1 + __sprintf (last, "%s(%s) [%p]",
+ info[cnt].dli_fname ?: "",
+ info[cnt].dli_sname ?: "",
+ array[cnt]);
else
{
char sign;
@@ -102,14 +102,14 @@ __backtrace_symbols (void *const *array, int size)
offset = info[cnt].dli_saddr - array[cnt];
}
- last += 1 + sprintf (last, "%s(%s%c%#tx) [%p]",
- info[cnt].dli_fname ?: "",
- info[cnt].dli_sname ?: "",
- sign, offset, array[cnt]);
+ last += 1 + __sprintf (last, "%s(%s%c%#tx) [%p]",
+ info[cnt].dli_fname ?: "",
+ info[cnt].dli_sname ?: "",
+ sign, offset, array[cnt]);
}
}
else
- last += 1 + sprintf (last, "[%p]", array[cnt]);
+ last += 1 + __sprintf (last, "[%p]", array[cnt]);
}
assert (last <= (char *) result + size * sizeof (char *) + total);
}
diff --git a/grp/putgrent.c b/grp/putgrent.c
index 966ba2a763..305ff44359 100644
--- a/grp/putgrent.c
+++ b/grp/putgrent.c
@@ -45,10 +45,10 @@ putgrent (const struct group *gr, FILE *stream)
flockfile (stream);
if (gr->gr_name[0] == '+' || gr->gr_name[0] == '-')
- retval = fprintf (stream, "%s:%s::",
+ retval = __fprintf (stream, "%s:%s::",
gr->gr_name, _S (gr->gr_passwd));
else
- retval = fprintf (stream, "%s:%s:%lu:",
+ retval = __fprintf (stream, "%s:%s:%lu:",
gr->gr_name, _S (gr->gr_passwd),
(unsigned long int) gr->gr_gid);
if (__builtin_expect (retval, 0) < 0)
@@ -60,7 +60,7 @@ putgrent (const struct group *gr, FILE *stream)
if (gr->gr_mem != NULL)
{
for (size_t i = 0; gr->gr_mem[i] != NULL; i++)
- if (fprintf (stream, i == 0 ? "%s" : ",%s", gr->gr_mem[i]) < 0)
+ if (__fprintf (stream, i == 0 ? "%s" : ",%s", gr->gr_mem[i]) < 0)
{
/* What else can we do? */
funlockfile (stream);
diff --git a/gshadow/putsgent.c b/gshadow/putsgent.c
index 9e2dca7eaf..870438de6d 100644
--- a/gshadow/putsgent.c
+++ b/gshadow/putsgent.c
@@ -42,7 +42,7 @@ putsgent (const struct sgrp *g, FILE *stream)
_IO_flockfile (stream);
- if (fprintf (stream, "%s:%s:", g->sg_namp, _S (g->sg_passwd)) < 0)
+ if (__fprintf (stream, "%s:%s:", g->sg_namp, _S (g->sg_passwd)) < 0)
++errors;
bool first = true;
@@ -50,7 +50,7 @@ putsgent (const struct sgrp *g, FILE *stream)
if (sp != NULL)
while (*sp != NULL)
{
- if (fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
+ if (__fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
{
++errors;
break;
@@ -65,7 +65,7 @@ putsgent (const struct sgrp *g, FILE *stream)
if (sp != NULL)
while (*sp != NULL)
{
- if (fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
+ if (__fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
{
++errors;
break;
diff --git a/include/bits/stdio-ldbl.h b/include/bits/stdio-ldbl.h
deleted file mode 100644
index 1f7d3ce1c6..0000000000
--- a/include/bits/stdio-ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <libio/bits/stdio-ldbl.h>
diff --git a/include/stdio.h b/include/stdio.h
index 23b7fd288c..a645a1bf99 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -22,13 +22,17 @@
/* Some libc_hidden_ldbl_proto's do not map to a unique symbol when
redirecting ldouble to _Float128 variants. We can therefore safely
directly alias them to their internal name. */
-# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc)
-# define stdio_hidden_ldbl_proto(p, f) \
- extern __typeof (p ## f) p ## f __asm (__ASMNAME ("___ieee128_" #f));
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# define stdio_hidden_ldbl_proto(p,f) __LDBL_REDIR1_DECL (p ## f, p ## f ## ieee128)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc) && defined SHARED
+# define __stdio_hidden_ldbl_proto(name, alias) \
+ extern __typeof (name) __##name __asm__ (__hidden_asmname (#alias));
+# define stdio_hidden_ldbl_proto(name) \
+ extern typeof (name) __##name##ieee128; \
+ libc_hidden_proto (__##name##ieee128); \
+ __stdio_hidden_ldbl_proto (name, __GI___##name##ieee128)
# else
-# define stdio_hidden_ldbl_proto(p,f) libc_hidden_proto (p ## f)
+# define stdio_hidden_ldbl_proto(name) \
+ extern __typeof (name) __##name; \
+ libc_hidden_proto (__##name)
# endif
/* Set the error indicator on FP. */
@@ -39,10 +43,7 @@ fseterr_unlocked (FILE *fp)
}
extern int __fcloseall (void) attribute_hidden;
-extern int __snprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, ...)
- __attribute__ ((__format__ (__printf__, 3, 4)));
-stdio_hidden_ldbl_proto (__, snprintf)
+stdio_hidden_ldbl_proto (snprintf);
extern int __vfscanf (FILE *__restrict __s,
const char *__restrict __format,
@@ -183,7 +184,7 @@ extern const char *const _sys_errlist_internal[] attribute_hidden;
extern const char *__get_errlist (int) attribute_hidden;
extern const char *__get_errname (int) attribute_hidden;
-libc_hidden_ldbl_proto (__asprintf)
+stdio_hidden_ldbl_proto (asprintf);
# if IS_IN (libc)
extern FILE *_IO_new_fopen (const char*, const char*);
@@ -205,13 +206,10 @@ extern int _IO_new_fgetpos (FILE *, __fpos_t *);
# define fgetpos(fp, posp) _IO_new_fgetpos (fp, posp)
# endif
-extern __typeof (dprintf) __dprintf
- __attribute__ ((__format__ (__printf__, 2, 3)));
-stdio_hidden_ldbl_proto (__, dprintf)
-libc_hidden_ldbl_proto (dprintf)
-libc_hidden_ldbl_proto (fprintf)
-libc_hidden_ldbl_proto (vfprintf)
-libc_hidden_ldbl_proto (sprintf)
+stdio_hidden_ldbl_proto (dprintf);
+stdio_hidden_ldbl_proto (fprintf);
+stdio_hidden_ldbl_proto (vfprintf);
+stdio_hidden_ldbl_proto (sprintf);
libc_hidden_proto (ungetc)
libc_hidden_proto (__getdelim)
libc_hidden_proto (fwrite)
diff --git a/inet/ether_ntoa_r.c b/inet/ether_ntoa_r.c
index 03011ffef6..f111e5234c 100644
--- a/inet/ether_ntoa_r.c
+++ b/inet/ether_ntoa_r.c
@@ -23,10 +23,10 @@
char *
ether_ntoa_r (const struct ether_addr *addr, char *buf)
{
- sprintf (buf, "%x:%x:%x:%x:%x:%x",
- addr->ether_addr_octet[0], addr->ether_addr_octet[1],
- addr->ether_addr_octet[2], addr->ether_addr_octet[3],
- addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
+ __sprintf (buf, "%x:%x:%x:%x:%x:%x",
+ addr->ether_addr_octet[0], addr->ether_addr_octet[1],
+ addr->ether_addr_octet[2], addr->ether_addr_octet[3],
+ addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
return buf;
}
libc_hidden_def (ether_ntoa_r)
diff --git a/inet/rexec.c b/inet/rexec.c
index 330282ac16..809475d976 100644
--- a/inet/rexec.c
+++ b/inet/rexec.c
@@ -135,7 +135,7 @@ retry:
NULL, 0, servbuff, sizeof(servbuff),
NI_NUMERICSERV))
port = (int) __strtol (servbuff, NULL, 10);
- (void) sprintf(num, "%u", port);
+ (void) __sprintf(num, "%u", port);
(void) __write(s, num, strlen(num)+1);
{ socklen_t len = sizeof (from);
s3 = TEMP_FAILURE_RETRY (accept(s2, (struct sockaddr *)&from,
diff --git a/libio/Makefile b/libio/Makefile
index e97387743f..a4830ddf42 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -23,7 +23,7 @@ subdir := libio
include ../Makeconfig
headers := stdio.h \
- bits/stdio.h bits/stdio2.h bits/stdio-ldbl.h \
+ bits/stdio.h bits/stdio2.h \
bits/types/FILE.h bits/types/__FILE.h bits/types/struct_FILE.h \
bits/types/__fpos_t.h bits/types/__fpos64_t.h \
bits/types/cookie_io_functions_t.h
diff --git a/libio/bits/stdio-ldbl.h b/libio/bits/stdio-ldbl.h
deleted file mode 100644
index 6b63394b50..0000000000
--- a/libio/bits/stdio-ldbl.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -mlong-double-64 compatibility mode for stdio functions.
- Copyright (C) 2006-2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#ifndef _STDIO_H
-# error "Never include <bits/stdio-ldbl.h> directly; use <stdio.h> instead."
-#endif
-
-__LDBL_REDIR_DECL (fprintf)
-__LDBL_REDIR_DECL (printf)
-__LDBL_REDIR_DECL (sprintf)
-__LDBL_REDIR_DECL (vfprintf)
-__LDBL_REDIR_DECL (vprintf)
-__LDBL_REDIR_DECL (vsprintf)
-#if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (fscanf, __nldbl___isoc99_fscanf)
-__LDBL_REDIR1_DECL (scanf, __nldbl___isoc99_scanf)
-__LDBL_REDIR1_DECL (sscanf, __nldbl___isoc99_sscanf)
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (fscanf, __isoc99_fscanfieee128)
-__LDBL_REDIR1_DECL (scanf, __isoc99_scanfieee128)
-__LDBL_REDIR1_DECL (sscanf, __isoc99_sscanfieee128)
-# else
-# error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-# endif
-#else
-__LDBL_REDIR_DECL (fscanf)
-__LDBL_REDIR_DECL (scanf)
-__LDBL_REDIR_DECL (sscanf)
-#endif
-
-#if defined __USE_ISOC99 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (snprintf)
-__LDBL_REDIR_DECL (vsnprintf)
-#endif
-
-#ifdef __USE_ISOC99
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (vfscanf, __nldbl___isoc99_vfscanf)
-__LDBL_REDIR1_DECL (vscanf, __nldbl___isoc99_vscanf)
-__LDBL_REDIR1_DECL (vsscanf, __nldbl___isoc99_vsscanf)
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (vfscanf, __isoc99_vfscanfieee128)
-__LDBL_REDIR1_DECL (vscanf, __isoc99_vscanfieee128)
-__LDBL_REDIR1_DECL (vsscanf, __isoc99_vsscanfieee128)
-# else
-# error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-# endif
-# else
-__LDBL_REDIR_DECL (vfscanf)
-__LDBL_REDIR_DECL (vsscanf)
-__LDBL_REDIR_DECL (vscanf)
-# endif
-#endif
-
-#ifdef __USE_XOPEN2K8
-__LDBL_REDIR_DECL (vdprintf)
-__LDBL_REDIR_DECL (dprintf)
-#endif
-
-#ifdef __USE_GNU
-__LDBL_REDIR_DECL (vasprintf)
-__LDBL_REDIR2_DECL (asprintf)
-__LDBL_REDIR_DECL (asprintf)
-__LDBL_REDIR_DECL (obstack_printf)
-__LDBL_REDIR_DECL (obstack_vprintf)
-#endif
-
-#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR2_DECL (sprintf_chk)
-__LDBL_REDIR2_DECL (vsprintf_chk)
-# if defined __USE_ISOC99 || defined __USE_UNIX98
-__LDBL_REDIR2_DECL (snprintf_chk)
-__LDBL_REDIR2_DECL (vsnprintf_chk)
-# endif
-# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR2_DECL (fprintf_chk)
-__LDBL_REDIR2_DECL (printf_chk)
-__LDBL_REDIR2_DECL (vfprintf_chk)
-__LDBL_REDIR2_DECL (vprintf_chk)
-# ifdef __USE_XOPEN2K8
-__LDBL_REDIR2_DECL (dprintf_chk)
-__LDBL_REDIR2_DECL (vdprintf_chk)
-# endif
-# ifdef __USE_GNU
-__LDBL_REDIR2_DECL (asprintf_chk)
-__LDBL_REDIR2_DECL (vasprintf_chk)
-__LDBL_REDIR2_DECL (obstack_printf_chk)
-__LDBL_REDIR2_DECL (obstack_vprintf_chk)
-# endif
-# endif
-#endif
diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h
index b0b655ee7a..de7f1f04aa 100644
--- a/libio/bits/stdio2.h
+++ b/libio/bits/stdio2.h
@@ -23,12 +23,17 @@
# error "Never include <bits/stdio2.h> directly; use <stdio.h> instead."
#endif
-extern int __sprintf_chk (char *__restrict __s, int __flag, size_t __slen,
- const char *__restrict __format, ...) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__sprintf_chk, (char *__restrict __s,
+ int __flag, size_t __slen,
+ const char *__restrict __format,
+ ...),
+ __sprintf_chkieee128, __nldbl___sprintf_chk)
__attr_access ((__write_only__, 1, 3));
-extern int __vsprintf_chk (char *__restrict __s, int __flag, size_t __slen,
- const char *__restrict __format,
- __gnuc_va_list __ap) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__vsprintf_chk, (char *__restrict __s,
+ int __flag, size_t __slen,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vsprintf_chkieee128, __nldbl___vsprintf_chk)
__attr_access ((__write_only__, 1, 3));
#ifdef __va_arg_pack
@@ -54,14 +59,19 @@ __NTH (vsprintf (char *__restrict __s, const char *__restrict __fmt,
}
#if defined __USE_ISOC99 || defined __USE_UNIX98
-
-extern int __snprintf_chk (char *__restrict __s, size_t __n, int __flag,
- size_t __slen, const char *__restrict __format,
- ...) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__snprintf_chk, (char *__restrict __s,
+ size_t __n, int __flag,
+ size_t __slen,
+ const char *__restrict __format,
+ ...),
+ __snprintf_chkieee128, __nldbl___snprintf_chk)
__attr_access ((__write_only__, 1, 2));
-extern int __vsnprintf_chk (char *__restrict __s, size_t __n, int __flag,
- size_t __slen, const char *__restrict __format,
- __gnuc_va_list __ap) __THROW;
+extern int __REDIRECT_LDBL_NTHNL (__vsnprintf_chk, (char *__restrict __s,
+ size_t __n, int __flag,
+ size_t __slen,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vsnprintf_chkieee128, __nldbl___vsnprintf_chk);
# ifdef __va_arg_pack
__fortify_function int
@@ -89,14 +99,24 @@ __NTH (vsnprintf (char *__restrict __s, size_t __n,
#endif
#if __USE_FORTIFY_LEVEL > 1
-
-extern int __fprintf_chk (FILE *__restrict __stream, int __flag,
- const char *__restrict __format, ...);
-extern int __printf_chk (int __flag, const char *__restrict __format, ...);
-extern int __vfprintf_chk (FILE *__restrict __stream, int __flag,
- const char *__restrict __format, __gnuc_va_list __ap);
-extern int __vprintf_chk (int __flag, const char *__restrict __format,
- __gnuc_va_list __ap);
+extern int __REDIRECT_LDBL (__fprintf_chk, (FILE *__restrict __stream,
+ int __flag,
+ const char *__restrict __format,
+ ...),
+ __fprintf_chkieee128, __nldbl___fprintf_chk);
+extern int __REDIRECT_LDBL (__printf_chk, (int __flag,
+ const char *__restrict __format,
+ ...),
+ __printf_chkieee128, __nldbl___printf_chk);
+extern int __REDIRECT_LDBL (__vfprintf_chk, (FILE *__restrict __stream,
+ int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vfprintf_chkieee128, __nldbl___vfprintf_chk);
+extern int __REDIRECT_LDBL (__vprintf_chk, (int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vprintf_chkieee128, __nldbl___vprintf_chk);
# ifdef __va_arg_pack
__fortify_function int
@@ -136,10 +156,15 @@ vfprintf (FILE *__restrict __stream,
}
# ifdef __USE_XOPEN2K8
-extern int __dprintf_chk (int __fd, int __flag, const char *__restrict __fmt,
- ...) __attribute__ ((__format__ (__printf__, 3, 4)));
-extern int __vdprintf_chk (int __fd, int __flag,
- const char *__restrict __fmt, __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL (__dprintf_chk, (int __fd, int __flag,
+ const char *__restrict __fmt,
+ ...),
+ __dprintf_chkieee128, __nldbl___dprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL (__vdprintf_chk, (int __fd, int __flag,
+ const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vdprintf_chkieee128, __nldbl___vdprintf_chk)
__attribute__ ((__format__ (__printf__, 3, 0)));
# ifdef __va_arg_pack
@@ -162,22 +187,32 @@ vdprintf (int __fd, const char *__restrict __fmt, __gnuc_va_list __ap)
# endif
# ifdef __USE_GNU
-
-extern int __asprintf_chk (char **__restrict __ptr, int __flag,
- const char *__restrict __fmt, ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4))) __wur;
-extern int __vasprintf_chk (char **__restrict __ptr, int __flag,
- const char *__restrict __fmt, __gnuc_va_list __arg)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
-extern int __obstack_printf_chk (struct obstack *__restrict __obstack,
- int __flag, const char *__restrict __format,
- ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
-extern int __obstack_vprintf_chk (struct obstack *__restrict __obstack,
- int __flag,
- const char *__restrict __format,
- __gnuc_va_list __args)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
+extern int __REDIRECT_LDBL_NTHNL (__asprintf_chk, (char **__restrict __ptr,
+ int __flag,
+ const char *__restrict __fmt,
+ ...),
+ __asprintf_chkieee128, __nldbl___asprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (__vasprintf_chk, (char **__restrict __ptr,
+ int __flag,
+ const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vasprintf_chkieee128, __nldbl___vasnprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (__obstack_printf_chk, (struct obstack *__restrict __obstack,
+ int __flag,
+ const char *__restrict __format,
+ ...),
+ __obstack_printf_chkieee128,
+ __nldbl___obstack_printf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL_NTHNL (__obstack_vprintf_chk, (struct obstack *__restrict __obstack,
+ int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __args),
+ __obstack_vprintf_chkieee128,
+ __nldbl___obstack_vprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
# ifdef __va_arg_pack
__fortify_function int
diff --git a/libio/stdio.h b/libio/stdio.h
index e6425341ce..54c9796a46 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -41,6 +41,7 @@ __BEGIN_DECLS
#include <bits/types/__FILE.h>
#include <bits/types/FILE.h>
#include <bits/types/struct_FILE.h>
+#include <bits/floatn.h>
#ifdef __USE_GNU
# include <bits/types/cookie_io_functions_t.h>
@@ -342,78 +343,143 @@ extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
extern void setlinebuf (FILE *__stream) __THROW;
#endif
-
/* Write formatted output to STREAM.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int fprintf (FILE *__restrict __stream,
- const char *__restrict __format, ...);
+extern int __REDIRECT_LDBL (fprintf, (FILE *__restrict __stream,
+ const char *__restrict __format, ...),
+ __fprintfieee128, __nldbl_fprintf);
/* Write formatted output to stdout.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int printf (const char *__restrict __format, ...);
+extern int __REDIRECT_LDBL (printf, (const char *__restrict __format, ...),
+ __printfieee128, __nldbl_printf);
/* Write formatted output to S. */
-extern int sprintf (char *__restrict __s,
- const char *__restrict __format, ...) __THROWNL;
+extern int __REDIRECT_LDBL_NTHNL (sprintf, (char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __sprintfieee128, __nldbl_sprintf);
/* Write formatted output to S from argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg);
+extern int __REDIRECT_LDBL (vfprintf, (FILE *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vfprintfieee128, __nldbl_vfprintf);
/* Write formatted output to stdout from argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
+extern int __REDIRECT_LDBL (vprintf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vprintfieee128, __nldbl_vprintf);
/* Write formatted output to S from argument list ARG. */
-extern int vsprintf (char *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg) __THROWNL;
+extern int __REDIRECT_LDBL_NTHNL (vsprintf, (char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsprintfieee128, __nldbl_vsprintf);
#if defined __USE_ISOC99 || defined __USE_UNIX98
/* Maximum chars of output to write in MAXLEN. */
-extern int snprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 3, 4)));
-
-extern int vsnprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, __gnuc_va_list __arg)
- __THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
+extern int __REDIRECT_LDBL_NTHNL (snprintf, (char *__restrict __s,
+ size_t __maxlen,
+ const char *__restrict __format,
+ ...),
+ __snprintfieee128, __nldbl_snprintf)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL_NTHNL (vsnprintf, (char *__restrict __s,
+ size_t __maxlen,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsnprintfieee128, __nldbl_vsnprintf)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
#endif
#if __GLIBC_USE (LIB_EXT2)
/* Write formatted output to a string dynamically allocated with `malloc'.
Store the address of the string in *PTR. */
-extern int vasprintf (char **__restrict __ptr, const char *__restrict __f,
- __gnuc_va_list __arg)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
-extern int __asprintf (char **__restrict __ptr,
- const char *__restrict __fmt, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
-extern int asprintf (char **__restrict __ptr,
- const char *__restrict __fmt, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (vasprintf, (char **__restrict __ptr,
+ const char *__restrict __f,
+ __gnuc_va_list __arg),
+ __vasprintfieee128, __nldbl_vasprintf)
+ __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (asprintf, (char **__restrict __ptr,
+ const char *__restrict __fmt,
+ ...),
+ __asprintfieee128, __nldbl_asprintf)
+ __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
#endif
#ifdef __USE_XOPEN2K8
/* Write formatted output to a file descriptor. */
-extern int vdprintf (int __fd, const char *__restrict __fmt,
- __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL (vdprintf, (int __fd, const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vdprintfieee128, __nldbl_vdprintf)
__attribute__ ((__format__ (__printf__, 2, 0)));
-extern int dprintf (int __fd, const char *__restrict __fmt, ...)
+extern int __REDIRECT_LDBL (dprintf, (int __fd, const char *__restrict __fmt,
+ ...),
+ __dprintfieee128, __nldbl_dprintf)
__attribute__ ((__format__ (__printf__, 2, 3)));
#endif
-
+#if !__GLIBC_USE (DEPRECATED_SCANF)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ ...),
+ __isoc99_fscanfieee128, __nldbl___isoc99_fscanf) __wur;
+extern int __REDIRECT_LDBL (scanf, (const char *__restrict __format,
+ ...),
+ __isoc99_scanfieee128, __nldbl___isoc99_scanf) __wur;
+extern int __REDIRECT_LDBL_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __isoc99_sscanfieee128, __nldbl___isoc99_sscanf);
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format, ...),
+ __isoc99_fscanf) __wur;
+extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
+ __isoc99_scanf) __wur;
+extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format, ...),
+ __isoc99_sscanf);
+# else
+extern int __isoc99_fscanf (FILE *__restrict __stream,
+ const char *__restrict __format, ...) __wur;
+extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
+extern int __isoc99_sscanf (const char *__restrict __s,
+ const char *__restrict __format, ...) __THROW;
+# define fscanf __isoc99_fscanf
+# define scanf __isoc99_scanf
+# define sscanf __isoc99_sscanf
+# endif /* __REDIRECT */
+# endif
+#else
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ ...),
+ __fscanfieee128, __nldbl_fscanf) __wur;
+extern int __REDIRECT_LDBL (scanf, (const char *__restrict __format,
+ ...),
+ __scanfieee128, __nldbl_scanf) __wur;
+extern int __REDIRECT_LDBL_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __sscanfieee128, __nldbl_sscanf) __wur;
+# else
/* Read formatted input from STREAM.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int fscanf (FILE *__restrict __stream,
- const char *__restrict __format, ...) __wur;
+ const char *__restrict __format, ...) __wur;
/* Read formatted input from stdin.
This function is a possible cancellation point and therefore not
@@ -421,43 +487,81 @@ extern int fscanf (FILE *__restrict __stream,
extern int scanf (const char *__restrict __format, ...) __wur;
/* Read formatted input from S. */
extern int sscanf (const char *__restrict __s,
- const char *__restrict __format, ...) __THROW;
-
-/* For historical reasons, the C99-compliant versions of the scanf
- functions are at alternative names. When __LDBL_COMPAT or
- __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
- bits/stdio-ldbl.h. */
-#include <bits/floatn.h>
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
- && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-# ifdef __REDIRECT
-extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
- const char *__restrict __format, ...),
- __isoc99_fscanf) __wur;
-extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
- __isoc99_scanf) __wur;
-extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
- const char *__restrict __format, ...),
- __isoc99_sscanf);
-# else
-extern int __isoc99_fscanf (FILE *__restrict __stream,
- const char *__restrict __format, ...) __wur;
-extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
-extern int __isoc99_sscanf (const char *__restrict __s,
- const char *__restrict __format, ...) __THROW;
-# define fscanf __isoc99_fscanf
-# define scanf __isoc99_scanf
-# define sscanf __isoc99_sscanf
+ const char *__restrict __format, ...) __THROW;
# endif
-#endif
+#endif /* DEPRECATED_SCANF */
-#ifdef __USE_ISOC99
+#ifdef __USE_ISOC99
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vfscanfieee128, __nldbl___isoc99_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vscanfieee128, __nldbl___isoc99_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_LDBL_NTH (vsscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vsscanfieee128, __nldbl___isoc99_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (vfscanf,
+ (FILE *__restrict __s,
+ const char *__restrict __format, __gnuc_va_list __arg),
+ __isoc99_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_NTH (vsscanf,
+ (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
+extern int __isoc99_vfscanf (FILE *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg) __wur;
+extern int __isoc99_vscanf (const char *__restrict __format,
+ __gnuc_va_list __arg) __wur;
+extern int __isoc99_vsscanf (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg) __THROW;
+# define vfscanf __isoc99_vfscanf
+# define vscanf __isoc99_vscanf
+# define vsscanf __isoc99_vsscanf
+# endif /* __REDIRECT */
+# endif
+# else /* DEPRECATED_SCANF */
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vfscanfieee128, __nldbl_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vscanfieee128, __nldbl_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_LDBL_NTH (vsscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsscanfieee128, __nldbl_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
/* Read formatted input from S into argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg)
+ __gnuc_va_list __arg)
__attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
/* Read formatted input from stdin into argument list ARG.
@@ -469,42 +573,11 @@ extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
/* Read formatted input from S into argument list ARG. */
extern int vsscanf (const char *__restrict __s,
- const char *__restrict __format, __gnuc_va_list __arg)
+ const char *__restrict __format, __gnuc_va_list __arg)
__THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
-
-/* Same redirection as above for the v*scanf family. */
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __REDIRECT && !defined __LDBL_COMPAT \
- && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-extern int __REDIRECT (vfscanf,
- (FILE *__restrict __s,
- const char *__restrict __format, __gnuc_va_list __arg),
- __isoc99_vfscanf)
- __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
-extern int __REDIRECT (vscanf, (const char *__restrict __format,
- __gnuc_va_list __arg), __isoc99_vscanf)
- __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
-extern int __REDIRECT_NTH (vsscanf,
- (const char *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg), __isoc99_vsscanf)
- __attribute__ ((__format__ (__scanf__, 2, 0)));
-# elif !defined __REDIRECT
-extern int __isoc99_vfscanf (FILE *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg) __wur;
-extern int __isoc99_vscanf (const char *__restrict __format,
- __gnuc_va_list __arg) __wur;
-extern int __isoc99_vsscanf (const char *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg) __THROW;
-# define vfscanf __isoc99_vfscanf
-# define vscanf __isoc99_vscanf
-# define vsscanf __isoc99_vsscanf
# endif
# endif
-#endif /* Use ISO C9x. */
-
+#endif /* __USE_ISOC99 */
/* Read a character from STREAM.
@@ -850,13 +923,17 @@ extern char *cuserid (char *__s)
struct obstack; /* See <obstack.h>. */
/* Write formatted output to an obstack. */
-extern int obstack_printf (struct obstack *__restrict __obstack,
- const char *__restrict __format, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3)));
-extern int obstack_vprintf (struct obstack *__restrict __obstack,
- const char *__restrict __format,
- __gnuc_va_list __args)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 0)));
+extern int __REDIRECT_LDBL_NTHNL (obstack_printf,
+ (struct obstack *__restrict __obstack,
+ const char *__restrict __format, ...),
+ __obstack_printfieee128, __nldbl_obstack_printf)
+ __attribute__ ((__format__ (__printf__, 2, 3)));
+extern int __REDIRECT_LDBL_NTHNL (obstack_vprintf,
+ (struct obstack *__restrict __obstack,
+ const char *__restrict __format,
+ __gnuc_va_list __args),
+ __obstack_vprintfieee128, __nldbl_obstack_vprintf)
+ __attribute__ ((__format__ (__printf__, 2, 0)));
#endif /* Use GNU. */
@@ -894,11 +971,6 @@ extern int __overflow (FILE *, int);
# include <bits/stdio2.h>
#endif
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/stdio-ldbl.h>
-#endif
-
__END_DECLS
#endif /* <stdio.h> included. */
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index 0299fe99a7..e1f68bddfb 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -17,6 +17,7 @@
not, see <https://www.gnu.org/licenses/>. */
#define __mremap mremap
+#define __fprintf fprintf
#include "malloc.c"
/* When memory is tagged, the checking data is stored in the user part
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 09e5ff2bce..aa35846e55 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5279,9 +5279,9 @@ __malloc_stats (void)
memset (&mi, 0, sizeof (mi));
__libc_lock_lock (ar_ptr->mutex);
int_mallinfo (ar_ptr, &mi);
- fprintf (stderr, "Arena %d:\n", i);
- fprintf (stderr, "system bytes = %10u\n", (unsigned int) mi.arena);
- fprintf (stderr, "in use bytes = %10u\n", (unsigned int) mi.uordblks);
+ __fprintf (stderr, "Arena %d:\n", i);
+ __fprintf (stderr, "system bytes = %10u\n", (unsigned int) mi.arena);
+ __fprintf (stderr, "in use bytes = %10u\n", (unsigned int) mi.uordblks);
#if MALLOC_DEBUG > 1
if (i > 0)
dump_heap (heap_for_ptr (top (ar_ptr)));
@@ -5293,12 +5293,12 @@ __malloc_stats (void)
if (ar_ptr == &main_arena)
break;
}
- fprintf (stderr, "Total (incl. mmap):\n");
- fprintf (stderr, "system bytes = %10u\n", system_b);
- fprintf (stderr, "in use bytes = %10u\n", in_use_b);
- fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps);
- fprintf (stderr, "max mmap bytes = %10lu\n",
- (unsigned long) mp_.max_mmapped_mem);
+ __fprintf (stderr, "Total (incl. mmap):\n");
+ __fprintf (stderr, "system bytes = %10u\n", system_b);
+ __fprintf (stderr, "in use bytes = %10u\n", in_use_b);
+ __fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps);
+ __fprintf (stderr, "max mmap bytes = %10lu\n",
+ (unsigned long) mp_.max_mmapped_mem);
stderr->_flags2 = old_flags2;
_IO_funlockfile (stderr);
}
@@ -5728,7 +5728,7 @@ __malloc_info (int options, FILE *fp)
mstate ar_ptr = &main_arena;
do
{
- fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
+ __fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
size_t nblocks = 0;
size_t nfastblocks = 0;
@@ -5839,12 +5839,12 @@ __malloc_info (int options, FILE *fp)
for (size_t i = 0; i < nsizes; ++i)
if (sizes[i].count != 0 && i != NFASTBINS)
- fprintf (fp, "\
+ __fprintf (fp, "\
<size from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
sizes[i].from, sizes[i].to, sizes[i].total, sizes[i].count);
if (sizes[NFASTBINS].count != 0)
- fprintf (fp, "\
+ __fprintf (fp, "\
<unsorted from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
sizes[NFASTBINS].from, sizes[NFASTBINS].to,
sizes[NFASTBINS].total, sizes[NFASTBINS].count);
@@ -5852,7 +5852,7 @@ __malloc_info (int options, FILE *fp)
total_system += ar_ptr->system_mem;
total_max_system += ar_ptr->max_system_mem;
- fprintf (fp,
+ __fprintf (fp,
"</sizes>\n<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
"<system type=\"current\" size=\"%zu\"/>\n"
@@ -5862,7 +5862,7 @@ __malloc_info (int options, FILE *fp)
if (ar_ptr != &main_arena)
{
- fprintf (fp,
+ __fprintf (fp,
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n"
"<aspace type=\"subheaps\" size=\"%zu\"/>\n",
@@ -5872,7 +5872,7 @@ __malloc_info (int options, FILE *fp)
}
else
{
- fprintf (fp,
+ __fprintf (fp,
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n",
ar_ptr->system_mem, ar_ptr->system_mem);
@@ -5885,7 +5885,7 @@ __malloc_info (int options, FILE *fp)
}
while (ar_ptr != &main_arena);
- fprintf (fp,
+ __fprintf (fp,
"<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"mmap\" count=\"%d\" size=\"%zu\"/>\n"
diff --git a/misc/efgcvt-template.c b/misc/efgcvt-template.c
index 87a90e78d4..f1630fd780 100644
--- a/misc/efgcvt-template.c
+++ b/misc/efgcvt-template.c
@@ -24,7 +24,7 @@
#include <math_ldbl_opt.h>
#ifndef SPRINTF
-# define SPRINTF sprintf
+# define SPRINTF __sprintf
#endif
#define APPEND(a, b) APPEND2 (a, b)
diff --git a/misc/mntent_r.c b/misc/mntent_r.c
index 3311ba0b50..65f29b97e9 100644
--- a/misc/mntent_r.c
+++ b/misc/mntent_r.c
@@ -251,7 +251,7 @@ __addmntent (FILE *stream, const struct mntent *mnt)
write_string (stream, mnt->mnt_dir);
write_string (stream, mnt->mnt_type);
write_string (stream, mnt->mnt_opts);
- fprintf (stream, "%d %d\n", mnt->mnt_freq, mnt->mnt_passno);
+ __fprintf (stream, "%d %d\n", mnt->mnt_freq, mnt->mnt_passno);
ret = __ferror_unlocked (stream) != 0 || fflush (stream) != 0;
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 44d3826bca..e43b5d4b36 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -560,6 +560,54 @@
# include <bits/long-double.h>
#endif
+#if (defined __GNUC__ && __GNUC__ >= 2) || (__clang_major__ >= 4)
+# define __REDIRECT_LDBL1(name, prenth, posnth, proto, alias) \
+ name proto prenth __asm__ (__ASMNAME (__ASMNAME (#alias))) posnth
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+# ifdef __REDIRECT
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , , proto, ieee128)
+# ifdef __cplusplus
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROW, , proto, ieee128)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROWNL, , proto, ieee128)
+# else
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROW, proto, ieee128)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROWNL, proto, ieee128)
+# endif /* __cplusplus */
+# else
+_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
+# endif /* __REDIRECT */
+# elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
+# ifdef __REDIRECT
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , , proto, compat)
+# ifdef __cplusplus
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROW, , proto, compat)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROWNL, , proto, compat)
+# else
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROW, proto, compat)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROWNL, proto, compat)
+# endif /* __cplusplus */
+# else
+_Static_assert (0, "Compat long double requires redirection on this platform");
+# endif /* __REDIRECT */
+# endif
+#endif
+
+#ifndef __REDIRECT_LDBL
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) name proto
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) name proto __THROW
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) name proto __THROWNL
+#endif
+
#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
# ifdef __REDIRECT
@@ -583,10 +631,6 @@
# define __REDIRECT_NTH_LDBL(name, proto, alias) \
__LDBL_REDIR1_NTH (name, proto, __##alias##ieee128)
-/* Unused. */
-# define __REDIRECT_LDBL(name, proto, alias) ... unused__redirect_ldbl
-# define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth
-
# else
_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
# endif
@@ -605,24 +649,6 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf
extern __typeof (name) name __asm (__ASMNAME (#alias));
# define __LDBL_REDIR_DECL(name) \
extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name));
-# define __REDIRECT_LDBL(name, proto, alias) \
- __LDBL_REDIR1 (name, proto, __nldbl_##alias)
-# define __REDIRECT_NTH_LDBL(name, proto, alias) \
- __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias)
-# endif
-#endif
-#if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \
- || !defined __REDIRECT
-# define __LDBL_REDIR1(name, proto, alias) name proto
-# define __LDBL_REDIR(name, proto) name proto
-# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW
-# define __LDBL_REDIR_NTH(name, proto) name proto __THROW
-# define __LDBL_REDIR2_DECL(name)
-# define __LDBL_REDIR_DECL(name)
-# ifdef __REDIRECT
-# define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias)
-# define __REDIRECT_NTH_LDBL(name, proto, alias) \
- __REDIRECT_NTH (name, proto, alias)
# endif
#endif
diff --git a/misc/syslog.c b/misc/syslog.c
index ee83b1bb76..0076361f6c 100644
--- a/misc/syslog.c
+++ b/misc/syslog.c
@@ -200,7 +200,7 @@ __vsyslog_internal(int pri, const char *fmt, va_list ap,
else
{
__fsetlocking (f, FSETLOCKING_BYCALLER);
- fprintf (f, "<%d>", pri);
+ __fprintf (f, "<%d>", pri);
now = time_now ();
f->_IO_write_ptr += __strftime_l (f->_IO_write_ptr,
f->_IO_write_end
@@ -214,7 +214,7 @@ __vsyslog_internal(int pri, const char *fmt, va_list ap,
if (LogTag != NULL)
__fputs_unlocked (LogTag, f);
if (LogStat & LOG_PID)
- fprintf (f, "[%d]", (int) __getpid ());
+ __fprintf (f, "[%d]", (int) __getpid ());
if (LogTag != NULL)
{
__putc_unlocked (':', f);
diff --git a/nis/nis_subr.c b/nis/nis_subr.c
index 385f221062..0e02cd19b5 100644
--- a/nis/nis_subr.c
+++ b/nis/nis_subr.c
@@ -280,10 +280,10 @@ nis_getnames (const_nis_name name)
}
if (pos == 0
- && __asprintf (&getnames[pos++], "%s%s%s%s",
- name, name[name_len - 1] == '.' ? "" : ".",
- local_domain,
- local_domain[local_domain_len - 1] == '.' ? "" : ".") < 0)
+ && asprintf (&getnames[pos++], "%s%s%s%s",
+ name, name[name_len - 1] == '.' ? "" : ".",
+ local_domain,
+ local_domain[local_domain_len - 1] == '.' ? "" : ".") < 0)
goto free_null;
getnames[pos] = NULL;
diff --git a/nptl/pthread_getname.c b/nptl/pthread_getname.c
index ebec06e23f..a424b3e4f8 100644
--- a/nptl/pthread_getname.c
+++ b/nptl/pthread_getname.c
@@ -42,7 +42,7 @@ __pthread_getname_np (pthread_t th, char *buf, size_t len)
#define FMT "/proc/self/task/%u/comm"
char fname[sizeof (FMT) + 8];
- sprintf (fname, FMT, (unsigned int) pd->tid);
+ __sprintf (fname, FMT, (unsigned int) pd->tid);
int fd = __open64_nocancel (fname, O_RDONLY);
if (fd == -1)
diff --git a/nptl/pthread_setname.c b/nptl/pthread_setname.c
index f24560db47..8520bac4be 100644
--- a/nptl/pthread_setname.c
+++ b/nptl/pthread_setname.c
@@ -44,7 +44,7 @@ __pthread_setname_np (pthread_t th, const char *name)
#define FMT "/proc/self/task/%u/comm"
char fname[sizeof (FMT) + 8];
- sprintf (fname, FMT, (unsigned int) pd->tid);
+ __sprintf (fname, FMT, (unsigned int) pd->tid);
int fd = __open64_nocancel (fname, O_RDWR);
if (fd == -1)
diff --git a/pwd/getpw.c b/pwd/getpw.c
index 547489a863..4784eaf00b 100644
--- a/pwd/getpw.c
+++ b/pwd/getpw.c
@@ -50,9 +50,9 @@ __getpw (__uid_t uid, char *buf)
if (p == NULL)
return -1;
- if (sprintf (buf, "%s:%s:%lu:%lu:%s:%s:%s", p->pw_name, p->pw_passwd,
- (unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
- p->pw_gecos, p->pw_dir, p->pw_shell) < 0)
+ if (__sprintf (buf, "%s:%s:%lu:%lu:%s:%s:%s", p->pw_name, p->pw_passwd,
+ (unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
+ p->pw_gecos, p->pw_dir, p->pw_shell) < 0)
return -1;
return 0;
diff --git a/pwd/putpwent.c b/pwd/putpwent.c
index e3f2f4e09e..480dd59813 100644
--- a/pwd/putpwent.c
+++ b/pwd/putpwent.c
@@ -48,11 +48,11 @@ putpwent (const struct passwd *p, FILE *stream)
return -1;
if (p->pw_name[0] == '+' || p->pw_name[0] == '-')
- ret = fprintf (stream, "%s:%s:::%s:%s:%s\n",
+ ret = __fprintf (stream, "%s:%s:::%s:%s:%s\n",
p->pw_name, _S (p->pw_passwd),
gecos, _S (p->pw_dir), _S (p->pw_shell));
else
- ret = fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
+ ret = __fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
p->pw_name, _S (p->pw_passwd),
(unsigned long int) p->pw_uid,
(unsigned long int) p->pw_gid,
diff --git a/resolv/inet_ntop.c b/resolv/inet_ntop.c
index c4d38c0f95..53725d805a 100644
--- a/resolv/inet_ntop.c
+++ b/resolv/inet_ntop.c
@@ -28,9 +28,9 @@
#include <string.h>
#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
+# define SPRINTF(x) strlen(__sprintf/**/x)
#else
-# define SPRINTF(x) ((size_t)sprintf x)
+# define SPRINTF(x) ((size_t)__sprintf x)
#endif
/*
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index 913a5cb82f..06a91b23ca 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -507,8 +507,8 @@ _nss_dns_gethostbyaddr2_r (const void *addr, socklen_t len, int af,
switch (af)
{
case AF_INET:
- sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", (uaddr[3] & 0xff),
- (uaddr[2] & 0xff), (uaddr[1] & 0xff), (uaddr[0] & 0xff));
+ __sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", (uaddr[3] & 0xff),
+ (uaddr[2] & 0xff), (uaddr[1] & 0xff), (uaddr[0] & 0xff));
break;
case AF_INET6:
qp = qbuf;
diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
index 09cd917444..304ae35b8b 100644
--- a/resolv/nss_dns/dns-network.c
+++ b/resolv/nss_dns/dns-network.c
@@ -191,21 +191,21 @@ _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result,
{
case 3:
/* Class A network. */
- sprintf (qbuf, "0.0.0.%u.in-addr.arpa", net_bytes[3]);
+ __sprintf (qbuf, "0.0.0.%u.in-addr.arpa", net_bytes[3]);
break;
case 2:
/* Class B network. */
- sprintf (qbuf, "0.0.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2]);
+ __sprintf (qbuf, "0.0.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2]);
break;
case 1:
/* Class C network. */
- sprintf (qbuf, "0.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
- net_bytes[1]);
+ __sprintf (qbuf, "0.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
+ net_bytes[1]);
break;
case 0:
/* Class D - E network. */
- sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
- net_bytes[1], net_bytes[0]);
+ __sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
+ net_bytes[1], net_bytes[0]);
break;
}
diff --git a/shadow/putspent.c b/shadow/putspent.c
index cbbb840d5b..d675e28210 100644
--- a/shadow/putspent.c
+++ b/shadow/putspent.c
@@ -42,47 +42,47 @@ putspent (const struct spwd *p, FILE *stream)
flockfile (stream);
- if (fprintf (stream, "%s:%s:", p->sp_namp, _S (p->sp_pwdp)) < 0)
+ if (__fprintf (stream, "%s:%s:", p->sp_namp, _S (p->sp_pwdp)) < 0)
++errors;
if ((p->sp_lstchg != (long int) -1
- && fprintf (stream, "%ld:", p->sp_lstchg) < 0)
+ && __fprintf (stream, "%ld:", p->sp_lstchg) < 0)
|| (p->sp_lstchg == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_min != (long int) -1
- && fprintf (stream, "%ld:", p->sp_min) < 0)
+ && __fprintf (stream, "%ld:", p->sp_min) < 0)
|| (p->sp_min == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_max != (long int) -1
- && fprintf (stream, "%ld:", p->sp_max) < 0)
+ && __fprintf (stream, "%ld:", p->sp_max) < 0)
|| (p->sp_max == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_warn != (long int) -1
- && fprintf (stream, "%ld:", p->sp_warn) < 0)
+ && __fprintf (stream, "%ld:", p->sp_warn) < 0)
|| (p->sp_warn == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_inact != (long int) -1
- && fprintf (stream, "%ld:", p->sp_inact) < 0)
+ && __fprintf (stream, "%ld:", p->sp_inact) < 0)
|| (p->sp_inact == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_expire != (long int) -1
- && fprintf (stream, "%ld:", p->sp_expire) < 0)
+ && __fprintf (stream, "%ld:", p->sp_expire) < 0)
|| (p->sp_expire == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if (p->sp_flag != ~0ul
- && fprintf (stream, "%ld", p->sp_flag) < 0)
+ && __fprintf (stream, "%ld", p->sp_flag) < 0)
++errors;
if (putc_unlocked ('\n', stream) == EOF)
diff --git a/stdio-common/dprintf.c b/stdio-common/dprintf.c
index 2e26d59714..6fbe5d4862 100644
--- a/stdio-common/dprintf.c
+++ b/stdio-common/dprintf.c
@@ -33,5 +33,4 @@ __dprintf (int d, const char *format, ...)
return done;
}
libc_hidden_def (__dprintf)
-ldbl_hidden_def (__dprintf, dprintf)
ldbl_weak_alias (__dprintf, dprintf)
diff --git a/stdio-common/fprintf.c b/stdio-common/fprintf.c
index 8d2cd37433..af7190c5b4 100644
--- a/stdio-common/fprintf.c
+++ b/stdio-common/fprintf.c
@@ -34,7 +34,7 @@ __fprintf (FILE *stream, const char *format, ...)
return done;
}
-ldbl_hidden_def (__fprintf, fprintf)
+libc_hidden_def (__fprintf)
ldbl_strong_alias (__fprintf, fprintf)
/* We define the function with the real name here. But deep down in
diff --git a/stdio-common/psiginfo.c b/stdio-common/psiginfo.c
index adf3b71b77..f99c51da17 100644
--- a/stdio-common/psiginfo.c
+++ b/stdio-common/psiginfo.c
@@ -76,7 +76,7 @@ psiginfo (const siginfo_t *pinfo, const char *s)
}
if (s != NULL && *s != '\0')
- fprintf (fp, "%s: ", s);
+ __fprintf (fp, "%s: ", s);
const char *desc;
if (pinfo->si_signo >= 0 && pinfo->si_signo < NSIG
@@ -92,21 +92,21 @@ psiginfo (const siginfo_t *pinfo, const char *s)
if (pinfo->si_signo - SIGRTMIN < SIGRTMAX - pinfo->si_signo)
{
if (pinfo->si_signo == SIGRTMIN)
- fprintf (fp, "SIGRTMIN (");
+ __fprintf (fp, "SIGRTMIN (");
else
- fprintf (fp, "SIGRTMIN+%d (", pinfo->si_signo - SIGRTMIN);
+ __fprintf (fp, "SIGRTMIN+%d (", pinfo->si_signo - SIGRTMIN);
}
else
{
if (pinfo->si_signo == SIGRTMAX)
- fprintf (fp, "SIGRTMAX (");
+ __fprintf (fp, "SIGRTMAX (");
else
- fprintf (fp, "SIGRTMAX-%d (", SIGRTMAX - pinfo->si_signo);
+ __fprintf (fp, "SIGRTMAX-%d (", SIGRTMAX - pinfo->si_signo);
}
}
else
#endif
- fprintf (fp, "%s (", _(desc));
+ __fprintf (fp, "%s (", _(desc));
const char *base = NULL;
const uint8_t *offarr = NULL;
@@ -178,25 +178,25 @@ Signal generated by the completion of an I/O request");
}
if (str != NULL)
- fprintf (fp, "%s ", _(str));
+ __fprintf (fp, "%s ", _(str));
else
- fprintf (fp, "%d ", pinfo->si_code);
+ __fprintf (fp, "%d ", pinfo->si_code);
if (pinfo->si_signo == SIGILL || pinfo->si_signo == SIGFPE
|| pinfo->si_signo == SIGSEGV || pinfo->si_signo == SIGBUS)
- fprintf (fp, "[%p])\n", pinfo->si_addr);
+ __fprintf (fp, "[%p])\n", pinfo->si_addr);
else if (pinfo->si_signo == SIGCHLD)
- fprintf (fp, "%ld %d %ld)\n",
- (long int) pinfo->si_pid, pinfo->si_status,
- (long int) pinfo->si_uid);
+ __fprintf (fp, "%ld %d %ld)\n",
+ (long int) pinfo->si_pid, pinfo->si_status,
+ (long int) pinfo->si_uid);
else if (pinfo->si_signo == SIGPOLL)
- fprintf (fp, "%ld)\n", (long int) pinfo->si_band);
+ __fprintf (fp, "%ld)\n", (long int) pinfo->si_band);
else
- fprintf (fp, "%ld %ld)\n",
- (long int) pinfo->si_pid, (long int) pinfo->si_uid);
+ __fprintf (fp, "%ld %ld)\n",
+ (long int) pinfo->si_pid, (long int) pinfo->si_uid);
}
else
- fprintf (fp, _("Unknown signal %d\n"), pinfo->si_signo);
+ __fprintf (fp, _("Unknown signal %d\n"), pinfo->si_signo);
fclose (fp);
diff --git a/stdio-common/sprintf.c b/stdio-common/sprintf.c
index a9665f753a..f1f43a49ec 100644
--- a/stdio-common/sprintf.c
+++ b/stdio-common/sprintf.c
@@ -32,6 +32,6 @@ __sprintf (char *s, const char *format, ...)
return done;
}
-ldbl_hidden_def (__sprintf, sprintf)
+libc_hidden_def (__sprintf)
ldbl_strong_alias (__sprintf, sprintf)
ldbl_strong_alias (__sprintf, _IO_sprintf)
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 7559fd239d..c5912788bd 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -24,4 +24,4 @@ __vfprintf (FILE *fp, const char *format, va_list ap)
}
ldbl_strong_alias (__vfprintf, _IO_vfprintf);
ldbl_strong_alias (__vfprintf, vfprintf);
-ldbl_hidden_def (__vfprintf, vfprintf)
+libc_hidden_def (__vfprintf)
diff --git a/sunrpc/netname.c b/sunrpc/netname.c
index bf7f0b81c4..97a881c3af 100644
--- a/sunrpc/netname.c
+++ b/sunrpc/netname.c
@@ -48,7 +48,7 @@ user2netname (char netname[MAXNETNAMELEN + 1], const uid_t uid,
if ((strlen (dfltdom) + OPSYS_LEN + 3 + MAXIPRINT) > (size_t) MAXNETNAMELEN)
return 0;
- sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
+ __sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
i = strlen (netname);
if (netname[i - 1] == '.')
netname[i - 1] = '\0';
@@ -112,7 +112,7 @@ host2netname (char netname[MAXNETNAMELEN + 1], const char *host,
> MAXNETNAMELEN)
return 0;
- sprintf (netname, "%s.%s@%s", OPSYS, hostname, domainname);
+ __sprintf (netname, "%s.%s@%s", OPSYS, hostname, domainname);
return 1;
}
#ifdef EXPORT_RPC_SYMBOLS
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
index f683836678..59f6e31d2d 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128___asprintf (char **string_ptr, const char *format, ...)
+int
+__asprintfieee128 (char **string_ptr, const char *format, ...)
{
va_list ap;
int done;
@@ -32,5 +32,4 @@ ___ieee128___asprintf (char **string_ptr, const char *format, ...)
return done;
}
-hidden_def (___ieee128___asprintf)
-strong_alias (___ieee128___asprintf, __asprintfieee128)
+libc_hidden_def (__asprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
index cf3b46c37a..ceba219dc7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_dprintf (int d, const char *format, ...)
+int
+__dprintfieee128 (int d, const char *format, ...)
{
va_list ap;
int done;
@@ -31,5 +31,4 @@ ___ieee128_dprintf (int d, const char *format, ...)
return done;
}
-strong_alias (___ieee128_dprintf, __dprintfieee128)
-hidden_def (___ieee128_dprintf);
+libc_hidden_def (__dprintfieee128);
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
index 4462588675..b58f27afb7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_fprintf (FILE *fp, const char *format, ...)
+int
+__fprintfieee128 (FILE *fp, const char *format, ...)
{
va_list ap;
int done;
@@ -31,5 +31,4 @@ ___ieee128_fprintf (FILE *fp, const char *format, ...)
return done;
}
-strong_alias (___ieee128_fprintf, __fprintfieee128)
-hidden_def (___ieee128_fprintf)
+libc_hidden_def (__fprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
index 9703069b95..243eb65629 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
@@ -18,8 +18,8 @@
/* When in IEEE long double mode, call ___ieee128_sprintf. */
#include <stdio.h>
-typeof (sprintf) ___ieee128_sprintf attribute_hidden;
-#define SPRINTF ___ieee128_sprintf
+typeof (sprintf) __sprintfieee128 attribute_hidden;
+#define SPRINTF __sprintfieee128
/* Declare internal functions: ___qecvtieee128_r and ___qfcvtieee128_r,
built from a different compiling unit, and called from here. */
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
index 0be5bb2810..8046f5fd46 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
@@ -18,8 +18,8 @@
/* When in IEEE long double mode, call ___ieee128_snprintf. */
#include <stdio.h>
-typeof (snprintf) ___ieee128_snprintf attribute_hidden;
-#define SNPRINTF ___ieee128_snprintf
+typeof (snprintf) __snprintfieee128 attribute_hidden;
+#define SNPRINTF __snprintfieee128
#define ECVT_R __qecvtieee128_r
#define FCVT_R __qfcvtieee128_r
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
index 5f51b3ec9e..da3d9441d7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_snprintf (char *s, size_t maxlen, const char *format, ...)
+int
+__snprintfieee128 (char *s, size_t maxlen, const char *format, ...)
{
va_list ap;
int done;
@@ -32,4 +32,4 @@ ___ieee128_snprintf (char *s, size_t maxlen, const char *format, ...)
return done;
}
-strong_alias (___ieee128_snprintf, __snprintfieee128)
+libc_hidden_def (__snprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
index 0cad130788..007a71659a 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_sprintf (char *s, const char *format, ...)
+int
+__sprintfieee128 (char *s, const char *format, ...)
{
va_list ap;
int done;
@@ -32,5 +32,4 @@ ___ieee128_sprintf (char *s, const char *format, ...)
return done;
}
-strong_alias (___ieee128_sprintf, __sprintfieee128)
-hidden_def (___ieee128_sprintf)
+libc_hidden_def (__sprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
index e340c9b457..4df1e485a5 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
@@ -18,10 +18,9 @@
#include <libio/libioP.h>
-extern int
-___ieee128_vfprintf (FILE *fp, const char *format, va_list ap)
+int
+__vfprintfieee128 (FILE *fp, const char *format, va_list ap)
{
return __vfprintf_internal (fp, format, ap, PRINTF_LDBL_USES_FLOAT128);
}
-strong_alias (___ieee128_vfprintf, __vfprintfieee128)
-hidden_def (___ieee128_vfprintf)
+libc_hidden_def (__vfprintfieee128)
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
index ebd2a43951..5b167d45ff 100644
--- a/sysdeps/posix/tempname.c
+++ b/sysdeps/posix/tempname.c
@@ -161,7 +161,7 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
return -1;
}
- sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
+ __sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
return 0;
}
#endif /* _LIBC */
diff --git a/sysdeps/unix/sysv/linux/ia64/makecontext.c b/sysdeps/unix/sysv/linux/ia64/makecontext.c
index 0bc4211dfc..0cf05d5999 100644
--- a/sysdeps/unix/sysv/linux/ia64/makecontext.c
+++ b/sysdeps/unix/sysv/linux/ia64/makecontext.c
@@ -54,7 +54,7 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
if (argc > 8)
{
- fprintf (stderr, _("\
+ __fprintf (stderr, _("\
makecontext: does not know how to handle more than 8 arguments\n"));
exit (-1);
}
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index 0e017f458b..f2dca7711a 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -233,10 +233,13 @@ extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
const wchar_t *__restrict __format, ...)
__THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
-extern int __REDIRECT_NTH_LDBL (__swprintf_alias,
- (wchar_t *__restrict __s, size_t __n,
- const wchar_t *__restrict __fmt, ...),
- swprintf);
+extern int __swprintf_alias (wchar_t *__restrict __s, size_t __n,
+ const wchar_t *__restrict __fmt, ...)
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+ __asm__ (__ASMNAME ("swprintf"))
+#endif
+ ;
+
#ifdef __va_arg_pack
__fortify_function int
@@ -264,10 +267,13 @@ extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
__gnuc_va_list __arg)
__THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-extern int __REDIRECT_NTH_LDBL (__vswprintf_alias,
- (wchar_t *__restrict __s, size_t __n,
- const wchar_t *__restrict __fmt,
- __gnuc_va_list __ap), vswprintf);
+extern int __vswprintf_alias (wchar_t *__restrict __s, size_t __n,
+ const wchar_t *__restrict __fmt,
+ __gnuc_va_list __ap)
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+ __asm__ (__ASMNAME ("vswprintf"))
+#endif
+ ;
__fortify_function int
__NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
^ permalink raw reply [flat|nested] 14+ messages in thread
* [glibc/azanella/clang] Remove stdio-ldbl.h
@ 2022-06-09 21:16 Adhemerval Zanella
0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-06-09 21:16 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=66103436786c18d6310af00e517962e661c9d6b5
commit 66103436786c18d6310af00e517962e661c9d6b5
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Thu Feb 24 14:13:12 2022 -0300
Remove stdio-ldbl.h
The functions which require different alias to long double depending
of the ABI now uses a set os macros that defines the expected alias
on the function prototype, instead of redefine them using the
__LDBL_REDIR_DEC macros.
The __REDIRECT_LDBL, __REDIRECT_LDBL_NTH, __REDIRECT_LDBL_NTHNL
are refactores to be similar to __REDIRECT with the difference it
now expects the aliases for binary128 and for the long double being
double (which __LDBL_REDIR_DEC does).
All printf internal usage are also replaced to use internal alias
instead.
Diff:
---
argp/argp-parse.c | 4 +-
debug/backtracesyms.c | 18 +-
grp/putgrent.c | 6 +-
gshadow/putsgent.c | 6 +-
include/bits/stdio-ldbl.h | 1 -
include/stdio.h | 34 ++-
inet/ether_ntoa_r.c | 8 +-
inet/rexec.c | 2 +-
libio/Makefile | 2 +-
libio/bits/stdio-ldbl.h | 108 --------
libio/bits/stdio2.h | 115 ++++++---
libio/stdio.h | 286 +++++++++++++--------
malloc/malloc-check.c | 1 +
malloc/malloc.c | 32 +--
misc/efgcvt-template.c | 2 +-
misc/mntent_r.c | 2 +-
misc/sys/cdefs.h | 70 +++--
nis/nis_subr.c | 8 +-
nptl/pthread_getname.c | 2 +-
nptl/pthread_setname.c | 2 +-
pwd/getpw.c | 6 +-
pwd/putpwent.c | 4 +-
resolv/inet_ntop.c | 4 +-
resolv/nss_dns/dns-host.c | 4 +-
resolv/nss_dns/dns-network.c | 12 +-
shadow/putspent.c | 16 +-
stdio-common/dprintf.c | 1 -
stdio-common/fprintf.c | 2 +-
stdio-common/psiginfo.c | 32 +--
stdio-common/sprintf.c | 2 +-
stdio-common/vfprintf.c | 2 +-
sunrpc/netname.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-asprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-dprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-fprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-snprintf.c | 6 +-
.../ieee754/ldbl-128ibm-compat/ieee128-sprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c | 7 +-
sysdeps/posix/tempname.c | 2 +-
sysdeps/unix/sysv/linux/ia64/makecontext.c | 2 +-
wcsmbs/bits/wchar2.h | 22 +-
43 files changed, 448 insertions(+), 425 deletions(-)
diff --git a/argp/argp-parse.c b/argp/argp-parse.c
index 13cd84dd33..c26c0fc27f 100644
--- a/argp/argp-parse.c
+++ b/argp/argp-parse.c
@@ -177,7 +177,7 @@ argp_version_parser (int key, char *arg, struct argp_state *state)
if (argp_program_version_hook)
(*argp_program_version_hook) (state->out_stream, state);
else if (argp_program_version)
- fprintf (state->out_stream, "%s\n", argp_program_version);
+ __fprintf (state->out_stream, "%s\n", argp_program_version);
else
__argp_error (state, dgettext (state->root_argp->argp_domain,
"(PROGRAM ERROR) No version known!?"));
@@ -618,7 +618,7 @@ parser_finalize (struct parser *parser,
{
if (!(parser->state.flags & ARGP_NO_ERRS)
&& parser->state.err_stream)
- fprintf (parser->state.err_stream,
+ __fprintf (parser->state.err_stream,
dgettext (parser->argp->argp_domain,
"%s: Too many arguments\n"),
parser->state.name);
diff --git a/debug/backtracesyms.c b/debug/backtracesyms.c
index 17e0626df8..adb939f888 100644
--- a/debug/backtracesyms.c
+++ b/debug/backtracesyms.c
@@ -83,10 +83,10 @@ __backtrace_symbols (void *const *array, int size)
info[cnt].dli_saddr = info[cnt].dli_fbase;
if (info[cnt].dli_sname == NULL && info[cnt].dli_saddr == 0)
- last += 1 + sprintf (last, "%s(%s) [%p]",
- info[cnt].dli_fname ?: "",
- info[cnt].dli_sname ?: "",
- array[cnt]);
+ last += 1 + __sprintf (last, "%s(%s) [%p]",
+ info[cnt].dli_fname ?: "",
+ info[cnt].dli_sname ?: "",
+ array[cnt]);
else
{
char sign;
@@ -102,14 +102,14 @@ __backtrace_symbols (void *const *array, int size)
offset = info[cnt].dli_saddr - array[cnt];
}
- last += 1 + sprintf (last, "%s(%s%c%#tx) [%p]",
- info[cnt].dli_fname ?: "",
- info[cnt].dli_sname ?: "",
- sign, offset, array[cnt]);
+ last += 1 + __sprintf (last, "%s(%s%c%#tx) [%p]",
+ info[cnt].dli_fname ?: "",
+ info[cnt].dli_sname ?: "",
+ sign, offset, array[cnt]);
}
}
else
- last += 1 + sprintf (last, "[%p]", array[cnt]);
+ last += 1 + __sprintf (last, "[%p]", array[cnt]);
}
assert (last <= (char *) result + size * sizeof (char *) + total);
}
diff --git a/grp/putgrent.c b/grp/putgrent.c
index 966ba2a763..305ff44359 100644
--- a/grp/putgrent.c
+++ b/grp/putgrent.c
@@ -45,10 +45,10 @@ putgrent (const struct group *gr, FILE *stream)
flockfile (stream);
if (gr->gr_name[0] == '+' || gr->gr_name[0] == '-')
- retval = fprintf (stream, "%s:%s::",
+ retval = __fprintf (stream, "%s:%s::",
gr->gr_name, _S (gr->gr_passwd));
else
- retval = fprintf (stream, "%s:%s:%lu:",
+ retval = __fprintf (stream, "%s:%s:%lu:",
gr->gr_name, _S (gr->gr_passwd),
(unsigned long int) gr->gr_gid);
if (__builtin_expect (retval, 0) < 0)
@@ -60,7 +60,7 @@ putgrent (const struct group *gr, FILE *stream)
if (gr->gr_mem != NULL)
{
for (size_t i = 0; gr->gr_mem[i] != NULL; i++)
- if (fprintf (stream, i == 0 ? "%s" : ",%s", gr->gr_mem[i]) < 0)
+ if (__fprintf (stream, i == 0 ? "%s" : ",%s", gr->gr_mem[i]) < 0)
{
/* What else can we do? */
funlockfile (stream);
diff --git a/gshadow/putsgent.c b/gshadow/putsgent.c
index 9e2dca7eaf..870438de6d 100644
--- a/gshadow/putsgent.c
+++ b/gshadow/putsgent.c
@@ -42,7 +42,7 @@ putsgent (const struct sgrp *g, FILE *stream)
_IO_flockfile (stream);
- if (fprintf (stream, "%s:%s:", g->sg_namp, _S (g->sg_passwd)) < 0)
+ if (__fprintf (stream, "%s:%s:", g->sg_namp, _S (g->sg_passwd)) < 0)
++errors;
bool first = true;
@@ -50,7 +50,7 @@ putsgent (const struct sgrp *g, FILE *stream)
if (sp != NULL)
while (*sp != NULL)
{
- if (fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
+ if (__fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
{
++errors;
break;
@@ -65,7 +65,7 @@ putsgent (const struct sgrp *g, FILE *stream)
if (sp != NULL)
while (*sp != NULL)
{
- if (fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
+ if (__fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
{
++errors;
break;
diff --git a/include/bits/stdio-ldbl.h b/include/bits/stdio-ldbl.h
deleted file mode 100644
index 1f7d3ce1c6..0000000000
--- a/include/bits/stdio-ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <libio/bits/stdio-ldbl.h>
diff --git a/include/stdio.h b/include/stdio.h
index a6f7fd43cb..39b4978130 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -22,13 +22,17 @@
/* Some libc_hidden_ldbl_proto's do not map to a unique symbol when
redirecting ldouble to _Float128 variants. We can therefore safely
directly alias them to their internal name. */
-# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc)
-# define stdio_hidden_ldbl_proto(p, f) \
- extern __typeof (p ## f) p ## f __asm (__ASMNAME ("___ieee128_" #f));
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# define stdio_hidden_ldbl_proto(p,f) __LDBL_REDIR1_DECL (p ## f, p ## f ## ieee128)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc) && defined SHARED
+# define __stdio_hidden_ldbl_proto(name, alias) \
+ extern __typeof (name) __##name __asm__ (__hidden_asmname (#alias));
+# define stdio_hidden_ldbl_proto(name) \
+ extern typeof (name) __##name##ieee128; \
+ libc_hidden_proto (__##name##ieee128); \
+ __stdio_hidden_ldbl_proto (name, __GI___##name##ieee128)
# else
-# define stdio_hidden_ldbl_proto(p,f) libc_hidden_proto (p ## f)
+# define stdio_hidden_ldbl_proto(name) \
+ extern __typeof (name) __##name; \
+ libc_hidden_proto (__##name)
# endif
/* Set the error indicator on FP. */
@@ -39,10 +43,7 @@ fseterr_unlocked (FILE *fp)
}
extern int __fcloseall (void) attribute_hidden;
-extern int __snprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, ...)
- __attribute__ ((__format__ (__printf__, 3, 4)));
-stdio_hidden_ldbl_proto (__, snprintf)
+stdio_hidden_ldbl_proto (snprintf);
extern int __vfscanf (FILE *__restrict __s,
const char *__restrict __format,
@@ -184,7 +185,7 @@ extern const size_t _sys_errlist_internal_len attribute_hidden;
extern const char *__get_errlist (int) attribute_hidden;
extern const char *__get_errname (int) attribute_hidden;
-libc_hidden_ldbl_proto (__asprintf)
+stdio_hidden_ldbl_proto (asprintf);
# if IS_IN (libc)
extern FILE *_IO_new_fopen (const char*, const char*);
@@ -206,13 +207,10 @@ extern int _IO_new_fgetpos (FILE *, __fpos_t *);
# define fgetpos(fp, posp) _IO_new_fgetpos (fp, posp)
# endif
-extern __typeof (dprintf) __dprintf
- __attribute__ ((__format__ (__printf__, 2, 3)));
-stdio_hidden_ldbl_proto (__, dprintf)
-libc_hidden_ldbl_proto (dprintf)
-libc_hidden_ldbl_proto (fprintf)
-libc_hidden_ldbl_proto (vfprintf)
-libc_hidden_ldbl_proto (sprintf)
+stdio_hidden_ldbl_proto (dprintf);
+stdio_hidden_ldbl_proto (fprintf);
+stdio_hidden_ldbl_proto (vfprintf);
+stdio_hidden_ldbl_proto (sprintf);
libc_hidden_proto (ungetc)
libc_hidden_proto (__getdelim)
libc_hidden_proto (fwrite)
diff --git a/inet/ether_ntoa_r.c b/inet/ether_ntoa_r.c
index 03011ffef6..f111e5234c 100644
--- a/inet/ether_ntoa_r.c
+++ b/inet/ether_ntoa_r.c
@@ -23,10 +23,10 @@
char *
ether_ntoa_r (const struct ether_addr *addr, char *buf)
{
- sprintf (buf, "%x:%x:%x:%x:%x:%x",
- addr->ether_addr_octet[0], addr->ether_addr_octet[1],
- addr->ether_addr_octet[2], addr->ether_addr_octet[3],
- addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
+ __sprintf (buf, "%x:%x:%x:%x:%x:%x",
+ addr->ether_addr_octet[0], addr->ether_addr_octet[1],
+ addr->ether_addr_octet[2], addr->ether_addr_octet[3],
+ addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
return buf;
}
libc_hidden_def (ether_ntoa_r)
diff --git a/inet/rexec.c b/inet/rexec.c
index 330282ac16..809475d976 100644
--- a/inet/rexec.c
+++ b/inet/rexec.c
@@ -135,7 +135,7 @@ retry:
NULL, 0, servbuff, sizeof(servbuff),
NI_NUMERICSERV))
port = (int) __strtol (servbuff, NULL, 10);
- (void) sprintf(num, "%u", port);
+ (void) __sprintf(num, "%u", port);
(void) __write(s, num, strlen(num)+1);
{ socklen_t len = sizeof (from);
s3 = TEMP_FAILURE_RETRY (accept(s2, (struct sockaddr *)&from,
diff --git a/libio/Makefile b/libio/Makefile
index e97387743f..a4830ddf42 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -23,7 +23,7 @@ subdir := libio
include ../Makeconfig
headers := stdio.h \
- bits/stdio.h bits/stdio2.h bits/stdio-ldbl.h \
+ bits/stdio.h bits/stdio2.h \
bits/types/FILE.h bits/types/__FILE.h bits/types/struct_FILE.h \
bits/types/__fpos_t.h bits/types/__fpos64_t.h \
bits/types/cookie_io_functions_t.h
diff --git a/libio/bits/stdio-ldbl.h b/libio/bits/stdio-ldbl.h
deleted file mode 100644
index 6b63394b50..0000000000
--- a/libio/bits/stdio-ldbl.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -mlong-double-64 compatibility mode for stdio functions.
- Copyright (C) 2006-2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#ifndef _STDIO_H
-# error "Never include <bits/stdio-ldbl.h> directly; use <stdio.h> instead."
-#endif
-
-__LDBL_REDIR_DECL (fprintf)
-__LDBL_REDIR_DECL (printf)
-__LDBL_REDIR_DECL (sprintf)
-__LDBL_REDIR_DECL (vfprintf)
-__LDBL_REDIR_DECL (vprintf)
-__LDBL_REDIR_DECL (vsprintf)
-#if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (fscanf, __nldbl___isoc99_fscanf)
-__LDBL_REDIR1_DECL (scanf, __nldbl___isoc99_scanf)
-__LDBL_REDIR1_DECL (sscanf, __nldbl___isoc99_sscanf)
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (fscanf, __isoc99_fscanfieee128)
-__LDBL_REDIR1_DECL (scanf, __isoc99_scanfieee128)
-__LDBL_REDIR1_DECL (sscanf, __isoc99_sscanfieee128)
-# else
-# error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-# endif
-#else
-__LDBL_REDIR_DECL (fscanf)
-__LDBL_REDIR_DECL (scanf)
-__LDBL_REDIR_DECL (sscanf)
-#endif
-
-#if defined __USE_ISOC99 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (snprintf)
-__LDBL_REDIR_DECL (vsnprintf)
-#endif
-
-#ifdef __USE_ISOC99
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (vfscanf, __nldbl___isoc99_vfscanf)
-__LDBL_REDIR1_DECL (vscanf, __nldbl___isoc99_vscanf)
-__LDBL_REDIR1_DECL (vsscanf, __nldbl___isoc99_vsscanf)
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (vfscanf, __isoc99_vfscanfieee128)
-__LDBL_REDIR1_DECL (vscanf, __isoc99_vscanfieee128)
-__LDBL_REDIR1_DECL (vsscanf, __isoc99_vsscanfieee128)
-# else
-# error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-# endif
-# else
-__LDBL_REDIR_DECL (vfscanf)
-__LDBL_REDIR_DECL (vsscanf)
-__LDBL_REDIR_DECL (vscanf)
-# endif
-#endif
-
-#ifdef __USE_XOPEN2K8
-__LDBL_REDIR_DECL (vdprintf)
-__LDBL_REDIR_DECL (dprintf)
-#endif
-
-#ifdef __USE_GNU
-__LDBL_REDIR_DECL (vasprintf)
-__LDBL_REDIR2_DECL (asprintf)
-__LDBL_REDIR_DECL (asprintf)
-__LDBL_REDIR_DECL (obstack_printf)
-__LDBL_REDIR_DECL (obstack_vprintf)
-#endif
-
-#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR2_DECL (sprintf_chk)
-__LDBL_REDIR2_DECL (vsprintf_chk)
-# if defined __USE_ISOC99 || defined __USE_UNIX98
-__LDBL_REDIR2_DECL (snprintf_chk)
-__LDBL_REDIR2_DECL (vsnprintf_chk)
-# endif
-# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR2_DECL (fprintf_chk)
-__LDBL_REDIR2_DECL (printf_chk)
-__LDBL_REDIR2_DECL (vfprintf_chk)
-__LDBL_REDIR2_DECL (vprintf_chk)
-# ifdef __USE_XOPEN2K8
-__LDBL_REDIR2_DECL (dprintf_chk)
-__LDBL_REDIR2_DECL (vdprintf_chk)
-# endif
-# ifdef __USE_GNU
-__LDBL_REDIR2_DECL (asprintf_chk)
-__LDBL_REDIR2_DECL (vasprintf_chk)
-__LDBL_REDIR2_DECL (obstack_printf_chk)
-__LDBL_REDIR2_DECL (obstack_vprintf_chk)
-# endif
-# endif
-#endif
diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h
index b0b655ee7a..de7f1f04aa 100644
--- a/libio/bits/stdio2.h
+++ b/libio/bits/stdio2.h
@@ -23,12 +23,17 @@
# error "Never include <bits/stdio2.h> directly; use <stdio.h> instead."
#endif
-extern int __sprintf_chk (char *__restrict __s, int __flag, size_t __slen,
- const char *__restrict __format, ...) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__sprintf_chk, (char *__restrict __s,
+ int __flag, size_t __slen,
+ const char *__restrict __format,
+ ...),
+ __sprintf_chkieee128, __nldbl___sprintf_chk)
__attr_access ((__write_only__, 1, 3));
-extern int __vsprintf_chk (char *__restrict __s, int __flag, size_t __slen,
- const char *__restrict __format,
- __gnuc_va_list __ap) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__vsprintf_chk, (char *__restrict __s,
+ int __flag, size_t __slen,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vsprintf_chkieee128, __nldbl___vsprintf_chk)
__attr_access ((__write_only__, 1, 3));
#ifdef __va_arg_pack
@@ -54,14 +59,19 @@ __NTH (vsprintf (char *__restrict __s, const char *__restrict __fmt,
}
#if defined __USE_ISOC99 || defined __USE_UNIX98
-
-extern int __snprintf_chk (char *__restrict __s, size_t __n, int __flag,
- size_t __slen, const char *__restrict __format,
- ...) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__snprintf_chk, (char *__restrict __s,
+ size_t __n, int __flag,
+ size_t __slen,
+ const char *__restrict __format,
+ ...),
+ __snprintf_chkieee128, __nldbl___snprintf_chk)
__attr_access ((__write_only__, 1, 2));
-extern int __vsnprintf_chk (char *__restrict __s, size_t __n, int __flag,
- size_t __slen, const char *__restrict __format,
- __gnuc_va_list __ap) __THROW;
+extern int __REDIRECT_LDBL_NTHNL (__vsnprintf_chk, (char *__restrict __s,
+ size_t __n, int __flag,
+ size_t __slen,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vsnprintf_chkieee128, __nldbl___vsnprintf_chk);
# ifdef __va_arg_pack
__fortify_function int
@@ -89,14 +99,24 @@ __NTH (vsnprintf (char *__restrict __s, size_t __n,
#endif
#if __USE_FORTIFY_LEVEL > 1
-
-extern int __fprintf_chk (FILE *__restrict __stream, int __flag,
- const char *__restrict __format, ...);
-extern int __printf_chk (int __flag, const char *__restrict __format, ...);
-extern int __vfprintf_chk (FILE *__restrict __stream, int __flag,
- const char *__restrict __format, __gnuc_va_list __ap);
-extern int __vprintf_chk (int __flag, const char *__restrict __format,
- __gnuc_va_list __ap);
+extern int __REDIRECT_LDBL (__fprintf_chk, (FILE *__restrict __stream,
+ int __flag,
+ const char *__restrict __format,
+ ...),
+ __fprintf_chkieee128, __nldbl___fprintf_chk);
+extern int __REDIRECT_LDBL (__printf_chk, (int __flag,
+ const char *__restrict __format,
+ ...),
+ __printf_chkieee128, __nldbl___printf_chk);
+extern int __REDIRECT_LDBL (__vfprintf_chk, (FILE *__restrict __stream,
+ int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vfprintf_chkieee128, __nldbl___vfprintf_chk);
+extern int __REDIRECT_LDBL (__vprintf_chk, (int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vprintf_chkieee128, __nldbl___vprintf_chk);
# ifdef __va_arg_pack
__fortify_function int
@@ -136,10 +156,15 @@ vfprintf (FILE *__restrict __stream,
}
# ifdef __USE_XOPEN2K8
-extern int __dprintf_chk (int __fd, int __flag, const char *__restrict __fmt,
- ...) __attribute__ ((__format__ (__printf__, 3, 4)));
-extern int __vdprintf_chk (int __fd, int __flag,
- const char *__restrict __fmt, __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL (__dprintf_chk, (int __fd, int __flag,
+ const char *__restrict __fmt,
+ ...),
+ __dprintf_chkieee128, __nldbl___dprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL (__vdprintf_chk, (int __fd, int __flag,
+ const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vdprintf_chkieee128, __nldbl___vdprintf_chk)
__attribute__ ((__format__ (__printf__, 3, 0)));
# ifdef __va_arg_pack
@@ -162,22 +187,32 @@ vdprintf (int __fd, const char *__restrict __fmt, __gnuc_va_list __ap)
# endif
# ifdef __USE_GNU
-
-extern int __asprintf_chk (char **__restrict __ptr, int __flag,
- const char *__restrict __fmt, ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4))) __wur;
-extern int __vasprintf_chk (char **__restrict __ptr, int __flag,
- const char *__restrict __fmt, __gnuc_va_list __arg)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
-extern int __obstack_printf_chk (struct obstack *__restrict __obstack,
- int __flag, const char *__restrict __format,
- ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
-extern int __obstack_vprintf_chk (struct obstack *__restrict __obstack,
- int __flag,
- const char *__restrict __format,
- __gnuc_va_list __args)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
+extern int __REDIRECT_LDBL_NTHNL (__asprintf_chk, (char **__restrict __ptr,
+ int __flag,
+ const char *__restrict __fmt,
+ ...),
+ __asprintf_chkieee128, __nldbl___asprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (__vasprintf_chk, (char **__restrict __ptr,
+ int __flag,
+ const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vasprintf_chkieee128, __nldbl___vasnprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (__obstack_printf_chk, (struct obstack *__restrict __obstack,
+ int __flag,
+ const char *__restrict __format,
+ ...),
+ __obstack_printf_chkieee128,
+ __nldbl___obstack_printf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL_NTHNL (__obstack_vprintf_chk, (struct obstack *__restrict __obstack,
+ int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __args),
+ __obstack_vprintf_chkieee128,
+ __nldbl___obstack_vprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
# ifdef __va_arg_pack
__fortify_function int
diff --git a/libio/stdio.h b/libio/stdio.h
index e6425341ce..54c9796a46 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -41,6 +41,7 @@ __BEGIN_DECLS
#include <bits/types/__FILE.h>
#include <bits/types/FILE.h>
#include <bits/types/struct_FILE.h>
+#include <bits/floatn.h>
#ifdef __USE_GNU
# include <bits/types/cookie_io_functions_t.h>
@@ -342,78 +343,143 @@ extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
extern void setlinebuf (FILE *__stream) __THROW;
#endif
-
/* Write formatted output to STREAM.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int fprintf (FILE *__restrict __stream,
- const char *__restrict __format, ...);
+extern int __REDIRECT_LDBL (fprintf, (FILE *__restrict __stream,
+ const char *__restrict __format, ...),
+ __fprintfieee128, __nldbl_fprintf);
/* Write formatted output to stdout.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int printf (const char *__restrict __format, ...);
+extern int __REDIRECT_LDBL (printf, (const char *__restrict __format, ...),
+ __printfieee128, __nldbl_printf);
/* Write formatted output to S. */
-extern int sprintf (char *__restrict __s,
- const char *__restrict __format, ...) __THROWNL;
+extern int __REDIRECT_LDBL_NTHNL (sprintf, (char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __sprintfieee128, __nldbl_sprintf);
/* Write formatted output to S from argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg);
+extern int __REDIRECT_LDBL (vfprintf, (FILE *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vfprintfieee128, __nldbl_vfprintf);
/* Write formatted output to stdout from argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
+extern int __REDIRECT_LDBL (vprintf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vprintfieee128, __nldbl_vprintf);
/* Write formatted output to S from argument list ARG. */
-extern int vsprintf (char *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg) __THROWNL;
+extern int __REDIRECT_LDBL_NTHNL (vsprintf, (char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsprintfieee128, __nldbl_vsprintf);
#if defined __USE_ISOC99 || defined __USE_UNIX98
/* Maximum chars of output to write in MAXLEN. */
-extern int snprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 3, 4)));
-
-extern int vsnprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, __gnuc_va_list __arg)
- __THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
+extern int __REDIRECT_LDBL_NTHNL (snprintf, (char *__restrict __s,
+ size_t __maxlen,
+ const char *__restrict __format,
+ ...),
+ __snprintfieee128, __nldbl_snprintf)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL_NTHNL (vsnprintf, (char *__restrict __s,
+ size_t __maxlen,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsnprintfieee128, __nldbl_vsnprintf)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
#endif
#if __GLIBC_USE (LIB_EXT2)
/* Write formatted output to a string dynamically allocated with `malloc'.
Store the address of the string in *PTR. */
-extern int vasprintf (char **__restrict __ptr, const char *__restrict __f,
- __gnuc_va_list __arg)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
-extern int __asprintf (char **__restrict __ptr,
- const char *__restrict __fmt, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
-extern int asprintf (char **__restrict __ptr,
- const char *__restrict __fmt, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (vasprintf, (char **__restrict __ptr,
+ const char *__restrict __f,
+ __gnuc_va_list __arg),
+ __vasprintfieee128, __nldbl_vasprintf)
+ __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (asprintf, (char **__restrict __ptr,
+ const char *__restrict __fmt,
+ ...),
+ __asprintfieee128, __nldbl_asprintf)
+ __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
#endif
#ifdef __USE_XOPEN2K8
/* Write formatted output to a file descriptor. */
-extern int vdprintf (int __fd, const char *__restrict __fmt,
- __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL (vdprintf, (int __fd, const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vdprintfieee128, __nldbl_vdprintf)
__attribute__ ((__format__ (__printf__, 2, 0)));
-extern int dprintf (int __fd, const char *__restrict __fmt, ...)
+extern int __REDIRECT_LDBL (dprintf, (int __fd, const char *__restrict __fmt,
+ ...),
+ __dprintfieee128, __nldbl_dprintf)
__attribute__ ((__format__ (__printf__, 2, 3)));
#endif
-
+#if !__GLIBC_USE (DEPRECATED_SCANF)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ ...),
+ __isoc99_fscanfieee128, __nldbl___isoc99_fscanf) __wur;
+extern int __REDIRECT_LDBL (scanf, (const char *__restrict __format,
+ ...),
+ __isoc99_scanfieee128, __nldbl___isoc99_scanf) __wur;
+extern int __REDIRECT_LDBL_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __isoc99_sscanfieee128, __nldbl___isoc99_sscanf);
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format, ...),
+ __isoc99_fscanf) __wur;
+extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
+ __isoc99_scanf) __wur;
+extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format, ...),
+ __isoc99_sscanf);
+# else
+extern int __isoc99_fscanf (FILE *__restrict __stream,
+ const char *__restrict __format, ...) __wur;
+extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
+extern int __isoc99_sscanf (const char *__restrict __s,
+ const char *__restrict __format, ...) __THROW;
+# define fscanf __isoc99_fscanf
+# define scanf __isoc99_scanf
+# define sscanf __isoc99_sscanf
+# endif /* __REDIRECT */
+# endif
+#else
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ ...),
+ __fscanfieee128, __nldbl_fscanf) __wur;
+extern int __REDIRECT_LDBL (scanf, (const char *__restrict __format,
+ ...),
+ __scanfieee128, __nldbl_scanf) __wur;
+extern int __REDIRECT_LDBL_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __sscanfieee128, __nldbl_sscanf) __wur;
+# else
/* Read formatted input from STREAM.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int fscanf (FILE *__restrict __stream,
- const char *__restrict __format, ...) __wur;
+ const char *__restrict __format, ...) __wur;
/* Read formatted input from stdin.
This function is a possible cancellation point and therefore not
@@ -421,43 +487,81 @@ extern int fscanf (FILE *__restrict __stream,
extern int scanf (const char *__restrict __format, ...) __wur;
/* Read formatted input from S. */
extern int sscanf (const char *__restrict __s,
- const char *__restrict __format, ...) __THROW;
-
-/* For historical reasons, the C99-compliant versions of the scanf
- functions are at alternative names. When __LDBL_COMPAT or
- __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
- bits/stdio-ldbl.h. */
-#include <bits/floatn.h>
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
- && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-# ifdef __REDIRECT
-extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
- const char *__restrict __format, ...),
- __isoc99_fscanf) __wur;
-extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
- __isoc99_scanf) __wur;
-extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
- const char *__restrict __format, ...),
- __isoc99_sscanf);
-# else
-extern int __isoc99_fscanf (FILE *__restrict __stream,
- const char *__restrict __format, ...) __wur;
-extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
-extern int __isoc99_sscanf (const char *__restrict __s,
- const char *__restrict __format, ...) __THROW;
-# define fscanf __isoc99_fscanf
-# define scanf __isoc99_scanf
-# define sscanf __isoc99_sscanf
+ const char *__restrict __format, ...) __THROW;
# endif
-#endif
+#endif /* DEPRECATED_SCANF */
-#ifdef __USE_ISOC99
+#ifdef __USE_ISOC99
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vfscanfieee128, __nldbl___isoc99_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vscanfieee128, __nldbl___isoc99_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_LDBL_NTH (vsscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vsscanfieee128, __nldbl___isoc99_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (vfscanf,
+ (FILE *__restrict __s,
+ const char *__restrict __format, __gnuc_va_list __arg),
+ __isoc99_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_NTH (vsscanf,
+ (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
+extern int __isoc99_vfscanf (FILE *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg) __wur;
+extern int __isoc99_vscanf (const char *__restrict __format,
+ __gnuc_va_list __arg) __wur;
+extern int __isoc99_vsscanf (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg) __THROW;
+# define vfscanf __isoc99_vfscanf
+# define vscanf __isoc99_vscanf
+# define vsscanf __isoc99_vsscanf
+# endif /* __REDIRECT */
+# endif
+# else /* DEPRECATED_SCANF */
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vfscanfieee128, __nldbl_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vscanfieee128, __nldbl_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_LDBL_NTH (vsscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsscanfieee128, __nldbl_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
/* Read formatted input from S into argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg)
+ __gnuc_va_list __arg)
__attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
/* Read formatted input from stdin into argument list ARG.
@@ -469,42 +573,11 @@ extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
/* Read formatted input from S into argument list ARG. */
extern int vsscanf (const char *__restrict __s,
- const char *__restrict __format, __gnuc_va_list __arg)
+ const char *__restrict __format, __gnuc_va_list __arg)
__THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
-
-/* Same redirection as above for the v*scanf family. */
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __REDIRECT && !defined __LDBL_COMPAT \
- && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-extern int __REDIRECT (vfscanf,
- (FILE *__restrict __s,
- const char *__restrict __format, __gnuc_va_list __arg),
- __isoc99_vfscanf)
- __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
-extern int __REDIRECT (vscanf, (const char *__restrict __format,
- __gnuc_va_list __arg), __isoc99_vscanf)
- __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
-extern int __REDIRECT_NTH (vsscanf,
- (const char *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg), __isoc99_vsscanf)
- __attribute__ ((__format__ (__scanf__, 2, 0)));
-# elif !defined __REDIRECT
-extern int __isoc99_vfscanf (FILE *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg) __wur;
-extern int __isoc99_vscanf (const char *__restrict __format,
- __gnuc_va_list __arg) __wur;
-extern int __isoc99_vsscanf (const char *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg) __THROW;
-# define vfscanf __isoc99_vfscanf
-# define vscanf __isoc99_vscanf
-# define vsscanf __isoc99_vsscanf
# endif
# endif
-#endif /* Use ISO C9x. */
-
+#endif /* __USE_ISOC99 */
/* Read a character from STREAM.
@@ -850,13 +923,17 @@ extern char *cuserid (char *__s)
struct obstack; /* See <obstack.h>. */
/* Write formatted output to an obstack. */
-extern int obstack_printf (struct obstack *__restrict __obstack,
- const char *__restrict __format, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3)));
-extern int obstack_vprintf (struct obstack *__restrict __obstack,
- const char *__restrict __format,
- __gnuc_va_list __args)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 0)));
+extern int __REDIRECT_LDBL_NTHNL (obstack_printf,
+ (struct obstack *__restrict __obstack,
+ const char *__restrict __format, ...),
+ __obstack_printfieee128, __nldbl_obstack_printf)
+ __attribute__ ((__format__ (__printf__, 2, 3)));
+extern int __REDIRECT_LDBL_NTHNL (obstack_vprintf,
+ (struct obstack *__restrict __obstack,
+ const char *__restrict __format,
+ __gnuc_va_list __args),
+ __obstack_vprintfieee128, __nldbl_obstack_vprintf)
+ __attribute__ ((__format__ (__printf__, 2, 0)));
#endif /* Use GNU. */
@@ -894,11 +971,6 @@ extern int __overflow (FILE *, int);
# include <bits/stdio2.h>
#endif
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/stdio-ldbl.h>
-#endif
-
__END_DECLS
#endif /* <stdio.h> included. */
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index 0299fe99a7..e1f68bddfb 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -17,6 +17,7 @@
not, see <https://www.gnu.org/licenses/>. */
#define __mremap mremap
+#define __fprintf fprintf
#include "malloc.c"
/* When memory is tagged, the checking data is stored in the user part
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 09e5ff2bce..aa35846e55 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5279,9 +5279,9 @@ __malloc_stats (void)
memset (&mi, 0, sizeof (mi));
__libc_lock_lock (ar_ptr->mutex);
int_mallinfo (ar_ptr, &mi);
- fprintf (stderr, "Arena %d:\n", i);
- fprintf (stderr, "system bytes = %10u\n", (unsigned int) mi.arena);
- fprintf (stderr, "in use bytes = %10u\n", (unsigned int) mi.uordblks);
+ __fprintf (stderr, "Arena %d:\n", i);
+ __fprintf (stderr, "system bytes = %10u\n", (unsigned int) mi.arena);
+ __fprintf (stderr, "in use bytes = %10u\n", (unsigned int) mi.uordblks);
#if MALLOC_DEBUG > 1
if (i > 0)
dump_heap (heap_for_ptr (top (ar_ptr)));
@@ -5293,12 +5293,12 @@ __malloc_stats (void)
if (ar_ptr == &main_arena)
break;
}
- fprintf (stderr, "Total (incl. mmap):\n");
- fprintf (stderr, "system bytes = %10u\n", system_b);
- fprintf (stderr, "in use bytes = %10u\n", in_use_b);
- fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps);
- fprintf (stderr, "max mmap bytes = %10lu\n",
- (unsigned long) mp_.max_mmapped_mem);
+ __fprintf (stderr, "Total (incl. mmap):\n");
+ __fprintf (stderr, "system bytes = %10u\n", system_b);
+ __fprintf (stderr, "in use bytes = %10u\n", in_use_b);
+ __fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps);
+ __fprintf (stderr, "max mmap bytes = %10lu\n",
+ (unsigned long) mp_.max_mmapped_mem);
stderr->_flags2 = old_flags2;
_IO_funlockfile (stderr);
}
@@ -5728,7 +5728,7 @@ __malloc_info (int options, FILE *fp)
mstate ar_ptr = &main_arena;
do
{
- fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
+ __fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
size_t nblocks = 0;
size_t nfastblocks = 0;
@@ -5839,12 +5839,12 @@ __malloc_info (int options, FILE *fp)
for (size_t i = 0; i < nsizes; ++i)
if (sizes[i].count != 0 && i != NFASTBINS)
- fprintf (fp, "\
+ __fprintf (fp, "\
<size from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
sizes[i].from, sizes[i].to, sizes[i].total, sizes[i].count);
if (sizes[NFASTBINS].count != 0)
- fprintf (fp, "\
+ __fprintf (fp, "\
<unsorted from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
sizes[NFASTBINS].from, sizes[NFASTBINS].to,
sizes[NFASTBINS].total, sizes[NFASTBINS].count);
@@ -5852,7 +5852,7 @@ __malloc_info (int options, FILE *fp)
total_system += ar_ptr->system_mem;
total_max_system += ar_ptr->max_system_mem;
- fprintf (fp,
+ __fprintf (fp,
"</sizes>\n<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
"<system type=\"current\" size=\"%zu\"/>\n"
@@ -5862,7 +5862,7 @@ __malloc_info (int options, FILE *fp)
if (ar_ptr != &main_arena)
{
- fprintf (fp,
+ __fprintf (fp,
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n"
"<aspace type=\"subheaps\" size=\"%zu\"/>\n",
@@ -5872,7 +5872,7 @@ __malloc_info (int options, FILE *fp)
}
else
{
- fprintf (fp,
+ __fprintf (fp,
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n",
ar_ptr->system_mem, ar_ptr->system_mem);
@@ -5885,7 +5885,7 @@ __malloc_info (int options, FILE *fp)
}
while (ar_ptr != &main_arena);
- fprintf (fp,
+ __fprintf (fp,
"<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"mmap\" count=\"%d\" size=\"%zu\"/>\n"
diff --git a/misc/efgcvt-template.c b/misc/efgcvt-template.c
index 87a90e78d4..f1630fd780 100644
--- a/misc/efgcvt-template.c
+++ b/misc/efgcvt-template.c
@@ -24,7 +24,7 @@
#include <math_ldbl_opt.h>
#ifndef SPRINTF
-# define SPRINTF sprintf
+# define SPRINTF __sprintf
#endif
#define APPEND(a, b) APPEND2 (a, b)
diff --git a/misc/mntent_r.c b/misc/mntent_r.c
index 3311ba0b50..65f29b97e9 100644
--- a/misc/mntent_r.c
+++ b/misc/mntent_r.c
@@ -251,7 +251,7 @@ __addmntent (FILE *stream, const struct mntent *mnt)
write_string (stream, mnt->mnt_dir);
write_string (stream, mnt->mnt_type);
write_string (stream, mnt->mnt_opts);
- fprintf (stream, "%d %d\n", mnt->mnt_freq, mnt->mnt_passno);
+ __fprintf (stream, "%d %d\n", mnt->mnt_freq, mnt->mnt_passno);
ret = __ferror_unlocked (stream) != 0 || fflush (stream) != 0;
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index f525f67547..e7f8952caa 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -560,6 +560,54 @@
# include <bits/long-double.h>
#endif
+#if (defined __GNUC__ && __GNUC__ >= 2) || (__clang_major__ >= 4)
+# define __REDIRECT_LDBL1(name, prenth, posnth, proto, alias) \
+ name proto prenth __asm__ (__ASMNAME (__ASMNAME (#alias))) posnth
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+# ifdef __REDIRECT
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , , proto, ieee128)
+# ifdef __cplusplus
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROW, , proto, ieee128)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROWNL, , proto, ieee128)
+# else
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROW, proto, ieee128)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROWNL, proto, ieee128)
+# endif /* __cplusplus */
+# else
+_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
+# endif /* __REDIRECT */
+# elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
+# ifdef __REDIRECT
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , , proto, compat)
+# ifdef __cplusplus
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROW, , proto, compat)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROWNL, , proto, compat)
+# else
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROW, proto, compat)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROWNL, proto, compat)
+# endif /* __cplusplus */
+# else
+_Static_assert (0, "Compat long double requires redirection on this platform");
+# endif /* __REDIRECT */
+# endif
+#endif
+
+#ifndef __REDIRECT_LDBL
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) name proto
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) name proto __THROW
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) name proto __THROWNL
+#endif
+
#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
# ifdef __REDIRECT
@@ -583,10 +631,6 @@
# define __REDIRECT_NTH_LDBL(name, proto, alias) \
__LDBL_REDIR1_NTH (name, proto, __##alias##ieee128)
-/* Unused. */
-# define __REDIRECT_LDBL(name, proto, alias) ... unused__redirect_ldbl
-# define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth
-
# else
_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
# endif
@@ -605,24 +649,6 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf
extern __typeof (name) name __asm (__ASMNAME (#alias));
# define __LDBL_REDIR_DECL(name) \
extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name));
-# define __REDIRECT_LDBL(name, proto, alias) \
- __LDBL_REDIR1 (name, proto, __nldbl_##alias)
-# define __REDIRECT_NTH_LDBL(name, proto, alias) \
- __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias)
-# endif
-#endif
-#if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \
- || !defined __REDIRECT
-# define __LDBL_REDIR1(name, proto, alias) name proto
-# define __LDBL_REDIR(name, proto) name proto
-# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW
-# define __LDBL_REDIR_NTH(name, proto) name proto __THROW
-# define __LDBL_REDIR2_DECL(name)
-# define __LDBL_REDIR_DECL(name)
-# ifdef __REDIRECT
-# define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias)
-# define __REDIRECT_NTH_LDBL(name, proto, alias) \
- __REDIRECT_NTH (name, proto, alias)
# endif
#endif
diff --git a/nis/nis_subr.c b/nis/nis_subr.c
index 385f221062..0e02cd19b5 100644
--- a/nis/nis_subr.c
+++ b/nis/nis_subr.c
@@ -280,10 +280,10 @@ nis_getnames (const_nis_name name)
}
if (pos == 0
- && __asprintf (&getnames[pos++], "%s%s%s%s",
- name, name[name_len - 1] == '.' ? "" : ".",
- local_domain,
- local_domain[local_domain_len - 1] == '.' ? "" : ".") < 0)
+ && asprintf (&getnames[pos++], "%s%s%s%s",
+ name, name[name_len - 1] == '.' ? "" : ".",
+ local_domain,
+ local_domain[local_domain_len - 1] == '.' ? "" : ".") < 0)
goto free_null;
getnames[pos] = NULL;
diff --git a/nptl/pthread_getname.c b/nptl/pthread_getname.c
index ebec06e23f..a424b3e4f8 100644
--- a/nptl/pthread_getname.c
+++ b/nptl/pthread_getname.c
@@ -42,7 +42,7 @@ __pthread_getname_np (pthread_t th, char *buf, size_t len)
#define FMT "/proc/self/task/%u/comm"
char fname[sizeof (FMT) + 8];
- sprintf (fname, FMT, (unsigned int) pd->tid);
+ __sprintf (fname, FMT, (unsigned int) pd->tid);
int fd = __open64_nocancel (fname, O_RDONLY);
if (fd == -1)
diff --git a/nptl/pthread_setname.c b/nptl/pthread_setname.c
index f24560db47..8520bac4be 100644
--- a/nptl/pthread_setname.c
+++ b/nptl/pthread_setname.c
@@ -44,7 +44,7 @@ __pthread_setname_np (pthread_t th, const char *name)
#define FMT "/proc/self/task/%u/comm"
char fname[sizeof (FMT) + 8];
- sprintf (fname, FMT, (unsigned int) pd->tid);
+ __sprintf (fname, FMT, (unsigned int) pd->tid);
int fd = __open64_nocancel (fname, O_RDWR);
if (fd == -1)
diff --git a/pwd/getpw.c b/pwd/getpw.c
index 547489a863..4784eaf00b 100644
--- a/pwd/getpw.c
+++ b/pwd/getpw.c
@@ -50,9 +50,9 @@ __getpw (__uid_t uid, char *buf)
if (p == NULL)
return -1;
- if (sprintf (buf, "%s:%s:%lu:%lu:%s:%s:%s", p->pw_name, p->pw_passwd,
- (unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
- p->pw_gecos, p->pw_dir, p->pw_shell) < 0)
+ if (__sprintf (buf, "%s:%s:%lu:%lu:%s:%s:%s", p->pw_name, p->pw_passwd,
+ (unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
+ p->pw_gecos, p->pw_dir, p->pw_shell) < 0)
return -1;
return 0;
diff --git a/pwd/putpwent.c b/pwd/putpwent.c
index e3f2f4e09e..480dd59813 100644
--- a/pwd/putpwent.c
+++ b/pwd/putpwent.c
@@ -48,11 +48,11 @@ putpwent (const struct passwd *p, FILE *stream)
return -1;
if (p->pw_name[0] == '+' || p->pw_name[0] == '-')
- ret = fprintf (stream, "%s:%s:::%s:%s:%s\n",
+ ret = __fprintf (stream, "%s:%s:::%s:%s:%s\n",
p->pw_name, _S (p->pw_passwd),
gecos, _S (p->pw_dir), _S (p->pw_shell));
else
- ret = fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
+ ret = __fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
p->pw_name, _S (p->pw_passwd),
(unsigned long int) p->pw_uid,
(unsigned long int) p->pw_gid,
diff --git a/resolv/inet_ntop.c b/resolv/inet_ntop.c
index c4d38c0f95..53725d805a 100644
--- a/resolv/inet_ntop.c
+++ b/resolv/inet_ntop.c
@@ -28,9 +28,9 @@
#include <string.h>
#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
+# define SPRINTF(x) strlen(__sprintf/**/x)
#else
-# define SPRINTF(x) ((size_t)sprintf x)
+# define SPRINTF(x) ((size_t)__sprintf x)
#endif
/*
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index 913a5cb82f..06a91b23ca 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -507,8 +507,8 @@ _nss_dns_gethostbyaddr2_r (const void *addr, socklen_t len, int af,
switch (af)
{
case AF_INET:
- sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", (uaddr[3] & 0xff),
- (uaddr[2] & 0xff), (uaddr[1] & 0xff), (uaddr[0] & 0xff));
+ __sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", (uaddr[3] & 0xff),
+ (uaddr[2] & 0xff), (uaddr[1] & 0xff), (uaddr[0] & 0xff));
break;
case AF_INET6:
qp = qbuf;
diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
index 09cd917444..304ae35b8b 100644
--- a/resolv/nss_dns/dns-network.c
+++ b/resolv/nss_dns/dns-network.c
@@ -191,21 +191,21 @@ _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result,
{
case 3:
/* Class A network. */
- sprintf (qbuf, "0.0.0.%u.in-addr.arpa", net_bytes[3]);
+ __sprintf (qbuf, "0.0.0.%u.in-addr.arpa", net_bytes[3]);
break;
case 2:
/* Class B network. */
- sprintf (qbuf, "0.0.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2]);
+ __sprintf (qbuf, "0.0.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2]);
break;
case 1:
/* Class C network. */
- sprintf (qbuf, "0.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
- net_bytes[1]);
+ __sprintf (qbuf, "0.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
+ net_bytes[1]);
break;
case 0:
/* Class D - E network. */
- sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
- net_bytes[1], net_bytes[0]);
+ __sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
+ net_bytes[1], net_bytes[0]);
break;
}
diff --git a/shadow/putspent.c b/shadow/putspent.c
index cbbb840d5b..d675e28210 100644
--- a/shadow/putspent.c
+++ b/shadow/putspent.c
@@ -42,47 +42,47 @@ putspent (const struct spwd *p, FILE *stream)
flockfile (stream);
- if (fprintf (stream, "%s:%s:", p->sp_namp, _S (p->sp_pwdp)) < 0)
+ if (__fprintf (stream, "%s:%s:", p->sp_namp, _S (p->sp_pwdp)) < 0)
++errors;
if ((p->sp_lstchg != (long int) -1
- && fprintf (stream, "%ld:", p->sp_lstchg) < 0)
+ && __fprintf (stream, "%ld:", p->sp_lstchg) < 0)
|| (p->sp_lstchg == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_min != (long int) -1
- && fprintf (stream, "%ld:", p->sp_min) < 0)
+ && __fprintf (stream, "%ld:", p->sp_min) < 0)
|| (p->sp_min == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_max != (long int) -1
- && fprintf (stream, "%ld:", p->sp_max) < 0)
+ && __fprintf (stream, "%ld:", p->sp_max) < 0)
|| (p->sp_max == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_warn != (long int) -1
- && fprintf (stream, "%ld:", p->sp_warn) < 0)
+ && __fprintf (stream, "%ld:", p->sp_warn) < 0)
|| (p->sp_warn == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_inact != (long int) -1
- && fprintf (stream, "%ld:", p->sp_inact) < 0)
+ && __fprintf (stream, "%ld:", p->sp_inact) < 0)
|| (p->sp_inact == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_expire != (long int) -1
- && fprintf (stream, "%ld:", p->sp_expire) < 0)
+ && __fprintf (stream, "%ld:", p->sp_expire) < 0)
|| (p->sp_expire == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if (p->sp_flag != ~0ul
- && fprintf (stream, "%ld", p->sp_flag) < 0)
+ && __fprintf (stream, "%ld", p->sp_flag) < 0)
++errors;
if (putc_unlocked ('\n', stream) == EOF)
diff --git a/stdio-common/dprintf.c b/stdio-common/dprintf.c
index 2e26d59714..6fbe5d4862 100644
--- a/stdio-common/dprintf.c
+++ b/stdio-common/dprintf.c
@@ -33,5 +33,4 @@ __dprintf (int d, const char *format, ...)
return done;
}
libc_hidden_def (__dprintf)
-ldbl_hidden_def (__dprintf, dprintf)
ldbl_weak_alias (__dprintf, dprintf)
diff --git a/stdio-common/fprintf.c b/stdio-common/fprintf.c
index 8d2cd37433..af7190c5b4 100644
--- a/stdio-common/fprintf.c
+++ b/stdio-common/fprintf.c
@@ -34,7 +34,7 @@ __fprintf (FILE *stream, const char *format, ...)
return done;
}
-ldbl_hidden_def (__fprintf, fprintf)
+libc_hidden_def (__fprintf)
ldbl_strong_alias (__fprintf, fprintf)
/* We define the function with the real name here. But deep down in
diff --git a/stdio-common/psiginfo.c b/stdio-common/psiginfo.c
index adf3b71b77..f99c51da17 100644
--- a/stdio-common/psiginfo.c
+++ b/stdio-common/psiginfo.c
@@ -76,7 +76,7 @@ psiginfo (const siginfo_t *pinfo, const char *s)
}
if (s != NULL && *s != '\0')
- fprintf (fp, "%s: ", s);
+ __fprintf (fp, "%s: ", s);
const char *desc;
if (pinfo->si_signo >= 0 && pinfo->si_signo < NSIG
@@ -92,21 +92,21 @@ psiginfo (const siginfo_t *pinfo, const char *s)
if (pinfo->si_signo - SIGRTMIN < SIGRTMAX - pinfo->si_signo)
{
if (pinfo->si_signo == SIGRTMIN)
- fprintf (fp, "SIGRTMIN (");
+ __fprintf (fp, "SIGRTMIN (");
else
- fprintf (fp, "SIGRTMIN+%d (", pinfo->si_signo - SIGRTMIN);
+ __fprintf (fp, "SIGRTMIN+%d (", pinfo->si_signo - SIGRTMIN);
}
else
{
if (pinfo->si_signo == SIGRTMAX)
- fprintf (fp, "SIGRTMAX (");
+ __fprintf (fp, "SIGRTMAX (");
else
- fprintf (fp, "SIGRTMAX-%d (", SIGRTMAX - pinfo->si_signo);
+ __fprintf (fp, "SIGRTMAX-%d (", SIGRTMAX - pinfo->si_signo);
}
}
else
#endif
- fprintf (fp, "%s (", _(desc));
+ __fprintf (fp, "%s (", _(desc));
const char *base = NULL;
const uint8_t *offarr = NULL;
@@ -178,25 +178,25 @@ Signal generated by the completion of an I/O request");
}
if (str != NULL)
- fprintf (fp, "%s ", _(str));
+ __fprintf (fp, "%s ", _(str));
else
- fprintf (fp, "%d ", pinfo->si_code);
+ __fprintf (fp, "%d ", pinfo->si_code);
if (pinfo->si_signo == SIGILL || pinfo->si_signo == SIGFPE
|| pinfo->si_signo == SIGSEGV || pinfo->si_signo == SIGBUS)
- fprintf (fp, "[%p])\n", pinfo->si_addr);
+ __fprintf (fp, "[%p])\n", pinfo->si_addr);
else if (pinfo->si_signo == SIGCHLD)
- fprintf (fp, "%ld %d %ld)\n",
- (long int) pinfo->si_pid, pinfo->si_status,
- (long int) pinfo->si_uid);
+ __fprintf (fp, "%ld %d %ld)\n",
+ (long int) pinfo->si_pid, pinfo->si_status,
+ (long int) pinfo->si_uid);
else if (pinfo->si_signo == SIGPOLL)
- fprintf (fp, "%ld)\n", (long int) pinfo->si_band);
+ __fprintf (fp, "%ld)\n", (long int) pinfo->si_band);
else
- fprintf (fp, "%ld %ld)\n",
- (long int) pinfo->si_pid, (long int) pinfo->si_uid);
+ __fprintf (fp, "%ld %ld)\n",
+ (long int) pinfo->si_pid, (long int) pinfo->si_uid);
}
else
- fprintf (fp, _("Unknown signal %d\n"), pinfo->si_signo);
+ __fprintf (fp, _("Unknown signal %d\n"), pinfo->si_signo);
fclose (fp);
diff --git a/stdio-common/sprintf.c b/stdio-common/sprintf.c
index a9665f753a..f1f43a49ec 100644
--- a/stdio-common/sprintf.c
+++ b/stdio-common/sprintf.c
@@ -32,6 +32,6 @@ __sprintf (char *s, const char *format, ...)
return done;
}
-ldbl_hidden_def (__sprintf, sprintf)
+libc_hidden_def (__sprintf)
ldbl_strong_alias (__sprintf, sprintf)
ldbl_strong_alias (__sprintf, _IO_sprintf)
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 7559fd239d..c5912788bd 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -24,4 +24,4 @@ __vfprintf (FILE *fp, const char *format, va_list ap)
}
ldbl_strong_alias (__vfprintf, _IO_vfprintf);
ldbl_strong_alias (__vfprintf, vfprintf);
-ldbl_hidden_def (__vfprintf, vfprintf)
+libc_hidden_def (__vfprintf)
diff --git a/sunrpc/netname.c b/sunrpc/netname.c
index bf7f0b81c4..97a881c3af 100644
--- a/sunrpc/netname.c
+++ b/sunrpc/netname.c
@@ -48,7 +48,7 @@ user2netname (char netname[MAXNETNAMELEN + 1], const uid_t uid,
if ((strlen (dfltdom) + OPSYS_LEN + 3 + MAXIPRINT) > (size_t) MAXNETNAMELEN)
return 0;
- sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
+ __sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
i = strlen (netname);
if (netname[i - 1] == '.')
netname[i - 1] = '\0';
@@ -112,7 +112,7 @@ host2netname (char netname[MAXNETNAMELEN + 1], const char *host,
> MAXNETNAMELEN)
return 0;
- sprintf (netname, "%s.%s@%s", OPSYS, hostname, domainname);
+ __sprintf (netname, "%s.%s@%s", OPSYS, hostname, domainname);
return 1;
}
#ifdef EXPORT_RPC_SYMBOLS
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
index f683836678..59f6e31d2d 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128___asprintf (char **string_ptr, const char *format, ...)
+int
+__asprintfieee128 (char **string_ptr, const char *format, ...)
{
va_list ap;
int done;
@@ -32,5 +32,4 @@ ___ieee128___asprintf (char **string_ptr, const char *format, ...)
return done;
}
-hidden_def (___ieee128___asprintf)
-strong_alias (___ieee128___asprintf, __asprintfieee128)
+libc_hidden_def (__asprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
index cf3b46c37a..ceba219dc7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_dprintf (int d, const char *format, ...)
+int
+__dprintfieee128 (int d, const char *format, ...)
{
va_list ap;
int done;
@@ -31,5 +31,4 @@ ___ieee128_dprintf (int d, const char *format, ...)
return done;
}
-strong_alias (___ieee128_dprintf, __dprintfieee128)
-hidden_def (___ieee128_dprintf);
+libc_hidden_def (__dprintfieee128);
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
index 4462588675..b58f27afb7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_fprintf (FILE *fp, const char *format, ...)
+int
+__fprintfieee128 (FILE *fp, const char *format, ...)
{
va_list ap;
int done;
@@ -31,5 +31,4 @@ ___ieee128_fprintf (FILE *fp, const char *format, ...)
return done;
}
-strong_alias (___ieee128_fprintf, __fprintfieee128)
-hidden_def (___ieee128_fprintf)
+libc_hidden_def (__fprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
index 9703069b95..243eb65629 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
@@ -18,8 +18,8 @@
/* When in IEEE long double mode, call ___ieee128_sprintf. */
#include <stdio.h>
-typeof (sprintf) ___ieee128_sprintf attribute_hidden;
-#define SPRINTF ___ieee128_sprintf
+typeof (sprintf) __sprintfieee128 attribute_hidden;
+#define SPRINTF __sprintfieee128
/* Declare internal functions: ___qecvtieee128_r and ___qfcvtieee128_r,
built from a different compiling unit, and called from here. */
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
index 0be5bb2810..8046f5fd46 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
@@ -18,8 +18,8 @@
/* When in IEEE long double mode, call ___ieee128_snprintf. */
#include <stdio.h>
-typeof (snprintf) ___ieee128_snprintf attribute_hidden;
-#define SNPRINTF ___ieee128_snprintf
+typeof (snprintf) __snprintfieee128 attribute_hidden;
+#define SNPRINTF __snprintfieee128
#define ECVT_R __qecvtieee128_r
#define FCVT_R __qfcvtieee128_r
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
index 5f51b3ec9e..da3d9441d7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_snprintf (char *s, size_t maxlen, const char *format, ...)
+int
+__snprintfieee128 (char *s, size_t maxlen, const char *format, ...)
{
va_list ap;
int done;
@@ -32,4 +32,4 @@ ___ieee128_snprintf (char *s, size_t maxlen, const char *format, ...)
return done;
}
-strong_alias (___ieee128_snprintf, __snprintfieee128)
+libc_hidden_def (__snprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
index 0cad130788..007a71659a 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_sprintf (char *s, const char *format, ...)
+int
+__sprintfieee128 (char *s, const char *format, ...)
{
va_list ap;
int done;
@@ -32,5 +32,4 @@ ___ieee128_sprintf (char *s, const char *format, ...)
return done;
}
-strong_alias (___ieee128_sprintf, __sprintfieee128)
-hidden_def (___ieee128_sprintf)
+libc_hidden_def (__sprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
index e340c9b457..4df1e485a5 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
@@ -18,10 +18,9 @@
#include <libio/libioP.h>
-extern int
-___ieee128_vfprintf (FILE *fp, const char *format, va_list ap)
+int
+__vfprintfieee128 (FILE *fp, const char *format, va_list ap)
{
return __vfprintf_internal (fp, format, ap, PRINTF_LDBL_USES_FLOAT128);
}
-strong_alias (___ieee128_vfprintf, __vfprintfieee128)
-hidden_def (___ieee128_vfprintf)
+libc_hidden_def (__vfprintfieee128)
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
index ebd2a43951..5b167d45ff 100644
--- a/sysdeps/posix/tempname.c
+++ b/sysdeps/posix/tempname.c
@@ -161,7 +161,7 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
return -1;
}
- sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
+ __sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
return 0;
}
#endif /* _LIBC */
diff --git a/sysdeps/unix/sysv/linux/ia64/makecontext.c b/sysdeps/unix/sysv/linux/ia64/makecontext.c
index 0bc4211dfc..0cf05d5999 100644
--- a/sysdeps/unix/sysv/linux/ia64/makecontext.c
+++ b/sysdeps/unix/sysv/linux/ia64/makecontext.c
@@ -54,7 +54,7 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
if (argc > 8)
{
- fprintf (stderr, _("\
+ __fprintf (stderr, _("\
makecontext: does not know how to handle more than 8 arguments\n"));
exit (-1);
}
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index 0e017f458b..f2dca7711a 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -233,10 +233,13 @@ extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
const wchar_t *__restrict __format, ...)
__THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
-extern int __REDIRECT_NTH_LDBL (__swprintf_alias,
- (wchar_t *__restrict __s, size_t __n,
- const wchar_t *__restrict __fmt, ...),
- swprintf);
+extern int __swprintf_alias (wchar_t *__restrict __s, size_t __n,
+ const wchar_t *__restrict __fmt, ...)
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+ __asm__ (__ASMNAME ("swprintf"))
+#endif
+ ;
+
#ifdef __va_arg_pack
__fortify_function int
@@ -264,10 +267,13 @@ extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
__gnuc_va_list __arg)
__THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-extern int __REDIRECT_NTH_LDBL (__vswprintf_alias,
- (wchar_t *__restrict __s, size_t __n,
- const wchar_t *__restrict __fmt,
- __gnuc_va_list __ap), vswprintf);
+extern int __vswprintf_alias (wchar_t *__restrict __s, size_t __n,
+ const wchar_t *__restrict __fmt,
+ __gnuc_va_list __ap)
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+ __asm__ (__ASMNAME ("vswprintf"))
+#endif
+ ;
__fortify_function int
__NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
^ permalink raw reply [flat|nested] 14+ messages in thread
* [glibc/azanella/clang] Remove stdio-ldbl.h
@ 2022-06-09 13:13 Adhemerval Zanella
0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-06-09 13:13 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=66103436786c18d6310af00e517962e661c9d6b5
commit 66103436786c18d6310af00e517962e661c9d6b5
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Thu Feb 24 14:13:12 2022 -0300
Remove stdio-ldbl.h
The functions which require different alias to long double depending
of the ABI now uses a set os macros that defines the expected alias
on the function prototype, instead of redefine them using the
__LDBL_REDIR_DEC macros.
The __REDIRECT_LDBL, __REDIRECT_LDBL_NTH, __REDIRECT_LDBL_NTHNL
are refactores to be similar to __REDIRECT with the difference it
now expects the aliases for binary128 and for the long double being
double (which __LDBL_REDIR_DEC does).
All printf internal usage are also replaced to use internal alias
instead.
Diff:
---
argp/argp-parse.c | 4 +-
debug/backtracesyms.c | 18 +-
grp/putgrent.c | 6 +-
gshadow/putsgent.c | 6 +-
include/bits/stdio-ldbl.h | 1 -
include/stdio.h | 34 ++-
inet/ether_ntoa_r.c | 8 +-
inet/rexec.c | 2 +-
libio/Makefile | 2 +-
libio/bits/stdio-ldbl.h | 108 --------
libio/bits/stdio2.h | 115 ++++++---
libio/stdio.h | 286 +++++++++++++--------
malloc/malloc-check.c | 1 +
malloc/malloc.c | 32 +--
misc/efgcvt-template.c | 2 +-
misc/mntent_r.c | 2 +-
misc/sys/cdefs.h | 70 +++--
nis/nis_subr.c | 8 +-
nptl/pthread_getname.c | 2 +-
nptl/pthread_setname.c | 2 +-
pwd/getpw.c | 6 +-
pwd/putpwent.c | 4 +-
resolv/inet_ntop.c | 4 +-
resolv/nss_dns/dns-host.c | 4 +-
resolv/nss_dns/dns-network.c | 12 +-
shadow/putspent.c | 16 +-
stdio-common/dprintf.c | 1 -
stdio-common/fprintf.c | 2 +-
stdio-common/psiginfo.c | 32 +--
stdio-common/sprintf.c | 2 +-
stdio-common/vfprintf.c | 2 +-
sunrpc/netname.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-asprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-dprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-fprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-snprintf.c | 6 +-
.../ieee754/ldbl-128ibm-compat/ieee128-sprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c | 7 +-
sysdeps/posix/tempname.c | 2 +-
sysdeps/unix/sysv/linux/ia64/makecontext.c | 2 +-
wcsmbs/bits/wchar2.h | 22 +-
43 files changed, 448 insertions(+), 425 deletions(-)
diff --git a/argp/argp-parse.c b/argp/argp-parse.c
index 13cd84dd33..c26c0fc27f 100644
--- a/argp/argp-parse.c
+++ b/argp/argp-parse.c
@@ -177,7 +177,7 @@ argp_version_parser (int key, char *arg, struct argp_state *state)
if (argp_program_version_hook)
(*argp_program_version_hook) (state->out_stream, state);
else if (argp_program_version)
- fprintf (state->out_stream, "%s\n", argp_program_version);
+ __fprintf (state->out_stream, "%s\n", argp_program_version);
else
__argp_error (state, dgettext (state->root_argp->argp_domain,
"(PROGRAM ERROR) No version known!?"));
@@ -618,7 +618,7 @@ parser_finalize (struct parser *parser,
{
if (!(parser->state.flags & ARGP_NO_ERRS)
&& parser->state.err_stream)
- fprintf (parser->state.err_stream,
+ __fprintf (parser->state.err_stream,
dgettext (parser->argp->argp_domain,
"%s: Too many arguments\n"),
parser->state.name);
diff --git a/debug/backtracesyms.c b/debug/backtracesyms.c
index 17e0626df8..adb939f888 100644
--- a/debug/backtracesyms.c
+++ b/debug/backtracesyms.c
@@ -83,10 +83,10 @@ __backtrace_symbols (void *const *array, int size)
info[cnt].dli_saddr = info[cnt].dli_fbase;
if (info[cnt].dli_sname == NULL && info[cnt].dli_saddr == 0)
- last += 1 + sprintf (last, "%s(%s) [%p]",
- info[cnt].dli_fname ?: "",
- info[cnt].dli_sname ?: "",
- array[cnt]);
+ last += 1 + __sprintf (last, "%s(%s) [%p]",
+ info[cnt].dli_fname ?: "",
+ info[cnt].dli_sname ?: "",
+ array[cnt]);
else
{
char sign;
@@ -102,14 +102,14 @@ __backtrace_symbols (void *const *array, int size)
offset = info[cnt].dli_saddr - array[cnt];
}
- last += 1 + sprintf (last, "%s(%s%c%#tx) [%p]",
- info[cnt].dli_fname ?: "",
- info[cnt].dli_sname ?: "",
- sign, offset, array[cnt]);
+ last += 1 + __sprintf (last, "%s(%s%c%#tx) [%p]",
+ info[cnt].dli_fname ?: "",
+ info[cnt].dli_sname ?: "",
+ sign, offset, array[cnt]);
}
}
else
- last += 1 + sprintf (last, "[%p]", array[cnt]);
+ last += 1 + __sprintf (last, "[%p]", array[cnt]);
}
assert (last <= (char *) result + size * sizeof (char *) + total);
}
diff --git a/grp/putgrent.c b/grp/putgrent.c
index 966ba2a763..305ff44359 100644
--- a/grp/putgrent.c
+++ b/grp/putgrent.c
@@ -45,10 +45,10 @@ putgrent (const struct group *gr, FILE *stream)
flockfile (stream);
if (gr->gr_name[0] == '+' || gr->gr_name[0] == '-')
- retval = fprintf (stream, "%s:%s::",
+ retval = __fprintf (stream, "%s:%s::",
gr->gr_name, _S (gr->gr_passwd));
else
- retval = fprintf (stream, "%s:%s:%lu:",
+ retval = __fprintf (stream, "%s:%s:%lu:",
gr->gr_name, _S (gr->gr_passwd),
(unsigned long int) gr->gr_gid);
if (__builtin_expect (retval, 0) < 0)
@@ -60,7 +60,7 @@ putgrent (const struct group *gr, FILE *stream)
if (gr->gr_mem != NULL)
{
for (size_t i = 0; gr->gr_mem[i] != NULL; i++)
- if (fprintf (stream, i == 0 ? "%s" : ",%s", gr->gr_mem[i]) < 0)
+ if (__fprintf (stream, i == 0 ? "%s" : ",%s", gr->gr_mem[i]) < 0)
{
/* What else can we do? */
funlockfile (stream);
diff --git a/gshadow/putsgent.c b/gshadow/putsgent.c
index 9e2dca7eaf..870438de6d 100644
--- a/gshadow/putsgent.c
+++ b/gshadow/putsgent.c
@@ -42,7 +42,7 @@ putsgent (const struct sgrp *g, FILE *stream)
_IO_flockfile (stream);
- if (fprintf (stream, "%s:%s:", g->sg_namp, _S (g->sg_passwd)) < 0)
+ if (__fprintf (stream, "%s:%s:", g->sg_namp, _S (g->sg_passwd)) < 0)
++errors;
bool first = true;
@@ -50,7 +50,7 @@ putsgent (const struct sgrp *g, FILE *stream)
if (sp != NULL)
while (*sp != NULL)
{
- if (fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
+ if (__fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
{
++errors;
break;
@@ -65,7 +65,7 @@ putsgent (const struct sgrp *g, FILE *stream)
if (sp != NULL)
while (*sp != NULL)
{
- if (fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
+ if (__fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
{
++errors;
break;
diff --git a/include/bits/stdio-ldbl.h b/include/bits/stdio-ldbl.h
deleted file mode 100644
index 1f7d3ce1c6..0000000000
--- a/include/bits/stdio-ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <libio/bits/stdio-ldbl.h>
diff --git a/include/stdio.h b/include/stdio.h
index a6f7fd43cb..39b4978130 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -22,13 +22,17 @@
/* Some libc_hidden_ldbl_proto's do not map to a unique symbol when
redirecting ldouble to _Float128 variants. We can therefore safely
directly alias them to their internal name. */
-# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc)
-# define stdio_hidden_ldbl_proto(p, f) \
- extern __typeof (p ## f) p ## f __asm (__ASMNAME ("___ieee128_" #f));
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# define stdio_hidden_ldbl_proto(p,f) __LDBL_REDIR1_DECL (p ## f, p ## f ## ieee128)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc) && defined SHARED
+# define __stdio_hidden_ldbl_proto(name, alias) \
+ extern __typeof (name) __##name __asm__ (__hidden_asmname (#alias));
+# define stdio_hidden_ldbl_proto(name) \
+ extern typeof (name) __##name##ieee128; \
+ libc_hidden_proto (__##name##ieee128); \
+ __stdio_hidden_ldbl_proto (name, __GI___##name##ieee128)
# else
-# define stdio_hidden_ldbl_proto(p,f) libc_hidden_proto (p ## f)
+# define stdio_hidden_ldbl_proto(name) \
+ extern __typeof (name) __##name; \
+ libc_hidden_proto (__##name)
# endif
/* Set the error indicator on FP. */
@@ -39,10 +43,7 @@ fseterr_unlocked (FILE *fp)
}
extern int __fcloseall (void) attribute_hidden;
-extern int __snprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, ...)
- __attribute__ ((__format__ (__printf__, 3, 4)));
-stdio_hidden_ldbl_proto (__, snprintf)
+stdio_hidden_ldbl_proto (snprintf);
extern int __vfscanf (FILE *__restrict __s,
const char *__restrict __format,
@@ -184,7 +185,7 @@ extern const size_t _sys_errlist_internal_len attribute_hidden;
extern const char *__get_errlist (int) attribute_hidden;
extern const char *__get_errname (int) attribute_hidden;
-libc_hidden_ldbl_proto (__asprintf)
+stdio_hidden_ldbl_proto (asprintf);
# if IS_IN (libc)
extern FILE *_IO_new_fopen (const char*, const char*);
@@ -206,13 +207,10 @@ extern int _IO_new_fgetpos (FILE *, __fpos_t *);
# define fgetpos(fp, posp) _IO_new_fgetpos (fp, posp)
# endif
-extern __typeof (dprintf) __dprintf
- __attribute__ ((__format__ (__printf__, 2, 3)));
-stdio_hidden_ldbl_proto (__, dprintf)
-libc_hidden_ldbl_proto (dprintf)
-libc_hidden_ldbl_proto (fprintf)
-libc_hidden_ldbl_proto (vfprintf)
-libc_hidden_ldbl_proto (sprintf)
+stdio_hidden_ldbl_proto (dprintf);
+stdio_hidden_ldbl_proto (fprintf);
+stdio_hidden_ldbl_proto (vfprintf);
+stdio_hidden_ldbl_proto (sprintf);
libc_hidden_proto (ungetc)
libc_hidden_proto (__getdelim)
libc_hidden_proto (fwrite)
diff --git a/inet/ether_ntoa_r.c b/inet/ether_ntoa_r.c
index 03011ffef6..f111e5234c 100644
--- a/inet/ether_ntoa_r.c
+++ b/inet/ether_ntoa_r.c
@@ -23,10 +23,10 @@
char *
ether_ntoa_r (const struct ether_addr *addr, char *buf)
{
- sprintf (buf, "%x:%x:%x:%x:%x:%x",
- addr->ether_addr_octet[0], addr->ether_addr_octet[1],
- addr->ether_addr_octet[2], addr->ether_addr_octet[3],
- addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
+ __sprintf (buf, "%x:%x:%x:%x:%x:%x",
+ addr->ether_addr_octet[0], addr->ether_addr_octet[1],
+ addr->ether_addr_octet[2], addr->ether_addr_octet[3],
+ addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
return buf;
}
libc_hidden_def (ether_ntoa_r)
diff --git a/inet/rexec.c b/inet/rexec.c
index 330282ac16..809475d976 100644
--- a/inet/rexec.c
+++ b/inet/rexec.c
@@ -135,7 +135,7 @@ retry:
NULL, 0, servbuff, sizeof(servbuff),
NI_NUMERICSERV))
port = (int) __strtol (servbuff, NULL, 10);
- (void) sprintf(num, "%u", port);
+ (void) __sprintf(num, "%u", port);
(void) __write(s, num, strlen(num)+1);
{ socklen_t len = sizeof (from);
s3 = TEMP_FAILURE_RETRY (accept(s2, (struct sockaddr *)&from,
diff --git a/libio/Makefile b/libio/Makefile
index e97387743f..a4830ddf42 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -23,7 +23,7 @@ subdir := libio
include ../Makeconfig
headers := stdio.h \
- bits/stdio.h bits/stdio2.h bits/stdio-ldbl.h \
+ bits/stdio.h bits/stdio2.h \
bits/types/FILE.h bits/types/__FILE.h bits/types/struct_FILE.h \
bits/types/__fpos_t.h bits/types/__fpos64_t.h \
bits/types/cookie_io_functions_t.h
diff --git a/libio/bits/stdio-ldbl.h b/libio/bits/stdio-ldbl.h
deleted file mode 100644
index 6b63394b50..0000000000
--- a/libio/bits/stdio-ldbl.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -mlong-double-64 compatibility mode for stdio functions.
- Copyright (C) 2006-2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#ifndef _STDIO_H
-# error "Never include <bits/stdio-ldbl.h> directly; use <stdio.h> instead."
-#endif
-
-__LDBL_REDIR_DECL (fprintf)
-__LDBL_REDIR_DECL (printf)
-__LDBL_REDIR_DECL (sprintf)
-__LDBL_REDIR_DECL (vfprintf)
-__LDBL_REDIR_DECL (vprintf)
-__LDBL_REDIR_DECL (vsprintf)
-#if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (fscanf, __nldbl___isoc99_fscanf)
-__LDBL_REDIR1_DECL (scanf, __nldbl___isoc99_scanf)
-__LDBL_REDIR1_DECL (sscanf, __nldbl___isoc99_sscanf)
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (fscanf, __isoc99_fscanfieee128)
-__LDBL_REDIR1_DECL (scanf, __isoc99_scanfieee128)
-__LDBL_REDIR1_DECL (sscanf, __isoc99_sscanfieee128)
-# else
-# error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-# endif
-#else
-__LDBL_REDIR_DECL (fscanf)
-__LDBL_REDIR_DECL (scanf)
-__LDBL_REDIR_DECL (sscanf)
-#endif
-
-#if defined __USE_ISOC99 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (snprintf)
-__LDBL_REDIR_DECL (vsnprintf)
-#endif
-
-#ifdef __USE_ISOC99
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (vfscanf, __nldbl___isoc99_vfscanf)
-__LDBL_REDIR1_DECL (vscanf, __nldbl___isoc99_vscanf)
-__LDBL_REDIR1_DECL (vsscanf, __nldbl___isoc99_vsscanf)
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (vfscanf, __isoc99_vfscanfieee128)
-__LDBL_REDIR1_DECL (vscanf, __isoc99_vscanfieee128)
-__LDBL_REDIR1_DECL (vsscanf, __isoc99_vsscanfieee128)
-# else
-# error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-# endif
-# else
-__LDBL_REDIR_DECL (vfscanf)
-__LDBL_REDIR_DECL (vsscanf)
-__LDBL_REDIR_DECL (vscanf)
-# endif
-#endif
-
-#ifdef __USE_XOPEN2K8
-__LDBL_REDIR_DECL (vdprintf)
-__LDBL_REDIR_DECL (dprintf)
-#endif
-
-#ifdef __USE_GNU
-__LDBL_REDIR_DECL (vasprintf)
-__LDBL_REDIR2_DECL (asprintf)
-__LDBL_REDIR_DECL (asprintf)
-__LDBL_REDIR_DECL (obstack_printf)
-__LDBL_REDIR_DECL (obstack_vprintf)
-#endif
-
-#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR2_DECL (sprintf_chk)
-__LDBL_REDIR2_DECL (vsprintf_chk)
-# if defined __USE_ISOC99 || defined __USE_UNIX98
-__LDBL_REDIR2_DECL (snprintf_chk)
-__LDBL_REDIR2_DECL (vsnprintf_chk)
-# endif
-# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR2_DECL (fprintf_chk)
-__LDBL_REDIR2_DECL (printf_chk)
-__LDBL_REDIR2_DECL (vfprintf_chk)
-__LDBL_REDIR2_DECL (vprintf_chk)
-# ifdef __USE_XOPEN2K8
-__LDBL_REDIR2_DECL (dprintf_chk)
-__LDBL_REDIR2_DECL (vdprintf_chk)
-# endif
-# ifdef __USE_GNU
-__LDBL_REDIR2_DECL (asprintf_chk)
-__LDBL_REDIR2_DECL (vasprintf_chk)
-__LDBL_REDIR2_DECL (obstack_printf_chk)
-__LDBL_REDIR2_DECL (obstack_vprintf_chk)
-# endif
-# endif
-#endif
diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h
index b0b655ee7a..de7f1f04aa 100644
--- a/libio/bits/stdio2.h
+++ b/libio/bits/stdio2.h
@@ -23,12 +23,17 @@
# error "Never include <bits/stdio2.h> directly; use <stdio.h> instead."
#endif
-extern int __sprintf_chk (char *__restrict __s, int __flag, size_t __slen,
- const char *__restrict __format, ...) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__sprintf_chk, (char *__restrict __s,
+ int __flag, size_t __slen,
+ const char *__restrict __format,
+ ...),
+ __sprintf_chkieee128, __nldbl___sprintf_chk)
__attr_access ((__write_only__, 1, 3));
-extern int __vsprintf_chk (char *__restrict __s, int __flag, size_t __slen,
- const char *__restrict __format,
- __gnuc_va_list __ap) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__vsprintf_chk, (char *__restrict __s,
+ int __flag, size_t __slen,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vsprintf_chkieee128, __nldbl___vsprintf_chk)
__attr_access ((__write_only__, 1, 3));
#ifdef __va_arg_pack
@@ -54,14 +59,19 @@ __NTH (vsprintf (char *__restrict __s, const char *__restrict __fmt,
}
#if defined __USE_ISOC99 || defined __USE_UNIX98
-
-extern int __snprintf_chk (char *__restrict __s, size_t __n, int __flag,
- size_t __slen, const char *__restrict __format,
- ...) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__snprintf_chk, (char *__restrict __s,
+ size_t __n, int __flag,
+ size_t __slen,
+ const char *__restrict __format,
+ ...),
+ __snprintf_chkieee128, __nldbl___snprintf_chk)
__attr_access ((__write_only__, 1, 2));
-extern int __vsnprintf_chk (char *__restrict __s, size_t __n, int __flag,
- size_t __slen, const char *__restrict __format,
- __gnuc_va_list __ap) __THROW;
+extern int __REDIRECT_LDBL_NTHNL (__vsnprintf_chk, (char *__restrict __s,
+ size_t __n, int __flag,
+ size_t __slen,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vsnprintf_chkieee128, __nldbl___vsnprintf_chk);
# ifdef __va_arg_pack
__fortify_function int
@@ -89,14 +99,24 @@ __NTH (vsnprintf (char *__restrict __s, size_t __n,
#endif
#if __USE_FORTIFY_LEVEL > 1
-
-extern int __fprintf_chk (FILE *__restrict __stream, int __flag,
- const char *__restrict __format, ...);
-extern int __printf_chk (int __flag, const char *__restrict __format, ...);
-extern int __vfprintf_chk (FILE *__restrict __stream, int __flag,
- const char *__restrict __format, __gnuc_va_list __ap);
-extern int __vprintf_chk (int __flag, const char *__restrict __format,
- __gnuc_va_list __ap);
+extern int __REDIRECT_LDBL (__fprintf_chk, (FILE *__restrict __stream,
+ int __flag,
+ const char *__restrict __format,
+ ...),
+ __fprintf_chkieee128, __nldbl___fprintf_chk);
+extern int __REDIRECT_LDBL (__printf_chk, (int __flag,
+ const char *__restrict __format,
+ ...),
+ __printf_chkieee128, __nldbl___printf_chk);
+extern int __REDIRECT_LDBL (__vfprintf_chk, (FILE *__restrict __stream,
+ int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vfprintf_chkieee128, __nldbl___vfprintf_chk);
+extern int __REDIRECT_LDBL (__vprintf_chk, (int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vprintf_chkieee128, __nldbl___vprintf_chk);
# ifdef __va_arg_pack
__fortify_function int
@@ -136,10 +156,15 @@ vfprintf (FILE *__restrict __stream,
}
# ifdef __USE_XOPEN2K8
-extern int __dprintf_chk (int __fd, int __flag, const char *__restrict __fmt,
- ...) __attribute__ ((__format__ (__printf__, 3, 4)));
-extern int __vdprintf_chk (int __fd, int __flag,
- const char *__restrict __fmt, __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL (__dprintf_chk, (int __fd, int __flag,
+ const char *__restrict __fmt,
+ ...),
+ __dprintf_chkieee128, __nldbl___dprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL (__vdprintf_chk, (int __fd, int __flag,
+ const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vdprintf_chkieee128, __nldbl___vdprintf_chk)
__attribute__ ((__format__ (__printf__, 3, 0)));
# ifdef __va_arg_pack
@@ -162,22 +187,32 @@ vdprintf (int __fd, const char *__restrict __fmt, __gnuc_va_list __ap)
# endif
# ifdef __USE_GNU
-
-extern int __asprintf_chk (char **__restrict __ptr, int __flag,
- const char *__restrict __fmt, ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4))) __wur;
-extern int __vasprintf_chk (char **__restrict __ptr, int __flag,
- const char *__restrict __fmt, __gnuc_va_list __arg)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
-extern int __obstack_printf_chk (struct obstack *__restrict __obstack,
- int __flag, const char *__restrict __format,
- ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
-extern int __obstack_vprintf_chk (struct obstack *__restrict __obstack,
- int __flag,
- const char *__restrict __format,
- __gnuc_va_list __args)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
+extern int __REDIRECT_LDBL_NTHNL (__asprintf_chk, (char **__restrict __ptr,
+ int __flag,
+ const char *__restrict __fmt,
+ ...),
+ __asprintf_chkieee128, __nldbl___asprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (__vasprintf_chk, (char **__restrict __ptr,
+ int __flag,
+ const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vasprintf_chkieee128, __nldbl___vasnprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (__obstack_printf_chk, (struct obstack *__restrict __obstack,
+ int __flag,
+ const char *__restrict __format,
+ ...),
+ __obstack_printf_chkieee128,
+ __nldbl___obstack_printf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL_NTHNL (__obstack_vprintf_chk, (struct obstack *__restrict __obstack,
+ int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __args),
+ __obstack_vprintf_chkieee128,
+ __nldbl___obstack_vprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
# ifdef __va_arg_pack
__fortify_function int
diff --git a/libio/stdio.h b/libio/stdio.h
index e6425341ce..54c9796a46 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -41,6 +41,7 @@ __BEGIN_DECLS
#include <bits/types/__FILE.h>
#include <bits/types/FILE.h>
#include <bits/types/struct_FILE.h>
+#include <bits/floatn.h>
#ifdef __USE_GNU
# include <bits/types/cookie_io_functions_t.h>
@@ -342,78 +343,143 @@ extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
extern void setlinebuf (FILE *__stream) __THROW;
#endif
-
/* Write formatted output to STREAM.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int fprintf (FILE *__restrict __stream,
- const char *__restrict __format, ...);
+extern int __REDIRECT_LDBL (fprintf, (FILE *__restrict __stream,
+ const char *__restrict __format, ...),
+ __fprintfieee128, __nldbl_fprintf);
/* Write formatted output to stdout.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int printf (const char *__restrict __format, ...);
+extern int __REDIRECT_LDBL (printf, (const char *__restrict __format, ...),
+ __printfieee128, __nldbl_printf);
/* Write formatted output to S. */
-extern int sprintf (char *__restrict __s,
- const char *__restrict __format, ...) __THROWNL;
+extern int __REDIRECT_LDBL_NTHNL (sprintf, (char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __sprintfieee128, __nldbl_sprintf);
/* Write formatted output to S from argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg);
+extern int __REDIRECT_LDBL (vfprintf, (FILE *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vfprintfieee128, __nldbl_vfprintf);
/* Write formatted output to stdout from argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
+extern int __REDIRECT_LDBL (vprintf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vprintfieee128, __nldbl_vprintf);
/* Write formatted output to S from argument list ARG. */
-extern int vsprintf (char *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg) __THROWNL;
+extern int __REDIRECT_LDBL_NTHNL (vsprintf, (char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsprintfieee128, __nldbl_vsprintf);
#if defined __USE_ISOC99 || defined __USE_UNIX98
/* Maximum chars of output to write in MAXLEN. */
-extern int snprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 3, 4)));
-
-extern int vsnprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, __gnuc_va_list __arg)
- __THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
+extern int __REDIRECT_LDBL_NTHNL (snprintf, (char *__restrict __s,
+ size_t __maxlen,
+ const char *__restrict __format,
+ ...),
+ __snprintfieee128, __nldbl_snprintf)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL_NTHNL (vsnprintf, (char *__restrict __s,
+ size_t __maxlen,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsnprintfieee128, __nldbl_vsnprintf)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
#endif
#if __GLIBC_USE (LIB_EXT2)
/* Write formatted output to a string dynamically allocated with `malloc'.
Store the address of the string in *PTR. */
-extern int vasprintf (char **__restrict __ptr, const char *__restrict __f,
- __gnuc_va_list __arg)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
-extern int __asprintf (char **__restrict __ptr,
- const char *__restrict __fmt, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
-extern int asprintf (char **__restrict __ptr,
- const char *__restrict __fmt, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (vasprintf, (char **__restrict __ptr,
+ const char *__restrict __f,
+ __gnuc_va_list __arg),
+ __vasprintfieee128, __nldbl_vasprintf)
+ __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (asprintf, (char **__restrict __ptr,
+ const char *__restrict __fmt,
+ ...),
+ __asprintfieee128, __nldbl_asprintf)
+ __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
#endif
#ifdef __USE_XOPEN2K8
/* Write formatted output to a file descriptor. */
-extern int vdprintf (int __fd, const char *__restrict __fmt,
- __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL (vdprintf, (int __fd, const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vdprintfieee128, __nldbl_vdprintf)
__attribute__ ((__format__ (__printf__, 2, 0)));
-extern int dprintf (int __fd, const char *__restrict __fmt, ...)
+extern int __REDIRECT_LDBL (dprintf, (int __fd, const char *__restrict __fmt,
+ ...),
+ __dprintfieee128, __nldbl_dprintf)
__attribute__ ((__format__ (__printf__, 2, 3)));
#endif
-
+#if !__GLIBC_USE (DEPRECATED_SCANF)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ ...),
+ __isoc99_fscanfieee128, __nldbl___isoc99_fscanf) __wur;
+extern int __REDIRECT_LDBL (scanf, (const char *__restrict __format,
+ ...),
+ __isoc99_scanfieee128, __nldbl___isoc99_scanf) __wur;
+extern int __REDIRECT_LDBL_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __isoc99_sscanfieee128, __nldbl___isoc99_sscanf);
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format, ...),
+ __isoc99_fscanf) __wur;
+extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
+ __isoc99_scanf) __wur;
+extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format, ...),
+ __isoc99_sscanf);
+# else
+extern int __isoc99_fscanf (FILE *__restrict __stream,
+ const char *__restrict __format, ...) __wur;
+extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
+extern int __isoc99_sscanf (const char *__restrict __s,
+ const char *__restrict __format, ...) __THROW;
+# define fscanf __isoc99_fscanf
+# define scanf __isoc99_scanf
+# define sscanf __isoc99_sscanf
+# endif /* __REDIRECT */
+# endif
+#else
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ ...),
+ __fscanfieee128, __nldbl_fscanf) __wur;
+extern int __REDIRECT_LDBL (scanf, (const char *__restrict __format,
+ ...),
+ __scanfieee128, __nldbl_scanf) __wur;
+extern int __REDIRECT_LDBL_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __sscanfieee128, __nldbl_sscanf) __wur;
+# else
/* Read formatted input from STREAM.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int fscanf (FILE *__restrict __stream,
- const char *__restrict __format, ...) __wur;
+ const char *__restrict __format, ...) __wur;
/* Read formatted input from stdin.
This function is a possible cancellation point and therefore not
@@ -421,43 +487,81 @@ extern int fscanf (FILE *__restrict __stream,
extern int scanf (const char *__restrict __format, ...) __wur;
/* Read formatted input from S. */
extern int sscanf (const char *__restrict __s,
- const char *__restrict __format, ...) __THROW;
-
-/* For historical reasons, the C99-compliant versions of the scanf
- functions are at alternative names. When __LDBL_COMPAT or
- __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
- bits/stdio-ldbl.h. */
-#include <bits/floatn.h>
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
- && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-# ifdef __REDIRECT
-extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
- const char *__restrict __format, ...),
- __isoc99_fscanf) __wur;
-extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
- __isoc99_scanf) __wur;
-extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
- const char *__restrict __format, ...),
- __isoc99_sscanf);
-# else
-extern int __isoc99_fscanf (FILE *__restrict __stream,
- const char *__restrict __format, ...) __wur;
-extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
-extern int __isoc99_sscanf (const char *__restrict __s,
- const char *__restrict __format, ...) __THROW;
-# define fscanf __isoc99_fscanf
-# define scanf __isoc99_scanf
-# define sscanf __isoc99_sscanf
+ const char *__restrict __format, ...) __THROW;
# endif
-#endif
+#endif /* DEPRECATED_SCANF */
-#ifdef __USE_ISOC99
+#ifdef __USE_ISOC99
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vfscanfieee128, __nldbl___isoc99_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vscanfieee128, __nldbl___isoc99_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_LDBL_NTH (vsscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vsscanfieee128, __nldbl___isoc99_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (vfscanf,
+ (FILE *__restrict __s,
+ const char *__restrict __format, __gnuc_va_list __arg),
+ __isoc99_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_NTH (vsscanf,
+ (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
+extern int __isoc99_vfscanf (FILE *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg) __wur;
+extern int __isoc99_vscanf (const char *__restrict __format,
+ __gnuc_va_list __arg) __wur;
+extern int __isoc99_vsscanf (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg) __THROW;
+# define vfscanf __isoc99_vfscanf
+# define vscanf __isoc99_vscanf
+# define vsscanf __isoc99_vsscanf
+# endif /* __REDIRECT */
+# endif
+# else /* DEPRECATED_SCANF */
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vfscanfieee128, __nldbl_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vscanfieee128, __nldbl_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_LDBL_NTH (vsscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsscanfieee128, __nldbl_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
/* Read formatted input from S into argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg)
+ __gnuc_va_list __arg)
__attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
/* Read formatted input from stdin into argument list ARG.
@@ -469,42 +573,11 @@ extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
/* Read formatted input from S into argument list ARG. */
extern int vsscanf (const char *__restrict __s,
- const char *__restrict __format, __gnuc_va_list __arg)
+ const char *__restrict __format, __gnuc_va_list __arg)
__THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
-
-/* Same redirection as above for the v*scanf family. */
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __REDIRECT && !defined __LDBL_COMPAT \
- && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-extern int __REDIRECT (vfscanf,
- (FILE *__restrict __s,
- const char *__restrict __format, __gnuc_va_list __arg),
- __isoc99_vfscanf)
- __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
-extern int __REDIRECT (vscanf, (const char *__restrict __format,
- __gnuc_va_list __arg), __isoc99_vscanf)
- __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
-extern int __REDIRECT_NTH (vsscanf,
- (const char *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg), __isoc99_vsscanf)
- __attribute__ ((__format__ (__scanf__, 2, 0)));
-# elif !defined __REDIRECT
-extern int __isoc99_vfscanf (FILE *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg) __wur;
-extern int __isoc99_vscanf (const char *__restrict __format,
- __gnuc_va_list __arg) __wur;
-extern int __isoc99_vsscanf (const char *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg) __THROW;
-# define vfscanf __isoc99_vfscanf
-# define vscanf __isoc99_vscanf
-# define vsscanf __isoc99_vsscanf
# endif
# endif
-#endif /* Use ISO C9x. */
-
+#endif /* __USE_ISOC99 */
/* Read a character from STREAM.
@@ -850,13 +923,17 @@ extern char *cuserid (char *__s)
struct obstack; /* See <obstack.h>. */
/* Write formatted output to an obstack. */
-extern int obstack_printf (struct obstack *__restrict __obstack,
- const char *__restrict __format, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3)));
-extern int obstack_vprintf (struct obstack *__restrict __obstack,
- const char *__restrict __format,
- __gnuc_va_list __args)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 0)));
+extern int __REDIRECT_LDBL_NTHNL (obstack_printf,
+ (struct obstack *__restrict __obstack,
+ const char *__restrict __format, ...),
+ __obstack_printfieee128, __nldbl_obstack_printf)
+ __attribute__ ((__format__ (__printf__, 2, 3)));
+extern int __REDIRECT_LDBL_NTHNL (obstack_vprintf,
+ (struct obstack *__restrict __obstack,
+ const char *__restrict __format,
+ __gnuc_va_list __args),
+ __obstack_vprintfieee128, __nldbl_obstack_vprintf)
+ __attribute__ ((__format__ (__printf__, 2, 0)));
#endif /* Use GNU. */
@@ -894,11 +971,6 @@ extern int __overflow (FILE *, int);
# include <bits/stdio2.h>
#endif
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/stdio-ldbl.h>
-#endif
-
__END_DECLS
#endif /* <stdio.h> included. */
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index 0299fe99a7..e1f68bddfb 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -17,6 +17,7 @@
not, see <https://www.gnu.org/licenses/>. */
#define __mremap mremap
+#define __fprintf fprintf
#include "malloc.c"
/* When memory is tagged, the checking data is stored in the user part
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 09e5ff2bce..aa35846e55 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5279,9 +5279,9 @@ __malloc_stats (void)
memset (&mi, 0, sizeof (mi));
__libc_lock_lock (ar_ptr->mutex);
int_mallinfo (ar_ptr, &mi);
- fprintf (stderr, "Arena %d:\n", i);
- fprintf (stderr, "system bytes = %10u\n", (unsigned int) mi.arena);
- fprintf (stderr, "in use bytes = %10u\n", (unsigned int) mi.uordblks);
+ __fprintf (stderr, "Arena %d:\n", i);
+ __fprintf (stderr, "system bytes = %10u\n", (unsigned int) mi.arena);
+ __fprintf (stderr, "in use bytes = %10u\n", (unsigned int) mi.uordblks);
#if MALLOC_DEBUG > 1
if (i > 0)
dump_heap (heap_for_ptr (top (ar_ptr)));
@@ -5293,12 +5293,12 @@ __malloc_stats (void)
if (ar_ptr == &main_arena)
break;
}
- fprintf (stderr, "Total (incl. mmap):\n");
- fprintf (stderr, "system bytes = %10u\n", system_b);
- fprintf (stderr, "in use bytes = %10u\n", in_use_b);
- fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps);
- fprintf (stderr, "max mmap bytes = %10lu\n",
- (unsigned long) mp_.max_mmapped_mem);
+ __fprintf (stderr, "Total (incl. mmap):\n");
+ __fprintf (stderr, "system bytes = %10u\n", system_b);
+ __fprintf (stderr, "in use bytes = %10u\n", in_use_b);
+ __fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps);
+ __fprintf (stderr, "max mmap bytes = %10lu\n",
+ (unsigned long) mp_.max_mmapped_mem);
stderr->_flags2 = old_flags2;
_IO_funlockfile (stderr);
}
@@ -5728,7 +5728,7 @@ __malloc_info (int options, FILE *fp)
mstate ar_ptr = &main_arena;
do
{
- fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
+ __fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
size_t nblocks = 0;
size_t nfastblocks = 0;
@@ -5839,12 +5839,12 @@ __malloc_info (int options, FILE *fp)
for (size_t i = 0; i < nsizes; ++i)
if (sizes[i].count != 0 && i != NFASTBINS)
- fprintf (fp, "\
+ __fprintf (fp, "\
<size from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
sizes[i].from, sizes[i].to, sizes[i].total, sizes[i].count);
if (sizes[NFASTBINS].count != 0)
- fprintf (fp, "\
+ __fprintf (fp, "\
<unsorted from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
sizes[NFASTBINS].from, sizes[NFASTBINS].to,
sizes[NFASTBINS].total, sizes[NFASTBINS].count);
@@ -5852,7 +5852,7 @@ __malloc_info (int options, FILE *fp)
total_system += ar_ptr->system_mem;
total_max_system += ar_ptr->max_system_mem;
- fprintf (fp,
+ __fprintf (fp,
"</sizes>\n<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
"<system type=\"current\" size=\"%zu\"/>\n"
@@ -5862,7 +5862,7 @@ __malloc_info (int options, FILE *fp)
if (ar_ptr != &main_arena)
{
- fprintf (fp,
+ __fprintf (fp,
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n"
"<aspace type=\"subheaps\" size=\"%zu\"/>\n",
@@ -5872,7 +5872,7 @@ __malloc_info (int options, FILE *fp)
}
else
{
- fprintf (fp,
+ __fprintf (fp,
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n",
ar_ptr->system_mem, ar_ptr->system_mem);
@@ -5885,7 +5885,7 @@ __malloc_info (int options, FILE *fp)
}
while (ar_ptr != &main_arena);
- fprintf (fp,
+ __fprintf (fp,
"<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"mmap\" count=\"%d\" size=\"%zu\"/>\n"
diff --git a/misc/efgcvt-template.c b/misc/efgcvt-template.c
index 87a90e78d4..f1630fd780 100644
--- a/misc/efgcvt-template.c
+++ b/misc/efgcvt-template.c
@@ -24,7 +24,7 @@
#include <math_ldbl_opt.h>
#ifndef SPRINTF
-# define SPRINTF sprintf
+# define SPRINTF __sprintf
#endif
#define APPEND(a, b) APPEND2 (a, b)
diff --git a/misc/mntent_r.c b/misc/mntent_r.c
index 3311ba0b50..65f29b97e9 100644
--- a/misc/mntent_r.c
+++ b/misc/mntent_r.c
@@ -251,7 +251,7 @@ __addmntent (FILE *stream, const struct mntent *mnt)
write_string (stream, mnt->mnt_dir);
write_string (stream, mnt->mnt_type);
write_string (stream, mnt->mnt_opts);
- fprintf (stream, "%d %d\n", mnt->mnt_freq, mnt->mnt_passno);
+ __fprintf (stream, "%d %d\n", mnt->mnt_freq, mnt->mnt_passno);
ret = __ferror_unlocked (stream) != 0 || fflush (stream) != 0;
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index f525f67547..e7f8952caa 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -560,6 +560,54 @@
# include <bits/long-double.h>
#endif
+#if (defined __GNUC__ && __GNUC__ >= 2) || (__clang_major__ >= 4)
+# define __REDIRECT_LDBL1(name, prenth, posnth, proto, alias) \
+ name proto prenth __asm__ (__ASMNAME (__ASMNAME (#alias))) posnth
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+# ifdef __REDIRECT
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , , proto, ieee128)
+# ifdef __cplusplus
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROW, , proto, ieee128)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROWNL, , proto, ieee128)
+# else
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROW, proto, ieee128)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROWNL, proto, ieee128)
+# endif /* __cplusplus */
+# else
+_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
+# endif /* __REDIRECT */
+# elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
+# ifdef __REDIRECT
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , , proto, compat)
+# ifdef __cplusplus
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROW, , proto, compat)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROWNL, , proto, compat)
+# else
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROW, proto, compat)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROWNL, proto, compat)
+# endif /* __cplusplus */
+# else
+_Static_assert (0, "Compat long double requires redirection on this platform");
+# endif /* __REDIRECT */
+# endif
+#endif
+
+#ifndef __REDIRECT_LDBL
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) name proto
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) name proto __THROW
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) name proto __THROWNL
+#endif
+
#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
# ifdef __REDIRECT
@@ -583,10 +631,6 @@
# define __REDIRECT_NTH_LDBL(name, proto, alias) \
__LDBL_REDIR1_NTH (name, proto, __##alias##ieee128)
-/* Unused. */
-# define __REDIRECT_LDBL(name, proto, alias) ... unused__redirect_ldbl
-# define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth
-
# else
_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
# endif
@@ -605,24 +649,6 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf
extern __typeof (name) name __asm (__ASMNAME (#alias));
# define __LDBL_REDIR_DECL(name) \
extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name));
-# define __REDIRECT_LDBL(name, proto, alias) \
- __LDBL_REDIR1 (name, proto, __nldbl_##alias)
-# define __REDIRECT_NTH_LDBL(name, proto, alias) \
- __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias)
-# endif
-#endif
-#if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \
- || !defined __REDIRECT
-# define __LDBL_REDIR1(name, proto, alias) name proto
-# define __LDBL_REDIR(name, proto) name proto
-# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW
-# define __LDBL_REDIR_NTH(name, proto) name proto __THROW
-# define __LDBL_REDIR2_DECL(name)
-# define __LDBL_REDIR_DECL(name)
-# ifdef __REDIRECT
-# define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias)
-# define __REDIRECT_NTH_LDBL(name, proto, alias) \
- __REDIRECT_NTH (name, proto, alias)
# endif
#endif
diff --git a/nis/nis_subr.c b/nis/nis_subr.c
index 385f221062..0e02cd19b5 100644
--- a/nis/nis_subr.c
+++ b/nis/nis_subr.c
@@ -280,10 +280,10 @@ nis_getnames (const_nis_name name)
}
if (pos == 0
- && __asprintf (&getnames[pos++], "%s%s%s%s",
- name, name[name_len - 1] == '.' ? "" : ".",
- local_domain,
- local_domain[local_domain_len - 1] == '.' ? "" : ".") < 0)
+ && asprintf (&getnames[pos++], "%s%s%s%s",
+ name, name[name_len - 1] == '.' ? "" : ".",
+ local_domain,
+ local_domain[local_domain_len - 1] == '.' ? "" : ".") < 0)
goto free_null;
getnames[pos] = NULL;
diff --git a/nptl/pthread_getname.c b/nptl/pthread_getname.c
index ebec06e23f..a424b3e4f8 100644
--- a/nptl/pthread_getname.c
+++ b/nptl/pthread_getname.c
@@ -42,7 +42,7 @@ __pthread_getname_np (pthread_t th, char *buf, size_t len)
#define FMT "/proc/self/task/%u/comm"
char fname[sizeof (FMT) + 8];
- sprintf (fname, FMT, (unsigned int) pd->tid);
+ __sprintf (fname, FMT, (unsigned int) pd->tid);
int fd = __open64_nocancel (fname, O_RDONLY);
if (fd == -1)
diff --git a/nptl/pthread_setname.c b/nptl/pthread_setname.c
index f24560db47..8520bac4be 100644
--- a/nptl/pthread_setname.c
+++ b/nptl/pthread_setname.c
@@ -44,7 +44,7 @@ __pthread_setname_np (pthread_t th, const char *name)
#define FMT "/proc/self/task/%u/comm"
char fname[sizeof (FMT) + 8];
- sprintf (fname, FMT, (unsigned int) pd->tid);
+ __sprintf (fname, FMT, (unsigned int) pd->tid);
int fd = __open64_nocancel (fname, O_RDWR);
if (fd == -1)
diff --git a/pwd/getpw.c b/pwd/getpw.c
index 547489a863..4784eaf00b 100644
--- a/pwd/getpw.c
+++ b/pwd/getpw.c
@@ -50,9 +50,9 @@ __getpw (__uid_t uid, char *buf)
if (p == NULL)
return -1;
- if (sprintf (buf, "%s:%s:%lu:%lu:%s:%s:%s", p->pw_name, p->pw_passwd,
- (unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
- p->pw_gecos, p->pw_dir, p->pw_shell) < 0)
+ if (__sprintf (buf, "%s:%s:%lu:%lu:%s:%s:%s", p->pw_name, p->pw_passwd,
+ (unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
+ p->pw_gecos, p->pw_dir, p->pw_shell) < 0)
return -1;
return 0;
diff --git a/pwd/putpwent.c b/pwd/putpwent.c
index e3f2f4e09e..480dd59813 100644
--- a/pwd/putpwent.c
+++ b/pwd/putpwent.c
@@ -48,11 +48,11 @@ putpwent (const struct passwd *p, FILE *stream)
return -1;
if (p->pw_name[0] == '+' || p->pw_name[0] == '-')
- ret = fprintf (stream, "%s:%s:::%s:%s:%s\n",
+ ret = __fprintf (stream, "%s:%s:::%s:%s:%s\n",
p->pw_name, _S (p->pw_passwd),
gecos, _S (p->pw_dir), _S (p->pw_shell));
else
- ret = fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
+ ret = __fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
p->pw_name, _S (p->pw_passwd),
(unsigned long int) p->pw_uid,
(unsigned long int) p->pw_gid,
diff --git a/resolv/inet_ntop.c b/resolv/inet_ntop.c
index c4d38c0f95..53725d805a 100644
--- a/resolv/inet_ntop.c
+++ b/resolv/inet_ntop.c
@@ -28,9 +28,9 @@
#include <string.h>
#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
+# define SPRINTF(x) strlen(__sprintf/**/x)
#else
-# define SPRINTF(x) ((size_t)sprintf x)
+# define SPRINTF(x) ((size_t)__sprintf x)
#endif
/*
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index 913a5cb82f..06a91b23ca 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -507,8 +507,8 @@ _nss_dns_gethostbyaddr2_r (const void *addr, socklen_t len, int af,
switch (af)
{
case AF_INET:
- sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", (uaddr[3] & 0xff),
- (uaddr[2] & 0xff), (uaddr[1] & 0xff), (uaddr[0] & 0xff));
+ __sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", (uaddr[3] & 0xff),
+ (uaddr[2] & 0xff), (uaddr[1] & 0xff), (uaddr[0] & 0xff));
break;
case AF_INET6:
qp = qbuf;
diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
index 09cd917444..304ae35b8b 100644
--- a/resolv/nss_dns/dns-network.c
+++ b/resolv/nss_dns/dns-network.c
@@ -191,21 +191,21 @@ _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result,
{
case 3:
/* Class A network. */
- sprintf (qbuf, "0.0.0.%u.in-addr.arpa", net_bytes[3]);
+ __sprintf (qbuf, "0.0.0.%u.in-addr.arpa", net_bytes[3]);
break;
case 2:
/* Class B network. */
- sprintf (qbuf, "0.0.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2]);
+ __sprintf (qbuf, "0.0.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2]);
break;
case 1:
/* Class C network. */
- sprintf (qbuf, "0.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
- net_bytes[1]);
+ __sprintf (qbuf, "0.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
+ net_bytes[1]);
break;
case 0:
/* Class D - E network. */
- sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
- net_bytes[1], net_bytes[0]);
+ __sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
+ net_bytes[1], net_bytes[0]);
break;
}
diff --git a/shadow/putspent.c b/shadow/putspent.c
index cbbb840d5b..d675e28210 100644
--- a/shadow/putspent.c
+++ b/shadow/putspent.c
@@ -42,47 +42,47 @@ putspent (const struct spwd *p, FILE *stream)
flockfile (stream);
- if (fprintf (stream, "%s:%s:", p->sp_namp, _S (p->sp_pwdp)) < 0)
+ if (__fprintf (stream, "%s:%s:", p->sp_namp, _S (p->sp_pwdp)) < 0)
++errors;
if ((p->sp_lstchg != (long int) -1
- && fprintf (stream, "%ld:", p->sp_lstchg) < 0)
+ && __fprintf (stream, "%ld:", p->sp_lstchg) < 0)
|| (p->sp_lstchg == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_min != (long int) -1
- && fprintf (stream, "%ld:", p->sp_min) < 0)
+ && __fprintf (stream, "%ld:", p->sp_min) < 0)
|| (p->sp_min == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_max != (long int) -1
- && fprintf (stream, "%ld:", p->sp_max) < 0)
+ && __fprintf (stream, "%ld:", p->sp_max) < 0)
|| (p->sp_max == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_warn != (long int) -1
- && fprintf (stream, "%ld:", p->sp_warn) < 0)
+ && __fprintf (stream, "%ld:", p->sp_warn) < 0)
|| (p->sp_warn == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_inact != (long int) -1
- && fprintf (stream, "%ld:", p->sp_inact) < 0)
+ && __fprintf (stream, "%ld:", p->sp_inact) < 0)
|| (p->sp_inact == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_expire != (long int) -1
- && fprintf (stream, "%ld:", p->sp_expire) < 0)
+ && __fprintf (stream, "%ld:", p->sp_expire) < 0)
|| (p->sp_expire == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if (p->sp_flag != ~0ul
- && fprintf (stream, "%ld", p->sp_flag) < 0)
+ && __fprintf (stream, "%ld", p->sp_flag) < 0)
++errors;
if (putc_unlocked ('\n', stream) == EOF)
diff --git a/stdio-common/dprintf.c b/stdio-common/dprintf.c
index 2e26d59714..6fbe5d4862 100644
--- a/stdio-common/dprintf.c
+++ b/stdio-common/dprintf.c
@@ -33,5 +33,4 @@ __dprintf (int d, const char *format, ...)
return done;
}
libc_hidden_def (__dprintf)
-ldbl_hidden_def (__dprintf, dprintf)
ldbl_weak_alias (__dprintf, dprintf)
diff --git a/stdio-common/fprintf.c b/stdio-common/fprintf.c
index 8d2cd37433..af7190c5b4 100644
--- a/stdio-common/fprintf.c
+++ b/stdio-common/fprintf.c
@@ -34,7 +34,7 @@ __fprintf (FILE *stream, const char *format, ...)
return done;
}
-ldbl_hidden_def (__fprintf, fprintf)
+libc_hidden_def (__fprintf)
ldbl_strong_alias (__fprintf, fprintf)
/* We define the function with the real name here. But deep down in
diff --git a/stdio-common/psiginfo.c b/stdio-common/psiginfo.c
index adf3b71b77..f99c51da17 100644
--- a/stdio-common/psiginfo.c
+++ b/stdio-common/psiginfo.c
@@ -76,7 +76,7 @@ psiginfo (const siginfo_t *pinfo, const char *s)
}
if (s != NULL && *s != '\0')
- fprintf (fp, "%s: ", s);
+ __fprintf (fp, "%s: ", s);
const char *desc;
if (pinfo->si_signo >= 0 && pinfo->si_signo < NSIG
@@ -92,21 +92,21 @@ psiginfo (const siginfo_t *pinfo, const char *s)
if (pinfo->si_signo - SIGRTMIN < SIGRTMAX - pinfo->si_signo)
{
if (pinfo->si_signo == SIGRTMIN)
- fprintf (fp, "SIGRTMIN (");
+ __fprintf (fp, "SIGRTMIN (");
else
- fprintf (fp, "SIGRTMIN+%d (", pinfo->si_signo - SIGRTMIN);
+ __fprintf (fp, "SIGRTMIN+%d (", pinfo->si_signo - SIGRTMIN);
}
else
{
if (pinfo->si_signo == SIGRTMAX)
- fprintf (fp, "SIGRTMAX (");
+ __fprintf (fp, "SIGRTMAX (");
else
- fprintf (fp, "SIGRTMAX-%d (", SIGRTMAX - pinfo->si_signo);
+ __fprintf (fp, "SIGRTMAX-%d (", SIGRTMAX - pinfo->si_signo);
}
}
else
#endif
- fprintf (fp, "%s (", _(desc));
+ __fprintf (fp, "%s (", _(desc));
const char *base = NULL;
const uint8_t *offarr = NULL;
@@ -178,25 +178,25 @@ Signal generated by the completion of an I/O request");
}
if (str != NULL)
- fprintf (fp, "%s ", _(str));
+ __fprintf (fp, "%s ", _(str));
else
- fprintf (fp, "%d ", pinfo->si_code);
+ __fprintf (fp, "%d ", pinfo->si_code);
if (pinfo->si_signo == SIGILL || pinfo->si_signo == SIGFPE
|| pinfo->si_signo == SIGSEGV || pinfo->si_signo == SIGBUS)
- fprintf (fp, "[%p])\n", pinfo->si_addr);
+ __fprintf (fp, "[%p])\n", pinfo->si_addr);
else if (pinfo->si_signo == SIGCHLD)
- fprintf (fp, "%ld %d %ld)\n",
- (long int) pinfo->si_pid, pinfo->si_status,
- (long int) pinfo->si_uid);
+ __fprintf (fp, "%ld %d %ld)\n",
+ (long int) pinfo->si_pid, pinfo->si_status,
+ (long int) pinfo->si_uid);
else if (pinfo->si_signo == SIGPOLL)
- fprintf (fp, "%ld)\n", (long int) pinfo->si_band);
+ __fprintf (fp, "%ld)\n", (long int) pinfo->si_band);
else
- fprintf (fp, "%ld %ld)\n",
- (long int) pinfo->si_pid, (long int) pinfo->si_uid);
+ __fprintf (fp, "%ld %ld)\n",
+ (long int) pinfo->si_pid, (long int) pinfo->si_uid);
}
else
- fprintf (fp, _("Unknown signal %d\n"), pinfo->si_signo);
+ __fprintf (fp, _("Unknown signal %d\n"), pinfo->si_signo);
fclose (fp);
diff --git a/stdio-common/sprintf.c b/stdio-common/sprintf.c
index a9665f753a..f1f43a49ec 100644
--- a/stdio-common/sprintf.c
+++ b/stdio-common/sprintf.c
@@ -32,6 +32,6 @@ __sprintf (char *s, const char *format, ...)
return done;
}
-ldbl_hidden_def (__sprintf, sprintf)
+libc_hidden_def (__sprintf)
ldbl_strong_alias (__sprintf, sprintf)
ldbl_strong_alias (__sprintf, _IO_sprintf)
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 7559fd239d..c5912788bd 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -24,4 +24,4 @@ __vfprintf (FILE *fp, const char *format, va_list ap)
}
ldbl_strong_alias (__vfprintf, _IO_vfprintf);
ldbl_strong_alias (__vfprintf, vfprintf);
-ldbl_hidden_def (__vfprintf, vfprintf)
+libc_hidden_def (__vfprintf)
diff --git a/sunrpc/netname.c b/sunrpc/netname.c
index bf7f0b81c4..97a881c3af 100644
--- a/sunrpc/netname.c
+++ b/sunrpc/netname.c
@@ -48,7 +48,7 @@ user2netname (char netname[MAXNETNAMELEN + 1], const uid_t uid,
if ((strlen (dfltdom) + OPSYS_LEN + 3 + MAXIPRINT) > (size_t) MAXNETNAMELEN)
return 0;
- sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
+ __sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
i = strlen (netname);
if (netname[i - 1] == '.')
netname[i - 1] = '\0';
@@ -112,7 +112,7 @@ host2netname (char netname[MAXNETNAMELEN + 1], const char *host,
> MAXNETNAMELEN)
return 0;
- sprintf (netname, "%s.%s@%s", OPSYS, hostname, domainname);
+ __sprintf (netname, "%s.%s@%s", OPSYS, hostname, domainname);
return 1;
}
#ifdef EXPORT_RPC_SYMBOLS
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
index f683836678..59f6e31d2d 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128___asprintf (char **string_ptr, const char *format, ...)
+int
+__asprintfieee128 (char **string_ptr, const char *format, ...)
{
va_list ap;
int done;
@@ -32,5 +32,4 @@ ___ieee128___asprintf (char **string_ptr, const char *format, ...)
return done;
}
-hidden_def (___ieee128___asprintf)
-strong_alias (___ieee128___asprintf, __asprintfieee128)
+libc_hidden_def (__asprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
index cf3b46c37a..ceba219dc7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_dprintf (int d, const char *format, ...)
+int
+__dprintfieee128 (int d, const char *format, ...)
{
va_list ap;
int done;
@@ -31,5 +31,4 @@ ___ieee128_dprintf (int d, const char *format, ...)
return done;
}
-strong_alias (___ieee128_dprintf, __dprintfieee128)
-hidden_def (___ieee128_dprintf);
+libc_hidden_def (__dprintfieee128);
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
index 4462588675..b58f27afb7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_fprintf (FILE *fp, const char *format, ...)
+int
+__fprintfieee128 (FILE *fp, const char *format, ...)
{
va_list ap;
int done;
@@ -31,5 +31,4 @@ ___ieee128_fprintf (FILE *fp, const char *format, ...)
return done;
}
-strong_alias (___ieee128_fprintf, __fprintfieee128)
-hidden_def (___ieee128_fprintf)
+libc_hidden_def (__fprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
index 9703069b95..243eb65629 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
@@ -18,8 +18,8 @@
/* When in IEEE long double mode, call ___ieee128_sprintf. */
#include <stdio.h>
-typeof (sprintf) ___ieee128_sprintf attribute_hidden;
-#define SPRINTF ___ieee128_sprintf
+typeof (sprintf) __sprintfieee128 attribute_hidden;
+#define SPRINTF __sprintfieee128
/* Declare internal functions: ___qecvtieee128_r and ___qfcvtieee128_r,
built from a different compiling unit, and called from here. */
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
index 0be5bb2810..8046f5fd46 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
@@ -18,8 +18,8 @@
/* When in IEEE long double mode, call ___ieee128_snprintf. */
#include <stdio.h>
-typeof (snprintf) ___ieee128_snprintf attribute_hidden;
-#define SNPRINTF ___ieee128_snprintf
+typeof (snprintf) __snprintfieee128 attribute_hidden;
+#define SNPRINTF __snprintfieee128
#define ECVT_R __qecvtieee128_r
#define FCVT_R __qfcvtieee128_r
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
index 5f51b3ec9e..da3d9441d7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_snprintf (char *s, size_t maxlen, const char *format, ...)
+int
+__snprintfieee128 (char *s, size_t maxlen, const char *format, ...)
{
va_list ap;
int done;
@@ -32,4 +32,4 @@ ___ieee128_snprintf (char *s, size_t maxlen, const char *format, ...)
return done;
}
-strong_alias (___ieee128_snprintf, __snprintfieee128)
+libc_hidden_def (__snprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
index 0cad130788..007a71659a 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_sprintf (char *s, const char *format, ...)
+int
+__sprintfieee128 (char *s, const char *format, ...)
{
va_list ap;
int done;
@@ -32,5 +32,4 @@ ___ieee128_sprintf (char *s, const char *format, ...)
return done;
}
-strong_alias (___ieee128_sprintf, __sprintfieee128)
-hidden_def (___ieee128_sprintf)
+libc_hidden_def (__sprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
index e340c9b457..4df1e485a5 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
@@ -18,10 +18,9 @@
#include <libio/libioP.h>
-extern int
-___ieee128_vfprintf (FILE *fp, const char *format, va_list ap)
+int
+__vfprintfieee128 (FILE *fp, const char *format, va_list ap)
{
return __vfprintf_internal (fp, format, ap, PRINTF_LDBL_USES_FLOAT128);
}
-strong_alias (___ieee128_vfprintf, __vfprintfieee128)
-hidden_def (___ieee128_vfprintf)
+libc_hidden_def (__vfprintfieee128)
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
index ebd2a43951..5b167d45ff 100644
--- a/sysdeps/posix/tempname.c
+++ b/sysdeps/posix/tempname.c
@@ -161,7 +161,7 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
return -1;
}
- sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
+ __sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
return 0;
}
#endif /* _LIBC */
diff --git a/sysdeps/unix/sysv/linux/ia64/makecontext.c b/sysdeps/unix/sysv/linux/ia64/makecontext.c
index 0bc4211dfc..0cf05d5999 100644
--- a/sysdeps/unix/sysv/linux/ia64/makecontext.c
+++ b/sysdeps/unix/sysv/linux/ia64/makecontext.c
@@ -54,7 +54,7 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
if (argc > 8)
{
- fprintf (stderr, _("\
+ __fprintf (stderr, _("\
makecontext: does not know how to handle more than 8 arguments\n"));
exit (-1);
}
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index 0e017f458b..f2dca7711a 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -233,10 +233,13 @@ extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
const wchar_t *__restrict __format, ...)
__THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
-extern int __REDIRECT_NTH_LDBL (__swprintf_alias,
- (wchar_t *__restrict __s, size_t __n,
- const wchar_t *__restrict __fmt, ...),
- swprintf);
+extern int __swprintf_alias (wchar_t *__restrict __s, size_t __n,
+ const wchar_t *__restrict __fmt, ...)
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+ __asm__ (__ASMNAME ("swprintf"))
+#endif
+ ;
+
#ifdef __va_arg_pack
__fortify_function int
@@ -264,10 +267,13 @@ extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
__gnuc_va_list __arg)
__THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-extern int __REDIRECT_NTH_LDBL (__vswprintf_alias,
- (wchar_t *__restrict __s, size_t __n,
- const wchar_t *__restrict __fmt,
- __gnuc_va_list __ap), vswprintf);
+extern int __vswprintf_alias (wchar_t *__restrict __s, size_t __n,
+ const wchar_t *__restrict __fmt,
+ __gnuc_va_list __ap)
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+ __asm__ (__ASMNAME ("vswprintf"))
+#endif
+ ;
__fortify_function int
__NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
^ permalink raw reply [flat|nested] 14+ messages in thread
* [glibc/azanella/clang] Remove stdio-ldbl.h
@ 2022-06-03 14:02 Adhemerval Zanella
0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-06-03 14:02 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8f798f434ae1dbb5c111a83448c9cfc51f9012ca
commit 8f798f434ae1dbb5c111a83448c9cfc51f9012ca
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Thu Feb 24 14:13:12 2022 -0300
Remove stdio-ldbl.h
The functions which require different alias to long double depending
of the ABI now uses a set os macros that defines the expected alias
on the function prototype, instead of redefine them using the
__LDBL_REDIR_DEC macros.
The __REDIRECT_LDBL, __REDIRECT_LDBL_NTH, __REDIRECT_LDBL_NTHNL
are refactores to be similar to __REDIRECT with the difference it
now expects the aliases for binary128 and for the long double being
double (which __LDBL_REDIR_DEC does).
All printf internal usage are also replaced to use internal alias
instead.
Diff:
---
argp/argp-parse.c | 4 +-
debug/backtracesyms.c | 18 +-
grp/putgrent.c | 6 +-
gshadow/putsgent.c | 6 +-
include/bits/stdio-ldbl.h | 1 -
include/stdio.h | 34 ++-
inet/ether_ntoa_r.c | 8 +-
inet/rexec.c | 2 +-
libio/Makefile | 2 +-
libio/bits/stdio-ldbl.h | 108 --------
libio/bits/stdio2.h | 115 ++++++---
libio/stdio.h | 286 +++++++++++++--------
malloc/malloc-check.c | 1 +
malloc/malloc.c | 32 +--
misc/efgcvt-template.c | 2 +-
misc/mntent_r.c | 2 +-
misc/sys/cdefs.h | 70 +++--
nis/nis_subr.c | 8 +-
nptl/pthread_getname.c | 2 +-
nptl/pthread_setname.c | 2 +-
pwd/getpw.c | 6 +-
pwd/putpwent.c | 4 +-
resolv/inet_ntop.c | 4 +-
resolv/nss_dns/dns-host.c | 4 +-
resolv/nss_dns/dns-network.c | 12 +-
shadow/putspent.c | 16 +-
stdio-common/dprintf.c | 1 -
stdio-common/fprintf.c | 2 +-
stdio-common/psiginfo.c | 32 +--
stdio-common/sprintf.c | 2 +-
stdio-common/vfprintf.c | 2 +-
sunrpc/netname.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-asprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-dprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-fprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-snprintf.c | 6 +-
.../ieee754/ldbl-128ibm-compat/ieee128-sprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c | 7 +-
sysdeps/posix/tempname.c | 2 +-
sysdeps/unix/sysv/linux/ia64/makecontext.c | 2 +-
wcsmbs/bits/wchar2.h | 22 +-
43 files changed, 448 insertions(+), 425 deletions(-)
diff --git a/argp/argp-parse.c b/argp/argp-parse.c
index 13cd84dd33..c26c0fc27f 100644
--- a/argp/argp-parse.c
+++ b/argp/argp-parse.c
@@ -177,7 +177,7 @@ argp_version_parser (int key, char *arg, struct argp_state *state)
if (argp_program_version_hook)
(*argp_program_version_hook) (state->out_stream, state);
else if (argp_program_version)
- fprintf (state->out_stream, "%s\n", argp_program_version);
+ __fprintf (state->out_stream, "%s\n", argp_program_version);
else
__argp_error (state, dgettext (state->root_argp->argp_domain,
"(PROGRAM ERROR) No version known!?"));
@@ -618,7 +618,7 @@ parser_finalize (struct parser *parser,
{
if (!(parser->state.flags & ARGP_NO_ERRS)
&& parser->state.err_stream)
- fprintf (parser->state.err_stream,
+ __fprintf (parser->state.err_stream,
dgettext (parser->argp->argp_domain,
"%s: Too many arguments\n"),
parser->state.name);
diff --git a/debug/backtracesyms.c b/debug/backtracesyms.c
index 17e0626df8..adb939f888 100644
--- a/debug/backtracesyms.c
+++ b/debug/backtracesyms.c
@@ -83,10 +83,10 @@ __backtrace_symbols (void *const *array, int size)
info[cnt].dli_saddr = info[cnt].dli_fbase;
if (info[cnt].dli_sname == NULL && info[cnt].dli_saddr == 0)
- last += 1 + sprintf (last, "%s(%s) [%p]",
- info[cnt].dli_fname ?: "",
- info[cnt].dli_sname ?: "",
- array[cnt]);
+ last += 1 + __sprintf (last, "%s(%s) [%p]",
+ info[cnt].dli_fname ?: "",
+ info[cnt].dli_sname ?: "",
+ array[cnt]);
else
{
char sign;
@@ -102,14 +102,14 @@ __backtrace_symbols (void *const *array, int size)
offset = info[cnt].dli_saddr - array[cnt];
}
- last += 1 + sprintf (last, "%s(%s%c%#tx) [%p]",
- info[cnt].dli_fname ?: "",
- info[cnt].dli_sname ?: "",
- sign, offset, array[cnt]);
+ last += 1 + __sprintf (last, "%s(%s%c%#tx) [%p]",
+ info[cnt].dli_fname ?: "",
+ info[cnt].dli_sname ?: "",
+ sign, offset, array[cnt]);
}
}
else
- last += 1 + sprintf (last, "[%p]", array[cnt]);
+ last += 1 + __sprintf (last, "[%p]", array[cnt]);
}
assert (last <= (char *) result + size * sizeof (char *) + total);
}
diff --git a/grp/putgrent.c b/grp/putgrent.c
index 966ba2a763..305ff44359 100644
--- a/grp/putgrent.c
+++ b/grp/putgrent.c
@@ -45,10 +45,10 @@ putgrent (const struct group *gr, FILE *stream)
flockfile (stream);
if (gr->gr_name[0] == '+' || gr->gr_name[0] == '-')
- retval = fprintf (stream, "%s:%s::",
+ retval = __fprintf (stream, "%s:%s::",
gr->gr_name, _S (gr->gr_passwd));
else
- retval = fprintf (stream, "%s:%s:%lu:",
+ retval = __fprintf (stream, "%s:%s:%lu:",
gr->gr_name, _S (gr->gr_passwd),
(unsigned long int) gr->gr_gid);
if (__builtin_expect (retval, 0) < 0)
@@ -60,7 +60,7 @@ putgrent (const struct group *gr, FILE *stream)
if (gr->gr_mem != NULL)
{
for (size_t i = 0; gr->gr_mem[i] != NULL; i++)
- if (fprintf (stream, i == 0 ? "%s" : ",%s", gr->gr_mem[i]) < 0)
+ if (__fprintf (stream, i == 0 ? "%s" : ",%s", gr->gr_mem[i]) < 0)
{
/* What else can we do? */
funlockfile (stream);
diff --git a/gshadow/putsgent.c b/gshadow/putsgent.c
index 9e2dca7eaf..870438de6d 100644
--- a/gshadow/putsgent.c
+++ b/gshadow/putsgent.c
@@ -42,7 +42,7 @@ putsgent (const struct sgrp *g, FILE *stream)
_IO_flockfile (stream);
- if (fprintf (stream, "%s:%s:", g->sg_namp, _S (g->sg_passwd)) < 0)
+ if (__fprintf (stream, "%s:%s:", g->sg_namp, _S (g->sg_passwd)) < 0)
++errors;
bool first = true;
@@ -50,7 +50,7 @@ putsgent (const struct sgrp *g, FILE *stream)
if (sp != NULL)
while (*sp != NULL)
{
- if (fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
+ if (__fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
{
++errors;
break;
@@ -65,7 +65,7 @@ putsgent (const struct sgrp *g, FILE *stream)
if (sp != NULL)
while (*sp != NULL)
{
- if (fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
+ if (__fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
{
++errors;
break;
diff --git a/include/bits/stdio-ldbl.h b/include/bits/stdio-ldbl.h
deleted file mode 100644
index 1f7d3ce1c6..0000000000
--- a/include/bits/stdio-ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <libio/bits/stdio-ldbl.h>
diff --git a/include/stdio.h b/include/stdio.h
index a6f7fd43cb..39b4978130 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -22,13 +22,17 @@
/* Some libc_hidden_ldbl_proto's do not map to a unique symbol when
redirecting ldouble to _Float128 variants. We can therefore safely
directly alias them to their internal name. */
-# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc)
-# define stdio_hidden_ldbl_proto(p, f) \
- extern __typeof (p ## f) p ## f __asm (__ASMNAME ("___ieee128_" #f));
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# define stdio_hidden_ldbl_proto(p,f) __LDBL_REDIR1_DECL (p ## f, p ## f ## ieee128)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc) && defined SHARED
+# define __stdio_hidden_ldbl_proto(name, alias) \
+ extern __typeof (name) __##name __asm__ (__hidden_asmname (#alias));
+# define stdio_hidden_ldbl_proto(name) \
+ extern typeof (name) __##name##ieee128; \
+ libc_hidden_proto (__##name##ieee128); \
+ __stdio_hidden_ldbl_proto (name, __GI___##name##ieee128)
# else
-# define stdio_hidden_ldbl_proto(p,f) libc_hidden_proto (p ## f)
+# define stdio_hidden_ldbl_proto(name) \
+ extern __typeof (name) __##name; \
+ libc_hidden_proto (__##name)
# endif
/* Set the error indicator on FP. */
@@ -39,10 +43,7 @@ fseterr_unlocked (FILE *fp)
}
extern int __fcloseall (void) attribute_hidden;
-extern int __snprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, ...)
- __attribute__ ((__format__ (__printf__, 3, 4)));
-stdio_hidden_ldbl_proto (__, snprintf)
+stdio_hidden_ldbl_proto (snprintf);
extern int __vfscanf (FILE *__restrict __s,
const char *__restrict __format,
@@ -184,7 +185,7 @@ extern const size_t _sys_errlist_internal_len attribute_hidden;
extern const char *__get_errlist (int) attribute_hidden;
extern const char *__get_errname (int) attribute_hidden;
-libc_hidden_ldbl_proto (__asprintf)
+stdio_hidden_ldbl_proto (asprintf);
# if IS_IN (libc)
extern FILE *_IO_new_fopen (const char*, const char*);
@@ -206,13 +207,10 @@ extern int _IO_new_fgetpos (FILE *, __fpos_t *);
# define fgetpos(fp, posp) _IO_new_fgetpos (fp, posp)
# endif
-extern __typeof (dprintf) __dprintf
- __attribute__ ((__format__ (__printf__, 2, 3)));
-stdio_hidden_ldbl_proto (__, dprintf)
-libc_hidden_ldbl_proto (dprintf)
-libc_hidden_ldbl_proto (fprintf)
-libc_hidden_ldbl_proto (vfprintf)
-libc_hidden_ldbl_proto (sprintf)
+stdio_hidden_ldbl_proto (dprintf);
+stdio_hidden_ldbl_proto (fprintf);
+stdio_hidden_ldbl_proto (vfprintf);
+stdio_hidden_ldbl_proto (sprintf);
libc_hidden_proto (ungetc)
libc_hidden_proto (__getdelim)
libc_hidden_proto (fwrite)
diff --git a/inet/ether_ntoa_r.c b/inet/ether_ntoa_r.c
index 03011ffef6..f111e5234c 100644
--- a/inet/ether_ntoa_r.c
+++ b/inet/ether_ntoa_r.c
@@ -23,10 +23,10 @@
char *
ether_ntoa_r (const struct ether_addr *addr, char *buf)
{
- sprintf (buf, "%x:%x:%x:%x:%x:%x",
- addr->ether_addr_octet[0], addr->ether_addr_octet[1],
- addr->ether_addr_octet[2], addr->ether_addr_octet[3],
- addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
+ __sprintf (buf, "%x:%x:%x:%x:%x:%x",
+ addr->ether_addr_octet[0], addr->ether_addr_octet[1],
+ addr->ether_addr_octet[2], addr->ether_addr_octet[3],
+ addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
return buf;
}
libc_hidden_def (ether_ntoa_r)
diff --git a/inet/rexec.c b/inet/rexec.c
index 330282ac16..809475d976 100644
--- a/inet/rexec.c
+++ b/inet/rexec.c
@@ -135,7 +135,7 @@ retry:
NULL, 0, servbuff, sizeof(servbuff),
NI_NUMERICSERV))
port = (int) __strtol (servbuff, NULL, 10);
- (void) sprintf(num, "%u", port);
+ (void) __sprintf(num, "%u", port);
(void) __write(s, num, strlen(num)+1);
{ socklen_t len = sizeof (from);
s3 = TEMP_FAILURE_RETRY (accept(s2, (struct sockaddr *)&from,
diff --git a/libio/Makefile b/libio/Makefile
index e97387743f..a4830ddf42 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -23,7 +23,7 @@ subdir := libio
include ../Makeconfig
headers := stdio.h \
- bits/stdio.h bits/stdio2.h bits/stdio-ldbl.h \
+ bits/stdio.h bits/stdio2.h \
bits/types/FILE.h bits/types/__FILE.h bits/types/struct_FILE.h \
bits/types/__fpos_t.h bits/types/__fpos64_t.h \
bits/types/cookie_io_functions_t.h
diff --git a/libio/bits/stdio-ldbl.h b/libio/bits/stdio-ldbl.h
deleted file mode 100644
index 6b63394b50..0000000000
--- a/libio/bits/stdio-ldbl.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -mlong-double-64 compatibility mode for stdio functions.
- Copyright (C) 2006-2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#ifndef _STDIO_H
-# error "Never include <bits/stdio-ldbl.h> directly; use <stdio.h> instead."
-#endif
-
-__LDBL_REDIR_DECL (fprintf)
-__LDBL_REDIR_DECL (printf)
-__LDBL_REDIR_DECL (sprintf)
-__LDBL_REDIR_DECL (vfprintf)
-__LDBL_REDIR_DECL (vprintf)
-__LDBL_REDIR_DECL (vsprintf)
-#if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (fscanf, __nldbl___isoc99_fscanf)
-__LDBL_REDIR1_DECL (scanf, __nldbl___isoc99_scanf)
-__LDBL_REDIR1_DECL (sscanf, __nldbl___isoc99_sscanf)
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (fscanf, __isoc99_fscanfieee128)
-__LDBL_REDIR1_DECL (scanf, __isoc99_scanfieee128)
-__LDBL_REDIR1_DECL (sscanf, __isoc99_sscanfieee128)
-# else
-# error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-# endif
-#else
-__LDBL_REDIR_DECL (fscanf)
-__LDBL_REDIR_DECL (scanf)
-__LDBL_REDIR_DECL (sscanf)
-#endif
-
-#if defined __USE_ISOC99 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (snprintf)
-__LDBL_REDIR_DECL (vsnprintf)
-#endif
-
-#ifdef __USE_ISOC99
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (vfscanf, __nldbl___isoc99_vfscanf)
-__LDBL_REDIR1_DECL (vscanf, __nldbl___isoc99_vscanf)
-__LDBL_REDIR1_DECL (vsscanf, __nldbl___isoc99_vsscanf)
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (vfscanf, __isoc99_vfscanfieee128)
-__LDBL_REDIR1_DECL (vscanf, __isoc99_vscanfieee128)
-__LDBL_REDIR1_DECL (vsscanf, __isoc99_vsscanfieee128)
-# else
-# error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-# endif
-# else
-__LDBL_REDIR_DECL (vfscanf)
-__LDBL_REDIR_DECL (vsscanf)
-__LDBL_REDIR_DECL (vscanf)
-# endif
-#endif
-
-#ifdef __USE_XOPEN2K8
-__LDBL_REDIR_DECL (vdprintf)
-__LDBL_REDIR_DECL (dprintf)
-#endif
-
-#ifdef __USE_GNU
-__LDBL_REDIR_DECL (vasprintf)
-__LDBL_REDIR2_DECL (asprintf)
-__LDBL_REDIR_DECL (asprintf)
-__LDBL_REDIR_DECL (obstack_printf)
-__LDBL_REDIR_DECL (obstack_vprintf)
-#endif
-
-#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR2_DECL (sprintf_chk)
-__LDBL_REDIR2_DECL (vsprintf_chk)
-# if defined __USE_ISOC99 || defined __USE_UNIX98
-__LDBL_REDIR2_DECL (snprintf_chk)
-__LDBL_REDIR2_DECL (vsnprintf_chk)
-# endif
-# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR2_DECL (fprintf_chk)
-__LDBL_REDIR2_DECL (printf_chk)
-__LDBL_REDIR2_DECL (vfprintf_chk)
-__LDBL_REDIR2_DECL (vprintf_chk)
-# ifdef __USE_XOPEN2K8
-__LDBL_REDIR2_DECL (dprintf_chk)
-__LDBL_REDIR2_DECL (vdprintf_chk)
-# endif
-# ifdef __USE_GNU
-__LDBL_REDIR2_DECL (asprintf_chk)
-__LDBL_REDIR2_DECL (vasprintf_chk)
-__LDBL_REDIR2_DECL (obstack_printf_chk)
-__LDBL_REDIR2_DECL (obstack_vprintf_chk)
-# endif
-# endif
-#endif
diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h
index b0b655ee7a..de7f1f04aa 100644
--- a/libio/bits/stdio2.h
+++ b/libio/bits/stdio2.h
@@ -23,12 +23,17 @@
# error "Never include <bits/stdio2.h> directly; use <stdio.h> instead."
#endif
-extern int __sprintf_chk (char *__restrict __s, int __flag, size_t __slen,
- const char *__restrict __format, ...) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__sprintf_chk, (char *__restrict __s,
+ int __flag, size_t __slen,
+ const char *__restrict __format,
+ ...),
+ __sprintf_chkieee128, __nldbl___sprintf_chk)
__attr_access ((__write_only__, 1, 3));
-extern int __vsprintf_chk (char *__restrict __s, int __flag, size_t __slen,
- const char *__restrict __format,
- __gnuc_va_list __ap) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__vsprintf_chk, (char *__restrict __s,
+ int __flag, size_t __slen,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vsprintf_chkieee128, __nldbl___vsprintf_chk)
__attr_access ((__write_only__, 1, 3));
#ifdef __va_arg_pack
@@ -54,14 +59,19 @@ __NTH (vsprintf (char *__restrict __s, const char *__restrict __fmt,
}
#if defined __USE_ISOC99 || defined __USE_UNIX98
-
-extern int __snprintf_chk (char *__restrict __s, size_t __n, int __flag,
- size_t __slen, const char *__restrict __format,
- ...) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__snprintf_chk, (char *__restrict __s,
+ size_t __n, int __flag,
+ size_t __slen,
+ const char *__restrict __format,
+ ...),
+ __snprintf_chkieee128, __nldbl___snprintf_chk)
__attr_access ((__write_only__, 1, 2));
-extern int __vsnprintf_chk (char *__restrict __s, size_t __n, int __flag,
- size_t __slen, const char *__restrict __format,
- __gnuc_va_list __ap) __THROW;
+extern int __REDIRECT_LDBL_NTHNL (__vsnprintf_chk, (char *__restrict __s,
+ size_t __n, int __flag,
+ size_t __slen,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vsnprintf_chkieee128, __nldbl___vsnprintf_chk);
# ifdef __va_arg_pack
__fortify_function int
@@ -89,14 +99,24 @@ __NTH (vsnprintf (char *__restrict __s, size_t __n,
#endif
#if __USE_FORTIFY_LEVEL > 1
-
-extern int __fprintf_chk (FILE *__restrict __stream, int __flag,
- const char *__restrict __format, ...);
-extern int __printf_chk (int __flag, const char *__restrict __format, ...);
-extern int __vfprintf_chk (FILE *__restrict __stream, int __flag,
- const char *__restrict __format, __gnuc_va_list __ap);
-extern int __vprintf_chk (int __flag, const char *__restrict __format,
- __gnuc_va_list __ap);
+extern int __REDIRECT_LDBL (__fprintf_chk, (FILE *__restrict __stream,
+ int __flag,
+ const char *__restrict __format,
+ ...),
+ __fprintf_chkieee128, __nldbl___fprintf_chk);
+extern int __REDIRECT_LDBL (__printf_chk, (int __flag,
+ const char *__restrict __format,
+ ...),
+ __printf_chkieee128, __nldbl___printf_chk);
+extern int __REDIRECT_LDBL (__vfprintf_chk, (FILE *__restrict __stream,
+ int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vfprintf_chkieee128, __nldbl___vfprintf_chk);
+extern int __REDIRECT_LDBL (__vprintf_chk, (int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vprintf_chkieee128, __nldbl___vprintf_chk);
# ifdef __va_arg_pack
__fortify_function int
@@ -136,10 +156,15 @@ vfprintf (FILE *__restrict __stream,
}
# ifdef __USE_XOPEN2K8
-extern int __dprintf_chk (int __fd, int __flag, const char *__restrict __fmt,
- ...) __attribute__ ((__format__ (__printf__, 3, 4)));
-extern int __vdprintf_chk (int __fd, int __flag,
- const char *__restrict __fmt, __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL (__dprintf_chk, (int __fd, int __flag,
+ const char *__restrict __fmt,
+ ...),
+ __dprintf_chkieee128, __nldbl___dprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL (__vdprintf_chk, (int __fd, int __flag,
+ const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vdprintf_chkieee128, __nldbl___vdprintf_chk)
__attribute__ ((__format__ (__printf__, 3, 0)));
# ifdef __va_arg_pack
@@ -162,22 +187,32 @@ vdprintf (int __fd, const char *__restrict __fmt, __gnuc_va_list __ap)
# endif
# ifdef __USE_GNU
-
-extern int __asprintf_chk (char **__restrict __ptr, int __flag,
- const char *__restrict __fmt, ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4))) __wur;
-extern int __vasprintf_chk (char **__restrict __ptr, int __flag,
- const char *__restrict __fmt, __gnuc_va_list __arg)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
-extern int __obstack_printf_chk (struct obstack *__restrict __obstack,
- int __flag, const char *__restrict __format,
- ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
-extern int __obstack_vprintf_chk (struct obstack *__restrict __obstack,
- int __flag,
- const char *__restrict __format,
- __gnuc_va_list __args)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
+extern int __REDIRECT_LDBL_NTHNL (__asprintf_chk, (char **__restrict __ptr,
+ int __flag,
+ const char *__restrict __fmt,
+ ...),
+ __asprintf_chkieee128, __nldbl___asprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (__vasprintf_chk, (char **__restrict __ptr,
+ int __flag,
+ const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vasprintf_chkieee128, __nldbl___vasnprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (__obstack_printf_chk, (struct obstack *__restrict __obstack,
+ int __flag,
+ const char *__restrict __format,
+ ...),
+ __obstack_printf_chkieee128,
+ __nldbl___obstack_printf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL_NTHNL (__obstack_vprintf_chk, (struct obstack *__restrict __obstack,
+ int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __args),
+ __obstack_vprintf_chkieee128,
+ __nldbl___obstack_vprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
# ifdef __va_arg_pack
__fortify_function int
diff --git a/libio/stdio.h b/libio/stdio.h
index e6425341ce..54c9796a46 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -41,6 +41,7 @@ __BEGIN_DECLS
#include <bits/types/__FILE.h>
#include <bits/types/FILE.h>
#include <bits/types/struct_FILE.h>
+#include <bits/floatn.h>
#ifdef __USE_GNU
# include <bits/types/cookie_io_functions_t.h>
@@ -342,78 +343,143 @@ extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
extern void setlinebuf (FILE *__stream) __THROW;
#endif
-
/* Write formatted output to STREAM.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int fprintf (FILE *__restrict __stream,
- const char *__restrict __format, ...);
+extern int __REDIRECT_LDBL (fprintf, (FILE *__restrict __stream,
+ const char *__restrict __format, ...),
+ __fprintfieee128, __nldbl_fprintf);
/* Write formatted output to stdout.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int printf (const char *__restrict __format, ...);
+extern int __REDIRECT_LDBL (printf, (const char *__restrict __format, ...),
+ __printfieee128, __nldbl_printf);
/* Write formatted output to S. */
-extern int sprintf (char *__restrict __s,
- const char *__restrict __format, ...) __THROWNL;
+extern int __REDIRECT_LDBL_NTHNL (sprintf, (char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __sprintfieee128, __nldbl_sprintf);
/* Write formatted output to S from argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg);
+extern int __REDIRECT_LDBL (vfprintf, (FILE *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vfprintfieee128, __nldbl_vfprintf);
/* Write formatted output to stdout from argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
+extern int __REDIRECT_LDBL (vprintf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vprintfieee128, __nldbl_vprintf);
/* Write formatted output to S from argument list ARG. */
-extern int vsprintf (char *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg) __THROWNL;
+extern int __REDIRECT_LDBL_NTHNL (vsprintf, (char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsprintfieee128, __nldbl_vsprintf);
#if defined __USE_ISOC99 || defined __USE_UNIX98
/* Maximum chars of output to write in MAXLEN. */
-extern int snprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 3, 4)));
-
-extern int vsnprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, __gnuc_va_list __arg)
- __THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
+extern int __REDIRECT_LDBL_NTHNL (snprintf, (char *__restrict __s,
+ size_t __maxlen,
+ const char *__restrict __format,
+ ...),
+ __snprintfieee128, __nldbl_snprintf)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL_NTHNL (vsnprintf, (char *__restrict __s,
+ size_t __maxlen,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsnprintfieee128, __nldbl_vsnprintf)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
#endif
#if __GLIBC_USE (LIB_EXT2)
/* Write formatted output to a string dynamically allocated with `malloc'.
Store the address of the string in *PTR. */
-extern int vasprintf (char **__restrict __ptr, const char *__restrict __f,
- __gnuc_va_list __arg)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
-extern int __asprintf (char **__restrict __ptr,
- const char *__restrict __fmt, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
-extern int asprintf (char **__restrict __ptr,
- const char *__restrict __fmt, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (vasprintf, (char **__restrict __ptr,
+ const char *__restrict __f,
+ __gnuc_va_list __arg),
+ __vasprintfieee128, __nldbl_vasprintf)
+ __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (asprintf, (char **__restrict __ptr,
+ const char *__restrict __fmt,
+ ...),
+ __asprintfieee128, __nldbl_asprintf)
+ __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
#endif
#ifdef __USE_XOPEN2K8
/* Write formatted output to a file descriptor. */
-extern int vdprintf (int __fd, const char *__restrict __fmt,
- __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL (vdprintf, (int __fd, const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vdprintfieee128, __nldbl_vdprintf)
__attribute__ ((__format__ (__printf__, 2, 0)));
-extern int dprintf (int __fd, const char *__restrict __fmt, ...)
+extern int __REDIRECT_LDBL (dprintf, (int __fd, const char *__restrict __fmt,
+ ...),
+ __dprintfieee128, __nldbl_dprintf)
__attribute__ ((__format__ (__printf__, 2, 3)));
#endif
-
+#if !__GLIBC_USE (DEPRECATED_SCANF)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ ...),
+ __isoc99_fscanfieee128, __nldbl___isoc99_fscanf) __wur;
+extern int __REDIRECT_LDBL (scanf, (const char *__restrict __format,
+ ...),
+ __isoc99_scanfieee128, __nldbl___isoc99_scanf) __wur;
+extern int __REDIRECT_LDBL_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __isoc99_sscanfieee128, __nldbl___isoc99_sscanf);
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format, ...),
+ __isoc99_fscanf) __wur;
+extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
+ __isoc99_scanf) __wur;
+extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format, ...),
+ __isoc99_sscanf);
+# else
+extern int __isoc99_fscanf (FILE *__restrict __stream,
+ const char *__restrict __format, ...) __wur;
+extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
+extern int __isoc99_sscanf (const char *__restrict __s,
+ const char *__restrict __format, ...) __THROW;
+# define fscanf __isoc99_fscanf
+# define scanf __isoc99_scanf
+# define sscanf __isoc99_sscanf
+# endif /* __REDIRECT */
+# endif
+#else
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ ...),
+ __fscanfieee128, __nldbl_fscanf) __wur;
+extern int __REDIRECT_LDBL (scanf, (const char *__restrict __format,
+ ...),
+ __scanfieee128, __nldbl_scanf) __wur;
+extern int __REDIRECT_LDBL_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __sscanfieee128, __nldbl_sscanf) __wur;
+# else
/* Read formatted input from STREAM.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int fscanf (FILE *__restrict __stream,
- const char *__restrict __format, ...) __wur;
+ const char *__restrict __format, ...) __wur;
/* Read formatted input from stdin.
This function is a possible cancellation point and therefore not
@@ -421,43 +487,81 @@ extern int fscanf (FILE *__restrict __stream,
extern int scanf (const char *__restrict __format, ...) __wur;
/* Read formatted input from S. */
extern int sscanf (const char *__restrict __s,
- const char *__restrict __format, ...) __THROW;
-
-/* For historical reasons, the C99-compliant versions of the scanf
- functions are at alternative names. When __LDBL_COMPAT or
- __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
- bits/stdio-ldbl.h. */
-#include <bits/floatn.h>
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
- && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-# ifdef __REDIRECT
-extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
- const char *__restrict __format, ...),
- __isoc99_fscanf) __wur;
-extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
- __isoc99_scanf) __wur;
-extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
- const char *__restrict __format, ...),
- __isoc99_sscanf);
-# else
-extern int __isoc99_fscanf (FILE *__restrict __stream,
- const char *__restrict __format, ...) __wur;
-extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
-extern int __isoc99_sscanf (const char *__restrict __s,
- const char *__restrict __format, ...) __THROW;
-# define fscanf __isoc99_fscanf
-# define scanf __isoc99_scanf
-# define sscanf __isoc99_sscanf
+ const char *__restrict __format, ...) __THROW;
# endif
-#endif
+#endif /* DEPRECATED_SCANF */
-#ifdef __USE_ISOC99
+#ifdef __USE_ISOC99
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vfscanfieee128, __nldbl___isoc99_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vscanfieee128, __nldbl___isoc99_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_LDBL_NTH (vsscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vsscanfieee128, __nldbl___isoc99_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (vfscanf,
+ (FILE *__restrict __s,
+ const char *__restrict __format, __gnuc_va_list __arg),
+ __isoc99_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_NTH (vsscanf,
+ (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
+extern int __isoc99_vfscanf (FILE *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg) __wur;
+extern int __isoc99_vscanf (const char *__restrict __format,
+ __gnuc_va_list __arg) __wur;
+extern int __isoc99_vsscanf (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg) __THROW;
+# define vfscanf __isoc99_vfscanf
+# define vscanf __isoc99_vscanf
+# define vsscanf __isoc99_vsscanf
+# endif /* __REDIRECT */
+# endif
+# else /* DEPRECATED_SCANF */
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vfscanfieee128, __nldbl_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vscanfieee128, __nldbl_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_LDBL_NTH (vsscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsscanfieee128, __nldbl_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
/* Read formatted input from S into argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg)
+ __gnuc_va_list __arg)
__attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
/* Read formatted input from stdin into argument list ARG.
@@ -469,42 +573,11 @@ extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
/* Read formatted input from S into argument list ARG. */
extern int vsscanf (const char *__restrict __s,
- const char *__restrict __format, __gnuc_va_list __arg)
+ const char *__restrict __format, __gnuc_va_list __arg)
__THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
-
-/* Same redirection as above for the v*scanf family. */
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __REDIRECT && !defined __LDBL_COMPAT \
- && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-extern int __REDIRECT (vfscanf,
- (FILE *__restrict __s,
- const char *__restrict __format, __gnuc_va_list __arg),
- __isoc99_vfscanf)
- __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
-extern int __REDIRECT (vscanf, (const char *__restrict __format,
- __gnuc_va_list __arg), __isoc99_vscanf)
- __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
-extern int __REDIRECT_NTH (vsscanf,
- (const char *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg), __isoc99_vsscanf)
- __attribute__ ((__format__ (__scanf__, 2, 0)));
-# elif !defined __REDIRECT
-extern int __isoc99_vfscanf (FILE *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg) __wur;
-extern int __isoc99_vscanf (const char *__restrict __format,
- __gnuc_va_list __arg) __wur;
-extern int __isoc99_vsscanf (const char *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg) __THROW;
-# define vfscanf __isoc99_vfscanf
-# define vscanf __isoc99_vscanf
-# define vsscanf __isoc99_vsscanf
# endif
# endif
-#endif /* Use ISO C9x. */
-
+#endif /* __USE_ISOC99 */
/* Read a character from STREAM.
@@ -850,13 +923,17 @@ extern char *cuserid (char *__s)
struct obstack; /* See <obstack.h>. */
/* Write formatted output to an obstack. */
-extern int obstack_printf (struct obstack *__restrict __obstack,
- const char *__restrict __format, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3)));
-extern int obstack_vprintf (struct obstack *__restrict __obstack,
- const char *__restrict __format,
- __gnuc_va_list __args)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 0)));
+extern int __REDIRECT_LDBL_NTHNL (obstack_printf,
+ (struct obstack *__restrict __obstack,
+ const char *__restrict __format, ...),
+ __obstack_printfieee128, __nldbl_obstack_printf)
+ __attribute__ ((__format__ (__printf__, 2, 3)));
+extern int __REDIRECT_LDBL_NTHNL (obstack_vprintf,
+ (struct obstack *__restrict __obstack,
+ const char *__restrict __format,
+ __gnuc_va_list __args),
+ __obstack_vprintfieee128, __nldbl_obstack_vprintf)
+ __attribute__ ((__format__ (__printf__, 2, 0)));
#endif /* Use GNU. */
@@ -894,11 +971,6 @@ extern int __overflow (FILE *, int);
# include <bits/stdio2.h>
#endif
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/stdio-ldbl.h>
-#endif
-
__END_DECLS
#endif /* <stdio.h> included. */
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index 0299fe99a7..e1f68bddfb 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -17,6 +17,7 @@
not, see <https://www.gnu.org/licenses/>. */
#define __mremap mremap
+#define __fprintf fprintf
#include "malloc.c"
/* When memory is tagged, the checking data is stored in the user part
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 09e5ff2bce..aa35846e55 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5279,9 +5279,9 @@ __malloc_stats (void)
memset (&mi, 0, sizeof (mi));
__libc_lock_lock (ar_ptr->mutex);
int_mallinfo (ar_ptr, &mi);
- fprintf (stderr, "Arena %d:\n", i);
- fprintf (stderr, "system bytes = %10u\n", (unsigned int) mi.arena);
- fprintf (stderr, "in use bytes = %10u\n", (unsigned int) mi.uordblks);
+ __fprintf (stderr, "Arena %d:\n", i);
+ __fprintf (stderr, "system bytes = %10u\n", (unsigned int) mi.arena);
+ __fprintf (stderr, "in use bytes = %10u\n", (unsigned int) mi.uordblks);
#if MALLOC_DEBUG > 1
if (i > 0)
dump_heap (heap_for_ptr (top (ar_ptr)));
@@ -5293,12 +5293,12 @@ __malloc_stats (void)
if (ar_ptr == &main_arena)
break;
}
- fprintf (stderr, "Total (incl. mmap):\n");
- fprintf (stderr, "system bytes = %10u\n", system_b);
- fprintf (stderr, "in use bytes = %10u\n", in_use_b);
- fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps);
- fprintf (stderr, "max mmap bytes = %10lu\n",
- (unsigned long) mp_.max_mmapped_mem);
+ __fprintf (stderr, "Total (incl. mmap):\n");
+ __fprintf (stderr, "system bytes = %10u\n", system_b);
+ __fprintf (stderr, "in use bytes = %10u\n", in_use_b);
+ __fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps);
+ __fprintf (stderr, "max mmap bytes = %10lu\n",
+ (unsigned long) mp_.max_mmapped_mem);
stderr->_flags2 = old_flags2;
_IO_funlockfile (stderr);
}
@@ -5728,7 +5728,7 @@ __malloc_info (int options, FILE *fp)
mstate ar_ptr = &main_arena;
do
{
- fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
+ __fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
size_t nblocks = 0;
size_t nfastblocks = 0;
@@ -5839,12 +5839,12 @@ __malloc_info (int options, FILE *fp)
for (size_t i = 0; i < nsizes; ++i)
if (sizes[i].count != 0 && i != NFASTBINS)
- fprintf (fp, "\
+ __fprintf (fp, "\
<size from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
sizes[i].from, sizes[i].to, sizes[i].total, sizes[i].count);
if (sizes[NFASTBINS].count != 0)
- fprintf (fp, "\
+ __fprintf (fp, "\
<unsorted from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
sizes[NFASTBINS].from, sizes[NFASTBINS].to,
sizes[NFASTBINS].total, sizes[NFASTBINS].count);
@@ -5852,7 +5852,7 @@ __malloc_info (int options, FILE *fp)
total_system += ar_ptr->system_mem;
total_max_system += ar_ptr->max_system_mem;
- fprintf (fp,
+ __fprintf (fp,
"</sizes>\n<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
"<system type=\"current\" size=\"%zu\"/>\n"
@@ -5862,7 +5862,7 @@ __malloc_info (int options, FILE *fp)
if (ar_ptr != &main_arena)
{
- fprintf (fp,
+ __fprintf (fp,
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n"
"<aspace type=\"subheaps\" size=\"%zu\"/>\n",
@@ -5872,7 +5872,7 @@ __malloc_info (int options, FILE *fp)
}
else
{
- fprintf (fp,
+ __fprintf (fp,
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n",
ar_ptr->system_mem, ar_ptr->system_mem);
@@ -5885,7 +5885,7 @@ __malloc_info (int options, FILE *fp)
}
while (ar_ptr != &main_arena);
- fprintf (fp,
+ __fprintf (fp,
"<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"mmap\" count=\"%d\" size=\"%zu\"/>\n"
diff --git a/misc/efgcvt-template.c b/misc/efgcvt-template.c
index 87a90e78d4..f1630fd780 100644
--- a/misc/efgcvt-template.c
+++ b/misc/efgcvt-template.c
@@ -24,7 +24,7 @@
#include <math_ldbl_opt.h>
#ifndef SPRINTF
-# define SPRINTF sprintf
+# define SPRINTF __sprintf
#endif
#define APPEND(a, b) APPEND2 (a, b)
diff --git a/misc/mntent_r.c b/misc/mntent_r.c
index 3311ba0b50..65f29b97e9 100644
--- a/misc/mntent_r.c
+++ b/misc/mntent_r.c
@@ -251,7 +251,7 @@ __addmntent (FILE *stream, const struct mntent *mnt)
write_string (stream, mnt->mnt_dir);
write_string (stream, mnt->mnt_type);
write_string (stream, mnt->mnt_opts);
- fprintf (stream, "%d %d\n", mnt->mnt_freq, mnt->mnt_passno);
+ __fprintf (stream, "%d %d\n", mnt->mnt_freq, mnt->mnt_passno);
ret = __ferror_unlocked (stream) != 0 || fflush (stream) != 0;
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index f525f67547..e7f8952caa 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -560,6 +560,54 @@
# include <bits/long-double.h>
#endif
+#if (defined __GNUC__ && __GNUC__ >= 2) || (__clang_major__ >= 4)
+# define __REDIRECT_LDBL1(name, prenth, posnth, proto, alias) \
+ name proto prenth __asm__ (__ASMNAME (__ASMNAME (#alias))) posnth
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+# ifdef __REDIRECT
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , , proto, ieee128)
+# ifdef __cplusplus
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROW, , proto, ieee128)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROWNL, , proto, ieee128)
+# else
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROW, proto, ieee128)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROWNL, proto, ieee128)
+# endif /* __cplusplus */
+# else
+_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
+# endif /* __REDIRECT */
+# elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
+# ifdef __REDIRECT
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , , proto, compat)
+# ifdef __cplusplus
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROW, , proto, compat)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROWNL, , proto, compat)
+# else
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROW, proto, compat)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROWNL, proto, compat)
+# endif /* __cplusplus */
+# else
+_Static_assert (0, "Compat long double requires redirection on this platform");
+# endif /* __REDIRECT */
+# endif
+#endif
+
+#ifndef __REDIRECT_LDBL
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) name proto
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) name proto __THROW
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) name proto __THROWNL
+#endif
+
#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
# ifdef __REDIRECT
@@ -583,10 +631,6 @@
# define __REDIRECT_NTH_LDBL(name, proto, alias) \
__LDBL_REDIR1_NTH (name, proto, __##alias##ieee128)
-/* Unused. */
-# define __REDIRECT_LDBL(name, proto, alias) ... unused__redirect_ldbl
-# define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth
-
# else
_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
# endif
@@ -605,24 +649,6 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf
extern __typeof (name) name __asm (__ASMNAME (#alias));
# define __LDBL_REDIR_DECL(name) \
extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name));
-# define __REDIRECT_LDBL(name, proto, alias) \
- __LDBL_REDIR1 (name, proto, __nldbl_##alias)
-# define __REDIRECT_NTH_LDBL(name, proto, alias) \
- __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias)
-# endif
-#endif
-#if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \
- || !defined __REDIRECT
-# define __LDBL_REDIR1(name, proto, alias) name proto
-# define __LDBL_REDIR(name, proto) name proto
-# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW
-# define __LDBL_REDIR_NTH(name, proto) name proto __THROW
-# define __LDBL_REDIR2_DECL(name)
-# define __LDBL_REDIR_DECL(name)
-# ifdef __REDIRECT
-# define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias)
-# define __REDIRECT_NTH_LDBL(name, proto, alias) \
- __REDIRECT_NTH (name, proto, alias)
# endif
#endif
diff --git a/nis/nis_subr.c b/nis/nis_subr.c
index 385f221062..0e02cd19b5 100644
--- a/nis/nis_subr.c
+++ b/nis/nis_subr.c
@@ -280,10 +280,10 @@ nis_getnames (const_nis_name name)
}
if (pos == 0
- && __asprintf (&getnames[pos++], "%s%s%s%s",
- name, name[name_len - 1] == '.' ? "" : ".",
- local_domain,
- local_domain[local_domain_len - 1] == '.' ? "" : ".") < 0)
+ && asprintf (&getnames[pos++], "%s%s%s%s",
+ name, name[name_len - 1] == '.' ? "" : ".",
+ local_domain,
+ local_domain[local_domain_len - 1] == '.' ? "" : ".") < 0)
goto free_null;
getnames[pos] = NULL;
diff --git a/nptl/pthread_getname.c b/nptl/pthread_getname.c
index ebec06e23f..a424b3e4f8 100644
--- a/nptl/pthread_getname.c
+++ b/nptl/pthread_getname.c
@@ -42,7 +42,7 @@ __pthread_getname_np (pthread_t th, char *buf, size_t len)
#define FMT "/proc/self/task/%u/comm"
char fname[sizeof (FMT) + 8];
- sprintf (fname, FMT, (unsigned int) pd->tid);
+ __sprintf (fname, FMT, (unsigned int) pd->tid);
int fd = __open64_nocancel (fname, O_RDONLY);
if (fd == -1)
diff --git a/nptl/pthread_setname.c b/nptl/pthread_setname.c
index f24560db47..8520bac4be 100644
--- a/nptl/pthread_setname.c
+++ b/nptl/pthread_setname.c
@@ -44,7 +44,7 @@ __pthread_setname_np (pthread_t th, const char *name)
#define FMT "/proc/self/task/%u/comm"
char fname[sizeof (FMT) + 8];
- sprintf (fname, FMT, (unsigned int) pd->tid);
+ __sprintf (fname, FMT, (unsigned int) pd->tid);
int fd = __open64_nocancel (fname, O_RDWR);
if (fd == -1)
diff --git a/pwd/getpw.c b/pwd/getpw.c
index 547489a863..4784eaf00b 100644
--- a/pwd/getpw.c
+++ b/pwd/getpw.c
@@ -50,9 +50,9 @@ __getpw (__uid_t uid, char *buf)
if (p == NULL)
return -1;
- if (sprintf (buf, "%s:%s:%lu:%lu:%s:%s:%s", p->pw_name, p->pw_passwd,
- (unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
- p->pw_gecos, p->pw_dir, p->pw_shell) < 0)
+ if (__sprintf (buf, "%s:%s:%lu:%lu:%s:%s:%s", p->pw_name, p->pw_passwd,
+ (unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
+ p->pw_gecos, p->pw_dir, p->pw_shell) < 0)
return -1;
return 0;
diff --git a/pwd/putpwent.c b/pwd/putpwent.c
index e3f2f4e09e..480dd59813 100644
--- a/pwd/putpwent.c
+++ b/pwd/putpwent.c
@@ -48,11 +48,11 @@ putpwent (const struct passwd *p, FILE *stream)
return -1;
if (p->pw_name[0] == '+' || p->pw_name[0] == '-')
- ret = fprintf (stream, "%s:%s:::%s:%s:%s\n",
+ ret = __fprintf (stream, "%s:%s:::%s:%s:%s\n",
p->pw_name, _S (p->pw_passwd),
gecos, _S (p->pw_dir), _S (p->pw_shell));
else
- ret = fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
+ ret = __fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
p->pw_name, _S (p->pw_passwd),
(unsigned long int) p->pw_uid,
(unsigned long int) p->pw_gid,
diff --git a/resolv/inet_ntop.c b/resolv/inet_ntop.c
index c4d38c0f95..53725d805a 100644
--- a/resolv/inet_ntop.c
+++ b/resolv/inet_ntop.c
@@ -28,9 +28,9 @@
#include <string.h>
#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
+# define SPRINTF(x) strlen(__sprintf/**/x)
#else
-# define SPRINTF(x) ((size_t)sprintf x)
+# define SPRINTF(x) ((size_t)__sprintf x)
#endif
/*
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index 913a5cb82f..06a91b23ca 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -507,8 +507,8 @@ _nss_dns_gethostbyaddr2_r (const void *addr, socklen_t len, int af,
switch (af)
{
case AF_INET:
- sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", (uaddr[3] & 0xff),
- (uaddr[2] & 0xff), (uaddr[1] & 0xff), (uaddr[0] & 0xff));
+ __sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", (uaddr[3] & 0xff),
+ (uaddr[2] & 0xff), (uaddr[1] & 0xff), (uaddr[0] & 0xff));
break;
case AF_INET6:
qp = qbuf;
diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
index 09cd917444..304ae35b8b 100644
--- a/resolv/nss_dns/dns-network.c
+++ b/resolv/nss_dns/dns-network.c
@@ -191,21 +191,21 @@ _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result,
{
case 3:
/* Class A network. */
- sprintf (qbuf, "0.0.0.%u.in-addr.arpa", net_bytes[3]);
+ __sprintf (qbuf, "0.0.0.%u.in-addr.arpa", net_bytes[3]);
break;
case 2:
/* Class B network. */
- sprintf (qbuf, "0.0.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2]);
+ __sprintf (qbuf, "0.0.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2]);
break;
case 1:
/* Class C network. */
- sprintf (qbuf, "0.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
- net_bytes[1]);
+ __sprintf (qbuf, "0.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
+ net_bytes[1]);
break;
case 0:
/* Class D - E network. */
- sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
- net_bytes[1], net_bytes[0]);
+ __sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
+ net_bytes[1], net_bytes[0]);
break;
}
diff --git a/shadow/putspent.c b/shadow/putspent.c
index cbbb840d5b..d675e28210 100644
--- a/shadow/putspent.c
+++ b/shadow/putspent.c
@@ -42,47 +42,47 @@ putspent (const struct spwd *p, FILE *stream)
flockfile (stream);
- if (fprintf (stream, "%s:%s:", p->sp_namp, _S (p->sp_pwdp)) < 0)
+ if (__fprintf (stream, "%s:%s:", p->sp_namp, _S (p->sp_pwdp)) < 0)
++errors;
if ((p->sp_lstchg != (long int) -1
- && fprintf (stream, "%ld:", p->sp_lstchg) < 0)
+ && __fprintf (stream, "%ld:", p->sp_lstchg) < 0)
|| (p->sp_lstchg == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_min != (long int) -1
- && fprintf (stream, "%ld:", p->sp_min) < 0)
+ && __fprintf (stream, "%ld:", p->sp_min) < 0)
|| (p->sp_min == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_max != (long int) -1
- && fprintf (stream, "%ld:", p->sp_max) < 0)
+ && __fprintf (stream, "%ld:", p->sp_max) < 0)
|| (p->sp_max == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_warn != (long int) -1
- && fprintf (stream, "%ld:", p->sp_warn) < 0)
+ && __fprintf (stream, "%ld:", p->sp_warn) < 0)
|| (p->sp_warn == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_inact != (long int) -1
- && fprintf (stream, "%ld:", p->sp_inact) < 0)
+ && __fprintf (stream, "%ld:", p->sp_inact) < 0)
|| (p->sp_inact == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_expire != (long int) -1
- && fprintf (stream, "%ld:", p->sp_expire) < 0)
+ && __fprintf (stream, "%ld:", p->sp_expire) < 0)
|| (p->sp_expire == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if (p->sp_flag != ~0ul
- && fprintf (stream, "%ld", p->sp_flag) < 0)
+ && __fprintf (stream, "%ld", p->sp_flag) < 0)
++errors;
if (putc_unlocked ('\n', stream) == EOF)
diff --git a/stdio-common/dprintf.c b/stdio-common/dprintf.c
index 2e26d59714..6fbe5d4862 100644
--- a/stdio-common/dprintf.c
+++ b/stdio-common/dprintf.c
@@ -33,5 +33,4 @@ __dprintf (int d, const char *format, ...)
return done;
}
libc_hidden_def (__dprintf)
-ldbl_hidden_def (__dprintf, dprintf)
ldbl_weak_alias (__dprintf, dprintf)
diff --git a/stdio-common/fprintf.c b/stdio-common/fprintf.c
index 8d2cd37433..af7190c5b4 100644
--- a/stdio-common/fprintf.c
+++ b/stdio-common/fprintf.c
@@ -34,7 +34,7 @@ __fprintf (FILE *stream, const char *format, ...)
return done;
}
-ldbl_hidden_def (__fprintf, fprintf)
+libc_hidden_def (__fprintf)
ldbl_strong_alias (__fprintf, fprintf)
/* We define the function with the real name here. But deep down in
diff --git a/stdio-common/psiginfo.c b/stdio-common/psiginfo.c
index adf3b71b77..f99c51da17 100644
--- a/stdio-common/psiginfo.c
+++ b/stdio-common/psiginfo.c
@@ -76,7 +76,7 @@ psiginfo (const siginfo_t *pinfo, const char *s)
}
if (s != NULL && *s != '\0')
- fprintf (fp, "%s: ", s);
+ __fprintf (fp, "%s: ", s);
const char *desc;
if (pinfo->si_signo >= 0 && pinfo->si_signo < NSIG
@@ -92,21 +92,21 @@ psiginfo (const siginfo_t *pinfo, const char *s)
if (pinfo->si_signo - SIGRTMIN < SIGRTMAX - pinfo->si_signo)
{
if (pinfo->si_signo == SIGRTMIN)
- fprintf (fp, "SIGRTMIN (");
+ __fprintf (fp, "SIGRTMIN (");
else
- fprintf (fp, "SIGRTMIN+%d (", pinfo->si_signo - SIGRTMIN);
+ __fprintf (fp, "SIGRTMIN+%d (", pinfo->si_signo - SIGRTMIN);
}
else
{
if (pinfo->si_signo == SIGRTMAX)
- fprintf (fp, "SIGRTMAX (");
+ __fprintf (fp, "SIGRTMAX (");
else
- fprintf (fp, "SIGRTMAX-%d (", SIGRTMAX - pinfo->si_signo);
+ __fprintf (fp, "SIGRTMAX-%d (", SIGRTMAX - pinfo->si_signo);
}
}
else
#endif
- fprintf (fp, "%s (", _(desc));
+ __fprintf (fp, "%s (", _(desc));
const char *base = NULL;
const uint8_t *offarr = NULL;
@@ -178,25 +178,25 @@ Signal generated by the completion of an I/O request");
}
if (str != NULL)
- fprintf (fp, "%s ", _(str));
+ __fprintf (fp, "%s ", _(str));
else
- fprintf (fp, "%d ", pinfo->si_code);
+ __fprintf (fp, "%d ", pinfo->si_code);
if (pinfo->si_signo == SIGILL || pinfo->si_signo == SIGFPE
|| pinfo->si_signo == SIGSEGV || pinfo->si_signo == SIGBUS)
- fprintf (fp, "[%p])\n", pinfo->si_addr);
+ __fprintf (fp, "[%p])\n", pinfo->si_addr);
else if (pinfo->si_signo == SIGCHLD)
- fprintf (fp, "%ld %d %ld)\n",
- (long int) pinfo->si_pid, pinfo->si_status,
- (long int) pinfo->si_uid);
+ __fprintf (fp, "%ld %d %ld)\n",
+ (long int) pinfo->si_pid, pinfo->si_status,
+ (long int) pinfo->si_uid);
else if (pinfo->si_signo == SIGPOLL)
- fprintf (fp, "%ld)\n", (long int) pinfo->si_band);
+ __fprintf (fp, "%ld)\n", (long int) pinfo->si_band);
else
- fprintf (fp, "%ld %ld)\n",
- (long int) pinfo->si_pid, (long int) pinfo->si_uid);
+ __fprintf (fp, "%ld %ld)\n",
+ (long int) pinfo->si_pid, (long int) pinfo->si_uid);
}
else
- fprintf (fp, _("Unknown signal %d\n"), pinfo->si_signo);
+ __fprintf (fp, _("Unknown signal %d\n"), pinfo->si_signo);
fclose (fp);
diff --git a/stdio-common/sprintf.c b/stdio-common/sprintf.c
index a9665f753a..f1f43a49ec 100644
--- a/stdio-common/sprintf.c
+++ b/stdio-common/sprintf.c
@@ -32,6 +32,6 @@ __sprintf (char *s, const char *format, ...)
return done;
}
-ldbl_hidden_def (__sprintf, sprintf)
+libc_hidden_def (__sprintf)
ldbl_strong_alias (__sprintf, sprintf)
ldbl_strong_alias (__sprintf, _IO_sprintf)
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 7559fd239d..c5912788bd 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -24,4 +24,4 @@ __vfprintf (FILE *fp, const char *format, va_list ap)
}
ldbl_strong_alias (__vfprintf, _IO_vfprintf);
ldbl_strong_alias (__vfprintf, vfprintf);
-ldbl_hidden_def (__vfprintf, vfprintf)
+libc_hidden_def (__vfprintf)
diff --git a/sunrpc/netname.c b/sunrpc/netname.c
index bf7f0b81c4..97a881c3af 100644
--- a/sunrpc/netname.c
+++ b/sunrpc/netname.c
@@ -48,7 +48,7 @@ user2netname (char netname[MAXNETNAMELEN + 1], const uid_t uid,
if ((strlen (dfltdom) + OPSYS_LEN + 3 + MAXIPRINT) > (size_t) MAXNETNAMELEN)
return 0;
- sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
+ __sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
i = strlen (netname);
if (netname[i - 1] == '.')
netname[i - 1] = '\0';
@@ -112,7 +112,7 @@ host2netname (char netname[MAXNETNAMELEN + 1], const char *host,
> MAXNETNAMELEN)
return 0;
- sprintf (netname, "%s.%s@%s", OPSYS, hostname, domainname);
+ __sprintf (netname, "%s.%s@%s", OPSYS, hostname, domainname);
return 1;
}
#ifdef EXPORT_RPC_SYMBOLS
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
index f683836678..59f6e31d2d 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128___asprintf (char **string_ptr, const char *format, ...)
+int
+__asprintfieee128 (char **string_ptr, const char *format, ...)
{
va_list ap;
int done;
@@ -32,5 +32,4 @@ ___ieee128___asprintf (char **string_ptr, const char *format, ...)
return done;
}
-hidden_def (___ieee128___asprintf)
-strong_alias (___ieee128___asprintf, __asprintfieee128)
+libc_hidden_def (__asprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
index cf3b46c37a..ceba219dc7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_dprintf (int d, const char *format, ...)
+int
+__dprintfieee128 (int d, const char *format, ...)
{
va_list ap;
int done;
@@ -31,5 +31,4 @@ ___ieee128_dprintf (int d, const char *format, ...)
return done;
}
-strong_alias (___ieee128_dprintf, __dprintfieee128)
-hidden_def (___ieee128_dprintf);
+libc_hidden_def (__dprintfieee128);
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
index 4462588675..b58f27afb7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_fprintf (FILE *fp, const char *format, ...)
+int
+__fprintfieee128 (FILE *fp, const char *format, ...)
{
va_list ap;
int done;
@@ -31,5 +31,4 @@ ___ieee128_fprintf (FILE *fp, const char *format, ...)
return done;
}
-strong_alias (___ieee128_fprintf, __fprintfieee128)
-hidden_def (___ieee128_fprintf)
+libc_hidden_def (__fprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
index 9703069b95..243eb65629 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
@@ -18,8 +18,8 @@
/* When in IEEE long double mode, call ___ieee128_sprintf. */
#include <stdio.h>
-typeof (sprintf) ___ieee128_sprintf attribute_hidden;
-#define SPRINTF ___ieee128_sprintf
+typeof (sprintf) __sprintfieee128 attribute_hidden;
+#define SPRINTF __sprintfieee128
/* Declare internal functions: ___qecvtieee128_r and ___qfcvtieee128_r,
built from a different compiling unit, and called from here. */
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
index 0be5bb2810..8046f5fd46 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
@@ -18,8 +18,8 @@
/* When in IEEE long double mode, call ___ieee128_snprintf. */
#include <stdio.h>
-typeof (snprintf) ___ieee128_snprintf attribute_hidden;
-#define SNPRINTF ___ieee128_snprintf
+typeof (snprintf) __snprintfieee128 attribute_hidden;
+#define SNPRINTF __snprintfieee128
#define ECVT_R __qecvtieee128_r
#define FCVT_R __qfcvtieee128_r
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
index 5f51b3ec9e..da3d9441d7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_snprintf (char *s, size_t maxlen, const char *format, ...)
+int
+__snprintfieee128 (char *s, size_t maxlen, const char *format, ...)
{
va_list ap;
int done;
@@ -32,4 +32,4 @@ ___ieee128_snprintf (char *s, size_t maxlen, const char *format, ...)
return done;
}
-strong_alias (___ieee128_snprintf, __snprintfieee128)
+libc_hidden_def (__snprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
index 0cad130788..007a71659a 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_sprintf (char *s, const char *format, ...)
+int
+__sprintfieee128 (char *s, const char *format, ...)
{
va_list ap;
int done;
@@ -32,5 +32,4 @@ ___ieee128_sprintf (char *s, const char *format, ...)
return done;
}
-strong_alias (___ieee128_sprintf, __sprintfieee128)
-hidden_def (___ieee128_sprintf)
+libc_hidden_def (__sprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
index e340c9b457..4df1e485a5 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
@@ -18,10 +18,9 @@
#include <libio/libioP.h>
-extern int
-___ieee128_vfprintf (FILE *fp, const char *format, va_list ap)
+int
+__vfprintfieee128 (FILE *fp, const char *format, va_list ap)
{
return __vfprintf_internal (fp, format, ap, PRINTF_LDBL_USES_FLOAT128);
}
-strong_alias (___ieee128_vfprintf, __vfprintfieee128)
-hidden_def (___ieee128_vfprintf)
+libc_hidden_def (__vfprintfieee128)
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
index ebd2a43951..5b167d45ff 100644
--- a/sysdeps/posix/tempname.c
+++ b/sysdeps/posix/tempname.c
@@ -161,7 +161,7 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
return -1;
}
- sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
+ __sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
return 0;
}
#endif /* _LIBC */
diff --git a/sysdeps/unix/sysv/linux/ia64/makecontext.c b/sysdeps/unix/sysv/linux/ia64/makecontext.c
index 0bc4211dfc..0cf05d5999 100644
--- a/sysdeps/unix/sysv/linux/ia64/makecontext.c
+++ b/sysdeps/unix/sysv/linux/ia64/makecontext.c
@@ -54,7 +54,7 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
if (argc > 8)
{
- fprintf (stderr, _("\
+ __fprintf (stderr, _("\
makecontext: does not know how to handle more than 8 arguments\n"));
exit (-1);
}
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index 0e017f458b..f2dca7711a 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -233,10 +233,13 @@ extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
const wchar_t *__restrict __format, ...)
__THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
-extern int __REDIRECT_NTH_LDBL (__swprintf_alias,
- (wchar_t *__restrict __s, size_t __n,
- const wchar_t *__restrict __fmt, ...),
- swprintf);
+extern int __swprintf_alias (wchar_t *__restrict __s, size_t __n,
+ const wchar_t *__restrict __fmt, ...)
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+ __asm__ (__ASMNAME ("swprintf"))
+#endif
+ ;
+
#ifdef __va_arg_pack
__fortify_function int
@@ -264,10 +267,13 @@ extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
__gnuc_va_list __arg)
__THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-extern int __REDIRECT_NTH_LDBL (__vswprintf_alias,
- (wchar_t *__restrict __s, size_t __n,
- const wchar_t *__restrict __fmt,
- __gnuc_va_list __ap), vswprintf);
+extern int __vswprintf_alias (wchar_t *__restrict __s, size_t __n,
+ const wchar_t *__restrict __fmt,
+ __gnuc_va_list __ap)
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+ __asm__ (__ASMNAME ("vswprintf"))
+#endif
+ ;
__fortify_function int
__NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
^ permalink raw reply [flat|nested] 14+ messages in thread
* [glibc/azanella/clang] Remove stdio-ldbl.h
@ 2022-05-13 14:16 Adhemerval Zanella
0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-05-13 14:16 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f6c8bfb40927f815e8d37c41d9ab68b61c7ddc3e
commit f6c8bfb40927f815e8d37c41d9ab68b61c7ddc3e
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Thu Feb 24 14:13:12 2022 -0300
Remove stdio-ldbl.h
The functions which require different alias to long double depending
of the ABI now uses a set os macros that defines the expected alias
on the function prototype, instead of redefine them using the
__LDBL_REDIR_DEC macros.
The __REDIRECT_LDBL, __REDIRECT_LDBL_NTH, __REDIRECT_LDBL_NTHNL
are refactores to be similar to __REDIRECT with the difference it
now expects the aliases for binary128 and for the long double being
double (which __LDBL_REDIR_DEC does).
All printf internal usage are also replaced to use internal alias
instead.
Diff:
---
argp/argp-parse.c | 4 +-
debug/backtracesyms.c | 18 +-
grp/putgrent.c | 6 +-
gshadow/putsgent.c | 6 +-
include/bits/stdio-ldbl.h | 1 -
include/stdio.h | 34 ++-
inet/ether_ntoa_r.c | 8 +-
inet/rexec.c | 2 +-
libio/Makefile | 2 +-
libio/bits/stdio-ldbl.h | 108 --------
libio/bits/stdio2.h | 115 ++++++---
libio/stdio.h | 286 +++++++++++++--------
malloc/malloc-check.c | 1 +
malloc/malloc.c | 32 +--
misc/efgcvt-template.c | 2 +-
misc/mntent_r.c | 2 +-
misc/sys/cdefs.h | 70 +++--
nis/nis_subr.c | 8 +-
nptl/pthread_getname.c | 2 +-
nptl/pthread_setname.c | 2 +-
pwd/getpw.c | 6 +-
pwd/putpwent.c | 4 +-
resolv/inet_ntop.c | 4 +-
resolv/nss_dns/dns-host.c | 4 +-
resolv/nss_dns/dns-network.c | 12 +-
shadow/putspent.c | 16 +-
stdio-common/dprintf.c | 1 -
stdio-common/fprintf.c | 2 +-
stdio-common/psiginfo.c | 32 +--
stdio-common/sprintf.c | 2 +-
stdio-common/vfprintf.c | 2 +-
sunrpc/netname.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-asprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-dprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-fprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-snprintf.c | 6 +-
.../ieee754/ldbl-128ibm-compat/ieee128-sprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c | 7 +-
sysdeps/posix/tempname.c | 2 +-
sysdeps/unix/sysv/linux/ia64/makecontext.c | 2 +-
wcsmbs/bits/wchar2.h | 22 +-
43 files changed, 448 insertions(+), 425 deletions(-)
diff --git a/argp/argp-parse.c b/argp/argp-parse.c
index 13cd84dd33..c26c0fc27f 100644
--- a/argp/argp-parse.c
+++ b/argp/argp-parse.c
@@ -177,7 +177,7 @@ argp_version_parser (int key, char *arg, struct argp_state *state)
if (argp_program_version_hook)
(*argp_program_version_hook) (state->out_stream, state);
else if (argp_program_version)
- fprintf (state->out_stream, "%s\n", argp_program_version);
+ __fprintf (state->out_stream, "%s\n", argp_program_version);
else
__argp_error (state, dgettext (state->root_argp->argp_domain,
"(PROGRAM ERROR) No version known!?"));
@@ -618,7 +618,7 @@ parser_finalize (struct parser *parser,
{
if (!(parser->state.flags & ARGP_NO_ERRS)
&& parser->state.err_stream)
- fprintf (parser->state.err_stream,
+ __fprintf (parser->state.err_stream,
dgettext (parser->argp->argp_domain,
"%s: Too many arguments\n"),
parser->state.name);
diff --git a/debug/backtracesyms.c b/debug/backtracesyms.c
index 17e0626df8..adb939f888 100644
--- a/debug/backtracesyms.c
+++ b/debug/backtracesyms.c
@@ -83,10 +83,10 @@ __backtrace_symbols (void *const *array, int size)
info[cnt].dli_saddr = info[cnt].dli_fbase;
if (info[cnt].dli_sname == NULL && info[cnt].dli_saddr == 0)
- last += 1 + sprintf (last, "%s(%s) [%p]",
- info[cnt].dli_fname ?: "",
- info[cnt].dli_sname ?: "",
- array[cnt]);
+ last += 1 + __sprintf (last, "%s(%s) [%p]",
+ info[cnt].dli_fname ?: "",
+ info[cnt].dli_sname ?: "",
+ array[cnt]);
else
{
char sign;
@@ -102,14 +102,14 @@ __backtrace_symbols (void *const *array, int size)
offset = info[cnt].dli_saddr - array[cnt];
}
- last += 1 + sprintf (last, "%s(%s%c%#tx) [%p]",
- info[cnt].dli_fname ?: "",
- info[cnt].dli_sname ?: "",
- sign, offset, array[cnt]);
+ last += 1 + __sprintf (last, "%s(%s%c%#tx) [%p]",
+ info[cnt].dli_fname ?: "",
+ info[cnt].dli_sname ?: "",
+ sign, offset, array[cnt]);
}
}
else
- last += 1 + sprintf (last, "[%p]", array[cnt]);
+ last += 1 + __sprintf (last, "[%p]", array[cnt]);
}
assert (last <= (char *) result + size * sizeof (char *) + total);
}
diff --git a/grp/putgrent.c b/grp/putgrent.c
index 966ba2a763..305ff44359 100644
--- a/grp/putgrent.c
+++ b/grp/putgrent.c
@@ -45,10 +45,10 @@ putgrent (const struct group *gr, FILE *stream)
flockfile (stream);
if (gr->gr_name[0] == '+' || gr->gr_name[0] == '-')
- retval = fprintf (stream, "%s:%s::",
+ retval = __fprintf (stream, "%s:%s::",
gr->gr_name, _S (gr->gr_passwd));
else
- retval = fprintf (stream, "%s:%s:%lu:",
+ retval = __fprintf (stream, "%s:%s:%lu:",
gr->gr_name, _S (gr->gr_passwd),
(unsigned long int) gr->gr_gid);
if (__builtin_expect (retval, 0) < 0)
@@ -60,7 +60,7 @@ putgrent (const struct group *gr, FILE *stream)
if (gr->gr_mem != NULL)
{
for (size_t i = 0; gr->gr_mem[i] != NULL; i++)
- if (fprintf (stream, i == 0 ? "%s" : ",%s", gr->gr_mem[i]) < 0)
+ if (__fprintf (stream, i == 0 ? "%s" : ",%s", gr->gr_mem[i]) < 0)
{
/* What else can we do? */
funlockfile (stream);
diff --git a/gshadow/putsgent.c b/gshadow/putsgent.c
index 9e2dca7eaf..870438de6d 100644
--- a/gshadow/putsgent.c
+++ b/gshadow/putsgent.c
@@ -42,7 +42,7 @@ putsgent (const struct sgrp *g, FILE *stream)
_IO_flockfile (stream);
- if (fprintf (stream, "%s:%s:", g->sg_namp, _S (g->sg_passwd)) < 0)
+ if (__fprintf (stream, "%s:%s:", g->sg_namp, _S (g->sg_passwd)) < 0)
++errors;
bool first = true;
@@ -50,7 +50,7 @@ putsgent (const struct sgrp *g, FILE *stream)
if (sp != NULL)
while (*sp != NULL)
{
- if (fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
+ if (__fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
{
++errors;
break;
@@ -65,7 +65,7 @@ putsgent (const struct sgrp *g, FILE *stream)
if (sp != NULL)
while (*sp != NULL)
{
- if (fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
+ if (__fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
{
++errors;
break;
diff --git a/include/bits/stdio-ldbl.h b/include/bits/stdio-ldbl.h
deleted file mode 100644
index 1f7d3ce1c6..0000000000
--- a/include/bits/stdio-ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <libio/bits/stdio-ldbl.h>
diff --git a/include/stdio.h b/include/stdio.h
index a6f7fd43cb..39b4978130 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -22,13 +22,17 @@
/* Some libc_hidden_ldbl_proto's do not map to a unique symbol when
redirecting ldouble to _Float128 variants. We can therefore safely
directly alias them to their internal name. */
-# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc)
-# define stdio_hidden_ldbl_proto(p, f) \
- extern __typeof (p ## f) p ## f __asm (__ASMNAME ("___ieee128_" #f));
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# define stdio_hidden_ldbl_proto(p,f) __LDBL_REDIR1_DECL (p ## f, p ## f ## ieee128)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc) && defined SHARED
+# define __stdio_hidden_ldbl_proto(name, alias) \
+ extern __typeof (name) __##name __asm__ (__hidden_asmname (#alias));
+# define stdio_hidden_ldbl_proto(name) \
+ extern typeof (name) __##name##ieee128; \
+ libc_hidden_proto (__##name##ieee128); \
+ __stdio_hidden_ldbl_proto (name, __GI___##name##ieee128)
# else
-# define stdio_hidden_ldbl_proto(p,f) libc_hidden_proto (p ## f)
+# define stdio_hidden_ldbl_proto(name) \
+ extern __typeof (name) __##name; \
+ libc_hidden_proto (__##name)
# endif
/* Set the error indicator on FP. */
@@ -39,10 +43,7 @@ fseterr_unlocked (FILE *fp)
}
extern int __fcloseall (void) attribute_hidden;
-extern int __snprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, ...)
- __attribute__ ((__format__ (__printf__, 3, 4)));
-stdio_hidden_ldbl_proto (__, snprintf)
+stdio_hidden_ldbl_proto (snprintf);
extern int __vfscanf (FILE *__restrict __s,
const char *__restrict __format,
@@ -184,7 +185,7 @@ extern const size_t _sys_errlist_internal_len attribute_hidden;
extern const char *__get_errlist (int) attribute_hidden;
extern const char *__get_errname (int) attribute_hidden;
-libc_hidden_ldbl_proto (__asprintf)
+stdio_hidden_ldbl_proto (asprintf);
# if IS_IN (libc)
extern FILE *_IO_new_fopen (const char*, const char*);
@@ -206,13 +207,10 @@ extern int _IO_new_fgetpos (FILE *, __fpos_t *);
# define fgetpos(fp, posp) _IO_new_fgetpos (fp, posp)
# endif
-extern __typeof (dprintf) __dprintf
- __attribute__ ((__format__ (__printf__, 2, 3)));
-stdio_hidden_ldbl_proto (__, dprintf)
-libc_hidden_ldbl_proto (dprintf)
-libc_hidden_ldbl_proto (fprintf)
-libc_hidden_ldbl_proto (vfprintf)
-libc_hidden_ldbl_proto (sprintf)
+stdio_hidden_ldbl_proto (dprintf);
+stdio_hidden_ldbl_proto (fprintf);
+stdio_hidden_ldbl_proto (vfprintf);
+stdio_hidden_ldbl_proto (sprintf);
libc_hidden_proto (ungetc)
libc_hidden_proto (__getdelim)
libc_hidden_proto (fwrite)
diff --git a/inet/ether_ntoa_r.c b/inet/ether_ntoa_r.c
index 03011ffef6..f111e5234c 100644
--- a/inet/ether_ntoa_r.c
+++ b/inet/ether_ntoa_r.c
@@ -23,10 +23,10 @@
char *
ether_ntoa_r (const struct ether_addr *addr, char *buf)
{
- sprintf (buf, "%x:%x:%x:%x:%x:%x",
- addr->ether_addr_octet[0], addr->ether_addr_octet[1],
- addr->ether_addr_octet[2], addr->ether_addr_octet[3],
- addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
+ __sprintf (buf, "%x:%x:%x:%x:%x:%x",
+ addr->ether_addr_octet[0], addr->ether_addr_octet[1],
+ addr->ether_addr_octet[2], addr->ether_addr_octet[3],
+ addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
return buf;
}
libc_hidden_def (ether_ntoa_r)
diff --git a/inet/rexec.c b/inet/rexec.c
index 330282ac16..809475d976 100644
--- a/inet/rexec.c
+++ b/inet/rexec.c
@@ -135,7 +135,7 @@ retry:
NULL, 0, servbuff, sizeof(servbuff),
NI_NUMERICSERV))
port = (int) __strtol (servbuff, NULL, 10);
- (void) sprintf(num, "%u", port);
+ (void) __sprintf(num, "%u", port);
(void) __write(s, num, strlen(num)+1);
{ socklen_t len = sizeof (from);
s3 = TEMP_FAILURE_RETRY (accept(s2, (struct sockaddr *)&from,
diff --git a/libio/Makefile b/libio/Makefile
index e97387743f..a4830ddf42 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -23,7 +23,7 @@ subdir := libio
include ../Makeconfig
headers := stdio.h \
- bits/stdio.h bits/stdio2.h bits/stdio-ldbl.h \
+ bits/stdio.h bits/stdio2.h \
bits/types/FILE.h bits/types/__FILE.h bits/types/struct_FILE.h \
bits/types/__fpos_t.h bits/types/__fpos64_t.h \
bits/types/cookie_io_functions_t.h
diff --git a/libio/bits/stdio-ldbl.h b/libio/bits/stdio-ldbl.h
deleted file mode 100644
index 6b63394b50..0000000000
--- a/libio/bits/stdio-ldbl.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -mlong-double-64 compatibility mode for stdio functions.
- Copyright (C) 2006-2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#ifndef _STDIO_H
-# error "Never include <bits/stdio-ldbl.h> directly; use <stdio.h> instead."
-#endif
-
-__LDBL_REDIR_DECL (fprintf)
-__LDBL_REDIR_DECL (printf)
-__LDBL_REDIR_DECL (sprintf)
-__LDBL_REDIR_DECL (vfprintf)
-__LDBL_REDIR_DECL (vprintf)
-__LDBL_REDIR_DECL (vsprintf)
-#if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (fscanf, __nldbl___isoc99_fscanf)
-__LDBL_REDIR1_DECL (scanf, __nldbl___isoc99_scanf)
-__LDBL_REDIR1_DECL (sscanf, __nldbl___isoc99_sscanf)
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (fscanf, __isoc99_fscanfieee128)
-__LDBL_REDIR1_DECL (scanf, __isoc99_scanfieee128)
-__LDBL_REDIR1_DECL (sscanf, __isoc99_sscanfieee128)
-# else
-# error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-# endif
-#else
-__LDBL_REDIR_DECL (fscanf)
-__LDBL_REDIR_DECL (scanf)
-__LDBL_REDIR_DECL (sscanf)
-#endif
-
-#if defined __USE_ISOC99 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (snprintf)
-__LDBL_REDIR_DECL (vsnprintf)
-#endif
-
-#ifdef __USE_ISOC99
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (vfscanf, __nldbl___isoc99_vfscanf)
-__LDBL_REDIR1_DECL (vscanf, __nldbl___isoc99_vscanf)
-__LDBL_REDIR1_DECL (vsscanf, __nldbl___isoc99_vsscanf)
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (vfscanf, __isoc99_vfscanfieee128)
-__LDBL_REDIR1_DECL (vscanf, __isoc99_vscanfieee128)
-__LDBL_REDIR1_DECL (vsscanf, __isoc99_vsscanfieee128)
-# else
-# error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-# endif
-# else
-__LDBL_REDIR_DECL (vfscanf)
-__LDBL_REDIR_DECL (vsscanf)
-__LDBL_REDIR_DECL (vscanf)
-# endif
-#endif
-
-#ifdef __USE_XOPEN2K8
-__LDBL_REDIR_DECL (vdprintf)
-__LDBL_REDIR_DECL (dprintf)
-#endif
-
-#ifdef __USE_GNU
-__LDBL_REDIR_DECL (vasprintf)
-__LDBL_REDIR2_DECL (asprintf)
-__LDBL_REDIR_DECL (asprintf)
-__LDBL_REDIR_DECL (obstack_printf)
-__LDBL_REDIR_DECL (obstack_vprintf)
-#endif
-
-#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR2_DECL (sprintf_chk)
-__LDBL_REDIR2_DECL (vsprintf_chk)
-# if defined __USE_ISOC99 || defined __USE_UNIX98
-__LDBL_REDIR2_DECL (snprintf_chk)
-__LDBL_REDIR2_DECL (vsnprintf_chk)
-# endif
-# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR2_DECL (fprintf_chk)
-__LDBL_REDIR2_DECL (printf_chk)
-__LDBL_REDIR2_DECL (vfprintf_chk)
-__LDBL_REDIR2_DECL (vprintf_chk)
-# ifdef __USE_XOPEN2K8
-__LDBL_REDIR2_DECL (dprintf_chk)
-__LDBL_REDIR2_DECL (vdprintf_chk)
-# endif
-# ifdef __USE_GNU
-__LDBL_REDIR2_DECL (asprintf_chk)
-__LDBL_REDIR2_DECL (vasprintf_chk)
-__LDBL_REDIR2_DECL (obstack_printf_chk)
-__LDBL_REDIR2_DECL (obstack_vprintf_chk)
-# endif
-# endif
-#endif
diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h
index b0b655ee7a..de7f1f04aa 100644
--- a/libio/bits/stdio2.h
+++ b/libio/bits/stdio2.h
@@ -23,12 +23,17 @@
# error "Never include <bits/stdio2.h> directly; use <stdio.h> instead."
#endif
-extern int __sprintf_chk (char *__restrict __s, int __flag, size_t __slen,
- const char *__restrict __format, ...) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__sprintf_chk, (char *__restrict __s,
+ int __flag, size_t __slen,
+ const char *__restrict __format,
+ ...),
+ __sprintf_chkieee128, __nldbl___sprintf_chk)
__attr_access ((__write_only__, 1, 3));
-extern int __vsprintf_chk (char *__restrict __s, int __flag, size_t __slen,
- const char *__restrict __format,
- __gnuc_va_list __ap) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__vsprintf_chk, (char *__restrict __s,
+ int __flag, size_t __slen,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vsprintf_chkieee128, __nldbl___vsprintf_chk)
__attr_access ((__write_only__, 1, 3));
#ifdef __va_arg_pack
@@ -54,14 +59,19 @@ __NTH (vsprintf (char *__restrict __s, const char *__restrict __fmt,
}
#if defined __USE_ISOC99 || defined __USE_UNIX98
-
-extern int __snprintf_chk (char *__restrict __s, size_t __n, int __flag,
- size_t __slen, const char *__restrict __format,
- ...) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__snprintf_chk, (char *__restrict __s,
+ size_t __n, int __flag,
+ size_t __slen,
+ const char *__restrict __format,
+ ...),
+ __snprintf_chkieee128, __nldbl___snprintf_chk)
__attr_access ((__write_only__, 1, 2));
-extern int __vsnprintf_chk (char *__restrict __s, size_t __n, int __flag,
- size_t __slen, const char *__restrict __format,
- __gnuc_va_list __ap) __THROW;
+extern int __REDIRECT_LDBL_NTHNL (__vsnprintf_chk, (char *__restrict __s,
+ size_t __n, int __flag,
+ size_t __slen,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vsnprintf_chkieee128, __nldbl___vsnprintf_chk);
# ifdef __va_arg_pack
__fortify_function int
@@ -89,14 +99,24 @@ __NTH (vsnprintf (char *__restrict __s, size_t __n,
#endif
#if __USE_FORTIFY_LEVEL > 1
-
-extern int __fprintf_chk (FILE *__restrict __stream, int __flag,
- const char *__restrict __format, ...);
-extern int __printf_chk (int __flag, const char *__restrict __format, ...);
-extern int __vfprintf_chk (FILE *__restrict __stream, int __flag,
- const char *__restrict __format, __gnuc_va_list __ap);
-extern int __vprintf_chk (int __flag, const char *__restrict __format,
- __gnuc_va_list __ap);
+extern int __REDIRECT_LDBL (__fprintf_chk, (FILE *__restrict __stream,
+ int __flag,
+ const char *__restrict __format,
+ ...),
+ __fprintf_chkieee128, __nldbl___fprintf_chk);
+extern int __REDIRECT_LDBL (__printf_chk, (int __flag,
+ const char *__restrict __format,
+ ...),
+ __printf_chkieee128, __nldbl___printf_chk);
+extern int __REDIRECT_LDBL (__vfprintf_chk, (FILE *__restrict __stream,
+ int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vfprintf_chkieee128, __nldbl___vfprintf_chk);
+extern int __REDIRECT_LDBL (__vprintf_chk, (int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vprintf_chkieee128, __nldbl___vprintf_chk);
# ifdef __va_arg_pack
__fortify_function int
@@ -136,10 +156,15 @@ vfprintf (FILE *__restrict __stream,
}
# ifdef __USE_XOPEN2K8
-extern int __dprintf_chk (int __fd, int __flag, const char *__restrict __fmt,
- ...) __attribute__ ((__format__ (__printf__, 3, 4)));
-extern int __vdprintf_chk (int __fd, int __flag,
- const char *__restrict __fmt, __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL (__dprintf_chk, (int __fd, int __flag,
+ const char *__restrict __fmt,
+ ...),
+ __dprintf_chkieee128, __nldbl___dprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL (__vdprintf_chk, (int __fd, int __flag,
+ const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vdprintf_chkieee128, __nldbl___vdprintf_chk)
__attribute__ ((__format__ (__printf__, 3, 0)));
# ifdef __va_arg_pack
@@ -162,22 +187,32 @@ vdprintf (int __fd, const char *__restrict __fmt, __gnuc_va_list __ap)
# endif
# ifdef __USE_GNU
-
-extern int __asprintf_chk (char **__restrict __ptr, int __flag,
- const char *__restrict __fmt, ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4))) __wur;
-extern int __vasprintf_chk (char **__restrict __ptr, int __flag,
- const char *__restrict __fmt, __gnuc_va_list __arg)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
-extern int __obstack_printf_chk (struct obstack *__restrict __obstack,
- int __flag, const char *__restrict __format,
- ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
-extern int __obstack_vprintf_chk (struct obstack *__restrict __obstack,
- int __flag,
- const char *__restrict __format,
- __gnuc_va_list __args)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
+extern int __REDIRECT_LDBL_NTHNL (__asprintf_chk, (char **__restrict __ptr,
+ int __flag,
+ const char *__restrict __fmt,
+ ...),
+ __asprintf_chkieee128, __nldbl___asprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (__vasprintf_chk, (char **__restrict __ptr,
+ int __flag,
+ const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vasprintf_chkieee128, __nldbl___vasnprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (__obstack_printf_chk, (struct obstack *__restrict __obstack,
+ int __flag,
+ const char *__restrict __format,
+ ...),
+ __obstack_printf_chkieee128,
+ __nldbl___obstack_printf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL_NTHNL (__obstack_vprintf_chk, (struct obstack *__restrict __obstack,
+ int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __args),
+ __obstack_vprintf_chkieee128,
+ __nldbl___obstack_vprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
# ifdef __va_arg_pack
__fortify_function int
diff --git a/libio/stdio.h b/libio/stdio.h
index e6425341ce..54c9796a46 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -41,6 +41,7 @@ __BEGIN_DECLS
#include <bits/types/__FILE.h>
#include <bits/types/FILE.h>
#include <bits/types/struct_FILE.h>
+#include <bits/floatn.h>
#ifdef __USE_GNU
# include <bits/types/cookie_io_functions_t.h>
@@ -342,78 +343,143 @@ extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
extern void setlinebuf (FILE *__stream) __THROW;
#endif
-
/* Write formatted output to STREAM.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int fprintf (FILE *__restrict __stream,
- const char *__restrict __format, ...);
+extern int __REDIRECT_LDBL (fprintf, (FILE *__restrict __stream,
+ const char *__restrict __format, ...),
+ __fprintfieee128, __nldbl_fprintf);
/* Write formatted output to stdout.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int printf (const char *__restrict __format, ...);
+extern int __REDIRECT_LDBL (printf, (const char *__restrict __format, ...),
+ __printfieee128, __nldbl_printf);
/* Write formatted output to S. */
-extern int sprintf (char *__restrict __s,
- const char *__restrict __format, ...) __THROWNL;
+extern int __REDIRECT_LDBL_NTHNL (sprintf, (char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __sprintfieee128, __nldbl_sprintf);
/* Write formatted output to S from argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg);
+extern int __REDIRECT_LDBL (vfprintf, (FILE *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vfprintfieee128, __nldbl_vfprintf);
/* Write formatted output to stdout from argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
+extern int __REDIRECT_LDBL (vprintf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vprintfieee128, __nldbl_vprintf);
/* Write formatted output to S from argument list ARG. */
-extern int vsprintf (char *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg) __THROWNL;
+extern int __REDIRECT_LDBL_NTHNL (vsprintf, (char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsprintfieee128, __nldbl_vsprintf);
#if defined __USE_ISOC99 || defined __USE_UNIX98
/* Maximum chars of output to write in MAXLEN. */
-extern int snprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 3, 4)));
-
-extern int vsnprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, __gnuc_va_list __arg)
- __THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
+extern int __REDIRECT_LDBL_NTHNL (snprintf, (char *__restrict __s,
+ size_t __maxlen,
+ const char *__restrict __format,
+ ...),
+ __snprintfieee128, __nldbl_snprintf)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL_NTHNL (vsnprintf, (char *__restrict __s,
+ size_t __maxlen,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsnprintfieee128, __nldbl_vsnprintf)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
#endif
#if __GLIBC_USE (LIB_EXT2)
/* Write formatted output to a string dynamically allocated with `malloc'.
Store the address of the string in *PTR. */
-extern int vasprintf (char **__restrict __ptr, const char *__restrict __f,
- __gnuc_va_list __arg)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
-extern int __asprintf (char **__restrict __ptr,
- const char *__restrict __fmt, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
-extern int asprintf (char **__restrict __ptr,
- const char *__restrict __fmt, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (vasprintf, (char **__restrict __ptr,
+ const char *__restrict __f,
+ __gnuc_va_list __arg),
+ __vasprintfieee128, __nldbl_vasprintf)
+ __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (asprintf, (char **__restrict __ptr,
+ const char *__restrict __fmt,
+ ...),
+ __asprintfieee128, __nldbl_asprintf)
+ __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
#endif
#ifdef __USE_XOPEN2K8
/* Write formatted output to a file descriptor. */
-extern int vdprintf (int __fd, const char *__restrict __fmt,
- __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL (vdprintf, (int __fd, const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vdprintfieee128, __nldbl_vdprintf)
__attribute__ ((__format__ (__printf__, 2, 0)));
-extern int dprintf (int __fd, const char *__restrict __fmt, ...)
+extern int __REDIRECT_LDBL (dprintf, (int __fd, const char *__restrict __fmt,
+ ...),
+ __dprintfieee128, __nldbl_dprintf)
__attribute__ ((__format__ (__printf__, 2, 3)));
#endif
-
+#if !__GLIBC_USE (DEPRECATED_SCANF)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ ...),
+ __isoc99_fscanfieee128, __nldbl___isoc99_fscanf) __wur;
+extern int __REDIRECT_LDBL (scanf, (const char *__restrict __format,
+ ...),
+ __isoc99_scanfieee128, __nldbl___isoc99_scanf) __wur;
+extern int __REDIRECT_LDBL_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __isoc99_sscanfieee128, __nldbl___isoc99_sscanf);
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format, ...),
+ __isoc99_fscanf) __wur;
+extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
+ __isoc99_scanf) __wur;
+extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format, ...),
+ __isoc99_sscanf);
+# else
+extern int __isoc99_fscanf (FILE *__restrict __stream,
+ const char *__restrict __format, ...) __wur;
+extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
+extern int __isoc99_sscanf (const char *__restrict __s,
+ const char *__restrict __format, ...) __THROW;
+# define fscanf __isoc99_fscanf
+# define scanf __isoc99_scanf
+# define sscanf __isoc99_sscanf
+# endif /* __REDIRECT */
+# endif
+#else
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ ...),
+ __fscanfieee128, __nldbl_fscanf) __wur;
+extern int __REDIRECT_LDBL (scanf, (const char *__restrict __format,
+ ...),
+ __scanfieee128, __nldbl_scanf) __wur;
+extern int __REDIRECT_LDBL_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __sscanfieee128, __nldbl_sscanf) __wur;
+# else
/* Read formatted input from STREAM.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int fscanf (FILE *__restrict __stream,
- const char *__restrict __format, ...) __wur;
+ const char *__restrict __format, ...) __wur;
/* Read formatted input from stdin.
This function is a possible cancellation point and therefore not
@@ -421,43 +487,81 @@ extern int fscanf (FILE *__restrict __stream,
extern int scanf (const char *__restrict __format, ...) __wur;
/* Read formatted input from S. */
extern int sscanf (const char *__restrict __s,
- const char *__restrict __format, ...) __THROW;
-
-/* For historical reasons, the C99-compliant versions of the scanf
- functions are at alternative names. When __LDBL_COMPAT or
- __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
- bits/stdio-ldbl.h. */
-#include <bits/floatn.h>
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
- && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-# ifdef __REDIRECT
-extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
- const char *__restrict __format, ...),
- __isoc99_fscanf) __wur;
-extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
- __isoc99_scanf) __wur;
-extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
- const char *__restrict __format, ...),
- __isoc99_sscanf);
-# else
-extern int __isoc99_fscanf (FILE *__restrict __stream,
- const char *__restrict __format, ...) __wur;
-extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
-extern int __isoc99_sscanf (const char *__restrict __s,
- const char *__restrict __format, ...) __THROW;
-# define fscanf __isoc99_fscanf
-# define scanf __isoc99_scanf
-# define sscanf __isoc99_sscanf
+ const char *__restrict __format, ...) __THROW;
# endif
-#endif
+#endif /* DEPRECATED_SCANF */
-#ifdef __USE_ISOC99
+#ifdef __USE_ISOC99
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vfscanfieee128, __nldbl___isoc99_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vscanfieee128, __nldbl___isoc99_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_LDBL_NTH (vsscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vsscanfieee128, __nldbl___isoc99_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (vfscanf,
+ (FILE *__restrict __s,
+ const char *__restrict __format, __gnuc_va_list __arg),
+ __isoc99_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_NTH (vsscanf,
+ (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
+extern int __isoc99_vfscanf (FILE *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg) __wur;
+extern int __isoc99_vscanf (const char *__restrict __format,
+ __gnuc_va_list __arg) __wur;
+extern int __isoc99_vsscanf (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg) __THROW;
+# define vfscanf __isoc99_vfscanf
+# define vscanf __isoc99_vscanf
+# define vsscanf __isoc99_vsscanf
+# endif /* __REDIRECT */
+# endif
+# else /* DEPRECATED_SCANF */
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vfscanfieee128, __nldbl_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vscanfieee128, __nldbl_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_LDBL_NTH (vsscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsscanfieee128, __nldbl_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
/* Read formatted input from S into argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg)
+ __gnuc_va_list __arg)
__attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
/* Read formatted input from stdin into argument list ARG.
@@ -469,42 +573,11 @@ extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
/* Read formatted input from S into argument list ARG. */
extern int vsscanf (const char *__restrict __s,
- const char *__restrict __format, __gnuc_va_list __arg)
+ const char *__restrict __format, __gnuc_va_list __arg)
__THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
-
-/* Same redirection as above for the v*scanf family. */
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __REDIRECT && !defined __LDBL_COMPAT \
- && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-extern int __REDIRECT (vfscanf,
- (FILE *__restrict __s,
- const char *__restrict __format, __gnuc_va_list __arg),
- __isoc99_vfscanf)
- __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
-extern int __REDIRECT (vscanf, (const char *__restrict __format,
- __gnuc_va_list __arg), __isoc99_vscanf)
- __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
-extern int __REDIRECT_NTH (vsscanf,
- (const char *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg), __isoc99_vsscanf)
- __attribute__ ((__format__ (__scanf__, 2, 0)));
-# elif !defined __REDIRECT
-extern int __isoc99_vfscanf (FILE *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg) __wur;
-extern int __isoc99_vscanf (const char *__restrict __format,
- __gnuc_va_list __arg) __wur;
-extern int __isoc99_vsscanf (const char *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg) __THROW;
-# define vfscanf __isoc99_vfscanf
-# define vscanf __isoc99_vscanf
-# define vsscanf __isoc99_vsscanf
# endif
# endif
-#endif /* Use ISO C9x. */
-
+#endif /* __USE_ISOC99 */
/* Read a character from STREAM.
@@ -850,13 +923,17 @@ extern char *cuserid (char *__s)
struct obstack; /* See <obstack.h>. */
/* Write formatted output to an obstack. */
-extern int obstack_printf (struct obstack *__restrict __obstack,
- const char *__restrict __format, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3)));
-extern int obstack_vprintf (struct obstack *__restrict __obstack,
- const char *__restrict __format,
- __gnuc_va_list __args)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 0)));
+extern int __REDIRECT_LDBL_NTHNL (obstack_printf,
+ (struct obstack *__restrict __obstack,
+ const char *__restrict __format, ...),
+ __obstack_printfieee128, __nldbl_obstack_printf)
+ __attribute__ ((__format__ (__printf__, 2, 3)));
+extern int __REDIRECT_LDBL_NTHNL (obstack_vprintf,
+ (struct obstack *__restrict __obstack,
+ const char *__restrict __format,
+ __gnuc_va_list __args),
+ __obstack_vprintfieee128, __nldbl_obstack_vprintf)
+ __attribute__ ((__format__ (__printf__, 2, 0)));
#endif /* Use GNU. */
@@ -894,11 +971,6 @@ extern int __overflow (FILE *, int);
# include <bits/stdio2.h>
#endif
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/stdio-ldbl.h>
-#endif
-
__END_DECLS
#endif /* <stdio.h> included. */
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index 0299fe99a7..e1f68bddfb 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -17,6 +17,7 @@
not, see <https://www.gnu.org/licenses/>. */
#define __mremap mremap
+#define __fprintf fprintf
#include "malloc.c"
/* When memory is tagged, the checking data is stored in the user part
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 09e5ff2bce..aa35846e55 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5279,9 +5279,9 @@ __malloc_stats (void)
memset (&mi, 0, sizeof (mi));
__libc_lock_lock (ar_ptr->mutex);
int_mallinfo (ar_ptr, &mi);
- fprintf (stderr, "Arena %d:\n", i);
- fprintf (stderr, "system bytes = %10u\n", (unsigned int) mi.arena);
- fprintf (stderr, "in use bytes = %10u\n", (unsigned int) mi.uordblks);
+ __fprintf (stderr, "Arena %d:\n", i);
+ __fprintf (stderr, "system bytes = %10u\n", (unsigned int) mi.arena);
+ __fprintf (stderr, "in use bytes = %10u\n", (unsigned int) mi.uordblks);
#if MALLOC_DEBUG > 1
if (i > 0)
dump_heap (heap_for_ptr (top (ar_ptr)));
@@ -5293,12 +5293,12 @@ __malloc_stats (void)
if (ar_ptr == &main_arena)
break;
}
- fprintf (stderr, "Total (incl. mmap):\n");
- fprintf (stderr, "system bytes = %10u\n", system_b);
- fprintf (stderr, "in use bytes = %10u\n", in_use_b);
- fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps);
- fprintf (stderr, "max mmap bytes = %10lu\n",
- (unsigned long) mp_.max_mmapped_mem);
+ __fprintf (stderr, "Total (incl. mmap):\n");
+ __fprintf (stderr, "system bytes = %10u\n", system_b);
+ __fprintf (stderr, "in use bytes = %10u\n", in_use_b);
+ __fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps);
+ __fprintf (stderr, "max mmap bytes = %10lu\n",
+ (unsigned long) mp_.max_mmapped_mem);
stderr->_flags2 = old_flags2;
_IO_funlockfile (stderr);
}
@@ -5728,7 +5728,7 @@ __malloc_info (int options, FILE *fp)
mstate ar_ptr = &main_arena;
do
{
- fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
+ __fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
size_t nblocks = 0;
size_t nfastblocks = 0;
@@ -5839,12 +5839,12 @@ __malloc_info (int options, FILE *fp)
for (size_t i = 0; i < nsizes; ++i)
if (sizes[i].count != 0 && i != NFASTBINS)
- fprintf (fp, "\
+ __fprintf (fp, "\
<size from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
sizes[i].from, sizes[i].to, sizes[i].total, sizes[i].count);
if (sizes[NFASTBINS].count != 0)
- fprintf (fp, "\
+ __fprintf (fp, "\
<unsorted from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
sizes[NFASTBINS].from, sizes[NFASTBINS].to,
sizes[NFASTBINS].total, sizes[NFASTBINS].count);
@@ -5852,7 +5852,7 @@ __malloc_info (int options, FILE *fp)
total_system += ar_ptr->system_mem;
total_max_system += ar_ptr->max_system_mem;
- fprintf (fp,
+ __fprintf (fp,
"</sizes>\n<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
"<system type=\"current\" size=\"%zu\"/>\n"
@@ -5862,7 +5862,7 @@ __malloc_info (int options, FILE *fp)
if (ar_ptr != &main_arena)
{
- fprintf (fp,
+ __fprintf (fp,
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n"
"<aspace type=\"subheaps\" size=\"%zu\"/>\n",
@@ -5872,7 +5872,7 @@ __malloc_info (int options, FILE *fp)
}
else
{
- fprintf (fp,
+ __fprintf (fp,
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n",
ar_ptr->system_mem, ar_ptr->system_mem);
@@ -5885,7 +5885,7 @@ __malloc_info (int options, FILE *fp)
}
while (ar_ptr != &main_arena);
- fprintf (fp,
+ __fprintf (fp,
"<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"mmap\" count=\"%d\" size=\"%zu\"/>\n"
diff --git a/misc/efgcvt-template.c b/misc/efgcvt-template.c
index 87a90e78d4..f1630fd780 100644
--- a/misc/efgcvt-template.c
+++ b/misc/efgcvt-template.c
@@ -24,7 +24,7 @@
#include <math_ldbl_opt.h>
#ifndef SPRINTF
-# define SPRINTF sprintf
+# define SPRINTF __sprintf
#endif
#define APPEND(a, b) APPEND2 (a, b)
diff --git a/misc/mntent_r.c b/misc/mntent_r.c
index 3311ba0b50..65f29b97e9 100644
--- a/misc/mntent_r.c
+++ b/misc/mntent_r.c
@@ -251,7 +251,7 @@ __addmntent (FILE *stream, const struct mntent *mnt)
write_string (stream, mnt->mnt_dir);
write_string (stream, mnt->mnt_type);
write_string (stream, mnt->mnt_opts);
- fprintf (stream, "%d %d\n", mnt->mnt_freq, mnt->mnt_passno);
+ __fprintf (stream, "%d %d\n", mnt->mnt_freq, mnt->mnt_passno);
ret = __ferror_unlocked (stream) != 0 || fflush (stream) != 0;
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index f1faf8292c..422ca351f2 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -560,6 +560,54 @@
# include <bits/long-double.h>
#endif
+#if (defined __GNUC__ && __GNUC__ >= 2) || (__clang_major__ >= 4)
+# define __REDIRECT_LDBL1(name, prenth, posnth, proto, alias) \
+ name proto prenth __asm__ (__ASMNAME (__ASMNAME (#alias))) posnth
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+# ifdef __REDIRECT
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , , proto, ieee128)
+# ifdef __cplusplus
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROW, , proto, ieee128)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROWNL, , proto, ieee128)
+# else
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROW, proto, ieee128)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROWNL, proto, ieee128)
+# endif /* __cplusplus */
+# else
+_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
+# endif /* __REDIRECT */
+# elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
+# ifdef __REDIRECT
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , , proto, compat)
+# ifdef __cplusplus
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROW, , proto, compat)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROWNL, , proto, compat)
+# else
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROW, proto, compat)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROWNL, proto, compat)
+# endif /* __cplusplus */
+# else
+_Static_assert (0, "Compat long double requires redirection on this platform");
+# endif /* __REDIRECT */
+# endif
+#endif
+
+#ifndef __REDIRECT_LDBL
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) name proto
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) name proto __THROW
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) name proto __THROWNL
+#endif
+
#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
# ifdef __REDIRECT
@@ -583,10 +631,6 @@
# define __REDIRECT_NTH_LDBL(name, proto, alias) \
__LDBL_REDIR1_NTH (name, proto, __##alias##ieee128)
-/* Unused. */
-# define __REDIRECT_LDBL(name, proto, alias) ... unused__redirect_ldbl
-# define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth
-
# else
_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
# endif
@@ -605,24 +649,6 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf
extern __typeof (name) name __asm (__ASMNAME (#alias));
# define __LDBL_REDIR_DECL(name) \
extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name));
-# define __REDIRECT_LDBL(name, proto, alias) \
- __LDBL_REDIR1 (name, proto, __nldbl_##alias)
-# define __REDIRECT_NTH_LDBL(name, proto, alias) \
- __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias)
-# endif
-#endif
-#if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \
- || !defined __REDIRECT
-# define __LDBL_REDIR1(name, proto, alias) name proto
-# define __LDBL_REDIR(name, proto) name proto
-# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW
-# define __LDBL_REDIR_NTH(name, proto) name proto __THROW
-# define __LDBL_REDIR2_DECL(name)
-# define __LDBL_REDIR_DECL(name)
-# ifdef __REDIRECT
-# define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias)
-# define __REDIRECT_NTH_LDBL(name, proto, alias) \
- __REDIRECT_NTH (name, proto, alias)
# endif
#endif
diff --git a/nis/nis_subr.c b/nis/nis_subr.c
index 385f221062..0e02cd19b5 100644
--- a/nis/nis_subr.c
+++ b/nis/nis_subr.c
@@ -280,10 +280,10 @@ nis_getnames (const_nis_name name)
}
if (pos == 0
- && __asprintf (&getnames[pos++], "%s%s%s%s",
- name, name[name_len - 1] == '.' ? "" : ".",
- local_domain,
- local_domain[local_domain_len - 1] == '.' ? "" : ".") < 0)
+ && asprintf (&getnames[pos++], "%s%s%s%s",
+ name, name[name_len - 1] == '.' ? "" : ".",
+ local_domain,
+ local_domain[local_domain_len - 1] == '.' ? "" : ".") < 0)
goto free_null;
getnames[pos] = NULL;
diff --git a/nptl/pthread_getname.c b/nptl/pthread_getname.c
index ebec06e23f..a424b3e4f8 100644
--- a/nptl/pthread_getname.c
+++ b/nptl/pthread_getname.c
@@ -42,7 +42,7 @@ __pthread_getname_np (pthread_t th, char *buf, size_t len)
#define FMT "/proc/self/task/%u/comm"
char fname[sizeof (FMT) + 8];
- sprintf (fname, FMT, (unsigned int) pd->tid);
+ __sprintf (fname, FMT, (unsigned int) pd->tid);
int fd = __open64_nocancel (fname, O_RDONLY);
if (fd == -1)
diff --git a/nptl/pthread_setname.c b/nptl/pthread_setname.c
index f24560db47..8520bac4be 100644
--- a/nptl/pthread_setname.c
+++ b/nptl/pthread_setname.c
@@ -44,7 +44,7 @@ __pthread_setname_np (pthread_t th, const char *name)
#define FMT "/proc/self/task/%u/comm"
char fname[sizeof (FMT) + 8];
- sprintf (fname, FMT, (unsigned int) pd->tid);
+ __sprintf (fname, FMT, (unsigned int) pd->tid);
int fd = __open64_nocancel (fname, O_RDWR);
if (fd == -1)
diff --git a/pwd/getpw.c b/pwd/getpw.c
index 547489a863..4784eaf00b 100644
--- a/pwd/getpw.c
+++ b/pwd/getpw.c
@@ -50,9 +50,9 @@ __getpw (__uid_t uid, char *buf)
if (p == NULL)
return -1;
- if (sprintf (buf, "%s:%s:%lu:%lu:%s:%s:%s", p->pw_name, p->pw_passwd,
- (unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
- p->pw_gecos, p->pw_dir, p->pw_shell) < 0)
+ if (__sprintf (buf, "%s:%s:%lu:%lu:%s:%s:%s", p->pw_name, p->pw_passwd,
+ (unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
+ p->pw_gecos, p->pw_dir, p->pw_shell) < 0)
return -1;
return 0;
diff --git a/pwd/putpwent.c b/pwd/putpwent.c
index e3f2f4e09e..480dd59813 100644
--- a/pwd/putpwent.c
+++ b/pwd/putpwent.c
@@ -48,11 +48,11 @@ putpwent (const struct passwd *p, FILE *stream)
return -1;
if (p->pw_name[0] == '+' || p->pw_name[0] == '-')
- ret = fprintf (stream, "%s:%s:::%s:%s:%s\n",
+ ret = __fprintf (stream, "%s:%s:::%s:%s:%s\n",
p->pw_name, _S (p->pw_passwd),
gecos, _S (p->pw_dir), _S (p->pw_shell));
else
- ret = fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
+ ret = __fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
p->pw_name, _S (p->pw_passwd),
(unsigned long int) p->pw_uid,
(unsigned long int) p->pw_gid,
diff --git a/resolv/inet_ntop.c b/resolv/inet_ntop.c
index c4d38c0f95..53725d805a 100644
--- a/resolv/inet_ntop.c
+++ b/resolv/inet_ntop.c
@@ -28,9 +28,9 @@
#include <string.h>
#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
+# define SPRINTF(x) strlen(__sprintf/**/x)
#else
-# define SPRINTF(x) ((size_t)sprintf x)
+# define SPRINTF(x) ((size_t)__sprintf x)
#endif
/*
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index 913a5cb82f..06a91b23ca 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -507,8 +507,8 @@ _nss_dns_gethostbyaddr2_r (const void *addr, socklen_t len, int af,
switch (af)
{
case AF_INET:
- sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", (uaddr[3] & 0xff),
- (uaddr[2] & 0xff), (uaddr[1] & 0xff), (uaddr[0] & 0xff));
+ __sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", (uaddr[3] & 0xff),
+ (uaddr[2] & 0xff), (uaddr[1] & 0xff), (uaddr[0] & 0xff));
break;
case AF_INET6:
qp = qbuf;
diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
index 09cd917444..304ae35b8b 100644
--- a/resolv/nss_dns/dns-network.c
+++ b/resolv/nss_dns/dns-network.c
@@ -191,21 +191,21 @@ _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result,
{
case 3:
/* Class A network. */
- sprintf (qbuf, "0.0.0.%u.in-addr.arpa", net_bytes[3]);
+ __sprintf (qbuf, "0.0.0.%u.in-addr.arpa", net_bytes[3]);
break;
case 2:
/* Class B network. */
- sprintf (qbuf, "0.0.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2]);
+ __sprintf (qbuf, "0.0.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2]);
break;
case 1:
/* Class C network. */
- sprintf (qbuf, "0.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
- net_bytes[1]);
+ __sprintf (qbuf, "0.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
+ net_bytes[1]);
break;
case 0:
/* Class D - E network. */
- sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
- net_bytes[1], net_bytes[0]);
+ __sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
+ net_bytes[1], net_bytes[0]);
break;
}
diff --git a/shadow/putspent.c b/shadow/putspent.c
index cbbb840d5b..d675e28210 100644
--- a/shadow/putspent.c
+++ b/shadow/putspent.c
@@ -42,47 +42,47 @@ putspent (const struct spwd *p, FILE *stream)
flockfile (stream);
- if (fprintf (stream, "%s:%s:", p->sp_namp, _S (p->sp_pwdp)) < 0)
+ if (__fprintf (stream, "%s:%s:", p->sp_namp, _S (p->sp_pwdp)) < 0)
++errors;
if ((p->sp_lstchg != (long int) -1
- && fprintf (stream, "%ld:", p->sp_lstchg) < 0)
+ && __fprintf (stream, "%ld:", p->sp_lstchg) < 0)
|| (p->sp_lstchg == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_min != (long int) -1
- && fprintf (stream, "%ld:", p->sp_min) < 0)
+ && __fprintf (stream, "%ld:", p->sp_min) < 0)
|| (p->sp_min == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_max != (long int) -1
- && fprintf (stream, "%ld:", p->sp_max) < 0)
+ && __fprintf (stream, "%ld:", p->sp_max) < 0)
|| (p->sp_max == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_warn != (long int) -1
- && fprintf (stream, "%ld:", p->sp_warn) < 0)
+ && __fprintf (stream, "%ld:", p->sp_warn) < 0)
|| (p->sp_warn == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_inact != (long int) -1
- && fprintf (stream, "%ld:", p->sp_inact) < 0)
+ && __fprintf (stream, "%ld:", p->sp_inact) < 0)
|| (p->sp_inact == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_expire != (long int) -1
- && fprintf (stream, "%ld:", p->sp_expire) < 0)
+ && __fprintf (stream, "%ld:", p->sp_expire) < 0)
|| (p->sp_expire == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if (p->sp_flag != ~0ul
- && fprintf (stream, "%ld", p->sp_flag) < 0)
+ && __fprintf (stream, "%ld", p->sp_flag) < 0)
++errors;
if (putc_unlocked ('\n', stream) == EOF)
diff --git a/stdio-common/dprintf.c b/stdio-common/dprintf.c
index 2e26d59714..6fbe5d4862 100644
--- a/stdio-common/dprintf.c
+++ b/stdio-common/dprintf.c
@@ -33,5 +33,4 @@ __dprintf (int d, const char *format, ...)
return done;
}
libc_hidden_def (__dprintf)
-ldbl_hidden_def (__dprintf, dprintf)
ldbl_weak_alias (__dprintf, dprintf)
diff --git a/stdio-common/fprintf.c b/stdio-common/fprintf.c
index 8d2cd37433..af7190c5b4 100644
--- a/stdio-common/fprintf.c
+++ b/stdio-common/fprintf.c
@@ -34,7 +34,7 @@ __fprintf (FILE *stream, const char *format, ...)
return done;
}
-ldbl_hidden_def (__fprintf, fprintf)
+libc_hidden_def (__fprintf)
ldbl_strong_alias (__fprintf, fprintf)
/* We define the function with the real name here. But deep down in
diff --git a/stdio-common/psiginfo.c b/stdio-common/psiginfo.c
index adf3b71b77..f99c51da17 100644
--- a/stdio-common/psiginfo.c
+++ b/stdio-common/psiginfo.c
@@ -76,7 +76,7 @@ psiginfo (const siginfo_t *pinfo, const char *s)
}
if (s != NULL && *s != '\0')
- fprintf (fp, "%s: ", s);
+ __fprintf (fp, "%s: ", s);
const char *desc;
if (pinfo->si_signo >= 0 && pinfo->si_signo < NSIG
@@ -92,21 +92,21 @@ psiginfo (const siginfo_t *pinfo, const char *s)
if (pinfo->si_signo - SIGRTMIN < SIGRTMAX - pinfo->si_signo)
{
if (pinfo->si_signo == SIGRTMIN)
- fprintf (fp, "SIGRTMIN (");
+ __fprintf (fp, "SIGRTMIN (");
else
- fprintf (fp, "SIGRTMIN+%d (", pinfo->si_signo - SIGRTMIN);
+ __fprintf (fp, "SIGRTMIN+%d (", pinfo->si_signo - SIGRTMIN);
}
else
{
if (pinfo->si_signo == SIGRTMAX)
- fprintf (fp, "SIGRTMAX (");
+ __fprintf (fp, "SIGRTMAX (");
else
- fprintf (fp, "SIGRTMAX-%d (", SIGRTMAX - pinfo->si_signo);
+ __fprintf (fp, "SIGRTMAX-%d (", SIGRTMAX - pinfo->si_signo);
}
}
else
#endif
- fprintf (fp, "%s (", _(desc));
+ __fprintf (fp, "%s (", _(desc));
const char *base = NULL;
const uint8_t *offarr = NULL;
@@ -178,25 +178,25 @@ Signal generated by the completion of an I/O request");
}
if (str != NULL)
- fprintf (fp, "%s ", _(str));
+ __fprintf (fp, "%s ", _(str));
else
- fprintf (fp, "%d ", pinfo->si_code);
+ __fprintf (fp, "%d ", pinfo->si_code);
if (pinfo->si_signo == SIGILL || pinfo->si_signo == SIGFPE
|| pinfo->si_signo == SIGSEGV || pinfo->si_signo == SIGBUS)
- fprintf (fp, "[%p])\n", pinfo->si_addr);
+ __fprintf (fp, "[%p])\n", pinfo->si_addr);
else if (pinfo->si_signo == SIGCHLD)
- fprintf (fp, "%ld %d %ld)\n",
- (long int) pinfo->si_pid, pinfo->si_status,
- (long int) pinfo->si_uid);
+ __fprintf (fp, "%ld %d %ld)\n",
+ (long int) pinfo->si_pid, pinfo->si_status,
+ (long int) pinfo->si_uid);
else if (pinfo->si_signo == SIGPOLL)
- fprintf (fp, "%ld)\n", (long int) pinfo->si_band);
+ __fprintf (fp, "%ld)\n", (long int) pinfo->si_band);
else
- fprintf (fp, "%ld %ld)\n",
- (long int) pinfo->si_pid, (long int) pinfo->si_uid);
+ __fprintf (fp, "%ld %ld)\n",
+ (long int) pinfo->si_pid, (long int) pinfo->si_uid);
}
else
- fprintf (fp, _("Unknown signal %d\n"), pinfo->si_signo);
+ __fprintf (fp, _("Unknown signal %d\n"), pinfo->si_signo);
fclose (fp);
diff --git a/stdio-common/sprintf.c b/stdio-common/sprintf.c
index a9665f753a..f1f43a49ec 100644
--- a/stdio-common/sprintf.c
+++ b/stdio-common/sprintf.c
@@ -32,6 +32,6 @@ __sprintf (char *s, const char *format, ...)
return done;
}
-ldbl_hidden_def (__sprintf, sprintf)
+libc_hidden_def (__sprintf)
ldbl_strong_alias (__sprintf, sprintf)
ldbl_strong_alias (__sprintf, _IO_sprintf)
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 7559fd239d..c5912788bd 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -24,4 +24,4 @@ __vfprintf (FILE *fp, const char *format, va_list ap)
}
ldbl_strong_alias (__vfprintf, _IO_vfprintf);
ldbl_strong_alias (__vfprintf, vfprintf);
-ldbl_hidden_def (__vfprintf, vfprintf)
+libc_hidden_def (__vfprintf)
diff --git a/sunrpc/netname.c b/sunrpc/netname.c
index bf7f0b81c4..97a881c3af 100644
--- a/sunrpc/netname.c
+++ b/sunrpc/netname.c
@@ -48,7 +48,7 @@ user2netname (char netname[MAXNETNAMELEN + 1], const uid_t uid,
if ((strlen (dfltdom) + OPSYS_LEN + 3 + MAXIPRINT) > (size_t) MAXNETNAMELEN)
return 0;
- sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
+ __sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
i = strlen (netname);
if (netname[i - 1] == '.')
netname[i - 1] = '\0';
@@ -112,7 +112,7 @@ host2netname (char netname[MAXNETNAMELEN + 1], const char *host,
> MAXNETNAMELEN)
return 0;
- sprintf (netname, "%s.%s@%s", OPSYS, hostname, domainname);
+ __sprintf (netname, "%s.%s@%s", OPSYS, hostname, domainname);
return 1;
}
#ifdef EXPORT_RPC_SYMBOLS
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
index f683836678..59f6e31d2d 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128___asprintf (char **string_ptr, const char *format, ...)
+int
+__asprintfieee128 (char **string_ptr, const char *format, ...)
{
va_list ap;
int done;
@@ -32,5 +32,4 @@ ___ieee128___asprintf (char **string_ptr, const char *format, ...)
return done;
}
-hidden_def (___ieee128___asprintf)
-strong_alias (___ieee128___asprintf, __asprintfieee128)
+libc_hidden_def (__asprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
index cf3b46c37a..ceba219dc7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_dprintf (int d, const char *format, ...)
+int
+__dprintfieee128 (int d, const char *format, ...)
{
va_list ap;
int done;
@@ -31,5 +31,4 @@ ___ieee128_dprintf (int d, const char *format, ...)
return done;
}
-strong_alias (___ieee128_dprintf, __dprintfieee128)
-hidden_def (___ieee128_dprintf);
+libc_hidden_def (__dprintfieee128);
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
index 4462588675..b58f27afb7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_fprintf (FILE *fp, const char *format, ...)
+int
+__fprintfieee128 (FILE *fp, const char *format, ...)
{
va_list ap;
int done;
@@ -31,5 +31,4 @@ ___ieee128_fprintf (FILE *fp, const char *format, ...)
return done;
}
-strong_alias (___ieee128_fprintf, __fprintfieee128)
-hidden_def (___ieee128_fprintf)
+libc_hidden_def (__fprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
index 9703069b95..243eb65629 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
@@ -18,8 +18,8 @@
/* When in IEEE long double mode, call ___ieee128_sprintf. */
#include <stdio.h>
-typeof (sprintf) ___ieee128_sprintf attribute_hidden;
-#define SPRINTF ___ieee128_sprintf
+typeof (sprintf) __sprintfieee128 attribute_hidden;
+#define SPRINTF __sprintfieee128
/* Declare internal functions: ___qecvtieee128_r and ___qfcvtieee128_r,
built from a different compiling unit, and called from here. */
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
index 0be5bb2810..8046f5fd46 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
@@ -18,8 +18,8 @@
/* When in IEEE long double mode, call ___ieee128_snprintf. */
#include <stdio.h>
-typeof (snprintf) ___ieee128_snprintf attribute_hidden;
-#define SNPRINTF ___ieee128_snprintf
+typeof (snprintf) __snprintfieee128 attribute_hidden;
+#define SNPRINTF __snprintfieee128
#define ECVT_R __qecvtieee128_r
#define FCVT_R __qfcvtieee128_r
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
index 5f51b3ec9e..da3d9441d7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_snprintf (char *s, size_t maxlen, const char *format, ...)
+int
+__snprintfieee128 (char *s, size_t maxlen, const char *format, ...)
{
va_list ap;
int done;
@@ -32,4 +32,4 @@ ___ieee128_snprintf (char *s, size_t maxlen, const char *format, ...)
return done;
}
-strong_alias (___ieee128_snprintf, __snprintfieee128)
+libc_hidden_def (__snprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
index 0cad130788..007a71659a 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_sprintf (char *s, const char *format, ...)
+int
+__sprintfieee128 (char *s, const char *format, ...)
{
va_list ap;
int done;
@@ -32,5 +32,4 @@ ___ieee128_sprintf (char *s, const char *format, ...)
return done;
}
-strong_alias (___ieee128_sprintf, __sprintfieee128)
-hidden_def (___ieee128_sprintf)
+libc_hidden_def (__sprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
index e340c9b457..4df1e485a5 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
@@ -18,10 +18,9 @@
#include <libio/libioP.h>
-extern int
-___ieee128_vfprintf (FILE *fp, const char *format, va_list ap)
+int
+__vfprintfieee128 (FILE *fp, const char *format, va_list ap)
{
return __vfprintf_internal (fp, format, ap, PRINTF_LDBL_USES_FLOAT128);
}
-strong_alias (___ieee128_vfprintf, __vfprintfieee128)
-hidden_def (___ieee128_vfprintf)
+libc_hidden_def (__vfprintfieee128)
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
index ebd2a43951..5b167d45ff 100644
--- a/sysdeps/posix/tempname.c
+++ b/sysdeps/posix/tempname.c
@@ -161,7 +161,7 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
return -1;
}
- sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
+ __sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
return 0;
}
#endif /* _LIBC */
diff --git a/sysdeps/unix/sysv/linux/ia64/makecontext.c b/sysdeps/unix/sysv/linux/ia64/makecontext.c
index 0bc4211dfc..0cf05d5999 100644
--- a/sysdeps/unix/sysv/linux/ia64/makecontext.c
+++ b/sysdeps/unix/sysv/linux/ia64/makecontext.c
@@ -54,7 +54,7 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
if (argc > 8)
{
- fprintf (stderr, _("\
+ __fprintf (stderr, _("\
makecontext: does not know how to handle more than 8 arguments\n"));
exit (-1);
}
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index 0e017f458b..f2dca7711a 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -233,10 +233,13 @@ extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
const wchar_t *__restrict __format, ...)
__THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
-extern int __REDIRECT_NTH_LDBL (__swprintf_alias,
- (wchar_t *__restrict __s, size_t __n,
- const wchar_t *__restrict __fmt, ...),
- swprintf);
+extern int __swprintf_alias (wchar_t *__restrict __s, size_t __n,
+ const wchar_t *__restrict __fmt, ...)
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+ __asm__ (__ASMNAME ("swprintf"))
+#endif
+ ;
+
#ifdef __va_arg_pack
__fortify_function int
@@ -264,10 +267,13 @@ extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
__gnuc_va_list __arg)
__THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-extern int __REDIRECT_NTH_LDBL (__vswprintf_alias,
- (wchar_t *__restrict __s, size_t __n,
- const wchar_t *__restrict __fmt,
- __gnuc_va_list __ap), vswprintf);
+extern int __vswprintf_alias (wchar_t *__restrict __s, size_t __n,
+ const wchar_t *__restrict __fmt,
+ __gnuc_va_list __ap)
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+ __asm__ (__ASMNAME ("vswprintf"))
+#endif
+ ;
__fortify_function int
__NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
^ permalink raw reply [flat|nested] 14+ messages in thread
* [glibc/azanella/clang] Remove stdio-ldbl.h
@ 2022-05-12 19:30 Adhemerval Zanella
0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-05-12 19:30 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c010fa12aff249580badf7d504f957fc0df9734e
commit c010fa12aff249580badf7d504f957fc0df9734e
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Thu Feb 24 14:13:12 2022 -0300
Remove stdio-ldbl.h
The functions which require different alias to long double depending
of the ABI now uses a set os macros that defines the expected alias
on the function prototype, instead of redefine them using the
__LDBL_REDIR_DEC macros.
The __REDIRECT_LDBL, __REDIRECT_LDBL_NTH, __REDIRECT_LDBL_NTHNL
are refactores to be similar to __REDIRECT with the difference it
now expects the aliases for binary128 and for the long double being
double (which __LDBL_REDIR_DEC does).
All printf internal usage are also replaced to use internal alias
instead.
Diff:
---
argp/argp-parse.c | 4 +-
debug/backtracesyms.c | 18 +-
grp/putgrent.c | 6 +-
gshadow/putsgent.c | 6 +-
include/bits/stdio-ldbl.h | 1 -
include/stdio.h | 34 ++-
inet/ether_ntoa_r.c | 8 +-
inet/rexec.c | 2 +-
libio/Makefile | 2 +-
libio/bits/stdio-ldbl.h | 108 --------
libio/bits/stdio2.h | 115 ++++++---
libio/stdio.h | 286 +++++++++++++--------
malloc/malloc-check.c | 1 +
malloc/malloc.c | 32 +--
misc/efgcvt-template.c | 2 +-
misc/mntent_r.c | 2 +-
misc/sys/cdefs.h | 70 +++--
nis/nis_subr.c | 8 +-
nptl/pthread_getname.c | 2 +-
nptl/pthread_setname.c | 2 +-
pwd/getpw.c | 6 +-
pwd/putpwent.c | 4 +-
resolv/inet_ntop.c | 4 +-
resolv/nss_dns/dns-host.c | 4 +-
resolv/nss_dns/dns-network.c | 12 +-
shadow/putspent.c | 16 +-
stdio-common/dprintf.c | 1 -
stdio-common/fprintf.c | 2 +-
stdio-common/psiginfo.c | 32 +--
stdio-common/sprintf.c | 2 +-
stdio-common/vfprintf.c | 2 +-
sunrpc/netname.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-asprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-dprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-fprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-snprintf.c | 6 +-
.../ieee754/ldbl-128ibm-compat/ieee128-sprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c | 7 +-
sysdeps/posix/tempname.c | 2 +-
sysdeps/unix/sysv/linux/ia64/makecontext.c | 2 +-
wcsmbs/bits/wchar2.h | 22 +-
43 files changed, 448 insertions(+), 425 deletions(-)
diff --git a/argp/argp-parse.c b/argp/argp-parse.c
index 13cd84dd33..c26c0fc27f 100644
--- a/argp/argp-parse.c
+++ b/argp/argp-parse.c
@@ -177,7 +177,7 @@ argp_version_parser (int key, char *arg, struct argp_state *state)
if (argp_program_version_hook)
(*argp_program_version_hook) (state->out_stream, state);
else if (argp_program_version)
- fprintf (state->out_stream, "%s\n", argp_program_version);
+ __fprintf (state->out_stream, "%s\n", argp_program_version);
else
__argp_error (state, dgettext (state->root_argp->argp_domain,
"(PROGRAM ERROR) No version known!?"));
@@ -618,7 +618,7 @@ parser_finalize (struct parser *parser,
{
if (!(parser->state.flags & ARGP_NO_ERRS)
&& parser->state.err_stream)
- fprintf (parser->state.err_stream,
+ __fprintf (parser->state.err_stream,
dgettext (parser->argp->argp_domain,
"%s: Too many arguments\n"),
parser->state.name);
diff --git a/debug/backtracesyms.c b/debug/backtracesyms.c
index 17e0626df8..adb939f888 100644
--- a/debug/backtracesyms.c
+++ b/debug/backtracesyms.c
@@ -83,10 +83,10 @@ __backtrace_symbols (void *const *array, int size)
info[cnt].dli_saddr = info[cnt].dli_fbase;
if (info[cnt].dli_sname == NULL && info[cnt].dli_saddr == 0)
- last += 1 + sprintf (last, "%s(%s) [%p]",
- info[cnt].dli_fname ?: "",
- info[cnt].dli_sname ?: "",
- array[cnt]);
+ last += 1 + __sprintf (last, "%s(%s) [%p]",
+ info[cnt].dli_fname ?: "",
+ info[cnt].dli_sname ?: "",
+ array[cnt]);
else
{
char sign;
@@ -102,14 +102,14 @@ __backtrace_symbols (void *const *array, int size)
offset = info[cnt].dli_saddr - array[cnt];
}
- last += 1 + sprintf (last, "%s(%s%c%#tx) [%p]",
- info[cnt].dli_fname ?: "",
- info[cnt].dli_sname ?: "",
- sign, offset, array[cnt]);
+ last += 1 + __sprintf (last, "%s(%s%c%#tx) [%p]",
+ info[cnt].dli_fname ?: "",
+ info[cnt].dli_sname ?: "",
+ sign, offset, array[cnt]);
}
}
else
- last += 1 + sprintf (last, "[%p]", array[cnt]);
+ last += 1 + __sprintf (last, "[%p]", array[cnt]);
}
assert (last <= (char *) result + size * sizeof (char *) + total);
}
diff --git a/grp/putgrent.c b/grp/putgrent.c
index 966ba2a763..305ff44359 100644
--- a/grp/putgrent.c
+++ b/grp/putgrent.c
@@ -45,10 +45,10 @@ putgrent (const struct group *gr, FILE *stream)
flockfile (stream);
if (gr->gr_name[0] == '+' || gr->gr_name[0] == '-')
- retval = fprintf (stream, "%s:%s::",
+ retval = __fprintf (stream, "%s:%s::",
gr->gr_name, _S (gr->gr_passwd));
else
- retval = fprintf (stream, "%s:%s:%lu:",
+ retval = __fprintf (stream, "%s:%s:%lu:",
gr->gr_name, _S (gr->gr_passwd),
(unsigned long int) gr->gr_gid);
if (__builtin_expect (retval, 0) < 0)
@@ -60,7 +60,7 @@ putgrent (const struct group *gr, FILE *stream)
if (gr->gr_mem != NULL)
{
for (size_t i = 0; gr->gr_mem[i] != NULL; i++)
- if (fprintf (stream, i == 0 ? "%s" : ",%s", gr->gr_mem[i]) < 0)
+ if (__fprintf (stream, i == 0 ? "%s" : ",%s", gr->gr_mem[i]) < 0)
{
/* What else can we do? */
funlockfile (stream);
diff --git a/gshadow/putsgent.c b/gshadow/putsgent.c
index 9e2dca7eaf..870438de6d 100644
--- a/gshadow/putsgent.c
+++ b/gshadow/putsgent.c
@@ -42,7 +42,7 @@ putsgent (const struct sgrp *g, FILE *stream)
_IO_flockfile (stream);
- if (fprintf (stream, "%s:%s:", g->sg_namp, _S (g->sg_passwd)) < 0)
+ if (__fprintf (stream, "%s:%s:", g->sg_namp, _S (g->sg_passwd)) < 0)
++errors;
bool first = true;
@@ -50,7 +50,7 @@ putsgent (const struct sgrp *g, FILE *stream)
if (sp != NULL)
while (*sp != NULL)
{
- if (fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
+ if (__fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
{
++errors;
break;
@@ -65,7 +65,7 @@ putsgent (const struct sgrp *g, FILE *stream)
if (sp != NULL)
while (*sp != NULL)
{
- if (fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
+ if (__fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
{
++errors;
break;
diff --git a/include/bits/stdio-ldbl.h b/include/bits/stdio-ldbl.h
deleted file mode 100644
index 1f7d3ce1c6..0000000000
--- a/include/bits/stdio-ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <libio/bits/stdio-ldbl.h>
diff --git a/include/stdio.h b/include/stdio.h
index a6f7fd43cb..39b4978130 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -22,13 +22,17 @@
/* Some libc_hidden_ldbl_proto's do not map to a unique symbol when
redirecting ldouble to _Float128 variants. We can therefore safely
directly alias them to their internal name. */
-# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc)
-# define stdio_hidden_ldbl_proto(p, f) \
- extern __typeof (p ## f) p ## f __asm (__ASMNAME ("___ieee128_" #f));
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# define stdio_hidden_ldbl_proto(p,f) __LDBL_REDIR1_DECL (p ## f, p ## f ## ieee128)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc) && defined SHARED
+# define __stdio_hidden_ldbl_proto(name, alias) \
+ extern __typeof (name) __##name __asm__ (__hidden_asmname (#alias));
+# define stdio_hidden_ldbl_proto(name) \
+ extern typeof (name) __##name##ieee128; \
+ libc_hidden_proto (__##name##ieee128); \
+ __stdio_hidden_ldbl_proto (name, __GI___##name##ieee128)
# else
-# define stdio_hidden_ldbl_proto(p,f) libc_hidden_proto (p ## f)
+# define stdio_hidden_ldbl_proto(name) \
+ extern __typeof (name) __##name; \
+ libc_hidden_proto (__##name)
# endif
/* Set the error indicator on FP. */
@@ -39,10 +43,7 @@ fseterr_unlocked (FILE *fp)
}
extern int __fcloseall (void) attribute_hidden;
-extern int __snprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, ...)
- __attribute__ ((__format__ (__printf__, 3, 4)));
-stdio_hidden_ldbl_proto (__, snprintf)
+stdio_hidden_ldbl_proto (snprintf);
extern int __vfscanf (FILE *__restrict __s,
const char *__restrict __format,
@@ -184,7 +185,7 @@ extern const size_t _sys_errlist_internal_len attribute_hidden;
extern const char *__get_errlist (int) attribute_hidden;
extern const char *__get_errname (int) attribute_hidden;
-libc_hidden_ldbl_proto (__asprintf)
+stdio_hidden_ldbl_proto (asprintf);
# if IS_IN (libc)
extern FILE *_IO_new_fopen (const char*, const char*);
@@ -206,13 +207,10 @@ extern int _IO_new_fgetpos (FILE *, __fpos_t *);
# define fgetpos(fp, posp) _IO_new_fgetpos (fp, posp)
# endif
-extern __typeof (dprintf) __dprintf
- __attribute__ ((__format__ (__printf__, 2, 3)));
-stdio_hidden_ldbl_proto (__, dprintf)
-libc_hidden_ldbl_proto (dprintf)
-libc_hidden_ldbl_proto (fprintf)
-libc_hidden_ldbl_proto (vfprintf)
-libc_hidden_ldbl_proto (sprintf)
+stdio_hidden_ldbl_proto (dprintf);
+stdio_hidden_ldbl_proto (fprintf);
+stdio_hidden_ldbl_proto (vfprintf);
+stdio_hidden_ldbl_proto (sprintf);
libc_hidden_proto (ungetc)
libc_hidden_proto (__getdelim)
libc_hidden_proto (fwrite)
diff --git a/inet/ether_ntoa_r.c b/inet/ether_ntoa_r.c
index 03011ffef6..f111e5234c 100644
--- a/inet/ether_ntoa_r.c
+++ b/inet/ether_ntoa_r.c
@@ -23,10 +23,10 @@
char *
ether_ntoa_r (const struct ether_addr *addr, char *buf)
{
- sprintf (buf, "%x:%x:%x:%x:%x:%x",
- addr->ether_addr_octet[0], addr->ether_addr_octet[1],
- addr->ether_addr_octet[2], addr->ether_addr_octet[3],
- addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
+ __sprintf (buf, "%x:%x:%x:%x:%x:%x",
+ addr->ether_addr_octet[0], addr->ether_addr_octet[1],
+ addr->ether_addr_octet[2], addr->ether_addr_octet[3],
+ addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
return buf;
}
libc_hidden_def (ether_ntoa_r)
diff --git a/inet/rexec.c b/inet/rexec.c
index 330282ac16..809475d976 100644
--- a/inet/rexec.c
+++ b/inet/rexec.c
@@ -135,7 +135,7 @@ retry:
NULL, 0, servbuff, sizeof(servbuff),
NI_NUMERICSERV))
port = (int) __strtol (servbuff, NULL, 10);
- (void) sprintf(num, "%u", port);
+ (void) __sprintf(num, "%u", port);
(void) __write(s, num, strlen(num)+1);
{ socklen_t len = sizeof (from);
s3 = TEMP_FAILURE_RETRY (accept(s2, (struct sockaddr *)&from,
diff --git a/libio/Makefile b/libio/Makefile
index e97387743f..a4830ddf42 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -23,7 +23,7 @@ subdir := libio
include ../Makeconfig
headers := stdio.h \
- bits/stdio.h bits/stdio2.h bits/stdio-ldbl.h \
+ bits/stdio.h bits/stdio2.h \
bits/types/FILE.h bits/types/__FILE.h bits/types/struct_FILE.h \
bits/types/__fpos_t.h bits/types/__fpos64_t.h \
bits/types/cookie_io_functions_t.h
diff --git a/libio/bits/stdio-ldbl.h b/libio/bits/stdio-ldbl.h
deleted file mode 100644
index 6b63394b50..0000000000
--- a/libio/bits/stdio-ldbl.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -mlong-double-64 compatibility mode for stdio functions.
- Copyright (C) 2006-2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#ifndef _STDIO_H
-# error "Never include <bits/stdio-ldbl.h> directly; use <stdio.h> instead."
-#endif
-
-__LDBL_REDIR_DECL (fprintf)
-__LDBL_REDIR_DECL (printf)
-__LDBL_REDIR_DECL (sprintf)
-__LDBL_REDIR_DECL (vfprintf)
-__LDBL_REDIR_DECL (vprintf)
-__LDBL_REDIR_DECL (vsprintf)
-#if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (fscanf, __nldbl___isoc99_fscanf)
-__LDBL_REDIR1_DECL (scanf, __nldbl___isoc99_scanf)
-__LDBL_REDIR1_DECL (sscanf, __nldbl___isoc99_sscanf)
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (fscanf, __isoc99_fscanfieee128)
-__LDBL_REDIR1_DECL (scanf, __isoc99_scanfieee128)
-__LDBL_REDIR1_DECL (sscanf, __isoc99_sscanfieee128)
-# else
-# error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-# endif
-#else
-__LDBL_REDIR_DECL (fscanf)
-__LDBL_REDIR_DECL (scanf)
-__LDBL_REDIR_DECL (sscanf)
-#endif
-
-#if defined __USE_ISOC99 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (snprintf)
-__LDBL_REDIR_DECL (vsnprintf)
-#endif
-
-#ifdef __USE_ISOC99
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (vfscanf, __nldbl___isoc99_vfscanf)
-__LDBL_REDIR1_DECL (vscanf, __nldbl___isoc99_vscanf)
-__LDBL_REDIR1_DECL (vsscanf, __nldbl___isoc99_vsscanf)
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (vfscanf, __isoc99_vfscanfieee128)
-__LDBL_REDIR1_DECL (vscanf, __isoc99_vscanfieee128)
-__LDBL_REDIR1_DECL (vsscanf, __isoc99_vsscanfieee128)
-# else
-# error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-# endif
-# else
-__LDBL_REDIR_DECL (vfscanf)
-__LDBL_REDIR_DECL (vsscanf)
-__LDBL_REDIR_DECL (vscanf)
-# endif
-#endif
-
-#ifdef __USE_XOPEN2K8
-__LDBL_REDIR_DECL (vdprintf)
-__LDBL_REDIR_DECL (dprintf)
-#endif
-
-#ifdef __USE_GNU
-__LDBL_REDIR_DECL (vasprintf)
-__LDBL_REDIR2_DECL (asprintf)
-__LDBL_REDIR_DECL (asprintf)
-__LDBL_REDIR_DECL (obstack_printf)
-__LDBL_REDIR_DECL (obstack_vprintf)
-#endif
-
-#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR2_DECL (sprintf_chk)
-__LDBL_REDIR2_DECL (vsprintf_chk)
-# if defined __USE_ISOC99 || defined __USE_UNIX98
-__LDBL_REDIR2_DECL (snprintf_chk)
-__LDBL_REDIR2_DECL (vsnprintf_chk)
-# endif
-# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR2_DECL (fprintf_chk)
-__LDBL_REDIR2_DECL (printf_chk)
-__LDBL_REDIR2_DECL (vfprintf_chk)
-__LDBL_REDIR2_DECL (vprintf_chk)
-# ifdef __USE_XOPEN2K8
-__LDBL_REDIR2_DECL (dprintf_chk)
-__LDBL_REDIR2_DECL (vdprintf_chk)
-# endif
-# ifdef __USE_GNU
-__LDBL_REDIR2_DECL (asprintf_chk)
-__LDBL_REDIR2_DECL (vasprintf_chk)
-__LDBL_REDIR2_DECL (obstack_printf_chk)
-__LDBL_REDIR2_DECL (obstack_vprintf_chk)
-# endif
-# endif
-#endif
diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h
index b0b655ee7a..de7f1f04aa 100644
--- a/libio/bits/stdio2.h
+++ b/libio/bits/stdio2.h
@@ -23,12 +23,17 @@
# error "Never include <bits/stdio2.h> directly; use <stdio.h> instead."
#endif
-extern int __sprintf_chk (char *__restrict __s, int __flag, size_t __slen,
- const char *__restrict __format, ...) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__sprintf_chk, (char *__restrict __s,
+ int __flag, size_t __slen,
+ const char *__restrict __format,
+ ...),
+ __sprintf_chkieee128, __nldbl___sprintf_chk)
__attr_access ((__write_only__, 1, 3));
-extern int __vsprintf_chk (char *__restrict __s, int __flag, size_t __slen,
- const char *__restrict __format,
- __gnuc_va_list __ap) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__vsprintf_chk, (char *__restrict __s,
+ int __flag, size_t __slen,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vsprintf_chkieee128, __nldbl___vsprintf_chk)
__attr_access ((__write_only__, 1, 3));
#ifdef __va_arg_pack
@@ -54,14 +59,19 @@ __NTH (vsprintf (char *__restrict __s, const char *__restrict __fmt,
}
#if defined __USE_ISOC99 || defined __USE_UNIX98
-
-extern int __snprintf_chk (char *__restrict __s, size_t __n, int __flag,
- size_t __slen, const char *__restrict __format,
- ...) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__snprintf_chk, (char *__restrict __s,
+ size_t __n, int __flag,
+ size_t __slen,
+ const char *__restrict __format,
+ ...),
+ __snprintf_chkieee128, __nldbl___snprintf_chk)
__attr_access ((__write_only__, 1, 2));
-extern int __vsnprintf_chk (char *__restrict __s, size_t __n, int __flag,
- size_t __slen, const char *__restrict __format,
- __gnuc_va_list __ap) __THROW;
+extern int __REDIRECT_LDBL_NTHNL (__vsnprintf_chk, (char *__restrict __s,
+ size_t __n, int __flag,
+ size_t __slen,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vsnprintf_chkieee128, __nldbl___vsnprintf_chk);
# ifdef __va_arg_pack
__fortify_function int
@@ -89,14 +99,24 @@ __NTH (vsnprintf (char *__restrict __s, size_t __n,
#endif
#if __USE_FORTIFY_LEVEL > 1
-
-extern int __fprintf_chk (FILE *__restrict __stream, int __flag,
- const char *__restrict __format, ...);
-extern int __printf_chk (int __flag, const char *__restrict __format, ...);
-extern int __vfprintf_chk (FILE *__restrict __stream, int __flag,
- const char *__restrict __format, __gnuc_va_list __ap);
-extern int __vprintf_chk (int __flag, const char *__restrict __format,
- __gnuc_va_list __ap);
+extern int __REDIRECT_LDBL (__fprintf_chk, (FILE *__restrict __stream,
+ int __flag,
+ const char *__restrict __format,
+ ...),
+ __fprintf_chkieee128, __nldbl___fprintf_chk);
+extern int __REDIRECT_LDBL (__printf_chk, (int __flag,
+ const char *__restrict __format,
+ ...),
+ __printf_chkieee128, __nldbl___printf_chk);
+extern int __REDIRECT_LDBL (__vfprintf_chk, (FILE *__restrict __stream,
+ int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vfprintf_chkieee128, __nldbl___vfprintf_chk);
+extern int __REDIRECT_LDBL (__vprintf_chk, (int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vprintf_chkieee128, __nldbl___vprintf_chk);
# ifdef __va_arg_pack
__fortify_function int
@@ -136,10 +156,15 @@ vfprintf (FILE *__restrict __stream,
}
# ifdef __USE_XOPEN2K8
-extern int __dprintf_chk (int __fd, int __flag, const char *__restrict __fmt,
- ...) __attribute__ ((__format__ (__printf__, 3, 4)));
-extern int __vdprintf_chk (int __fd, int __flag,
- const char *__restrict __fmt, __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL (__dprintf_chk, (int __fd, int __flag,
+ const char *__restrict __fmt,
+ ...),
+ __dprintf_chkieee128, __nldbl___dprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL (__vdprintf_chk, (int __fd, int __flag,
+ const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vdprintf_chkieee128, __nldbl___vdprintf_chk)
__attribute__ ((__format__ (__printf__, 3, 0)));
# ifdef __va_arg_pack
@@ -162,22 +187,32 @@ vdprintf (int __fd, const char *__restrict __fmt, __gnuc_va_list __ap)
# endif
# ifdef __USE_GNU
-
-extern int __asprintf_chk (char **__restrict __ptr, int __flag,
- const char *__restrict __fmt, ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4))) __wur;
-extern int __vasprintf_chk (char **__restrict __ptr, int __flag,
- const char *__restrict __fmt, __gnuc_va_list __arg)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
-extern int __obstack_printf_chk (struct obstack *__restrict __obstack,
- int __flag, const char *__restrict __format,
- ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
-extern int __obstack_vprintf_chk (struct obstack *__restrict __obstack,
- int __flag,
- const char *__restrict __format,
- __gnuc_va_list __args)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
+extern int __REDIRECT_LDBL_NTHNL (__asprintf_chk, (char **__restrict __ptr,
+ int __flag,
+ const char *__restrict __fmt,
+ ...),
+ __asprintf_chkieee128, __nldbl___asprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (__vasprintf_chk, (char **__restrict __ptr,
+ int __flag,
+ const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vasprintf_chkieee128, __nldbl___vasnprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (__obstack_printf_chk, (struct obstack *__restrict __obstack,
+ int __flag,
+ const char *__restrict __format,
+ ...),
+ __obstack_printf_chkieee128,
+ __nldbl___obstack_printf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL_NTHNL (__obstack_vprintf_chk, (struct obstack *__restrict __obstack,
+ int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __args),
+ __obstack_vprintf_chkieee128,
+ __nldbl___obstack_vprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
# ifdef __va_arg_pack
__fortify_function int
diff --git a/libio/stdio.h b/libio/stdio.h
index e6425341ce..54c9796a46 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -41,6 +41,7 @@ __BEGIN_DECLS
#include <bits/types/__FILE.h>
#include <bits/types/FILE.h>
#include <bits/types/struct_FILE.h>
+#include <bits/floatn.h>
#ifdef __USE_GNU
# include <bits/types/cookie_io_functions_t.h>
@@ -342,78 +343,143 @@ extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
extern void setlinebuf (FILE *__stream) __THROW;
#endif
-
/* Write formatted output to STREAM.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int fprintf (FILE *__restrict __stream,
- const char *__restrict __format, ...);
+extern int __REDIRECT_LDBL (fprintf, (FILE *__restrict __stream,
+ const char *__restrict __format, ...),
+ __fprintfieee128, __nldbl_fprintf);
/* Write formatted output to stdout.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int printf (const char *__restrict __format, ...);
+extern int __REDIRECT_LDBL (printf, (const char *__restrict __format, ...),
+ __printfieee128, __nldbl_printf);
/* Write formatted output to S. */
-extern int sprintf (char *__restrict __s,
- const char *__restrict __format, ...) __THROWNL;
+extern int __REDIRECT_LDBL_NTHNL (sprintf, (char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __sprintfieee128, __nldbl_sprintf);
/* Write formatted output to S from argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg);
+extern int __REDIRECT_LDBL (vfprintf, (FILE *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vfprintfieee128, __nldbl_vfprintf);
/* Write formatted output to stdout from argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
+extern int __REDIRECT_LDBL (vprintf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vprintfieee128, __nldbl_vprintf);
/* Write formatted output to S from argument list ARG. */
-extern int vsprintf (char *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg) __THROWNL;
+extern int __REDIRECT_LDBL_NTHNL (vsprintf, (char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsprintfieee128, __nldbl_vsprintf);
#if defined __USE_ISOC99 || defined __USE_UNIX98
/* Maximum chars of output to write in MAXLEN. */
-extern int snprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 3, 4)));
-
-extern int vsnprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, __gnuc_va_list __arg)
- __THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
+extern int __REDIRECT_LDBL_NTHNL (snprintf, (char *__restrict __s,
+ size_t __maxlen,
+ const char *__restrict __format,
+ ...),
+ __snprintfieee128, __nldbl_snprintf)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL_NTHNL (vsnprintf, (char *__restrict __s,
+ size_t __maxlen,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsnprintfieee128, __nldbl_vsnprintf)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
#endif
#if __GLIBC_USE (LIB_EXT2)
/* Write formatted output to a string dynamically allocated with `malloc'.
Store the address of the string in *PTR. */
-extern int vasprintf (char **__restrict __ptr, const char *__restrict __f,
- __gnuc_va_list __arg)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
-extern int __asprintf (char **__restrict __ptr,
- const char *__restrict __fmt, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
-extern int asprintf (char **__restrict __ptr,
- const char *__restrict __fmt, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (vasprintf, (char **__restrict __ptr,
+ const char *__restrict __f,
+ __gnuc_va_list __arg),
+ __vasprintfieee128, __nldbl_vasprintf)
+ __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (asprintf, (char **__restrict __ptr,
+ const char *__restrict __fmt,
+ ...),
+ __asprintfieee128, __nldbl_asprintf)
+ __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
#endif
#ifdef __USE_XOPEN2K8
/* Write formatted output to a file descriptor. */
-extern int vdprintf (int __fd, const char *__restrict __fmt,
- __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL (vdprintf, (int __fd, const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vdprintfieee128, __nldbl_vdprintf)
__attribute__ ((__format__ (__printf__, 2, 0)));
-extern int dprintf (int __fd, const char *__restrict __fmt, ...)
+extern int __REDIRECT_LDBL (dprintf, (int __fd, const char *__restrict __fmt,
+ ...),
+ __dprintfieee128, __nldbl_dprintf)
__attribute__ ((__format__ (__printf__, 2, 3)));
#endif
-
+#if !__GLIBC_USE (DEPRECATED_SCANF)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ ...),
+ __isoc99_fscanfieee128, __nldbl___isoc99_fscanf) __wur;
+extern int __REDIRECT_LDBL (scanf, (const char *__restrict __format,
+ ...),
+ __isoc99_scanfieee128, __nldbl___isoc99_scanf) __wur;
+extern int __REDIRECT_LDBL_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __isoc99_sscanfieee128, __nldbl___isoc99_sscanf);
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format, ...),
+ __isoc99_fscanf) __wur;
+extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
+ __isoc99_scanf) __wur;
+extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format, ...),
+ __isoc99_sscanf);
+# else
+extern int __isoc99_fscanf (FILE *__restrict __stream,
+ const char *__restrict __format, ...) __wur;
+extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
+extern int __isoc99_sscanf (const char *__restrict __s,
+ const char *__restrict __format, ...) __THROW;
+# define fscanf __isoc99_fscanf
+# define scanf __isoc99_scanf
+# define sscanf __isoc99_sscanf
+# endif /* __REDIRECT */
+# endif
+#else
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ ...),
+ __fscanfieee128, __nldbl_fscanf) __wur;
+extern int __REDIRECT_LDBL (scanf, (const char *__restrict __format,
+ ...),
+ __scanfieee128, __nldbl_scanf) __wur;
+extern int __REDIRECT_LDBL_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __sscanfieee128, __nldbl_sscanf) __wur;
+# else
/* Read formatted input from STREAM.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int fscanf (FILE *__restrict __stream,
- const char *__restrict __format, ...) __wur;
+ const char *__restrict __format, ...) __wur;
/* Read formatted input from stdin.
This function is a possible cancellation point and therefore not
@@ -421,43 +487,81 @@ extern int fscanf (FILE *__restrict __stream,
extern int scanf (const char *__restrict __format, ...) __wur;
/* Read formatted input from S. */
extern int sscanf (const char *__restrict __s,
- const char *__restrict __format, ...) __THROW;
-
-/* For historical reasons, the C99-compliant versions of the scanf
- functions are at alternative names. When __LDBL_COMPAT or
- __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
- bits/stdio-ldbl.h. */
-#include <bits/floatn.h>
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
- && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-# ifdef __REDIRECT
-extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
- const char *__restrict __format, ...),
- __isoc99_fscanf) __wur;
-extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
- __isoc99_scanf) __wur;
-extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
- const char *__restrict __format, ...),
- __isoc99_sscanf);
-# else
-extern int __isoc99_fscanf (FILE *__restrict __stream,
- const char *__restrict __format, ...) __wur;
-extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
-extern int __isoc99_sscanf (const char *__restrict __s,
- const char *__restrict __format, ...) __THROW;
-# define fscanf __isoc99_fscanf
-# define scanf __isoc99_scanf
-# define sscanf __isoc99_sscanf
+ const char *__restrict __format, ...) __THROW;
# endif
-#endif
+#endif /* DEPRECATED_SCANF */
-#ifdef __USE_ISOC99
+#ifdef __USE_ISOC99
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vfscanfieee128, __nldbl___isoc99_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vscanfieee128, __nldbl___isoc99_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_LDBL_NTH (vsscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vsscanfieee128, __nldbl___isoc99_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (vfscanf,
+ (FILE *__restrict __s,
+ const char *__restrict __format, __gnuc_va_list __arg),
+ __isoc99_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_NTH (vsscanf,
+ (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
+extern int __isoc99_vfscanf (FILE *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg) __wur;
+extern int __isoc99_vscanf (const char *__restrict __format,
+ __gnuc_va_list __arg) __wur;
+extern int __isoc99_vsscanf (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg) __THROW;
+# define vfscanf __isoc99_vfscanf
+# define vscanf __isoc99_vscanf
+# define vsscanf __isoc99_vsscanf
+# endif /* __REDIRECT */
+# endif
+# else /* DEPRECATED_SCANF */
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vfscanfieee128, __nldbl_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vscanfieee128, __nldbl_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_LDBL_NTH (vsscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsscanfieee128, __nldbl_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
/* Read formatted input from S into argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg)
+ __gnuc_va_list __arg)
__attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
/* Read formatted input from stdin into argument list ARG.
@@ -469,42 +573,11 @@ extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
/* Read formatted input from S into argument list ARG. */
extern int vsscanf (const char *__restrict __s,
- const char *__restrict __format, __gnuc_va_list __arg)
+ const char *__restrict __format, __gnuc_va_list __arg)
__THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
-
-/* Same redirection as above for the v*scanf family. */
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __REDIRECT && !defined __LDBL_COMPAT \
- && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-extern int __REDIRECT (vfscanf,
- (FILE *__restrict __s,
- const char *__restrict __format, __gnuc_va_list __arg),
- __isoc99_vfscanf)
- __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
-extern int __REDIRECT (vscanf, (const char *__restrict __format,
- __gnuc_va_list __arg), __isoc99_vscanf)
- __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
-extern int __REDIRECT_NTH (vsscanf,
- (const char *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg), __isoc99_vsscanf)
- __attribute__ ((__format__ (__scanf__, 2, 0)));
-# elif !defined __REDIRECT
-extern int __isoc99_vfscanf (FILE *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg) __wur;
-extern int __isoc99_vscanf (const char *__restrict __format,
- __gnuc_va_list __arg) __wur;
-extern int __isoc99_vsscanf (const char *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg) __THROW;
-# define vfscanf __isoc99_vfscanf
-# define vscanf __isoc99_vscanf
-# define vsscanf __isoc99_vsscanf
# endif
# endif
-#endif /* Use ISO C9x. */
-
+#endif /* __USE_ISOC99 */
/* Read a character from STREAM.
@@ -850,13 +923,17 @@ extern char *cuserid (char *__s)
struct obstack; /* See <obstack.h>. */
/* Write formatted output to an obstack. */
-extern int obstack_printf (struct obstack *__restrict __obstack,
- const char *__restrict __format, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3)));
-extern int obstack_vprintf (struct obstack *__restrict __obstack,
- const char *__restrict __format,
- __gnuc_va_list __args)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 0)));
+extern int __REDIRECT_LDBL_NTHNL (obstack_printf,
+ (struct obstack *__restrict __obstack,
+ const char *__restrict __format, ...),
+ __obstack_printfieee128, __nldbl_obstack_printf)
+ __attribute__ ((__format__ (__printf__, 2, 3)));
+extern int __REDIRECT_LDBL_NTHNL (obstack_vprintf,
+ (struct obstack *__restrict __obstack,
+ const char *__restrict __format,
+ __gnuc_va_list __args),
+ __obstack_vprintfieee128, __nldbl_obstack_vprintf)
+ __attribute__ ((__format__ (__printf__, 2, 0)));
#endif /* Use GNU. */
@@ -894,11 +971,6 @@ extern int __overflow (FILE *, int);
# include <bits/stdio2.h>
#endif
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/stdio-ldbl.h>
-#endif
-
__END_DECLS
#endif /* <stdio.h> included. */
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index 0299fe99a7..e1f68bddfb 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -17,6 +17,7 @@
not, see <https://www.gnu.org/licenses/>. */
#define __mremap mremap
+#define __fprintf fprintf
#include "malloc.c"
/* When memory is tagged, the checking data is stored in the user part
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 09e5ff2bce..aa35846e55 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5279,9 +5279,9 @@ __malloc_stats (void)
memset (&mi, 0, sizeof (mi));
__libc_lock_lock (ar_ptr->mutex);
int_mallinfo (ar_ptr, &mi);
- fprintf (stderr, "Arena %d:\n", i);
- fprintf (stderr, "system bytes = %10u\n", (unsigned int) mi.arena);
- fprintf (stderr, "in use bytes = %10u\n", (unsigned int) mi.uordblks);
+ __fprintf (stderr, "Arena %d:\n", i);
+ __fprintf (stderr, "system bytes = %10u\n", (unsigned int) mi.arena);
+ __fprintf (stderr, "in use bytes = %10u\n", (unsigned int) mi.uordblks);
#if MALLOC_DEBUG > 1
if (i > 0)
dump_heap (heap_for_ptr (top (ar_ptr)));
@@ -5293,12 +5293,12 @@ __malloc_stats (void)
if (ar_ptr == &main_arena)
break;
}
- fprintf (stderr, "Total (incl. mmap):\n");
- fprintf (stderr, "system bytes = %10u\n", system_b);
- fprintf (stderr, "in use bytes = %10u\n", in_use_b);
- fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps);
- fprintf (stderr, "max mmap bytes = %10lu\n",
- (unsigned long) mp_.max_mmapped_mem);
+ __fprintf (stderr, "Total (incl. mmap):\n");
+ __fprintf (stderr, "system bytes = %10u\n", system_b);
+ __fprintf (stderr, "in use bytes = %10u\n", in_use_b);
+ __fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps);
+ __fprintf (stderr, "max mmap bytes = %10lu\n",
+ (unsigned long) mp_.max_mmapped_mem);
stderr->_flags2 = old_flags2;
_IO_funlockfile (stderr);
}
@@ -5728,7 +5728,7 @@ __malloc_info (int options, FILE *fp)
mstate ar_ptr = &main_arena;
do
{
- fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
+ __fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
size_t nblocks = 0;
size_t nfastblocks = 0;
@@ -5839,12 +5839,12 @@ __malloc_info (int options, FILE *fp)
for (size_t i = 0; i < nsizes; ++i)
if (sizes[i].count != 0 && i != NFASTBINS)
- fprintf (fp, "\
+ __fprintf (fp, "\
<size from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
sizes[i].from, sizes[i].to, sizes[i].total, sizes[i].count);
if (sizes[NFASTBINS].count != 0)
- fprintf (fp, "\
+ __fprintf (fp, "\
<unsorted from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
sizes[NFASTBINS].from, sizes[NFASTBINS].to,
sizes[NFASTBINS].total, sizes[NFASTBINS].count);
@@ -5852,7 +5852,7 @@ __malloc_info (int options, FILE *fp)
total_system += ar_ptr->system_mem;
total_max_system += ar_ptr->max_system_mem;
- fprintf (fp,
+ __fprintf (fp,
"</sizes>\n<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
"<system type=\"current\" size=\"%zu\"/>\n"
@@ -5862,7 +5862,7 @@ __malloc_info (int options, FILE *fp)
if (ar_ptr != &main_arena)
{
- fprintf (fp,
+ __fprintf (fp,
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n"
"<aspace type=\"subheaps\" size=\"%zu\"/>\n",
@@ -5872,7 +5872,7 @@ __malloc_info (int options, FILE *fp)
}
else
{
- fprintf (fp,
+ __fprintf (fp,
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n",
ar_ptr->system_mem, ar_ptr->system_mem);
@@ -5885,7 +5885,7 @@ __malloc_info (int options, FILE *fp)
}
while (ar_ptr != &main_arena);
- fprintf (fp,
+ __fprintf (fp,
"<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"mmap\" count=\"%d\" size=\"%zu\"/>\n"
diff --git a/misc/efgcvt-template.c b/misc/efgcvt-template.c
index 87a90e78d4..f1630fd780 100644
--- a/misc/efgcvt-template.c
+++ b/misc/efgcvt-template.c
@@ -24,7 +24,7 @@
#include <math_ldbl_opt.h>
#ifndef SPRINTF
-# define SPRINTF sprintf
+# define SPRINTF __sprintf
#endif
#define APPEND(a, b) APPEND2 (a, b)
diff --git a/misc/mntent_r.c b/misc/mntent_r.c
index 3311ba0b50..65f29b97e9 100644
--- a/misc/mntent_r.c
+++ b/misc/mntent_r.c
@@ -251,7 +251,7 @@ __addmntent (FILE *stream, const struct mntent *mnt)
write_string (stream, mnt->mnt_dir);
write_string (stream, mnt->mnt_type);
write_string (stream, mnt->mnt_opts);
- fprintf (stream, "%d %d\n", mnt->mnt_freq, mnt->mnt_passno);
+ __fprintf (stream, "%d %d\n", mnt->mnt_freq, mnt->mnt_passno);
ret = __ferror_unlocked (stream) != 0 || fflush (stream) != 0;
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index f1faf8292c..422ca351f2 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -560,6 +560,54 @@
# include <bits/long-double.h>
#endif
+#if (defined __GNUC__ && __GNUC__ >= 2) || (__clang_major__ >= 4)
+# define __REDIRECT_LDBL1(name, prenth, posnth, proto, alias) \
+ name proto prenth __asm__ (__ASMNAME (__ASMNAME (#alias))) posnth
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+# ifdef __REDIRECT
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , , proto, ieee128)
+# ifdef __cplusplus
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROW, , proto, ieee128)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROWNL, , proto, ieee128)
+# else
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROW, proto, ieee128)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROWNL, proto, ieee128)
+# endif /* __cplusplus */
+# else
+_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
+# endif /* __REDIRECT */
+# elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
+# ifdef __REDIRECT
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , , proto, compat)
+# ifdef __cplusplus
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROW, , proto, compat)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROWNL, , proto, compat)
+# else
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROW, proto, compat)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROWNL, proto, compat)
+# endif /* __cplusplus */
+# else
+_Static_assert (0, "Compat long double requires redirection on this platform");
+# endif /* __REDIRECT */
+# endif
+#endif
+
+#ifndef __REDIRECT_LDBL
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) name proto
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) name proto __THROW
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) name proto __THROWNL
+#endif
+
#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
# ifdef __REDIRECT
@@ -583,10 +631,6 @@
# define __REDIRECT_NTH_LDBL(name, proto, alias) \
__LDBL_REDIR1_NTH (name, proto, __##alias##ieee128)
-/* Unused. */
-# define __REDIRECT_LDBL(name, proto, alias) ... unused__redirect_ldbl
-# define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth
-
# else
_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
# endif
@@ -605,24 +649,6 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf
extern __typeof (name) name __asm (__ASMNAME (#alias));
# define __LDBL_REDIR_DECL(name) \
extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name));
-# define __REDIRECT_LDBL(name, proto, alias) \
- __LDBL_REDIR1 (name, proto, __nldbl_##alias)
-# define __REDIRECT_NTH_LDBL(name, proto, alias) \
- __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias)
-# endif
-#endif
-#if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \
- || !defined __REDIRECT
-# define __LDBL_REDIR1(name, proto, alias) name proto
-# define __LDBL_REDIR(name, proto) name proto
-# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW
-# define __LDBL_REDIR_NTH(name, proto) name proto __THROW
-# define __LDBL_REDIR2_DECL(name)
-# define __LDBL_REDIR_DECL(name)
-# ifdef __REDIRECT
-# define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias)
-# define __REDIRECT_NTH_LDBL(name, proto, alias) \
- __REDIRECT_NTH (name, proto, alias)
# endif
#endif
diff --git a/nis/nis_subr.c b/nis/nis_subr.c
index 385f221062..0e02cd19b5 100644
--- a/nis/nis_subr.c
+++ b/nis/nis_subr.c
@@ -280,10 +280,10 @@ nis_getnames (const_nis_name name)
}
if (pos == 0
- && __asprintf (&getnames[pos++], "%s%s%s%s",
- name, name[name_len - 1] == '.' ? "" : ".",
- local_domain,
- local_domain[local_domain_len - 1] == '.' ? "" : ".") < 0)
+ && asprintf (&getnames[pos++], "%s%s%s%s",
+ name, name[name_len - 1] == '.' ? "" : ".",
+ local_domain,
+ local_domain[local_domain_len - 1] == '.' ? "" : ".") < 0)
goto free_null;
getnames[pos] = NULL;
diff --git a/nptl/pthread_getname.c b/nptl/pthread_getname.c
index ebec06e23f..a424b3e4f8 100644
--- a/nptl/pthread_getname.c
+++ b/nptl/pthread_getname.c
@@ -42,7 +42,7 @@ __pthread_getname_np (pthread_t th, char *buf, size_t len)
#define FMT "/proc/self/task/%u/comm"
char fname[sizeof (FMT) + 8];
- sprintf (fname, FMT, (unsigned int) pd->tid);
+ __sprintf (fname, FMT, (unsigned int) pd->tid);
int fd = __open64_nocancel (fname, O_RDONLY);
if (fd == -1)
diff --git a/nptl/pthread_setname.c b/nptl/pthread_setname.c
index f24560db47..8520bac4be 100644
--- a/nptl/pthread_setname.c
+++ b/nptl/pthread_setname.c
@@ -44,7 +44,7 @@ __pthread_setname_np (pthread_t th, const char *name)
#define FMT "/proc/self/task/%u/comm"
char fname[sizeof (FMT) + 8];
- sprintf (fname, FMT, (unsigned int) pd->tid);
+ __sprintf (fname, FMT, (unsigned int) pd->tid);
int fd = __open64_nocancel (fname, O_RDWR);
if (fd == -1)
diff --git a/pwd/getpw.c b/pwd/getpw.c
index 547489a863..4784eaf00b 100644
--- a/pwd/getpw.c
+++ b/pwd/getpw.c
@@ -50,9 +50,9 @@ __getpw (__uid_t uid, char *buf)
if (p == NULL)
return -1;
- if (sprintf (buf, "%s:%s:%lu:%lu:%s:%s:%s", p->pw_name, p->pw_passwd,
- (unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
- p->pw_gecos, p->pw_dir, p->pw_shell) < 0)
+ if (__sprintf (buf, "%s:%s:%lu:%lu:%s:%s:%s", p->pw_name, p->pw_passwd,
+ (unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
+ p->pw_gecos, p->pw_dir, p->pw_shell) < 0)
return -1;
return 0;
diff --git a/pwd/putpwent.c b/pwd/putpwent.c
index e3f2f4e09e..480dd59813 100644
--- a/pwd/putpwent.c
+++ b/pwd/putpwent.c
@@ -48,11 +48,11 @@ putpwent (const struct passwd *p, FILE *stream)
return -1;
if (p->pw_name[0] == '+' || p->pw_name[0] == '-')
- ret = fprintf (stream, "%s:%s:::%s:%s:%s\n",
+ ret = __fprintf (stream, "%s:%s:::%s:%s:%s\n",
p->pw_name, _S (p->pw_passwd),
gecos, _S (p->pw_dir), _S (p->pw_shell));
else
- ret = fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
+ ret = __fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
p->pw_name, _S (p->pw_passwd),
(unsigned long int) p->pw_uid,
(unsigned long int) p->pw_gid,
diff --git a/resolv/inet_ntop.c b/resolv/inet_ntop.c
index c4d38c0f95..53725d805a 100644
--- a/resolv/inet_ntop.c
+++ b/resolv/inet_ntop.c
@@ -28,9 +28,9 @@
#include <string.h>
#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
+# define SPRINTF(x) strlen(__sprintf/**/x)
#else
-# define SPRINTF(x) ((size_t)sprintf x)
+# define SPRINTF(x) ((size_t)__sprintf x)
#endif
/*
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index 913a5cb82f..06a91b23ca 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -507,8 +507,8 @@ _nss_dns_gethostbyaddr2_r (const void *addr, socklen_t len, int af,
switch (af)
{
case AF_INET:
- sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", (uaddr[3] & 0xff),
- (uaddr[2] & 0xff), (uaddr[1] & 0xff), (uaddr[0] & 0xff));
+ __sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", (uaddr[3] & 0xff),
+ (uaddr[2] & 0xff), (uaddr[1] & 0xff), (uaddr[0] & 0xff));
break;
case AF_INET6:
qp = qbuf;
diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
index 09cd917444..304ae35b8b 100644
--- a/resolv/nss_dns/dns-network.c
+++ b/resolv/nss_dns/dns-network.c
@@ -191,21 +191,21 @@ _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result,
{
case 3:
/* Class A network. */
- sprintf (qbuf, "0.0.0.%u.in-addr.arpa", net_bytes[3]);
+ __sprintf (qbuf, "0.0.0.%u.in-addr.arpa", net_bytes[3]);
break;
case 2:
/* Class B network. */
- sprintf (qbuf, "0.0.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2]);
+ __sprintf (qbuf, "0.0.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2]);
break;
case 1:
/* Class C network. */
- sprintf (qbuf, "0.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
- net_bytes[1]);
+ __sprintf (qbuf, "0.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
+ net_bytes[1]);
break;
case 0:
/* Class D - E network. */
- sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
- net_bytes[1], net_bytes[0]);
+ __sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
+ net_bytes[1], net_bytes[0]);
break;
}
diff --git a/shadow/putspent.c b/shadow/putspent.c
index cbbb840d5b..d675e28210 100644
--- a/shadow/putspent.c
+++ b/shadow/putspent.c
@@ -42,47 +42,47 @@ putspent (const struct spwd *p, FILE *stream)
flockfile (stream);
- if (fprintf (stream, "%s:%s:", p->sp_namp, _S (p->sp_pwdp)) < 0)
+ if (__fprintf (stream, "%s:%s:", p->sp_namp, _S (p->sp_pwdp)) < 0)
++errors;
if ((p->sp_lstchg != (long int) -1
- && fprintf (stream, "%ld:", p->sp_lstchg) < 0)
+ && __fprintf (stream, "%ld:", p->sp_lstchg) < 0)
|| (p->sp_lstchg == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_min != (long int) -1
- && fprintf (stream, "%ld:", p->sp_min) < 0)
+ && __fprintf (stream, "%ld:", p->sp_min) < 0)
|| (p->sp_min == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_max != (long int) -1
- && fprintf (stream, "%ld:", p->sp_max) < 0)
+ && __fprintf (stream, "%ld:", p->sp_max) < 0)
|| (p->sp_max == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_warn != (long int) -1
- && fprintf (stream, "%ld:", p->sp_warn) < 0)
+ && __fprintf (stream, "%ld:", p->sp_warn) < 0)
|| (p->sp_warn == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_inact != (long int) -1
- && fprintf (stream, "%ld:", p->sp_inact) < 0)
+ && __fprintf (stream, "%ld:", p->sp_inact) < 0)
|| (p->sp_inact == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_expire != (long int) -1
- && fprintf (stream, "%ld:", p->sp_expire) < 0)
+ && __fprintf (stream, "%ld:", p->sp_expire) < 0)
|| (p->sp_expire == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if (p->sp_flag != ~0ul
- && fprintf (stream, "%ld", p->sp_flag) < 0)
+ && __fprintf (stream, "%ld", p->sp_flag) < 0)
++errors;
if (putc_unlocked ('\n', stream) == EOF)
diff --git a/stdio-common/dprintf.c b/stdio-common/dprintf.c
index 2e26d59714..6fbe5d4862 100644
--- a/stdio-common/dprintf.c
+++ b/stdio-common/dprintf.c
@@ -33,5 +33,4 @@ __dprintf (int d, const char *format, ...)
return done;
}
libc_hidden_def (__dprintf)
-ldbl_hidden_def (__dprintf, dprintf)
ldbl_weak_alias (__dprintf, dprintf)
diff --git a/stdio-common/fprintf.c b/stdio-common/fprintf.c
index 8d2cd37433..af7190c5b4 100644
--- a/stdio-common/fprintf.c
+++ b/stdio-common/fprintf.c
@@ -34,7 +34,7 @@ __fprintf (FILE *stream, const char *format, ...)
return done;
}
-ldbl_hidden_def (__fprintf, fprintf)
+libc_hidden_def (__fprintf)
ldbl_strong_alias (__fprintf, fprintf)
/* We define the function with the real name here. But deep down in
diff --git a/stdio-common/psiginfo.c b/stdio-common/psiginfo.c
index adf3b71b77..f99c51da17 100644
--- a/stdio-common/psiginfo.c
+++ b/stdio-common/psiginfo.c
@@ -76,7 +76,7 @@ psiginfo (const siginfo_t *pinfo, const char *s)
}
if (s != NULL && *s != '\0')
- fprintf (fp, "%s: ", s);
+ __fprintf (fp, "%s: ", s);
const char *desc;
if (pinfo->si_signo >= 0 && pinfo->si_signo < NSIG
@@ -92,21 +92,21 @@ psiginfo (const siginfo_t *pinfo, const char *s)
if (pinfo->si_signo - SIGRTMIN < SIGRTMAX - pinfo->si_signo)
{
if (pinfo->si_signo == SIGRTMIN)
- fprintf (fp, "SIGRTMIN (");
+ __fprintf (fp, "SIGRTMIN (");
else
- fprintf (fp, "SIGRTMIN+%d (", pinfo->si_signo - SIGRTMIN);
+ __fprintf (fp, "SIGRTMIN+%d (", pinfo->si_signo - SIGRTMIN);
}
else
{
if (pinfo->si_signo == SIGRTMAX)
- fprintf (fp, "SIGRTMAX (");
+ __fprintf (fp, "SIGRTMAX (");
else
- fprintf (fp, "SIGRTMAX-%d (", SIGRTMAX - pinfo->si_signo);
+ __fprintf (fp, "SIGRTMAX-%d (", SIGRTMAX - pinfo->si_signo);
}
}
else
#endif
- fprintf (fp, "%s (", _(desc));
+ __fprintf (fp, "%s (", _(desc));
const char *base = NULL;
const uint8_t *offarr = NULL;
@@ -178,25 +178,25 @@ Signal generated by the completion of an I/O request");
}
if (str != NULL)
- fprintf (fp, "%s ", _(str));
+ __fprintf (fp, "%s ", _(str));
else
- fprintf (fp, "%d ", pinfo->si_code);
+ __fprintf (fp, "%d ", pinfo->si_code);
if (pinfo->si_signo == SIGILL || pinfo->si_signo == SIGFPE
|| pinfo->si_signo == SIGSEGV || pinfo->si_signo == SIGBUS)
- fprintf (fp, "[%p])\n", pinfo->si_addr);
+ __fprintf (fp, "[%p])\n", pinfo->si_addr);
else if (pinfo->si_signo == SIGCHLD)
- fprintf (fp, "%ld %d %ld)\n",
- (long int) pinfo->si_pid, pinfo->si_status,
- (long int) pinfo->si_uid);
+ __fprintf (fp, "%ld %d %ld)\n",
+ (long int) pinfo->si_pid, pinfo->si_status,
+ (long int) pinfo->si_uid);
else if (pinfo->si_signo == SIGPOLL)
- fprintf (fp, "%ld)\n", (long int) pinfo->si_band);
+ __fprintf (fp, "%ld)\n", (long int) pinfo->si_band);
else
- fprintf (fp, "%ld %ld)\n",
- (long int) pinfo->si_pid, (long int) pinfo->si_uid);
+ __fprintf (fp, "%ld %ld)\n",
+ (long int) pinfo->si_pid, (long int) pinfo->si_uid);
}
else
- fprintf (fp, _("Unknown signal %d\n"), pinfo->si_signo);
+ __fprintf (fp, _("Unknown signal %d\n"), pinfo->si_signo);
fclose (fp);
diff --git a/stdio-common/sprintf.c b/stdio-common/sprintf.c
index a9665f753a..f1f43a49ec 100644
--- a/stdio-common/sprintf.c
+++ b/stdio-common/sprintf.c
@@ -32,6 +32,6 @@ __sprintf (char *s, const char *format, ...)
return done;
}
-ldbl_hidden_def (__sprintf, sprintf)
+libc_hidden_def (__sprintf)
ldbl_strong_alias (__sprintf, sprintf)
ldbl_strong_alias (__sprintf, _IO_sprintf)
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 7559fd239d..c5912788bd 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -24,4 +24,4 @@ __vfprintf (FILE *fp, const char *format, va_list ap)
}
ldbl_strong_alias (__vfprintf, _IO_vfprintf);
ldbl_strong_alias (__vfprintf, vfprintf);
-ldbl_hidden_def (__vfprintf, vfprintf)
+libc_hidden_def (__vfprintf)
diff --git a/sunrpc/netname.c b/sunrpc/netname.c
index bf7f0b81c4..97a881c3af 100644
--- a/sunrpc/netname.c
+++ b/sunrpc/netname.c
@@ -48,7 +48,7 @@ user2netname (char netname[MAXNETNAMELEN + 1], const uid_t uid,
if ((strlen (dfltdom) + OPSYS_LEN + 3 + MAXIPRINT) > (size_t) MAXNETNAMELEN)
return 0;
- sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
+ __sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
i = strlen (netname);
if (netname[i - 1] == '.')
netname[i - 1] = '\0';
@@ -112,7 +112,7 @@ host2netname (char netname[MAXNETNAMELEN + 1], const char *host,
> MAXNETNAMELEN)
return 0;
- sprintf (netname, "%s.%s@%s", OPSYS, hostname, domainname);
+ __sprintf (netname, "%s.%s@%s", OPSYS, hostname, domainname);
return 1;
}
#ifdef EXPORT_RPC_SYMBOLS
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
index f683836678..59f6e31d2d 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128___asprintf (char **string_ptr, const char *format, ...)
+int
+__asprintfieee128 (char **string_ptr, const char *format, ...)
{
va_list ap;
int done;
@@ -32,5 +32,4 @@ ___ieee128___asprintf (char **string_ptr, const char *format, ...)
return done;
}
-hidden_def (___ieee128___asprintf)
-strong_alias (___ieee128___asprintf, __asprintfieee128)
+libc_hidden_def (__asprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
index cf3b46c37a..ceba219dc7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_dprintf (int d, const char *format, ...)
+int
+__dprintfieee128 (int d, const char *format, ...)
{
va_list ap;
int done;
@@ -31,5 +31,4 @@ ___ieee128_dprintf (int d, const char *format, ...)
return done;
}
-strong_alias (___ieee128_dprintf, __dprintfieee128)
-hidden_def (___ieee128_dprintf);
+libc_hidden_def (__dprintfieee128);
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
index 4462588675..b58f27afb7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_fprintf (FILE *fp, const char *format, ...)
+int
+__fprintfieee128 (FILE *fp, const char *format, ...)
{
va_list ap;
int done;
@@ -31,5 +31,4 @@ ___ieee128_fprintf (FILE *fp, const char *format, ...)
return done;
}
-strong_alias (___ieee128_fprintf, __fprintfieee128)
-hidden_def (___ieee128_fprintf)
+libc_hidden_def (__fprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
index 9703069b95..243eb65629 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
@@ -18,8 +18,8 @@
/* When in IEEE long double mode, call ___ieee128_sprintf. */
#include <stdio.h>
-typeof (sprintf) ___ieee128_sprintf attribute_hidden;
-#define SPRINTF ___ieee128_sprintf
+typeof (sprintf) __sprintfieee128 attribute_hidden;
+#define SPRINTF __sprintfieee128
/* Declare internal functions: ___qecvtieee128_r and ___qfcvtieee128_r,
built from a different compiling unit, and called from here. */
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
index 0be5bb2810..8046f5fd46 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
@@ -18,8 +18,8 @@
/* When in IEEE long double mode, call ___ieee128_snprintf. */
#include <stdio.h>
-typeof (snprintf) ___ieee128_snprintf attribute_hidden;
-#define SNPRINTF ___ieee128_snprintf
+typeof (snprintf) __snprintfieee128 attribute_hidden;
+#define SNPRINTF __snprintfieee128
#define ECVT_R __qecvtieee128_r
#define FCVT_R __qfcvtieee128_r
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
index 5f51b3ec9e..da3d9441d7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_snprintf (char *s, size_t maxlen, const char *format, ...)
+int
+__snprintfieee128 (char *s, size_t maxlen, const char *format, ...)
{
va_list ap;
int done;
@@ -32,4 +32,4 @@ ___ieee128_snprintf (char *s, size_t maxlen, const char *format, ...)
return done;
}
-strong_alias (___ieee128_snprintf, __snprintfieee128)
+libc_hidden_def (__snprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
index 0cad130788..007a71659a 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_sprintf (char *s, const char *format, ...)
+int
+__sprintfieee128 (char *s, const char *format, ...)
{
va_list ap;
int done;
@@ -32,5 +32,4 @@ ___ieee128_sprintf (char *s, const char *format, ...)
return done;
}
-strong_alias (___ieee128_sprintf, __sprintfieee128)
-hidden_def (___ieee128_sprintf)
+libc_hidden_def (__sprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
index e340c9b457..4df1e485a5 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
@@ -18,10 +18,9 @@
#include <libio/libioP.h>
-extern int
-___ieee128_vfprintf (FILE *fp, const char *format, va_list ap)
+int
+__vfprintfieee128 (FILE *fp, const char *format, va_list ap)
{
return __vfprintf_internal (fp, format, ap, PRINTF_LDBL_USES_FLOAT128);
}
-strong_alias (___ieee128_vfprintf, __vfprintfieee128)
-hidden_def (___ieee128_vfprintf)
+libc_hidden_def (__vfprintfieee128)
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
index ebd2a43951..5b167d45ff 100644
--- a/sysdeps/posix/tempname.c
+++ b/sysdeps/posix/tempname.c
@@ -161,7 +161,7 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
return -1;
}
- sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
+ __sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
return 0;
}
#endif /* _LIBC */
diff --git a/sysdeps/unix/sysv/linux/ia64/makecontext.c b/sysdeps/unix/sysv/linux/ia64/makecontext.c
index 0bc4211dfc..0cf05d5999 100644
--- a/sysdeps/unix/sysv/linux/ia64/makecontext.c
+++ b/sysdeps/unix/sysv/linux/ia64/makecontext.c
@@ -54,7 +54,7 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
if (argc > 8)
{
- fprintf (stderr, _("\
+ __fprintf (stderr, _("\
makecontext: does not know how to handle more than 8 arguments\n"));
exit (-1);
}
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index 0e017f458b..f2dca7711a 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -233,10 +233,13 @@ extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
const wchar_t *__restrict __format, ...)
__THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
-extern int __REDIRECT_NTH_LDBL (__swprintf_alias,
- (wchar_t *__restrict __s, size_t __n,
- const wchar_t *__restrict __fmt, ...),
- swprintf);
+extern int __swprintf_alias (wchar_t *__restrict __s, size_t __n,
+ const wchar_t *__restrict __fmt, ...)
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+ __asm__ (__ASMNAME ("swprintf"))
+#endif
+ ;
+
#ifdef __va_arg_pack
__fortify_function int
@@ -264,10 +267,13 @@ extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
__gnuc_va_list __arg)
__THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-extern int __REDIRECT_NTH_LDBL (__vswprintf_alias,
- (wchar_t *__restrict __s, size_t __n,
- const wchar_t *__restrict __fmt,
- __gnuc_va_list __ap), vswprintf);
+extern int __vswprintf_alias (wchar_t *__restrict __s, size_t __n,
+ const wchar_t *__restrict __fmt,
+ __gnuc_va_list __ap)
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+ __asm__ (__ASMNAME ("vswprintf"))
+#endif
+ ;
__fortify_function int
__NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
^ permalink raw reply [flat|nested] 14+ messages in thread
* [glibc/azanella/clang] Remove stdio-ldbl.h
@ 2022-05-10 18:20 Adhemerval Zanella
0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-05-10 18:20 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f05b9e628f8c425ac76ac596a1b0aa1a0fa78a92
commit f05b9e628f8c425ac76ac596a1b0aa1a0fa78a92
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Thu Feb 24 14:13:12 2022 -0300
Remove stdio-ldbl.h
The functions which require different alias to long double depending
of the ABI now uses a set os macros that defines the expected alias
on the function prototype, instead of redefine them using the
__LDBL_REDIR_DEC macros.
The __REDIRECT_LDBL, __REDIRECT_LDBL_NTH, __REDIRECT_LDBL_NTHNL
are refactores to be similar to __REDIRECT with the difference it
now expects the aliases for binary128 and for the long double being
double (which __LDBL_REDIR_DEC does).
All printf internal usage are also replaced to use internal alias
instead.
Diff:
---
argp/argp-parse.c | 4 +-
debug/backtracesyms.c | 18 +-
grp/putgrent.c | 6 +-
gshadow/putsgent.c | 6 +-
include/bits/stdio-ldbl.h | 1 -
include/stdio.h | 34 ++-
inet/ether_ntoa_r.c | 8 +-
inet/rexec.c | 2 +-
libio/Makefile | 2 +-
libio/bits/stdio-ldbl.h | 108 --------
libio/bits/stdio2.h | 115 ++++++---
libio/stdio.h | 286 +++++++++++++--------
malloc/malloc-check.c | 1 +
malloc/malloc.c | 32 +--
misc/efgcvt-template.c | 2 +-
misc/mntent_r.c | 2 +-
misc/sys/cdefs.h | 70 +++--
nis/nis_subr.c | 8 +-
nptl/pthread_getname.c | 2 +-
nptl/pthread_setname.c | 2 +-
pwd/getpw.c | 6 +-
pwd/putpwent.c | 4 +-
resolv/inet_ntop.c | 4 +-
resolv/nss_dns/dns-host.c | 4 +-
resolv/nss_dns/dns-network.c | 12 +-
shadow/putspent.c | 16 +-
stdio-common/dprintf.c | 1 -
stdio-common/fprintf.c | 2 +-
stdio-common/psiginfo.c | 32 +--
stdio-common/sprintf.c | 2 +-
stdio-common/vfprintf.c | 2 +-
sunrpc/netname.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-asprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-dprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-fprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-snprintf.c | 6 +-
.../ieee754/ldbl-128ibm-compat/ieee128-sprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c | 7 +-
sysdeps/posix/tempname.c | 2 +-
sysdeps/unix/sysv/linux/ia64/makecontext.c | 2 +-
wcsmbs/bits/wchar2.h | 22 +-
43 files changed, 448 insertions(+), 425 deletions(-)
diff --git a/argp/argp-parse.c b/argp/argp-parse.c
index 13cd84dd33..c26c0fc27f 100644
--- a/argp/argp-parse.c
+++ b/argp/argp-parse.c
@@ -177,7 +177,7 @@ argp_version_parser (int key, char *arg, struct argp_state *state)
if (argp_program_version_hook)
(*argp_program_version_hook) (state->out_stream, state);
else if (argp_program_version)
- fprintf (state->out_stream, "%s\n", argp_program_version);
+ __fprintf (state->out_stream, "%s\n", argp_program_version);
else
__argp_error (state, dgettext (state->root_argp->argp_domain,
"(PROGRAM ERROR) No version known!?"));
@@ -618,7 +618,7 @@ parser_finalize (struct parser *parser,
{
if (!(parser->state.flags & ARGP_NO_ERRS)
&& parser->state.err_stream)
- fprintf (parser->state.err_stream,
+ __fprintf (parser->state.err_stream,
dgettext (parser->argp->argp_domain,
"%s: Too many arguments\n"),
parser->state.name);
diff --git a/debug/backtracesyms.c b/debug/backtracesyms.c
index 17e0626df8..adb939f888 100644
--- a/debug/backtracesyms.c
+++ b/debug/backtracesyms.c
@@ -83,10 +83,10 @@ __backtrace_symbols (void *const *array, int size)
info[cnt].dli_saddr = info[cnt].dli_fbase;
if (info[cnt].dli_sname == NULL && info[cnt].dli_saddr == 0)
- last += 1 + sprintf (last, "%s(%s) [%p]",
- info[cnt].dli_fname ?: "",
- info[cnt].dli_sname ?: "",
- array[cnt]);
+ last += 1 + __sprintf (last, "%s(%s) [%p]",
+ info[cnt].dli_fname ?: "",
+ info[cnt].dli_sname ?: "",
+ array[cnt]);
else
{
char sign;
@@ -102,14 +102,14 @@ __backtrace_symbols (void *const *array, int size)
offset = info[cnt].dli_saddr - array[cnt];
}
- last += 1 + sprintf (last, "%s(%s%c%#tx) [%p]",
- info[cnt].dli_fname ?: "",
- info[cnt].dli_sname ?: "",
- sign, offset, array[cnt]);
+ last += 1 + __sprintf (last, "%s(%s%c%#tx) [%p]",
+ info[cnt].dli_fname ?: "",
+ info[cnt].dli_sname ?: "",
+ sign, offset, array[cnt]);
}
}
else
- last += 1 + sprintf (last, "[%p]", array[cnt]);
+ last += 1 + __sprintf (last, "[%p]", array[cnt]);
}
assert (last <= (char *) result + size * sizeof (char *) + total);
}
diff --git a/grp/putgrent.c b/grp/putgrent.c
index 966ba2a763..305ff44359 100644
--- a/grp/putgrent.c
+++ b/grp/putgrent.c
@@ -45,10 +45,10 @@ putgrent (const struct group *gr, FILE *stream)
flockfile (stream);
if (gr->gr_name[0] == '+' || gr->gr_name[0] == '-')
- retval = fprintf (stream, "%s:%s::",
+ retval = __fprintf (stream, "%s:%s::",
gr->gr_name, _S (gr->gr_passwd));
else
- retval = fprintf (stream, "%s:%s:%lu:",
+ retval = __fprintf (stream, "%s:%s:%lu:",
gr->gr_name, _S (gr->gr_passwd),
(unsigned long int) gr->gr_gid);
if (__builtin_expect (retval, 0) < 0)
@@ -60,7 +60,7 @@ putgrent (const struct group *gr, FILE *stream)
if (gr->gr_mem != NULL)
{
for (size_t i = 0; gr->gr_mem[i] != NULL; i++)
- if (fprintf (stream, i == 0 ? "%s" : ",%s", gr->gr_mem[i]) < 0)
+ if (__fprintf (stream, i == 0 ? "%s" : ",%s", gr->gr_mem[i]) < 0)
{
/* What else can we do? */
funlockfile (stream);
diff --git a/gshadow/putsgent.c b/gshadow/putsgent.c
index 9e2dca7eaf..870438de6d 100644
--- a/gshadow/putsgent.c
+++ b/gshadow/putsgent.c
@@ -42,7 +42,7 @@ putsgent (const struct sgrp *g, FILE *stream)
_IO_flockfile (stream);
- if (fprintf (stream, "%s:%s:", g->sg_namp, _S (g->sg_passwd)) < 0)
+ if (__fprintf (stream, "%s:%s:", g->sg_namp, _S (g->sg_passwd)) < 0)
++errors;
bool first = true;
@@ -50,7 +50,7 @@ putsgent (const struct sgrp *g, FILE *stream)
if (sp != NULL)
while (*sp != NULL)
{
- if (fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
+ if (__fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
{
++errors;
break;
@@ -65,7 +65,7 @@ putsgent (const struct sgrp *g, FILE *stream)
if (sp != NULL)
while (*sp != NULL)
{
- if (fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
+ if (__fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
{
++errors;
break;
diff --git a/include/bits/stdio-ldbl.h b/include/bits/stdio-ldbl.h
deleted file mode 100644
index 1f7d3ce1c6..0000000000
--- a/include/bits/stdio-ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <libio/bits/stdio-ldbl.h>
diff --git a/include/stdio.h b/include/stdio.h
index a6f7fd43cb..39b4978130 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -22,13 +22,17 @@
/* Some libc_hidden_ldbl_proto's do not map to a unique symbol when
redirecting ldouble to _Float128 variants. We can therefore safely
directly alias them to their internal name. */
-# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc)
-# define stdio_hidden_ldbl_proto(p, f) \
- extern __typeof (p ## f) p ## f __asm (__ASMNAME ("___ieee128_" #f));
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# define stdio_hidden_ldbl_proto(p,f) __LDBL_REDIR1_DECL (p ## f, p ## f ## ieee128)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc) && defined SHARED
+# define __stdio_hidden_ldbl_proto(name, alias) \
+ extern __typeof (name) __##name __asm__ (__hidden_asmname (#alias));
+# define stdio_hidden_ldbl_proto(name) \
+ extern typeof (name) __##name##ieee128; \
+ libc_hidden_proto (__##name##ieee128); \
+ __stdio_hidden_ldbl_proto (name, __GI___##name##ieee128)
# else
-# define stdio_hidden_ldbl_proto(p,f) libc_hidden_proto (p ## f)
+# define stdio_hidden_ldbl_proto(name) \
+ extern __typeof (name) __##name; \
+ libc_hidden_proto (__##name)
# endif
/* Set the error indicator on FP. */
@@ -39,10 +43,7 @@ fseterr_unlocked (FILE *fp)
}
extern int __fcloseall (void) attribute_hidden;
-extern int __snprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, ...)
- __attribute__ ((__format__ (__printf__, 3, 4)));
-stdio_hidden_ldbl_proto (__, snprintf)
+stdio_hidden_ldbl_proto (snprintf);
extern int __vfscanf (FILE *__restrict __s,
const char *__restrict __format,
@@ -184,7 +185,7 @@ extern const size_t _sys_errlist_internal_len attribute_hidden;
extern const char *__get_errlist (int) attribute_hidden;
extern const char *__get_errname (int) attribute_hidden;
-libc_hidden_ldbl_proto (__asprintf)
+stdio_hidden_ldbl_proto (asprintf);
# if IS_IN (libc)
extern FILE *_IO_new_fopen (const char*, const char*);
@@ -206,13 +207,10 @@ extern int _IO_new_fgetpos (FILE *, __fpos_t *);
# define fgetpos(fp, posp) _IO_new_fgetpos (fp, posp)
# endif
-extern __typeof (dprintf) __dprintf
- __attribute__ ((__format__ (__printf__, 2, 3)));
-stdio_hidden_ldbl_proto (__, dprintf)
-libc_hidden_ldbl_proto (dprintf)
-libc_hidden_ldbl_proto (fprintf)
-libc_hidden_ldbl_proto (vfprintf)
-libc_hidden_ldbl_proto (sprintf)
+stdio_hidden_ldbl_proto (dprintf);
+stdio_hidden_ldbl_proto (fprintf);
+stdio_hidden_ldbl_proto (vfprintf);
+stdio_hidden_ldbl_proto (sprintf);
libc_hidden_proto (ungetc)
libc_hidden_proto (__getdelim)
libc_hidden_proto (fwrite)
diff --git a/inet/ether_ntoa_r.c b/inet/ether_ntoa_r.c
index 03011ffef6..f111e5234c 100644
--- a/inet/ether_ntoa_r.c
+++ b/inet/ether_ntoa_r.c
@@ -23,10 +23,10 @@
char *
ether_ntoa_r (const struct ether_addr *addr, char *buf)
{
- sprintf (buf, "%x:%x:%x:%x:%x:%x",
- addr->ether_addr_octet[0], addr->ether_addr_octet[1],
- addr->ether_addr_octet[2], addr->ether_addr_octet[3],
- addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
+ __sprintf (buf, "%x:%x:%x:%x:%x:%x",
+ addr->ether_addr_octet[0], addr->ether_addr_octet[1],
+ addr->ether_addr_octet[2], addr->ether_addr_octet[3],
+ addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
return buf;
}
libc_hidden_def (ether_ntoa_r)
diff --git a/inet/rexec.c b/inet/rexec.c
index 330282ac16..809475d976 100644
--- a/inet/rexec.c
+++ b/inet/rexec.c
@@ -135,7 +135,7 @@ retry:
NULL, 0, servbuff, sizeof(servbuff),
NI_NUMERICSERV))
port = (int) __strtol (servbuff, NULL, 10);
- (void) sprintf(num, "%u", port);
+ (void) __sprintf(num, "%u", port);
(void) __write(s, num, strlen(num)+1);
{ socklen_t len = sizeof (from);
s3 = TEMP_FAILURE_RETRY (accept(s2, (struct sockaddr *)&from,
diff --git a/libio/Makefile b/libio/Makefile
index e97387743f..a4830ddf42 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -23,7 +23,7 @@ subdir := libio
include ../Makeconfig
headers := stdio.h \
- bits/stdio.h bits/stdio2.h bits/stdio-ldbl.h \
+ bits/stdio.h bits/stdio2.h \
bits/types/FILE.h bits/types/__FILE.h bits/types/struct_FILE.h \
bits/types/__fpos_t.h bits/types/__fpos64_t.h \
bits/types/cookie_io_functions_t.h
diff --git a/libio/bits/stdio-ldbl.h b/libio/bits/stdio-ldbl.h
deleted file mode 100644
index 6b63394b50..0000000000
--- a/libio/bits/stdio-ldbl.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -mlong-double-64 compatibility mode for stdio functions.
- Copyright (C) 2006-2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#ifndef _STDIO_H
-# error "Never include <bits/stdio-ldbl.h> directly; use <stdio.h> instead."
-#endif
-
-__LDBL_REDIR_DECL (fprintf)
-__LDBL_REDIR_DECL (printf)
-__LDBL_REDIR_DECL (sprintf)
-__LDBL_REDIR_DECL (vfprintf)
-__LDBL_REDIR_DECL (vprintf)
-__LDBL_REDIR_DECL (vsprintf)
-#if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (fscanf, __nldbl___isoc99_fscanf)
-__LDBL_REDIR1_DECL (scanf, __nldbl___isoc99_scanf)
-__LDBL_REDIR1_DECL (sscanf, __nldbl___isoc99_sscanf)
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (fscanf, __isoc99_fscanfieee128)
-__LDBL_REDIR1_DECL (scanf, __isoc99_scanfieee128)
-__LDBL_REDIR1_DECL (sscanf, __isoc99_sscanfieee128)
-# else
-# error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-# endif
-#else
-__LDBL_REDIR_DECL (fscanf)
-__LDBL_REDIR_DECL (scanf)
-__LDBL_REDIR_DECL (sscanf)
-#endif
-
-#if defined __USE_ISOC99 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (snprintf)
-__LDBL_REDIR_DECL (vsnprintf)
-#endif
-
-#ifdef __USE_ISOC99
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (vfscanf, __nldbl___isoc99_vfscanf)
-__LDBL_REDIR1_DECL (vscanf, __nldbl___isoc99_vscanf)
-__LDBL_REDIR1_DECL (vsscanf, __nldbl___isoc99_vsscanf)
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (vfscanf, __isoc99_vfscanfieee128)
-__LDBL_REDIR1_DECL (vscanf, __isoc99_vscanfieee128)
-__LDBL_REDIR1_DECL (vsscanf, __isoc99_vsscanfieee128)
-# else
-# error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-# endif
-# else
-__LDBL_REDIR_DECL (vfscanf)
-__LDBL_REDIR_DECL (vsscanf)
-__LDBL_REDIR_DECL (vscanf)
-# endif
-#endif
-
-#ifdef __USE_XOPEN2K8
-__LDBL_REDIR_DECL (vdprintf)
-__LDBL_REDIR_DECL (dprintf)
-#endif
-
-#ifdef __USE_GNU
-__LDBL_REDIR_DECL (vasprintf)
-__LDBL_REDIR2_DECL (asprintf)
-__LDBL_REDIR_DECL (asprintf)
-__LDBL_REDIR_DECL (obstack_printf)
-__LDBL_REDIR_DECL (obstack_vprintf)
-#endif
-
-#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR2_DECL (sprintf_chk)
-__LDBL_REDIR2_DECL (vsprintf_chk)
-# if defined __USE_ISOC99 || defined __USE_UNIX98
-__LDBL_REDIR2_DECL (snprintf_chk)
-__LDBL_REDIR2_DECL (vsnprintf_chk)
-# endif
-# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR2_DECL (fprintf_chk)
-__LDBL_REDIR2_DECL (printf_chk)
-__LDBL_REDIR2_DECL (vfprintf_chk)
-__LDBL_REDIR2_DECL (vprintf_chk)
-# ifdef __USE_XOPEN2K8
-__LDBL_REDIR2_DECL (dprintf_chk)
-__LDBL_REDIR2_DECL (vdprintf_chk)
-# endif
-# ifdef __USE_GNU
-__LDBL_REDIR2_DECL (asprintf_chk)
-__LDBL_REDIR2_DECL (vasprintf_chk)
-__LDBL_REDIR2_DECL (obstack_printf_chk)
-__LDBL_REDIR2_DECL (obstack_vprintf_chk)
-# endif
-# endif
-#endif
diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h
index b0b655ee7a..de7f1f04aa 100644
--- a/libio/bits/stdio2.h
+++ b/libio/bits/stdio2.h
@@ -23,12 +23,17 @@
# error "Never include <bits/stdio2.h> directly; use <stdio.h> instead."
#endif
-extern int __sprintf_chk (char *__restrict __s, int __flag, size_t __slen,
- const char *__restrict __format, ...) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__sprintf_chk, (char *__restrict __s,
+ int __flag, size_t __slen,
+ const char *__restrict __format,
+ ...),
+ __sprintf_chkieee128, __nldbl___sprintf_chk)
__attr_access ((__write_only__, 1, 3));
-extern int __vsprintf_chk (char *__restrict __s, int __flag, size_t __slen,
- const char *__restrict __format,
- __gnuc_va_list __ap) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__vsprintf_chk, (char *__restrict __s,
+ int __flag, size_t __slen,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vsprintf_chkieee128, __nldbl___vsprintf_chk)
__attr_access ((__write_only__, 1, 3));
#ifdef __va_arg_pack
@@ -54,14 +59,19 @@ __NTH (vsprintf (char *__restrict __s, const char *__restrict __fmt,
}
#if defined __USE_ISOC99 || defined __USE_UNIX98
-
-extern int __snprintf_chk (char *__restrict __s, size_t __n, int __flag,
- size_t __slen, const char *__restrict __format,
- ...) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__snprintf_chk, (char *__restrict __s,
+ size_t __n, int __flag,
+ size_t __slen,
+ const char *__restrict __format,
+ ...),
+ __snprintf_chkieee128, __nldbl___snprintf_chk)
__attr_access ((__write_only__, 1, 2));
-extern int __vsnprintf_chk (char *__restrict __s, size_t __n, int __flag,
- size_t __slen, const char *__restrict __format,
- __gnuc_va_list __ap) __THROW;
+extern int __REDIRECT_LDBL_NTHNL (__vsnprintf_chk, (char *__restrict __s,
+ size_t __n, int __flag,
+ size_t __slen,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vsnprintf_chkieee128, __nldbl___vsnprintf_chk);
# ifdef __va_arg_pack
__fortify_function int
@@ -89,14 +99,24 @@ __NTH (vsnprintf (char *__restrict __s, size_t __n,
#endif
#if __USE_FORTIFY_LEVEL > 1
-
-extern int __fprintf_chk (FILE *__restrict __stream, int __flag,
- const char *__restrict __format, ...);
-extern int __printf_chk (int __flag, const char *__restrict __format, ...);
-extern int __vfprintf_chk (FILE *__restrict __stream, int __flag,
- const char *__restrict __format, __gnuc_va_list __ap);
-extern int __vprintf_chk (int __flag, const char *__restrict __format,
- __gnuc_va_list __ap);
+extern int __REDIRECT_LDBL (__fprintf_chk, (FILE *__restrict __stream,
+ int __flag,
+ const char *__restrict __format,
+ ...),
+ __fprintf_chkieee128, __nldbl___fprintf_chk);
+extern int __REDIRECT_LDBL (__printf_chk, (int __flag,
+ const char *__restrict __format,
+ ...),
+ __printf_chkieee128, __nldbl___printf_chk);
+extern int __REDIRECT_LDBL (__vfprintf_chk, (FILE *__restrict __stream,
+ int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vfprintf_chkieee128, __nldbl___vfprintf_chk);
+extern int __REDIRECT_LDBL (__vprintf_chk, (int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vprintf_chkieee128, __nldbl___vprintf_chk);
# ifdef __va_arg_pack
__fortify_function int
@@ -136,10 +156,15 @@ vfprintf (FILE *__restrict __stream,
}
# ifdef __USE_XOPEN2K8
-extern int __dprintf_chk (int __fd, int __flag, const char *__restrict __fmt,
- ...) __attribute__ ((__format__ (__printf__, 3, 4)));
-extern int __vdprintf_chk (int __fd, int __flag,
- const char *__restrict __fmt, __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL (__dprintf_chk, (int __fd, int __flag,
+ const char *__restrict __fmt,
+ ...),
+ __dprintf_chkieee128, __nldbl___dprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL (__vdprintf_chk, (int __fd, int __flag,
+ const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vdprintf_chkieee128, __nldbl___vdprintf_chk)
__attribute__ ((__format__ (__printf__, 3, 0)));
# ifdef __va_arg_pack
@@ -162,22 +187,32 @@ vdprintf (int __fd, const char *__restrict __fmt, __gnuc_va_list __ap)
# endif
# ifdef __USE_GNU
-
-extern int __asprintf_chk (char **__restrict __ptr, int __flag,
- const char *__restrict __fmt, ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4))) __wur;
-extern int __vasprintf_chk (char **__restrict __ptr, int __flag,
- const char *__restrict __fmt, __gnuc_va_list __arg)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
-extern int __obstack_printf_chk (struct obstack *__restrict __obstack,
- int __flag, const char *__restrict __format,
- ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
-extern int __obstack_vprintf_chk (struct obstack *__restrict __obstack,
- int __flag,
- const char *__restrict __format,
- __gnuc_va_list __args)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
+extern int __REDIRECT_LDBL_NTHNL (__asprintf_chk, (char **__restrict __ptr,
+ int __flag,
+ const char *__restrict __fmt,
+ ...),
+ __asprintf_chkieee128, __nldbl___asprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (__vasprintf_chk, (char **__restrict __ptr,
+ int __flag,
+ const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vasprintf_chkieee128, __nldbl___vasnprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (__obstack_printf_chk, (struct obstack *__restrict __obstack,
+ int __flag,
+ const char *__restrict __format,
+ ...),
+ __obstack_printf_chkieee128,
+ __nldbl___obstack_printf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL_NTHNL (__obstack_vprintf_chk, (struct obstack *__restrict __obstack,
+ int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __args),
+ __obstack_vprintf_chkieee128,
+ __nldbl___obstack_vprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
# ifdef __va_arg_pack
__fortify_function int
diff --git a/libio/stdio.h b/libio/stdio.h
index e6425341ce..54c9796a46 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -41,6 +41,7 @@ __BEGIN_DECLS
#include <bits/types/__FILE.h>
#include <bits/types/FILE.h>
#include <bits/types/struct_FILE.h>
+#include <bits/floatn.h>
#ifdef __USE_GNU
# include <bits/types/cookie_io_functions_t.h>
@@ -342,78 +343,143 @@ extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
extern void setlinebuf (FILE *__stream) __THROW;
#endif
-
/* Write formatted output to STREAM.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int fprintf (FILE *__restrict __stream,
- const char *__restrict __format, ...);
+extern int __REDIRECT_LDBL (fprintf, (FILE *__restrict __stream,
+ const char *__restrict __format, ...),
+ __fprintfieee128, __nldbl_fprintf);
/* Write formatted output to stdout.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int printf (const char *__restrict __format, ...);
+extern int __REDIRECT_LDBL (printf, (const char *__restrict __format, ...),
+ __printfieee128, __nldbl_printf);
/* Write formatted output to S. */
-extern int sprintf (char *__restrict __s,
- const char *__restrict __format, ...) __THROWNL;
+extern int __REDIRECT_LDBL_NTHNL (sprintf, (char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __sprintfieee128, __nldbl_sprintf);
/* Write formatted output to S from argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg);
+extern int __REDIRECT_LDBL (vfprintf, (FILE *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vfprintfieee128, __nldbl_vfprintf);
/* Write formatted output to stdout from argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
+extern int __REDIRECT_LDBL (vprintf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vprintfieee128, __nldbl_vprintf);
/* Write formatted output to S from argument list ARG. */
-extern int vsprintf (char *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg) __THROWNL;
+extern int __REDIRECT_LDBL_NTHNL (vsprintf, (char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsprintfieee128, __nldbl_vsprintf);
#if defined __USE_ISOC99 || defined __USE_UNIX98
/* Maximum chars of output to write in MAXLEN. */
-extern int snprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 3, 4)));
-
-extern int vsnprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, __gnuc_va_list __arg)
- __THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
+extern int __REDIRECT_LDBL_NTHNL (snprintf, (char *__restrict __s,
+ size_t __maxlen,
+ const char *__restrict __format,
+ ...),
+ __snprintfieee128, __nldbl_snprintf)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL_NTHNL (vsnprintf, (char *__restrict __s,
+ size_t __maxlen,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsnprintfieee128, __nldbl_vsnprintf)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
#endif
#if __GLIBC_USE (LIB_EXT2)
/* Write formatted output to a string dynamically allocated with `malloc'.
Store the address of the string in *PTR. */
-extern int vasprintf (char **__restrict __ptr, const char *__restrict __f,
- __gnuc_va_list __arg)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
-extern int __asprintf (char **__restrict __ptr,
- const char *__restrict __fmt, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
-extern int asprintf (char **__restrict __ptr,
- const char *__restrict __fmt, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (vasprintf, (char **__restrict __ptr,
+ const char *__restrict __f,
+ __gnuc_va_list __arg),
+ __vasprintfieee128, __nldbl_vasprintf)
+ __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (asprintf, (char **__restrict __ptr,
+ const char *__restrict __fmt,
+ ...),
+ __asprintfieee128, __nldbl_asprintf)
+ __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
#endif
#ifdef __USE_XOPEN2K8
/* Write formatted output to a file descriptor. */
-extern int vdprintf (int __fd, const char *__restrict __fmt,
- __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL (vdprintf, (int __fd, const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vdprintfieee128, __nldbl_vdprintf)
__attribute__ ((__format__ (__printf__, 2, 0)));
-extern int dprintf (int __fd, const char *__restrict __fmt, ...)
+extern int __REDIRECT_LDBL (dprintf, (int __fd, const char *__restrict __fmt,
+ ...),
+ __dprintfieee128, __nldbl_dprintf)
__attribute__ ((__format__ (__printf__, 2, 3)));
#endif
-
+#if !__GLIBC_USE (DEPRECATED_SCANF)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ ...),
+ __isoc99_fscanfieee128, __nldbl___isoc99_fscanf) __wur;
+extern int __REDIRECT_LDBL (scanf, (const char *__restrict __format,
+ ...),
+ __isoc99_scanfieee128, __nldbl___isoc99_scanf) __wur;
+extern int __REDIRECT_LDBL_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __isoc99_sscanfieee128, __nldbl___isoc99_sscanf);
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format, ...),
+ __isoc99_fscanf) __wur;
+extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
+ __isoc99_scanf) __wur;
+extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format, ...),
+ __isoc99_sscanf);
+# else
+extern int __isoc99_fscanf (FILE *__restrict __stream,
+ const char *__restrict __format, ...) __wur;
+extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
+extern int __isoc99_sscanf (const char *__restrict __s,
+ const char *__restrict __format, ...) __THROW;
+# define fscanf __isoc99_fscanf
+# define scanf __isoc99_scanf
+# define sscanf __isoc99_sscanf
+# endif /* __REDIRECT */
+# endif
+#else
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ ...),
+ __fscanfieee128, __nldbl_fscanf) __wur;
+extern int __REDIRECT_LDBL (scanf, (const char *__restrict __format,
+ ...),
+ __scanfieee128, __nldbl_scanf) __wur;
+extern int __REDIRECT_LDBL_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __sscanfieee128, __nldbl_sscanf) __wur;
+# else
/* Read formatted input from STREAM.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int fscanf (FILE *__restrict __stream,
- const char *__restrict __format, ...) __wur;
+ const char *__restrict __format, ...) __wur;
/* Read formatted input from stdin.
This function is a possible cancellation point and therefore not
@@ -421,43 +487,81 @@ extern int fscanf (FILE *__restrict __stream,
extern int scanf (const char *__restrict __format, ...) __wur;
/* Read formatted input from S. */
extern int sscanf (const char *__restrict __s,
- const char *__restrict __format, ...) __THROW;
-
-/* For historical reasons, the C99-compliant versions of the scanf
- functions are at alternative names. When __LDBL_COMPAT or
- __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
- bits/stdio-ldbl.h. */
-#include <bits/floatn.h>
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
- && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-# ifdef __REDIRECT
-extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
- const char *__restrict __format, ...),
- __isoc99_fscanf) __wur;
-extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
- __isoc99_scanf) __wur;
-extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
- const char *__restrict __format, ...),
- __isoc99_sscanf);
-# else
-extern int __isoc99_fscanf (FILE *__restrict __stream,
- const char *__restrict __format, ...) __wur;
-extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
-extern int __isoc99_sscanf (const char *__restrict __s,
- const char *__restrict __format, ...) __THROW;
-# define fscanf __isoc99_fscanf
-# define scanf __isoc99_scanf
-# define sscanf __isoc99_sscanf
+ const char *__restrict __format, ...) __THROW;
# endif
-#endif
+#endif /* DEPRECATED_SCANF */
-#ifdef __USE_ISOC99
+#ifdef __USE_ISOC99
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vfscanfieee128, __nldbl___isoc99_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vscanfieee128, __nldbl___isoc99_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_LDBL_NTH (vsscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vsscanfieee128, __nldbl___isoc99_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (vfscanf,
+ (FILE *__restrict __s,
+ const char *__restrict __format, __gnuc_va_list __arg),
+ __isoc99_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_NTH (vsscanf,
+ (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
+extern int __isoc99_vfscanf (FILE *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg) __wur;
+extern int __isoc99_vscanf (const char *__restrict __format,
+ __gnuc_va_list __arg) __wur;
+extern int __isoc99_vsscanf (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg) __THROW;
+# define vfscanf __isoc99_vfscanf
+# define vscanf __isoc99_vscanf
+# define vsscanf __isoc99_vsscanf
+# endif /* __REDIRECT */
+# endif
+# else /* DEPRECATED_SCANF */
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vfscanfieee128, __nldbl_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vscanfieee128, __nldbl_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_LDBL_NTH (vsscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsscanfieee128, __nldbl_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
/* Read formatted input from S into argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg)
+ __gnuc_va_list __arg)
__attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
/* Read formatted input from stdin into argument list ARG.
@@ -469,42 +573,11 @@ extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
/* Read formatted input from S into argument list ARG. */
extern int vsscanf (const char *__restrict __s,
- const char *__restrict __format, __gnuc_va_list __arg)
+ const char *__restrict __format, __gnuc_va_list __arg)
__THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
-
-/* Same redirection as above for the v*scanf family. */
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __REDIRECT && !defined __LDBL_COMPAT \
- && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-extern int __REDIRECT (vfscanf,
- (FILE *__restrict __s,
- const char *__restrict __format, __gnuc_va_list __arg),
- __isoc99_vfscanf)
- __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
-extern int __REDIRECT (vscanf, (const char *__restrict __format,
- __gnuc_va_list __arg), __isoc99_vscanf)
- __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
-extern int __REDIRECT_NTH (vsscanf,
- (const char *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg), __isoc99_vsscanf)
- __attribute__ ((__format__ (__scanf__, 2, 0)));
-# elif !defined __REDIRECT
-extern int __isoc99_vfscanf (FILE *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg) __wur;
-extern int __isoc99_vscanf (const char *__restrict __format,
- __gnuc_va_list __arg) __wur;
-extern int __isoc99_vsscanf (const char *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg) __THROW;
-# define vfscanf __isoc99_vfscanf
-# define vscanf __isoc99_vscanf
-# define vsscanf __isoc99_vsscanf
# endif
# endif
-#endif /* Use ISO C9x. */
-
+#endif /* __USE_ISOC99 */
/* Read a character from STREAM.
@@ -850,13 +923,17 @@ extern char *cuserid (char *__s)
struct obstack; /* See <obstack.h>. */
/* Write formatted output to an obstack. */
-extern int obstack_printf (struct obstack *__restrict __obstack,
- const char *__restrict __format, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3)));
-extern int obstack_vprintf (struct obstack *__restrict __obstack,
- const char *__restrict __format,
- __gnuc_va_list __args)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 0)));
+extern int __REDIRECT_LDBL_NTHNL (obstack_printf,
+ (struct obstack *__restrict __obstack,
+ const char *__restrict __format, ...),
+ __obstack_printfieee128, __nldbl_obstack_printf)
+ __attribute__ ((__format__ (__printf__, 2, 3)));
+extern int __REDIRECT_LDBL_NTHNL (obstack_vprintf,
+ (struct obstack *__restrict __obstack,
+ const char *__restrict __format,
+ __gnuc_va_list __args),
+ __obstack_vprintfieee128, __nldbl_obstack_vprintf)
+ __attribute__ ((__format__ (__printf__, 2, 0)));
#endif /* Use GNU. */
@@ -894,11 +971,6 @@ extern int __overflow (FILE *, int);
# include <bits/stdio2.h>
#endif
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/stdio-ldbl.h>
-#endif
-
__END_DECLS
#endif /* <stdio.h> included. */
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index 0299fe99a7..e1f68bddfb 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -17,6 +17,7 @@
not, see <https://www.gnu.org/licenses/>. */
#define __mremap mremap
+#define __fprintf fprintf
#include "malloc.c"
/* When memory is tagged, the checking data is stored in the user part
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 09e5ff2bce..aa35846e55 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5279,9 +5279,9 @@ __malloc_stats (void)
memset (&mi, 0, sizeof (mi));
__libc_lock_lock (ar_ptr->mutex);
int_mallinfo (ar_ptr, &mi);
- fprintf (stderr, "Arena %d:\n", i);
- fprintf (stderr, "system bytes = %10u\n", (unsigned int) mi.arena);
- fprintf (stderr, "in use bytes = %10u\n", (unsigned int) mi.uordblks);
+ __fprintf (stderr, "Arena %d:\n", i);
+ __fprintf (stderr, "system bytes = %10u\n", (unsigned int) mi.arena);
+ __fprintf (stderr, "in use bytes = %10u\n", (unsigned int) mi.uordblks);
#if MALLOC_DEBUG > 1
if (i > 0)
dump_heap (heap_for_ptr (top (ar_ptr)));
@@ -5293,12 +5293,12 @@ __malloc_stats (void)
if (ar_ptr == &main_arena)
break;
}
- fprintf (stderr, "Total (incl. mmap):\n");
- fprintf (stderr, "system bytes = %10u\n", system_b);
- fprintf (stderr, "in use bytes = %10u\n", in_use_b);
- fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps);
- fprintf (stderr, "max mmap bytes = %10lu\n",
- (unsigned long) mp_.max_mmapped_mem);
+ __fprintf (stderr, "Total (incl. mmap):\n");
+ __fprintf (stderr, "system bytes = %10u\n", system_b);
+ __fprintf (stderr, "in use bytes = %10u\n", in_use_b);
+ __fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps);
+ __fprintf (stderr, "max mmap bytes = %10lu\n",
+ (unsigned long) mp_.max_mmapped_mem);
stderr->_flags2 = old_flags2;
_IO_funlockfile (stderr);
}
@@ -5728,7 +5728,7 @@ __malloc_info (int options, FILE *fp)
mstate ar_ptr = &main_arena;
do
{
- fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
+ __fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
size_t nblocks = 0;
size_t nfastblocks = 0;
@@ -5839,12 +5839,12 @@ __malloc_info (int options, FILE *fp)
for (size_t i = 0; i < nsizes; ++i)
if (sizes[i].count != 0 && i != NFASTBINS)
- fprintf (fp, "\
+ __fprintf (fp, "\
<size from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
sizes[i].from, sizes[i].to, sizes[i].total, sizes[i].count);
if (sizes[NFASTBINS].count != 0)
- fprintf (fp, "\
+ __fprintf (fp, "\
<unsorted from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
sizes[NFASTBINS].from, sizes[NFASTBINS].to,
sizes[NFASTBINS].total, sizes[NFASTBINS].count);
@@ -5852,7 +5852,7 @@ __malloc_info (int options, FILE *fp)
total_system += ar_ptr->system_mem;
total_max_system += ar_ptr->max_system_mem;
- fprintf (fp,
+ __fprintf (fp,
"</sizes>\n<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
"<system type=\"current\" size=\"%zu\"/>\n"
@@ -5862,7 +5862,7 @@ __malloc_info (int options, FILE *fp)
if (ar_ptr != &main_arena)
{
- fprintf (fp,
+ __fprintf (fp,
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n"
"<aspace type=\"subheaps\" size=\"%zu\"/>\n",
@@ -5872,7 +5872,7 @@ __malloc_info (int options, FILE *fp)
}
else
{
- fprintf (fp,
+ __fprintf (fp,
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n",
ar_ptr->system_mem, ar_ptr->system_mem);
@@ -5885,7 +5885,7 @@ __malloc_info (int options, FILE *fp)
}
while (ar_ptr != &main_arena);
- fprintf (fp,
+ __fprintf (fp,
"<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"mmap\" count=\"%d\" size=\"%zu\"/>\n"
diff --git a/misc/efgcvt-template.c b/misc/efgcvt-template.c
index 87a90e78d4..f1630fd780 100644
--- a/misc/efgcvt-template.c
+++ b/misc/efgcvt-template.c
@@ -24,7 +24,7 @@
#include <math_ldbl_opt.h>
#ifndef SPRINTF
-# define SPRINTF sprintf
+# define SPRINTF __sprintf
#endif
#define APPEND(a, b) APPEND2 (a, b)
diff --git a/misc/mntent_r.c b/misc/mntent_r.c
index 3311ba0b50..65f29b97e9 100644
--- a/misc/mntent_r.c
+++ b/misc/mntent_r.c
@@ -251,7 +251,7 @@ __addmntent (FILE *stream, const struct mntent *mnt)
write_string (stream, mnt->mnt_dir);
write_string (stream, mnt->mnt_type);
write_string (stream, mnt->mnt_opts);
- fprintf (stream, "%d %d\n", mnt->mnt_freq, mnt->mnt_passno);
+ __fprintf (stream, "%d %d\n", mnt->mnt_freq, mnt->mnt_passno);
ret = __ferror_unlocked (stream) != 0 || fflush (stream) != 0;
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index f1faf8292c..422ca351f2 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -560,6 +560,54 @@
# include <bits/long-double.h>
#endif
+#if (defined __GNUC__ && __GNUC__ >= 2) || (__clang_major__ >= 4)
+# define __REDIRECT_LDBL1(name, prenth, posnth, proto, alias) \
+ name proto prenth __asm__ (__ASMNAME (__ASMNAME (#alias))) posnth
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+# ifdef __REDIRECT
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , , proto, ieee128)
+# ifdef __cplusplus
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROW, , proto, ieee128)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROWNL, , proto, ieee128)
+# else
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROW, proto, ieee128)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROWNL, proto, ieee128)
+# endif /* __cplusplus */
+# else
+_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
+# endif /* __REDIRECT */
+# elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
+# ifdef __REDIRECT
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , , proto, compat)
+# ifdef __cplusplus
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROW, , proto, compat)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROWNL, , proto, compat)
+# else
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROW, proto, compat)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROWNL, proto, compat)
+# endif /* __cplusplus */
+# else
+_Static_assert (0, "Compat long double requires redirection on this platform");
+# endif /* __REDIRECT */
+# endif
+#endif
+
+#ifndef __REDIRECT_LDBL
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) name proto
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) name proto __THROW
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) name proto __THROWNL
+#endif
+
#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
# ifdef __REDIRECT
@@ -583,10 +631,6 @@
# define __REDIRECT_NTH_LDBL(name, proto, alias) \
__LDBL_REDIR1_NTH (name, proto, __##alias##ieee128)
-/* Unused. */
-# define __REDIRECT_LDBL(name, proto, alias) ... unused__redirect_ldbl
-# define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth
-
# else
_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
# endif
@@ -605,24 +649,6 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf
extern __typeof (name) name __asm (__ASMNAME (#alias));
# define __LDBL_REDIR_DECL(name) \
extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name));
-# define __REDIRECT_LDBL(name, proto, alias) \
- __LDBL_REDIR1 (name, proto, __nldbl_##alias)
-# define __REDIRECT_NTH_LDBL(name, proto, alias) \
- __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias)
-# endif
-#endif
-#if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \
- || !defined __REDIRECT
-# define __LDBL_REDIR1(name, proto, alias) name proto
-# define __LDBL_REDIR(name, proto) name proto
-# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW
-# define __LDBL_REDIR_NTH(name, proto) name proto __THROW
-# define __LDBL_REDIR2_DECL(name)
-# define __LDBL_REDIR_DECL(name)
-# ifdef __REDIRECT
-# define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias)
-# define __REDIRECT_NTH_LDBL(name, proto, alias) \
- __REDIRECT_NTH (name, proto, alias)
# endif
#endif
diff --git a/nis/nis_subr.c b/nis/nis_subr.c
index 385f221062..0e02cd19b5 100644
--- a/nis/nis_subr.c
+++ b/nis/nis_subr.c
@@ -280,10 +280,10 @@ nis_getnames (const_nis_name name)
}
if (pos == 0
- && __asprintf (&getnames[pos++], "%s%s%s%s",
- name, name[name_len - 1] == '.' ? "" : ".",
- local_domain,
- local_domain[local_domain_len - 1] == '.' ? "" : ".") < 0)
+ && asprintf (&getnames[pos++], "%s%s%s%s",
+ name, name[name_len - 1] == '.' ? "" : ".",
+ local_domain,
+ local_domain[local_domain_len - 1] == '.' ? "" : ".") < 0)
goto free_null;
getnames[pos] = NULL;
diff --git a/nptl/pthread_getname.c b/nptl/pthread_getname.c
index ebec06e23f..a424b3e4f8 100644
--- a/nptl/pthread_getname.c
+++ b/nptl/pthread_getname.c
@@ -42,7 +42,7 @@ __pthread_getname_np (pthread_t th, char *buf, size_t len)
#define FMT "/proc/self/task/%u/comm"
char fname[sizeof (FMT) + 8];
- sprintf (fname, FMT, (unsigned int) pd->tid);
+ __sprintf (fname, FMT, (unsigned int) pd->tid);
int fd = __open64_nocancel (fname, O_RDONLY);
if (fd == -1)
diff --git a/nptl/pthread_setname.c b/nptl/pthread_setname.c
index f24560db47..8520bac4be 100644
--- a/nptl/pthread_setname.c
+++ b/nptl/pthread_setname.c
@@ -44,7 +44,7 @@ __pthread_setname_np (pthread_t th, const char *name)
#define FMT "/proc/self/task/%u/comm"
char fname[sizeof (FMT) + 8];
- sprintf (fname, FMT, (unsigned int) pd->tid);
+ __sprintf (fname, FMT, (unsigned int) pd->tid);
int fd = __open64_nocancel (fname, O_RDWR);
if (fd == -1)
diff --git a/pwd/getpw.c b/pwd/getpw.c
index 547489a863..4784eaf00b 100644
--- a/pwd/getpw.c
+++ b/pwd/getpw.c
@@ -50,9 +50,9 @@ __getpw (__uid_t uid, char *buf)
if (p == NULL)
return -1;
- if (sprintf (buf, "%s:%s:%lu:%lu:%s:%s:%s", p->pw_name, p->pw_passwd,
- (unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
- p->pw_gecos, p->pw_dir, p->pw_shell) < 0)
+ if (__sprintf (buf, "%s:%s:%lu:%lu:%s:%s:%s", p->pw_name, p->pw_passwd,
+ (unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
+ p->pw_gecos, p->pw_dir, p->pw_shell) < 0)
return -1;
return 0;
diff --git a/pwd/putpwent.c b/pwd/putpwent.c
index e3f2f4e09e..480dd59813 100644
--- a/pwd/putpwent.c
+++ b/pwd/putpwent.c
@@ -48,11 +48,11 @@ putpwent (const struct passwd *p, FILE *stream)
return -1;
if (p->pw_name[0] == '+' || p->pw_name[0] == '-')
- ret = fprintf (stream, "%s:%s:::%s:%s:%s\n",
+ ret = __fprintf (stream, "%s:%s:::%s:%s:%s\n",
p->pw_name, _S (p->pw_passwd),
gecos, _S (p->pw_dir), _S (p->pw_shell));
else
- ret = fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
+ ret = __fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
p->pw_name, _S (p->pw_passwd),
(unsigned long int) p->pw_uid,
(unsigned long int) p->pw_gid,
diff --git a/resolv/inet_ntop.c b/resolv/inet_ntop.c
index c4d38c0f95..53725d805a 100644
--- a/resolv/inet_ntop.c
+++ b/resolv/inet_ntop.c
@@ -28,9 +28,9 @@
#include <string.h>
#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
+# define SPRINTF(x) strlen(__sprintf/**/x)
#else
-# define SPRINTF(x) ((size_t)sprintf x)
+# define SPRINTF(x) ((size_t)__sprintf x)
#endif
/*
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index 913a5cb82f..06a91b23ca 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -507,8 +507,8 @@ _nss_dns_gethostbyaddr2_r (const void *addr, socklen_t len, int af,
switch (af)
{
case AF_INET:
- sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", (uaddr[3] & 0xff),
- (uaddr[2] & 0xff), (uaddr[1] & 0xff), (uaddr[0] & 0xff));
+ __sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", (uaddr[3] & 0xff),
+ (uaddr[2] & 0xff), (uaddr[1] & 0xff), (uaddr[0] & 0xff));
break;
case AF_INET6:
qp = qbuf;
diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
index 09cd917444..304ae35b8b 100644
--- a/resolv/nss_dns/dns-network.c
+++ b/resolv/nss_dns/dns-network.c
@@ -191,21 +191,21 @@ _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result,
{
case 3:
/* Class A network. */
- sprintf (qbuf, "0.0.0.%u.in-addr.arpa", net_bytes[3]);
+ __sprintf (qbuf, "0.0.0.%u.in-addr.arpa", net_bytes[3]);
break;
case 2:
/* Class B network. */
- sprintf (qbuf, "0.0.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2]);
+ __sprintf (qbuf, "0.0.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2]);
break;
case 1:
/* Class C network. */
- sprintf (qbuf, "0.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
- net_bytes[1]);
+ __sprintf (qbuf, "0.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
+ net_bytes[1]);
break;
case 0:
/* Class D - E network. */
- sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
- net_bytes[1], net_bytes[0]);
+ __sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
+ net_bytes[1], net_bytes[0]);
break;
}
diff --git a/shadow/putspent.c b/shadow/putspent.c
index cbbb840d5b..d675e28210 100644
--- a/shadow/putspent.c
+++ b/shadow/putspent.c
@@ -42,47 +42,47 @@ putspent (const struct spwd *p, FILE *stream)
flockfile (stream);
- if (fprintf (stream, "%s:%s:", p->sp_namp, _S (p->sp_pwdp)) < 0)
+ if (__fprintf (stream, "%s:%s:", p->sp_namp, _S (p->sp_pwdp)) < 0)
++errors;
if ((p->sp_lstchg != (long int) -1
- && fprintf (stream, "%ld:", p->sp_lstchg) < 0)
+ && __fprintf (stream, "%ld:", p->sp_lstchg) < 0)
|| (p->sp_lstchg == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_min != (long int) -1
- && fprintf (stream, "%ld:", p->sp_min) < 0)
+ && __fprintf (stream, "%ld:", p->sp_min) < 0)
|| (p->sp_min == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_max != (long int) -1
- && fprintf (stream, "%ld:", p->sp_max) < 0)
+ && __fprintf (stream, "%ld:", p->sp_max) < 0)
|| (p->sp_max == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_warn != (long int) -1
- && fprintf (stream, "%ld:", p->sp_warn) < 0)
+ && __fprintf (stream, "%ld:", p->sp_warn) < 0)
|| (p->sp_warn == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_inact != (long int) -1
- && fprintf (stream, "%ld:", p->sp_inact) < 0)
+ && __fprintf (stream, "%ld:", p->sp_inact) < 0)
|| (p->sp_inact == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_expire != (long int) -1
- && fprintf (stream, "%ld:", p->sp_expire) < 0)
+ && __fprintf (stream, "%ld:", p->sp_expire) < 0)
|| (p->sp_expire == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if (p->sp_flag != ~0ul
- && fprintf (stream, "%ld", p->sp_flag) < 0)
+ && __fprintf (stream, "%ld", p->sp_flag) < 0)
++errors;
if (putc_unlocked ('\n', stream) == EOF)
diff --git a/stdio-common/dprintf.c b/stdio-common/dprintf.c
index 2e26d59714..6fbe5d4862 100644
--- a/stdio-common/dprintf.c
+++ b/stdio-common/dprintf.c
@@ -33,5 +33,4 @@ __dprintf (int d, const char *format, ...)
return done;
}
libc_hidden_def (__dprintf)
-ldbl_hidden_def (__dprintf, dprintf)
ldbl_weak_alias (__dprintf, dprintf)
diff --git a/stdio-common/fprintf.c b/stdio-common/fprintf.c
index 8d2cd37433..af7190c5b4 100644
--- a/stdio-common/fprintf.c
+++ b/stdio-common/fprintf.c
@@ -34,7 +34,7 @@ __fprintf (FILE *stream, const char *format, ...)
return done;
}
-ldbl_hidden_def (__fprintf, fprintf)
+libc_hidden_def (__fprintf)
ldbl_strong_alias (__fprintf, fprintf)
/* We define the function with the real name here. But deep down in
diff --git a/stdio-common/psiginfo.c b/stdio-common/psiginfo.c
index adf3b71b77..f99c51da17 100644
--- a/stdio-common/psiginfo.c
+++ b/stdio-common/psiginfo.c
@@ -76,7 +76,7 @@ psiginfo (const siginfo_t *pinfo, const char *s)
}
if (s != NULL && *s != '\0')
- fprintf (fp, "%s: ", s);
+ __fprintf (fp, "%s: ", s);
const char *desc;
if (pinfo->si_signo >= 0 && pinfo->si_signo < NSIG
@@ -92,21 +92,21 @@ psiginfo (const siginfo_t *pinfo, const char *s)
if (pinfo->si_signo - SIGRTMIN < SIGRTMAX - pinfo->si_signo)
{
if (pinfo->si_signo == SIGRTMIN)
- fprintf (fp, "SIGRTMIN (");
+ __fprintf (fp, "SIGRTMIN (");
else
- fprintf (fp, "SIGRTMIN+%d (", pinfo->si_signo - SIGRTMIN);
+ __fprintf (fp, "SIGRTMIN+%d (", pinfo->si_signo - SIGRTMIN);
}
else
{
if (pinfo->si_signo == SIGRTMAX)
- fprintf (fp, "SIGRTMAX (");
+ __fprintf (fp, "SIGRTMAX (");
else
- fprintf (fp, "SIGRTMAX-%d (", SIGRTMAX - pinfo->si_signo);
+ __fprintf (fp, "SIGRTMAX-%d (", SIGRTMAX - pinfo->si_signo);
}
}
else
#endif
- fprintf (fp, "%s (", _(desc));
+ __fprintf (fp, "%s (", _(desc));
const char *base = NULL;
const uint8_t *offarr = NULL;
@@ -178,25 +178,25 @@ Signal generated by the completion of an I/O request");
}
if (str != NULL)
- fprintf (fp, "%s ", _(str));
+ __fprintf (fp, "%s ", _(str));
else
- fprintf (fp, "%d ", pinfo->si_code);
+ __fprintf (fp, "%d ", pinfo->si_code);
if (pinfo->si_signo == SIGILL || pinfo->si_signo == SIGFPE
|| pinfo->si_signo == SIGSEGV || pinfo->si_signo == SIGBUS)
- fprintf (fp, "[%p])\n", pinfo->si_addr);
+ __fprintf (fp, "[%p])\n", pinfo->si_addr);
else if (pinfo->si_signo == SIGCHLD)
- fprintf (fp, "%ld %d %ld)\n",
- (long int) pinfo->si_pid, pinfo->si_status,
- (long int) pinfo->si_uid);
+ __fprintf (fp, "%ld %d %ld)\n",
+ (long int) pinfo->si_pid, pinfo->si_status,
+ (long int) pinfo->si_uid);
else if (pinfo->si_signo == SIGPOLL)
- fprintf (fp, "%ld)\n", (long int) pinfo->si_band);
+ __fprintf (fp, "%ld)\n", (long int) pinfo->si_band);
else
- fprintf (fp, "%ld %ld)\n",
- (long int) pinfo->si_pid, (long int) pinfo->si_uid);
+ __fprintf (fp, "%ld %ld)\n",
+ (long int) pinfo->si_pid, (long int) pinfo->si_uid);
}
else
- fprintf (fp, _("Unknown signal %d\n"), pinfo->si_signo);
+ __fprintf (fp, _("Unknown signal %d\n"), pinfo->si_signo);
fclose (fp);
diff --git a/stdio-common/sprintf.c b/stdio-common/sprintf.c
index a9665f753a..f1f43a49ec 100644
--- a/stdio-common/sprintf.c
+++ b/stdio-common/sprintf.c
@@ -32,6 +32,6 @@ __sprintf (char *s, const char *format, ...)
return done;
}
-ldbl_hidden_def (__sprintf, sprintf)
+libc_hidden_def (__sprintf)
ldbl_strong_alias (__sprintf, sprintf)
ldbl_strong_alias (__sprintf, _IO_sprintf)
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 7559fd239d..c5912788bd 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -24,4 +24,4 @@ __vfprintf (FILE *fp, const char *format, va_list ap)
}
ldbl_strong_alias (__vfprintf, _IO_vfprintf);
ldbl_strong_alias (__vfprintf, vfprintf);
-ldbl_hidden_def (__vfprintf, vfprintf)
+libc_hidden_def (__vfprintf)
diff --git a/sunrpc/netname.c b/sunrpc/netname.c
index bf7f0b81c4..97a881c3af 100644
--- a/sunrpc/netname.c
+++ b/sunrpc/netname.c
@@ -48,7 +48,7 @@ user2netname (char netname[MAXNETNAMELEN + 1], const uid_t uid,
if ((strlen (dfltdom) + OPSYS_LEN + 3 + MAXIPRINT) > (size_t) MAXNETNAMELEN)
return 0;
- sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
+ __sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
i = strlen (netname);
if (netname[i - 1] == '.')
netname[i - 1] = '\0';
@@ -112,7 +112,7 @@ host2netname (char netname[MAXNETNAMELEN + 1], const char *host,
> MAXNETNAMELEN)
return 0;
- sprintf (netname, "%s.%s@%s", OPSYS, hostname, domainname);
+ __sprintf (netname, "%s.%s@%s", OPSYS, hostname, domainname);
return 1;
}
#ifdef EXPORT_RPC_SYMBOLS
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
index f683836678..59f6e31d2d 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128___asprintf (char **string_ptr, const char *format, ...)
+int
+__asprintfieee128 (char **string_ptr, const char *format, ...)
{
va_list ap;
int done;
@@ -32,5 +32,4 @@ ___ieee128___asprintf (char **string_ptr, const char *format, ...)
return done;
}
-hidden_def (___ieee128___asprintf)
-strong_alias (___ieee128___asprintf, __asprintfieee128)
+libc_hidden_def (__asprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
index cf3b46c37a..ceba219dc7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_dprintf (int d, const char *format, ...)
+int
+__dprintfieee128 (int d, const char *format, ...)
{
va_list ap;
int done;
@@ -31,5 +31,4 @@ ___ieee128_dprintf (int d, const char *format, ...)
return done;
}
-strong_alias (___ieee128_dprintf, __dprintfieee128)
-hidden_def (___ieee128_dprintf);
+libc_hidden_def (__dprintfieee128);
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
index 4462588675..b58f27afb7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_fprintf (FILE *fp, const char *format, ...)
+int
+__fprintfieee128 (FILE *fp, const char *format, ...)
{
va_list ap;
int done;
@@ -31,5 +31,4 @@ ___ieee128_fprintf (FILE *fp, const char *format, ...)
return done;
}
-strong_alias (___ieee128_fprintf, __fprintfieee128)
-hidden_def (___ieee128_fprintf)
+libc_hidden_def (__fprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
index 9703069b95..243eb65629 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
@@ -18,8 +18,8 @@
/* When in IEEE long double mode, call ___ieee128_sprintf. */
#include <stdio.h>
-typeof (sprintf) ___ieee128_sprintf attribute_hidden;
-#define SPRINTF ___ieee128_sprintf
+typeof (sprintf) __sprintfieee128 attribute_hidden;
+#define SPRINTF __sprintfieee128
/* Declare internal functions: ___qecvtieee128_r and ___qfcvtieee128_r,
built from a different compiling unit, and called from here. */
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
index 0be5bb2810..8046f5fd46 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
@@ -18,8 +18,8 @@
/* When in IEEE long double mode, call ___ieee128_snprintf. */
#include <stdio.h>
-typeof (snprintf) ___ieee128_snprintf attribute_hidden;
-#define SNPRINTF ___ieee128_snprintf
+typeof (snprintf) __snprintfieee128 attribute_hidden;
+#define SNPRINTF __snprintfieee128
#define ECVT_R __qecvtieee128_r
#define FCVT_R __qfcvtieee128_r
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
index 5f51b3ec9e..da3d9441d7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_snprintf (char *s, size_t maxlen, const char *format, ...)
+int
+__snprintfieee128 (char *s, size_t maxlen, const char *format, ...)
{
va_list ap;
int done;
@@ -32,4 +32,4 @@ ___ieee128_snprintf (char *s, size_t maxlen, const char *format, ...)
return done;
}
-strong_alias (___ieee128_snprintf, __snprintfieee128)
+libc_hidden_def (__snprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
index 0cad130788..007a71659a 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_sprintf (char *s, const char *format, ...)
+int
+__sprintfieee128 (char *s, const char *format, ...)
{
va_list ap;
int done;
@@ -32,5 +32,4 @@ ___ieee128_sprintf (char *s, const char *format, ...)
return done;
}
-strong_alias (___ieee128_sprintf, __sprintfieee128)
-hidden_def (___ieee128_sprintf)
+libc_hidden_def (__sprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
index e340c9b457..4df1e485a5 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
@@ -18,10 +18,9 @@
#include <libio/libioP.h>
-extern int
-___ieee128_vfprintf (FILE *fp, const char *format, va_list ap)
+int
+__vfprintfieee128 (FILE *fp, const char *format, va_list ap)
{
return __vfprintf_internal (fp, format, ap, PRINTF_LDBL_USES_FLOAT128);
}
-strong_alias (___ieee128_vfprintf, __vfprintfieee128)
-hidden_def (___ieee128_vfprintf)
+libc_hidden_def (__vfprintfieee128)
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
index ebd2a43951..5b167d45ff 100644
--- a/sysdeps/posix/tempname.c
+++ b/sysdeps/posix/tempname.c
@@ -161,7 +161,7 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
return -1;
}
- sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
+ __sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
return 0;
}
#endif /* _LIBC */
diff --git a/sysdeps/unix/sysv/linux/ia64/makecontext.c b/sysdeps/unix/sysv/linux/ia64/makecontext.c
index 0bc4211dfc..0cf05d5999 100644
--- a/sysdeps/unix/sysv/linux/ia64/makecontext.c
+++ b/sysdeps/unix/sysv/linux/ia64/makecontext.c
@@ -54,7 +54,7 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
if (argc > 8)
{
- fprintf (stderr, _("\
+ __fprintf (stderr, _("\
makecontext: does not know how to handle more than 8 arguments\n"));
exit (-1);
}
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index 0e017f458b..f2dca7711a 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -233,10 +233,13 @@ extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
const wchar_t *__restrict __format, ...)
__THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
-extern int __REDIRECT_NTH_LDBL (__swprintf_alias,
- (wchar_t *__restrict __s, size_t __n,
- const wchar_t *__restrict __fmt, ...),
- swprintf);
+extern int __swprintf_alias (wchar_t *__restrict __s, size_t __n,
+ const wchar_t *__restrict __fmt, ...)
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+ __asm__ (__ASMNAME ("swprintf"))
+#endif
+ ;
+
#ifdef __va_arg_pack
__fortify_function int
@@ -264,10 +267,13 @@ extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
__gnuc_va_list __arg)
__THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-extern int __REDIRECT_NTH_LDBL (__vswprintf_alias,
- (wchar_t *__restrict __s, size_t __n,
- const wchar_t *__restrict __fmt,
- __gnuc_va_list __ap), vswprintf);
+extern int __vswprintf_alias (wchar_t *__restrict __s, size_t __n,
+ const wchar_t *__restrict __fmt,
+ __gnuc_va_list __ap)
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+ __asm__ (__ASMNAME ("vswprintf"))
+#endif
+ ;
__fortify_function int
__NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
^ permalink raw reply [flat|nested] 14+ messages in thread
* [glibc/azanella/clang] Remove stdio-ldbl.h
@ 2022-04-29 14:00 Adhemerval Zanella
0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-04-29 14:00 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=6c40ba52d40950d9bfb9b04e641c9bf21a980e7b
commit 6c40ba52d40950d9bfb9b04e641c9bf21a980e7b
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Thu Feb 24 14:13:12 2022 -0300
Remove stdio-ldbl.h
The functions which require different alias to long double depending
of the ABI now uses a set os macros that defines the expected alias
on the function prototype, instead of redefine them using the
__LDBL_REDIR_DEC macros.
The __REDIRECT_LDBL, __REDIRECT_LDBL_NTH, __REDIRECT_LDBL_NTHNL
are refactores to be similar to __REDIRECT with the difference it
now expects the aliases for binary128 and for the long double being
double (which __LDBL_REDIR_DEC does).
All printf internal usage are also replaced to use internal alias
instead.
Diff:
---
argp/argp-parse.c | 4 +-
debug/backtracesyms.c | 18 +-
grp/putgrent.c | 6 +-
gshadow/putsgent.c | 6 +-
include/bits/stdio-ldbl.h | 1 -
include/stdio.h | 34 ++-
inet/ether_ntoa_r.c | 8 +-
inet/rexec.c | 2 +-
libio/Makefile | 2 +-
libio/bits/stdio-ldbl.h | 108 --------
libio/bits/stdio2.h | 115 ++++++---
libio/stdio.h | 286 +++++++++++++--------
malloc/malloc-check.c | 1 +
malloc/malloc.c | 32 +--
misc/efgcvt-template.c | 2 +-
misc/mntent_r.c | 2 +-
misc/sys/cdefs.h | 70 +++--
nis/nis_subr.c | 8 +-
nptl/pthread_getname.c | 2 +-
nptl/pthread_setname.c | 2 +-
pwd/getpw.c | 6 +-
pwd/putpwent.c | 4 +-
resolv/inet_ntop.c | 4 +-
resolv/nss_dns/dns-host.c | 4 +-
resolv/nss_dns/dns-network.c | 12 +-
shadow/putspent.c | 16 +-
stdio-common/dprintf.c | 1 -
stdio-common/fprintf.c | 2 +-
stdio-common/psiginfo.c | 32 +--
stdio-common/sprintf.c | 2 +-
stdio-common/vfprintf.c | 2 +-
sunrpc/netname.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-asprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-dprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-fprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-snprintf.c | 6 +-
.../ieee754/ldbl-128ibm-compat/ieee128-sprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c | 7 +-
sysdeps/posix/tempname.c | 2 +-
sysdeps/unix/sysv/linux/ia64/makecontext.c | 2 +-
wcsmbs/bits/wchar2.h | 22 +-
43 files changed, 448 insertions(+), 425 deletions(-)
diff --git a/argp/argp-parse.c b/argp/argp-parse.c
index 13cd84dd33..c26c0fc27f 100644
--- a/argp/argp-parse.c
+++ b/argp/argp-parse.c
@@ -177,7 +177,7 @@ argp_version_parser (int key, char *arg, struct argp_state *state)
if (argp_program_version_hook)
(*argp_program_version_hook) (state->out_stream, state);
else if (argp_program_version)
- fprintf (state->out_stream, "%s\n", argp_program_version);
+ __fprintf (state->out_stream, "%s\n", argp_program_version);
else
__argp_error (state, dgettext (state->root_argp->argp_domain,
"(PROGRAM ERROR) No version known!?"));
@@ -618,7 +618,7 @@ parser_finalize (struct parser *parser,
{
if (!(parser->state.flags & ARGP_NO_ERRS)
&& parser->state.err_stream)
- fprintf (parser->state.err_stream,
+ __fprintf (parser->state.err_stream,
dgettext (parser->argp->argp_domain,
"%s: Too many arguments\n"),
parser->state.name);
diff --git a/debug/backtracesyms.c b/debug/backtracesyms.c
index 17e0626df8..adb939f888 100644
--- a/debug/backtracesyms.c
+++ b/debug/backtracesyms.c
@@ -83,10 +83,10 @@ __backtrace_symbols (void *const *array, int size)
info[cnt].dli_saddr = info[cnt].dli_fbase;
if (info[cnt].dli_sname == NULL && info[cnt].dli_saddr == 0)
- last += 1 + sprintf (last, "%s(%s) [%p]",
- info[cnt].dli_fname ?: "",
- info[cnt].dli_sname ?: "",
- array[cnt]);
+ last += 1 + __sprintf (last, "%s(%s) [%p]",
+ info[cnt].dli_fname ?: "",
+ info[cnt].dli_sname ?: "",
+ array[cnt]);
else
{
char sign;
@@ -102,14 +102,14 @@ __backtrace_symbols (void *const *array, int size)
offset = info[cnt].dli_saddr - array[cnt];
}
- last += 1 + sprintf (last, "%s(%s%c%#tx) [%p]",
- info[cnt].dli_fname ?: "",
- info[cnt].dli_sname ?: "",
- sign, offset, array[cnt]);
+ last += 1 + __sprintf (last, "%s(%s%c%#tx) [%p]",
+ info[cnt].dli_fname ?: "",
+ info[cnt].dli_sname ?: "",
+ sign, offset, array[cnt]);
}
}
else
- last += 1 + sprintf (last, "[%p]", array[cnt]);
+ last += 1 + __sprintf (last, "[%p]", array[cnt]);
}
assert (last <= (char *) result + size * sizeof (char *) + total);
}
diff --git a/grp/putgrent.c b/grp/putgrent.c
index 966ba2a763..305ff44359 100644
--- a/grp/putgrent.c
+++ b/grp/putgrent.c
@@ -45,10 +45,10 @@ putgrent (const struct group *gr, FILE *stream)
flockfile (stream);
if (gr->gr_name[0] == '+' || gr->gr_name[0] == '-')
- retval = fprintf (stream, "%s:%s::",
+ retval = __fprintf (stream, "%s:%s::",
gr->gr_name, _S (gr->gr_passwd));
else
- retval = fprintf (stream, "%s:%s:%lu:",
+ retval = __fprintf (stream, "%s:%s:%lu:",
gr->gr_name, _S (gr->gr_passwd),
(unsigned long int) gr->gr_gid);
if (__builtin_expect (retval, 0) < 0)
@@ -60,7 +60,7 @@ putgrent (const struct group *gr, FILE *stream)
if (gr->gr_mem != NULL)
{
for (size_t i = 0; gr->gr_mem[i] != NULL; i++)
- if (fprintf (stream, i == 0 ? "%s" : ",%s", gr->gr_mem[i]) < 0)
+ if (__fprintf (stream, i == 0 ? "%s" : ",%s", gr->gr_mem[i]) < 0)
{
/* What else can we do? */
funlockfile (stream);
diff --git a/gshadow/putsgent.c b/gshadow/putsgent.c
index 9e2dca7eaf..870438de6d 100644
--- a/gshadow/putsgent.c
+++ b/gshadow/putsgent.c
@@ -42,7 +42,7 @@ putsgent (const struct sgrp *g, FILE *stream)
_IO_flockfile (stream);
- if (fprintf (stream, "%s:%s:", g->sg_namp, _S (g->sg_passwd)) < 0)
+ if (__fprintf (stream, "%s:%s:", g->sg_namp, _S (g->sg_passwd)) < 0)
++errors;
bool first = true;
@@ -50,7 +50,7 @@ putsgent (const struct sgrp *g, FILE *stream)
if (sp != NULL)
while (*sp != NULL)
{
- if (fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
+ if (__fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
{
++errors;
break;
@@ -65,7 +65,7 @@ putsgent (const struct sgrp *g, FILE *stream)
if (sp != NULL)
while (*sp != NULL)
{
- if (fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
+ if (__fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
{
++errors;
break;
diff --git a/include/bits/stdio-ldbl.h b/include/bits/stdio-ldbl.h
deleted file mode 100644
index 1f7d3ce1c6..0000000000
--- a/include/bits/stdio-ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <libio/bits/stdio-ldbl.h>
diff --git a/include/stdio.h b/include/stdio.h
index a6f7fd43cb..39b4978130 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -22,13 +22,17 @@
/* Some libc_hidden_ldbl_proto's do not map to a unique symbol when
redirecting ldouble to _Float128 variants. We can therefore safely
directly alias them to their internal name. */
-# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc)
-# define stdio_hidden_ldbl_proto(p, f) \
- extern __typeof (p ## f) p ## f __asm (__ASMNAME ("___ieee128_" #f));
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# define stdio_hidden_ldbl_proto(p,f) __LDBL_REDIR1_DECL (p ## f, p ## f ## ieee128)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc) && defined SHARED
+# define __stdio_hidden_ldbl_proto(name, alias) \
+ extern __typeof (name) __##name __asm__ (__hidden_asmname (#alias));
+# define stdio_hidden_ldbl_proto(name) \
+ extern typeof (name) __##name##ieee128; \
+ libc_hidden_proto (__##name##ieee128); \
+ __stdio_hidden_ldbl_proto (name, __GI___##name##ieee128)
# else
-# define stdio_hidden_ldbl_proto(p,f) libc_hidden_proto (p ## f)
+# define stdio_hidden_ldbl_proto(name) \
+ extern __typeof (name) __##name; \
+ libc_hidden_proto (__##name)
# endif
/* Set the error indicator on FP. */
@@ -39,10 +43,7 @@ fseterr_unlocked (FILE *fp)
}
extern int __fcloseall (void) attribute_hidden;
-extern int __snprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, ...)
- __attribute__ ((__format__ (__printf__, 3, 4)));
-stdio_hidden_ldbl_proto (__, snprintf)
+stdio_hidden_ldbl_proto (snprintf);
extern int __vfscanf (FILE *__restrict __s,
const char *__restrict __format,
@@ -184,7 +185,7 @@ extern const size_t _sys_errlist_internal_len attribute_hidden;
extern const char *__get_errlist (int) attribute_hidden;
extern const char *__get_errname (int) attribute_hidden;
-libc_hidden_ldbl_proto (__asprintf)
+stdio_hidden_ldbl_proto (asprintf);
# if IS_IN (libc)
extern FILE *_IO_new_fopen (const char*, const char*);
@@ -206,13 +207,10 @@ extern int _IO_new_fgetpos (FILE *, __fpos_t *);
# define fgetpos(fp, posp) _IO_new_fgetpos (fp, posp)
# endif
-extern __typeof (dprintf) __dprintf
- __attribute__ ((__format__ (__printf__, 2, 3)));
-stdio_hidden_ldbl_proto (__, dprintf)
-libc_hidden_ldbl_proto (dprintf)
-libc_hidden_ldbl_proto (fprintf)
-libc_hidden_ldbl_proto (vfprintf)
-libc_hidden_ldbl_proto (sprintf)
+stdio_hidden_ldbl_proto (dprintf);
+stdio_hidden_ldbl_proto (fprintf);
+stdio_hidden_ldbl_proto (vfprintf);
+stdio_hidden_ldbl_proto (sprintf);
libc_hidden_proto (ungetc)
libc_hidden_proto (__getdelim)
libc_hidden_proto (fwrite)
diff --git a/inet/ether_ntoa_r.c b/inet/ether_ntoa_r.c
index 03011ffef6..f111e5234c 100644
--- a/inet/ether_ntoa_r.c
+++ b/inet/ether_ntoa_r.c
@@ -23,10 +23,10 @@
char *
ether_ntoa_r (const struct ether_addr *addr, char *buf)
{
- sprintf (buf, "%x:%x:%x:%x:%x:%x",
- addr->ether_addr_octet[0], addr->ether_addr_octet[1],
- addr->ether_addr_octet[2], addr->ether_addr_octet[3],
- addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
+ __sprintf (buf, "%x:%x:%x:%x:%x:%x",
+ addr->ether_addr_octet[0], addr->ether_addr_octet[1],
+ addr->ether_addr_octet[2], addr->ether_addr_octet[3],
+ addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
return buf;
}
libc_hidden_def (ether_ntoa_r)
diff --git a/inet/rexec.c b/inet/rexec.c
index 330282ac16..809475d976 100644
--- a/inet/rexec.c
+++ b/inet/rexec.c
@@ -135,7 +135,7 @@ retry:
NULL, 0, servbuff, sizeof(servbuff),
NI_NUMERICSERV))
port = (int) __strtol (servbuff, NULL, 10);
- (void) sprintf(num, "%u", port);
+ (void) __sprintf(num, "%u", port);
(void) __write(s, num, strlen(num)+1);
{ socklen_t len = sizeof (from);
s3 = TEMP_FAILURE_RETRY (accept(s2, (struct sockaddr *)&from,
diff --git a/libio/Makefile b/libio/Makefile
index e97387743f..a4830ddf42 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -23,7 +23,7 @@ subdir := libio
include ../Makeconfig
headers := stdio.h \
- bits/stdio.h bits/stdio2.h bits/stdio-ldbl.h \
+ bits/stdio.h bits/stdio2.h \
bits/types/FILE.h bits/types/__FILE.h bits/types/struct_FILE.h \
bits/types/__fpos_t.h bits/types/__fpos64_t.h \
bits/types/cookie_io_functions_t.h
diff --git a/libio/bits/stdio-ldbl.h b/libio/bits/stdio-ldbl.h
deleted file mode 100644
index 6b63394b50..0000000000
--- a/libio/bits/stdio-ldbl.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -mlong-double-64 compatibility mode for stdio functions.
- Copyright (C) 2006-2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#ifndef _STDIO_H
-# error "Never include <bits/stdio-ldbl.h> directly; use <stdio.h> instead."
-#endif
-
-__LDBL_REDIR_DECL (fprintf)
-__LDBL_REDIR_DECL (printf)
-__LDBL_REDIR_DECL (sprintf)
-__LDBL_REDIR_DECL (vfprintf)
-__LDBL_REDIR_DECL (vprintf)
-__LDBL_REDIR_DECL (vsprintf)
-#if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (fscanf, __nldbl___isoc99_fscanf)
-__LDBL_REDIR1_DECL (scanf, __nldbl___isoc99_scanf)
-__LDBL_REDIR1_DECL (sscanf, __nldbl___isoc99_sscanf)
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (fscanf, __isoc99_fscanfieee128)
-__LDBL_REDIR1_DECL (scanf, __isoc99_scanfieee128)
-__LDBL_REDIR1_DECL (sscanf, __isoc99_sscanfieee128)
-# else
-# error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-# endif
-#else
-__LDBL_REDIR_DECL (fscanf)
-__LDBL_REDIR_DECL (scanf)
-__LDBL_REDIR_DECL (sscanf)
-#endif
-
-#if defined __USE_ISOC99 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (snprintf)
-__LDBL_REDIR_DECL (vsnprintf)
-#endif
-
-#ifdef __USE_ISOC99
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (vfscanf, __nldbl___isoc99_vfscanf)
-__LDBL_REDIR1_DECL (vscanf, __nldbl___isoc99_vscanf)
-__LDBL_REDIR1_DECL (vsscanf, __nldbl___isoc99_vsscanf)
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (vfscanf, __isoc99_vfscanfieee128)
-__LDBL_REDIR1_DECL (vscanf, __isoc99_vscanfieee128)
-__LDBL_REDIR1_DECL (vsscanf, __isoc99_vsscanfieee128)
-# else
-# error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-# endif
-# else
-__LDBL_REDIR_DECL (vfscanf)
-__LDBL_REDIR_DECL (vsscanf)
-__LDBL_REDIR_DECL (vscanf)
-# endif
-#endif
-
-#ifdef __USE_XOPEN2K8
-__LDBL_REDIR_DECL (vdprintf)
-__LDBL_REDIR_DECL (dprintf)
-#endif
-
-#ifdef __USE_GNU
-__LDBL_REDIR_DECL (vasprintf)
-__LDBL_REDIR2_DECL (asprintf)
-__LDBL_REDIR_DECL (asprintf)
-__LDBL_REDIR_DECL (obstack_printf)
-__LDBL_REDIR_DECL (obstack_vprintf)
-#endif
-
-#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR2_DECL (sprintf_chk)
-__LDBL_REDIR2_DECL (vsprintf_chk)
-# if defined __USE_ISOC99 || defined __USE_UNIX98
-__LDBL_REDIR2_DECL (snprintf_chk)
-__LDBL_REDIR2_DECL (vsnprintf_chk)
-# endif
-# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR2_DECL (fprintf_chk)
-__LDBL_REDIR2_DECL (printf_chk)
-__LDBL_REDIR2_DECL (vfprintf_chk)
-__LDBL_REDIR2_DECL (vprintf_chk)
-# ifdef __USE_XOPEN2K8
-__LDBL_REDIR2_DECL (dprintf_chk)
-__LDBL_REDIR2_DECL (vdprintf_chk)
-# endif
-# ifdef __USE_GNU
-__LDBL_REDIR2_DECL (asprintf_chk)
-__LDBL_REDIR2_DECL (vasprintf_chk)
-__LDBL_REDIR2_DECL (obstack_printf_chk)
-__LDBL_REDIR2_DECL (obstack_vprintf_chk)
-# endif
-# endif
-#endif
diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h
index b0b655ee7a..de7f1f04aa 100644
--- a/libio/bits/stdio2.h
+++ b/libio/bits/stdio2.h
@@ -23,12 +23,17 @@
# error "Never include <bits/stdio2.h> directly; use <stdio.h> instead."
#endif
-extern int __sprintf_chk (char *__restrict __s, int __flag, size_t __slen,
- const char *__restrict __format, ...) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__sprintf_chk, (char *__restrict __s,
+ int __flag, size_t __slen,
+ const char *__restrict __format,
+ ...),
+ __sprintf_chkieee128, __nldbl___sprintf_chk)
__attr_access ((__write_only__, 1, 3));
-extern int __vsprintf_chk (char *__restrict __s, int __flag, size_t __slen,
- const char *__restrict __format,
- __gnuc_va_list __ap) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__vsprintf_chk, (char *__restrict __s,
+ int __flag, size_t __slen,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vsprintf_chkieee128, __nldbl___vsprintf_chk)
__attr_access ((__write_only__, 1, 3));
#ifdef __va_arg_pack
@@ -54,14 +59,19 @@ __NTH (vsprintf (char *__restrict __s, const char *__restrict __fmt,
}
#if defined __USE_ISOC99 || defined __USE_UNIX98
-
-extern int __snprintf_chk (char *__restrict __s, size_t __n, int __flag,
- size_t __slen, const char *__restrict __format,
- ...) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__snprintf_chk, (char *__restrict __s,
+ size_t __n, int __flag,
+ size_t __slen,
+ const char *__restrict __format,
+ ...),
+ __snprintf_chkieee128, __nldbl___snprintf_chk)
__attr_access ((__write_only__, 1, 2));
-extern int __vsnprintf_chk (char *__restrict __s, size_t __n, int __flag,
- size_t __slen, const char *__restrict __format,
- __gnuc_va_list __ap) __THROW;
+extern int __REDIRECT_LDBL_NTHNL (__vsnprintf_chk, (char *__restrict __s,
+ size_t __n, int __flag,
+ size_t __slen,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vsnprintf_chkieee128, __nldbl___vsnprintf_chk);
# ifdef __va_arg_pack
__fortify_function int
@@ -89,14 +99,24 @@ __NTH (vsnprintf (char *__restrict __s, size_t __n,
#endif
#if __USE_FORTIFY_LEVEL > 1
-
-extern int __fprintf_chk (FILE *__restrict __stream, int __flag,
- const char *__restrict __format, ...);
-extern int __printf_chk (int __flag, const char *__restrict __format, ...);
-extern int __vfprintf_chk (FILE *__restrict __stream, int __flag,
- const char *__restrict __format, __gnuc_va_list __ap);
-extern int __vprintf_chk (int __flag, const char *__restrict __format,
- __gnuc_va_list __ap);
+extern int __REDIRECT_LDBL (__fprintf_chk, (FILE *__restrict __stream,
+ int __flag,
+ const char *__restrict __format,
+ ...),
+ __fprintf_chkieee128, __nldbl___fprintf_chk);
+extern int __REDIRECT_LDBL (__printf_chk, (int __flag,
+ const char *__restrict __format,
+ ...),
+ __printf_chkieee128, __nldbl___printf_chk);
+extern int __REDIRECT_LDBL (__vfprintf_chk, (FILE *__restrict __stream,
+ int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vfprintf_chkieee128, __nldbl___vfprintf_chk);
+extern int __REDIRECT_LDBL (__vprintf_chk, (int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vprintf_chkieee128, __nldbl___vprintf_chk);
# ifdef __va_arg_pack
__fortify_function int
@@ -136,10 +156,15 @@ vfprintf (FILE *__restrict __stream,
}
# ifdef __USE_XOPEN2K8
-extern int __dprintf_chk (int __fd, int __flag, const char *__restrict __fmt,
- ...) __attribute__ ((__format__ (__printf__, 3, 4)));
-extern int __vdprintf_chk (int __fd, int __flag,
- const char *__restrict __fmt, __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL (__dprintf_chk, (int __fd, int __flag,
+ const char *__restrict __fmt,
+ ...),
+ __dprintf_chkieee128, __nldbl___dprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL (__vdprintf_chk, (int __fd, int __flag,
+ const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vdprintf_chkieee128, __nldbl___vdprintf_chk)
__attribute__ ((__format__ (__printf__, 3, 0)));
# ifdef __va_arg_pack
@@ -162,22 +187,32 @@ vdprintf (int __fd, const char *__restrict __fmt, __gnuc_va_list __ap)
# endif
# ifdef __USE_GNU
-
-extern int __asprintf_chk (char **__restrict __ptr, int __flag,
- const char *__restrict __fmt, ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4))) __wur;
-extern int __vasprintf_chk (char **__restrict __ptr, int __flag,
- const char *__restrict __fmt, __gnuc_va_list __arg)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
-extern int __obstack_printf_chk (struct obstack *__restrict __obstack,
- int __flag, const char *__restrict __format,
- ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
-extern int __obstack_vprintf_chk (struct obstack *__restrict __obstack,
- int __flag,
- const char *__restrict __format,
- __gnuc_va_list __args)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
+extern int __REDIRECT_LDBL_NTHNL (__asprintf_chk, (char **__restrict __ptr,
+ int __flag,
+ const char *__restrict __fmt,
+ ...),
+ __asprintf_chkieee128, __nldbl___asprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (__vasprintf_chk, (char **__restrict __ptr,
+ int __flag,
+ const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vasprintf_chkieee128, __nldbl___vasnprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (__obstack_printf_chk, (struct obstack *__restrict __obstack,
+ int __flag,
+ const char *__restrict __format,
+ ...),
+ __obstack_printf_chkieee128,
+ __nldbl___obstack_printf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL_NTHNL (__obstack_vprintf_chk, (struct obstack *__restrict __obstack,
+ int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __args),
+ __obstack_vprintf_chkieee128,
+ __nldbl___obstack_vprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
# ifdef __va_arg_pack
__fortify_function int
diff --git a/libio/stdio.h b/libio/stdio.h
index e6425341ce..54c9796a46 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -41,6 +41,7 @@ __BEGIN_DECLS
#include <bits/types/__FILE.h>
#include <bits/types/FILE.h>
#include <bits/types/struct_FILE.h>
+#include <bits/floatn.h>
#ifdef __USE_GNU
# include <bits/types/cookie_io_functions_t.h>
@@ -342,78 +343,143 @@ extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
extern void setlinebuf (FILE *__stream) __THROW;
#endif
-
/* Write formatted output to STREAM.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int fprintf (FILE *__restrict __stream,
- const char *__restrict __format, ...);
+extern int __REDIRECT_LDBL (fprintf, (FILE *__restrict __stream,
+ const char *__restrict __format, ...),
+ __fprintfieee128, __nldbl_fprintf);
/* Write formatted output to stdout.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int printf (const char *__restrict __format, ...);
+extern int __REDIRECT_LDBL (printf, (const char *__restrict __format, ...),
+ __printfieee128, __nldbl_printf);
/* Write formatted output to S. */
-extern int sprintf (char *__restrict __s,
- const char *__restrict __format, ...) __THROWNL;
+extern int __REDIRECT_LDBL_NTHNL (sprintf, (char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __sprintfieee128, __nldbl_sprintf);
/* Write formatted output to S from argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg);
+extern int __REDIRECT_LDBL (vfprintf, (FILE *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vfprintfieee128, __nldbl_vfprintf);
/* Write formatted output to stdout from argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
+extern int __REDIRECT_LDBL (vprintf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vprintfieee128, __nldbl_vprintf);
/* Write formatted output to S from argument list ARG. */
-extern int vsprintf (char *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg) __THROWNL;
+extern int __REDIRECT_LDBL_NTHNL (vsprintf, (char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsprintfieee128, __nldbl_vsprintf);
#if defined __USE_ISOC99 || defined __USE_UNIX98
/* Maximum chars of output to write in MAXLEN. */
-extern int snprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 3, 4)));
-
-extern int vsnprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, __gnuc_va_list __arg)
- __THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
+extern int __REDIRECT_LDBL_NTHNL (snprintf, (char *__restrict __s,
+ size_t __maxlen,
+ const char *__restrict __format,
+ ...),
+ __snprintfieee128, __nldbl_snprintf)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL_NTHNL (vsnprintf, (char *__restrict __s,
+ size_t __maxlen,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsnprintfieee128, __nldbl_vsnprintf)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
#endif
#if __GLIBC_USE (LIB_EXT2)
/* Write formatted output to a string dynamically allocated with `malloc'.
Store the address of the string in *PTR. */
-extern int vasprintf (char **__restrict __ptr, const char *__restrict __f,
- __gnuc_va_list __arg)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
-extern int __asprintf (char **__restrict __ptr,
- const char *__restrict __fmt, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
-extern int asprintf (char **__restrict __ptr,
- const char *__restrict __fmt, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (vasprintf, (char **__restrict __ptr,
+ const char *__restrict __f,
+ __gnuc_va_list __arg),
+ __vasprintfieee128, __nldbl_vasprintf)
+ __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (asprintf, (char **__restrict __ptr,
+ const char *__restrict __fmt,
+ ...),
+ __asprintfieee128, __nldbl_asprintf)
+ __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
#endif
#ifdef __USE_XOPEN2K8
/* Write formatted output to a file descriptor. */
-extern int vdprintf (int __fd, const char *__restrict __fmt,
- __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL (vdprintf, (int __fd, const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vdprintfieee128, __nldbl_vdprintf)
__attribute__ ((__format__ (__printf__, 2, 0)));
-extern int dprintf (int __fd, const char *__restrict __fmt, ...)
+extern int __REDIRECT_LDBL (dprintf, (int __fd, const char *__restrict __fmt,
+ ...),
+ __dprintfieee128, __nldbl_dprintf)
__attribute__ ((__format__ (__printf__, 2, 3)));
#endif
-
+#if !__GLIBC_USE (DEPRECATED_SCANF)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ ...),
+ __isoc99_fscanfieee128, __nldbl___isoc99_fscanf) __wur;
+extern int __REDIRECT_LDBL (scanf, (const char *__restrict __format,
+ ...),
+ __isoc99_scanfieee128, __nldbl___isoc99_scanf) __wur;
+extern int __REDIRECT_LDBL_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __isoc99_sscanfieee128, __nldbl___isoc99_sscanf);
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format, ...),
+ __isoc99_fscanf) __wur;
+extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
+ __isoc99_scanf) __wur;
+extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format, ...),
+ __isoc99_sscanf);
+# else
+extern int __isoc99_fscanf (FILE *__restrict __stream,
+ const char *__restrict __format, ...) __wur;
+extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
+extern int __isoc99_sscanf (const char *__restrict __s,
+ const char *__restrict __format, ...) __THROW;
+# define fscanf __isoc99_fscanf
+# define scanf __isoc99_scanf
+# define sscanf __isoc99_sscanf
+# endif /* __REDIRECT */
+# endif
+#else
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ ...),
+ __fscanfieee128, __nldbl_fscanf) __wur;
+extern int __REDIRECT_LDBL (scanf, (const char *__restrict __format,
+ ...),
+ __scanfieee128, __nldbl_scanf) __wur;
+extern int __REDIRECT_LDBL_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __sscanfieee128, __nldbl_sscanf) __wur;
+# else
/* Read formatted input from STREAM.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int fscanf (FILE *__restrict __stream,
- const char *__restrict __format, ...) __wur;
+ const char *__restrict __format, ...) __wur;
/* Read formatted input from stdin.
This function is a possible cancellation point and therefore not
@@ -421,43 +487,81 @@ extern int fscanf (FILE *__restrict __stream,
extern int scanf (const char *__restrict __format, ...) __wur;
/* Read formatted input from S. */
extern int sscanf (const char *__restrict __s,
- const char *__restrict __format, ...) __THROW;
-
-/* For historical reasons, the C99-compliant versions of the scanf
- functions are at alternative names. When __LDBL_COMPAT or
- __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
- bits/stdio-ldbl.h. */
-#include <bits/floatn.h>
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
- && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-# ifdef __REDIRECT
-extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
- const char *__restrict __format, ...),
- __isoc99_fscanf) __wur;
-extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
- __isoc99_scanf) __wur;
-extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
- const char *__restrict __format, ...),
- __isoc99_sscanf);
-# else
-extern int __isoc99_fscanf (FILE *__restrict __stream,
- const char *__restrict __format, ...) __wur;
-extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
-extern int __isoc99_sscanf (const char *__restrict __s,
- const char *__restrict __format, ...) __THROW;
-# define fscanf __isoc99_fscanf
-# define scanf __isoc99_scanf
-# define sscanf __isoc99_sscanf
+ const char *__restrict __format, ...) __THROW;
# endif
-#endif
+#endif /* DEPRECATED_SCANF */
-#ifdef __USE_ISOC99
+#ifdef __USE_ISOC99
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vfscanfieee128, __nldbl___isoc99_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vscanfieee128, __nldbl___isoc99_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_LDBL_NTH (vsscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vsscanfieee128, __nldbl___isoc99_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (vfscanf,
+ (FILE *__restrict __s,
+ const char *__restrict __format, __gnuc_va_list __arg),
+ __isoc99_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_NTH (vsscanf,
+ (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
+extern int __isoc99_vfscanf (FILE *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg) __wur;
+extern int __isoc99_vscanf (const char *__restrict __format,
+ __gnuc_va_list __arg) __wur;
+extern int __isoc99_vsscanf (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg) __THROW;
+# define vfscanf __isoc99_vfscanf
+# define vscanf __isoc99_vscanf
+# define vsscanf __isoc99_vsscanf
+# endif /* __REDIRECT */
+# endif
+# else /* DEPRECATED_SCANF */
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vfscanfieee128, __nldbl_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vscanfieee128, __nldbl_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_LDBL_NTH (vsscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsscanfieee128, __nldbl_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
/* Read formatted input from S into argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg)
+ __gnuc_va_list __arg)
__attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
/* Read formatted input from stdin into argument list ARG.
@@ -469,42 +573,11 @@ extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
/* Read formatted input from S into argument list ARG. */
extern int vsscanf (const char *__restrict __s,
- const char *__restrict __format, __gnuc_va_list __arg)
+ const char *__restrict __format, __gnuc_va_list __arg)
__THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
-
-/* Same redirection as above for the v*scanf family. */
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __REDIRECT && !defined __LDBL_COMPAT \
- && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-extern int __REDIRECT (vfscanf,
- (FILE *__restrict __s,
- const char *__restrict __format, __gnuc_va_list __arg),
- __isoc99_vfscanf)
- __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
-extern int __REDIRECT (vscanf, (const char *__restrict __format,
- __gnuc_va_list __arg), __isoc99_vscanf)
- __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
-extern int __REDIRECT_NTH (vsscanf,
- (const char *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg), __isoc99_vsscanf)
- __attribute__ ((__format__ (__scanf__, 2, 0)));
-# elif !defined __REDIRECT
-extern int __isoc99_vfscanf (FILE *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg) __wur;
-extern int __isoc99_vscanf (const char *__restrict __format,
- __gnuc_va_list __arg) __wur;
-extern int __isoc99_vsscanf (const char *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg) __THROW;
-# define vfscanf __isoc99_vfscanf
-# define vscanf __isoc99_vscanf
-# define vsscanf __isoc99_vsscanf
# endif
# endif
-#endif /* Use ISO C9x. */
-
+#endif /* __USE_ISOC99 */
/* Read a character from STREAM.
@@ -850,13 +923,17 @@ extern char *cuserid (char *__s)
struct obstack; /* See <obstack.h>. */
/* Write formatted output to an obstack. */
-extern int obstack_printf (struct obstack *__restrict __obstack,
- const char *__restrict __format, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3)));
-extern int obstack_vprintf (struct obstack *__restrict __obstack,
- const char *__restrict __format,
- __gnuc_va_list __args)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 0)));
+extern int __REDIRECT_LDBL_NTHNL (obstack_printf,
+ (struct obstack *__restrict __obstack,
+ const char *__restrict __format, ...),
+ __obstack_printfieee128, __nldbl_obstack_printf)
+ __attribute__ ((__format__ (__printf__, 2, 3)));
+extern int __REDIRECT_LDBL_NTHNL (obstack_vprintf,
+ (struct obstack *__restrict __obstack,
+ const char *__restrict __format,
+ __gnuc_va_list __args),
+ __obstack_vprintfieee128, __nldbl_obstack_vprintf)
+ __attribute__ ((__format__ (__printf__, 2, 0)));
#endif /* Use GNU. */
@@ -894,11 +971,6 @@ extern int __overflow (FILE *, int);
# include <bits/stdio2.h>
#endif
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/stdio-ldbl.h>
-#endif
-
__END_DECLS
#endif /* <stdio.h> included. */
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index 0299fe99a7..e1f68bddfb 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -17,6 +17,7 @@
not, see <https://www.gnu.org/licenses/>. */
#define __mremap mremap
+#define __fprintf fprintf
#include "malloc.c"
/* When memory is tagged, the checking data is stored in the user part
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 09e5ff2bce..aa35846e55 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5279,9 +5279,9 @@ __malloc_stats (void)
memset (&mi, 0, sizeof (mi));
__libc_lock_lock (ar_ptr->mutex);
int_mallinfo (ar_ptr, &mi);
- fprintf (stderr, "Arena %d:\n", i);
- fprintf (stderr, "system bytes = %10u\n", (unsigned int) mi.arena);
- fprintf (stderr, "in use bytes = %10u\n", (unsigned int) mi.uordblks);
+ __fprintf (stderr, "Arena %d:\n", i);
+ __fprintf (stderr, "system bytes = %10u\n", (unsigned int) mi.arena);
+ __fprintf (stderr, "in use bytes = %10u\n", (unsigned int) mi.uordblks);
#if MALLOC_DEBUG > 1
if (i > 0)
dump_heap (heap_for_ptr (top (ar_ptr)));
@@ -5293,12 +5293,12 @@ __malloc_stats (void)
if (ar_ptr == &main_arena)
break;
}
- fprintf (stderr, "Total (incl. mmap):\n");
- fprintf (stderr, "system bytes = %10u\n", system_b);
- fprintf (stderr, "in use bytes = %10u\n", in_use_b);
- fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps);
- fprintf (stderr, "max mmap bytes = %10lu\n",
- (unsigned long) mp_.max_mmapped_mem);
+ __fprintf (stderr, "Total (incl. mmap):\n");
+ __fprintf (stderr, "system bytes = %10u\n", system_b);
+ __fprintf (stderr, "in use bytes = %10u\n", in_use_b);
+ __fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps);
+ __fprintf (stderr, "max mmap bytes = %10lu\n",
+ (unsigned long) mp_.max_mmapped_mem);
stderr->_flags2 = old_flags2;
_IO_funlockfile (stderr);
}
@@ -5728,7 +5728,7 @@ __malloc_info (int options, FILE *fp)
mstate ar_ptr = &main_arena;
do
{
- fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
+ __fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
size_t nblocks = 0;
size_t nfastblocks = 0;
@@ -5839,12 +5839,12 @@ __malloc_info (int options, FILE *fp)
for (size_t i = 0; i < nsizes; ++i)
if (sizes[i].count != 0 && i != NFASTBINS)
- fprintf (fp, "\
+ __fprintf (fp, "\
<size from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
sizes[i].from, sizes[i].to, sizes[i].total, sizes[i].count);
if (sizes[NFASTBINS].count != 0)
- fprintf (fp, "\
+ __fprintf (fp, "\
<unsorted from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
sizes[NFASTBINS].from, sizes[NFASTBINS].to,
sizes[NFASTBINS].total, sizes[NFASTBINS].count);
@@ -5852,7 +5852,7 @@ __malloc_info (int options, FILE *fp)
total_system += ar_ptr->system_mem;
total_max_system += ar_ptr->max_system_mem;
- fprintf (fp,
+ __fprintf (fp,
"</sizes>\n<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
"<system type=\"current\" size=\"%zu\"/>\n"
@@ -5862,7 +5862,7 @@ __malloc_info (int options, FILE *fp)
if (ar_ptr != &main_arena)
{
- fprintf (fp,
+ __fprintf (fp,
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n"
"<aspace type=\"subheaps\" size=\"%zu\"/>\n",
@@ -5872,7 +5872,7 @@ __malloc_info (int options, FILE *fp)
}
else
{
- fprintf (fp,
+ __fprintf (fp,
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n",
ar_ptr->system_mem, ar_ptr->system_mem);
@@ -5885,7 +5885,7 @@ __malloc_info (int options, FILE *fp)
}
while (ar_ptr != &main_arena);
- fprintf (fp,
+ __fprintf (fp,
"<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"mmap\" count=\"%d\" size=\"%zu\"/>\n"
diff --git a/misc/efgcvt-template.c b/misc/efgcvt-template.c
index 87a90e78d4..f1630fd780 100644
--- a/misc/efgcvt-template.c
+++ b/misc/efgcvt-template.c
@@ -24,7 +24,7 @@
#include <math_ldbl_opt.h>
#ifndef SPRINTF
-# define SPRINTF sprintf
+# define SPRINTF __sprintf
#endif
#define APPEND(a, b) APPEND2 (a, b)
diff --git a/misc/mntent_r.c b/misc/mntent_r.c
index 3311ba0b50..65f29b97e9 100644
--- a/misc/mntent_r.c
+++ b/misc/mntent_r.c
@@ -251,7 +251,7 @@ __addmntent (FILE *stream, const struct mntent *mnt)
write_string (stream, mnt->mnt_dir);
write_string (stream, mnt->mnt_type);
write_string (stream, mnt->mnt_opts);
- fprintf (stream, "%d %d\n", mnt->mnt_freq, mnt->mnt_passno);
+ __fprintf (stream, "%d %d\n", mnt->mnt_freq, mnt->mnt_passno);
ret = __ferror_unlocked (stream) != 0 || fflush (stream) != 0;
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index f1faf8292c..422ca351f2 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -560,6 +560,54 @@
# include <bits/long-double.h>
#endif
+#if (defined __GNUC__ && __GNUC__ >= 2) || (__clang_major__ >= 4)
+# define __REDIRECT_LDBL1(name, prenth, posnth, proto, alias) \
+ name proto prenth __asm__ (__ASMNAME (__ASMNAME (#alias))) posnth
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+# ifdef __REDIRECT
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , , proto, ieee128)
+# ifdef __cplusplus
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROW, , proto, ieee128)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROWNL, , proto, ieee128)
+# else
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROW, proto, ieee128)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROWNL, proto, ieee128)
+# endif /* __cplusplus */
+# else
+_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
+# endif /* __REDIRECT */
+# elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
+# ifdef __REDIRECT
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , , proto, compat)
+# ifdef __cplusplus
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROW, , proto, compat)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROWNL, , proto, compat)
+# else
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROW, proto, compat)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROWNL, proto, compat)
+# endif /* __cplusplus */
+# else
+_Static_assert (0, "Compat long double requires redirection on this platform");
+# endif /* __REDIRECT */
+# endif
+#endif
+
+#ifndef __REDIRECT_LDBL
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) name proto
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) name proto __THROW
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) name proto __THROWNL
+#endif
+
#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
# ifdef __REDIRECT
@@ -583,10 +631,6 @@
# define __REDIRECT_NTH_LDBL(name, proto, alias) \
__LDBL_REDIR1_NTH (name, proto, __##alias##ieee128)
-/* Unused. */
-# define __REDIRECT_LDBL(name, proto, alias) ... unused__redirect_ldbl
-# define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth
-
# else
_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
# endif
@@ -605,24 +649,6 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf
extern __typeof (name) name __asm (__ASMNAME (#alias));
# define __LDBL_REDIR_DECL(name) \
extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name));
-# define __REDIRECT_LDBL(name, proto, alias) \
- __LDBL_REDIR1 (name, proto, __nldbl_##alias)
-# define __REDIRECT_NTH_LDBL(name, proto, alias) \
- __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias)
-# endif
-#endif
-#if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \
- || !defined __REDIRECT
-# define __LDBL_REDIR1(name, proto, alias) name proto
-# define __LDBL_REDIR(name, proto) name proto
-# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW
-# define __LDBL_REDIR_NTH(name, proto) name proto __THROW
-# define __LDBL_REDIR2_DECL(name)
-# define __LDBL_REDIR_DECL(name)
-# ifdef __REDIRECT
-# define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias)
-# define __REDIRECT_NTH_LDBL(name, proto, alias) \
- __REDIRECT_NTH (name, proto, alias)
# endif
#endif
diff --git a/nis/nis_subr.c b/nis/nis_subr.c
index 385f221062..0e02cd19b5 100644
--- a/nis/nis_subr.c
+++ b/nis/nis_subr.c
@@ -280,10 +280,10 @@ nis_getnames (const_nis_name name)
}
if (pos == 0
- && __asprintf (&getnames[pos++], "%s%s%s%s",
- name, name[name_len - 1] == '.' ? "" : ".",
- local_domain,
- local_domain[local_domain_len - 1] == '.' ? "" : ".") < 0)
+ && asprintf (&getnames[pos++], "%s%s%s%s",
+ name, name[name_len - 1] == '.' ? "" : ".",
+ local_domain,
+ local_domain[local_domain_len - 1] == '.' ? "" : ".") < 0)
goto free_null;
getnames[pos] = NULL;
diff --git a/nptl/pthread_getname.c b/nptl/pthread_getname.c
index ebec06e23f..a424b3e4f8 100644
--- a/nptl/pthread_getname.c
+++ b/nptl/pthread_getname.c
@@ -42,7 +42,7 @@ __pthread_getname_np (pthread_t th, char *buf, size_t len)
#define FMT "/proc/self/task/%u/comm"
char fname[sizeof (FMT) + 8];
- sprintf (fname, FMT, (unsigned int) pd->tid);
+ __sprintf (fname, FMT, (unsigned int) pd->tid);
int fd = __open64_nocancel (fname, O_RDONLY);
if (fd == -1)
diff --git a/nptl/pthread_setname.c b/nptl/pthread_setname.c
index f24560db47..8520bac4be 100644
--- a/nptl/pthread_setname.c
+++ b/nptl/pthread_setname.c
@@ -44,7 +44,7 @@ __pthread_setname_np (pthread_t th, const char *name)
#define FMT "/proc/self/task/%u/comm"
char fname[sizeof (FMT) + 8];
- sprintf (fname, FMT, (unsigned int) pd->tid);
+ __sprintf (fname, FMT, (unsigned int) pd->tid);
int fd = __open64_nocancel (fname, O_RDWR);
if (fd == -1)
diff --git a/pwd/getpw.c b/pwd/getpw.c
index 547489a863..4784eaf00b 100644
--- a/pwd/getpw.c
+++ b/pwd/getpw.c
@@ -50,9 +50,9 @@ __getpw (__uid_t uid, char *buf)
if (p == NULL)
return -1;
- if (sprintf (buf, "%s:%s:%lu:%lu:%s:%s:%s", p->pw_name, p->pw_passwd,
- (unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
- p->pw_gecos, p->pw_dir, p->pw_shell) < 0)
+ if (__sprintf (buf, "%s:%s:%lu:%lu:%s:%s:%s", p->pw_name, p->pw_passwd,
+ (unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
+ p->pw_gecos, p->pw_dir, p->pw_shell) < 0)
return -1;
return 0;
diff --git a/pwd/putpwent.c b/pwd/putpwent.c
index e3f2f4e09e..480dd59813 100644
--- a/pwd/putpwent.c
+++ b/pwd/putpwent.c
@@ -48,11 +48,11 @@ putpwent (const struct passwd *p, FILE *stream)
return -1;
if (p->pw_name[0] == '+' || p->pw_name[0] == '-')
- ret = fprintf (stream, "%s:%s:::%s:%s:%s\n",
+ ret = __fprintf (stream, "%s:%s:::%s:%s:%s\n",
p->pw_name, _S (p->pw_passwd),
gecos, _S (p->pw_dir), _S (p->pw_shell));
else
- ret = fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
+ ret = __fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
p->pw_name, _S (p->pw_passwd),
(unsigned long int) p->pw_uid,
(unsigned long int) p->pw_gid,
diff --git a/resolv/inet_ntop.c b/resolv/inet_ntop.c
index c4d38c0f95..53725d805a 100644
--- a/resolv/inet_ntop.c
+++ b/resolv/inet_ntop.c
@@ -28,9 +28,9 @@
#include <string.h>
#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
+# define SPRINTF(x) strlen(__sprintf/**/x)
#else
-# define SPRINTF(x) ((size_t)sprintf x)
+# define SPRINTF(x) ((size_t)__sprintf x)
#endif
/*
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index 913a5cb82f..06a91b23ca 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -507,8 +507,8 @@ _nss_dns_gethostbyaddr2_r (const void *addr, socklen_t len, int af,
switch (af)
{
case AF_INET:
- sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", (uaddr[3] & 0xff),
- (uaddr[2] & 0xff), (uaddr[1] & 0xff), (uaddr[0] & 0xff));
+ __sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", (uaddr[3] & 0xff),
+ (uaddr[2] & 0xff), (uaddr[1] & 0xff), (uaddr[0] & 0xff));
break;
case AF_INET6:
qp = qbuf;
diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
index 09cd917444..304ae35b8b 100644
--- a/resolv/nss_dns/dns-network.c
+++ b/resolv/nss_dns/dns-network.c
@@ -191,21 +191,21 @@ _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result,
{
case 3:
/* Class A network. */
- sprintf (qbuf, "0.0.0.%u.in-addr.arpa", net_bytes[3]);
+ __sprintf (qbuf, "0.0.0.%u.in-addr.arpa", net_bytes[3]);
break;
case 2:
/* Class B network. */
- sprintf (qbuf, "0.0.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2]);
+ __sprintf (qbuf, "0.0.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2]);
break;
case 1:
/* Class C network. */
- sprintf (qbuf, "0.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
- net_bytes[1]);
+ __sprintf (qbuf, "0.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
+ net_bytes[1]);
break;
case 0:
/* Class D - E network. */
- sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
- net_bytes[1], net_bytes[0]);
+ __sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
+ net_bytes[1], net_bytes[0]);
break;
}
diff --git a/shadow/putspent.c b/shadow/putspent.c
index cbbb840d5b..d675e28210 100644
--- a/shadow/putspent.c
+++ b/shadow/putspent.c
@@ -42,47 +42,47 @@ putspent (const struct spwd *p, FILE *stream)
flockfile (stream);
- if (fprintf (stream, "%s:%s:", p->sp_namp, _S (p->sp_pwdp)) < 0)
+ if (__fprintf (stream, "%s:%s:", p->sp_namp, _S (p->sp_pwdp)) < 0)
++errors;
if ((p->sp_lstchg != (long int) -1
- && fprintf (stream, "%ld:", p->sp_lstchg) < 0)
+ && __fprintf (stream, "%ld:", p->sp_lstchg) < 0)
|| (p->sp_lstchg == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_min != (long int) -1
- && fprintf (stream, "%ld:", p->sp_min) < 0)
+ && __fprintf (stream, "%ld:", p->sp_min) < 0)
|| (p->sp_min == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_max != (long int) -1
- && fprintf (stream, "%ld:", p->sp_max) < 0)
+ && __fprintf (stream, "%ld:", p->sp_max) < 0)
|| (p->sp_max == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_warn != (long int) -1
- && fprintf (stream, "%ld:", p->sp_warn) < 0)
+ && __fprintf (stream, "%ld:", p->sp_warn) < 0)
|| (p->sp_warn == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_inact != (long int) -1
- && fprintf (stream, "%ld:", p->sp_inact) < 0)
+ && __fprintf (stream, "%ld:", p->sp_inact) < 0)
|| (p->sp_inact == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_expire != (long int) -1
- && fprintf (stream, "%ld:", p->sp_expire) < 0)
+ && __fprintf (stream, "%ld:", p->sp_expire) < 0)
|| (p->sp_expire == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if (p->sp_flag != ~0ul
- && fprintf (stream, "%ld", p->sp_flag) < 0)
+ && __fprintf (stream, "%ld", p->sp_flag) < 0)
++errors;
if (putc_unlocked ('\n', stream) == EOF)
diff --git a/stdio-common/dprintf.c b/stdio-common/dprintf.c
index 2e26d59714..6fbe5d4862 100644
--- a/stdio-common/dprintf.c
+++ b/stdio-common/dprintf.c
@@ -33,5 +33,4 @@ __dprintf (int d, const char *format, ...)
return done;
}
libc_hidden_def (__dprintf)
-ldbl_hidden_def (__dprintf, dprintf)
ldbl_weak_alias (__dprintf, dprintf)
diff --git a/stdio-common/fprintf.c b/stdio-common/fprintf.c
index 8d2cd37433..af7190c5b4 100644
--- a/stdio-common/fprintf.c
+++ b/stdio-common/fprintf.c
@@ -34,7 +34,7 @@ __fprintf (FILE *stream, const char *format, ...)
return done;
}
-ldbl_hidden_def (__fprintf, fprintf)
+libc_hidden_def (__fprintf)
ldbl_strong_alias (__fprintf, fprintf)
/* We define the function with the real name here. But deep down in
diff --git a/stdio-common/psiginfo.c b/stdio-common/psiginfo.c
index adf3b71b77..f99c51da17 100644
--- a/stdio-common/psiginfo.c
+++ b/stdio-common/psiginfo.c
@@ -76,7 +76,7 @@ psiginfo (const siginfo_t *pinfo, const char *s)
}
if (s != NULL && *s != '\0')
- fprintf (fp, "%s: ", s);
+ __fprintf (fp, "%s: ", s);
const char *desc;
if (pinfo->si_signo >= 0 && pinfo->si_signo < NSIG
@@ -92,21 +92,21 @@ psiginfo (const siginfo_t *pinfo, const char *s)
if (pinfo->si_signo - SIGRTMIN < SIGRTMAX - pinfo->si_signo)
{
if (pinfo->si_signo == SIGRTMIN)
- fprintf (fp, "SIGRTMIN (");
+ __fprintf (fp, "SIGRTMIN (");
else
- fprintf (fp, "SIGRTMIN+%d (", pinfo->si_signo - SIGRTMIN);
+ __fprintf (fp, "SIGRTMIN+%d (", pinfo->si_signo - SIGRTMIN);
}
else
{
if (pinfo->si_signo == SIGRTMAX)
- fprintf (fp, "SIGRTMAX (");
+ __fprintf (fp, "SIGRTMAX (");
else
- fprintf (fp, "SIGRTMAX-%d (", SIGRTMAX - pinfo->si_signo);
+ __fprintf (fp, "SIGRTMAX-%d (", SIGRTMAX - pinfo->si_signo);
}
}
else
#endif
- fprintf (fp, "%s (", _(desc));
+ __fprintf (fp, "%s (", _(desc));
const char *base = NULL;
const uint8_t *offarr = NULL;
@@ -178,25 +178,25 @@ Signal generated by the completion of an I/O request");
}
if (str != NULL)
- fprintf (fp, "%s ", _(str));
+ __fprintf (fp, "%s ", _(str));
else
- fprintf (fp, "%d ", pinfo->si_code);
+ __fprintf (fp, "%d ", pinfo->si_code);
if (pinfo->si_signo == SIGILL || pinfo->si_signo == SIGFPE
|| pinfo->si_signo == SIGSEGV || pinfo->si_signo == SIGBUS)
- fprintf (fp, "[%p])\n", pinfo->si_addr);
+ __fprintf (fp, "[%p])\n", pinfo->si_addr);
else if (pinfo->si_signo == SIGCHLD)
- fprintf (fp, "%ld %d %ld)\n",
- (long int) pinfo->si_pid, pinfo->si_status,
- (long int) pinfo->si_uid);
+ __fprintf (fp, "%ld %d %ld)\n",
+ (long int) pinfo->si_pid, pinfo->si_status,
+ (long int) pinfo->si_uid);
else if (pinfo->si_signo == SIGPOLL)
- fprintf (fp, "%ld)\n", (long int) pinfo->si_band);
+ __fprintf (fp, "%ld)\n", (long int) pinfo->si_band);
else
- fprintf (fp, "%ld %ld)\n",
- (long int) pinfo->si_pid, (long int) pinfo->si_uid);
+ __fprintf (fp, "%ld %ld)\n",
+ (long int) pinfo->si_pid, (long int) pinfo->si_uid);
}
else
- fprintf (fp, _("Unknown signal %d\n"), pinfo->si_signo);
+ __fprintf (fp, _("Unknown signal %d\n"), pinfo->si_signo);
fclose (fp);
diff --git a/stdio-common/sprintf.c b/stdio-common/sprintf.c
index a9665f753a..f1f43a49ec 100644
--- a/stdio-common/sprintf.c
+++ b/stdio-common/sprintf.c
@@ -32,6 +32,6 @@ __sprintf (char *s, const char *format, ...)
return done;
}
-ldbl_hidden_def (__sprintf, sprintf)
+libc_hidden_def (__sprintf)
ldbl_strong_alias (__sprintf, sprintf)
ldbl_strong_alias (__sprintf, _IO_sprintf)
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 7559fd239d..c5912788bd 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -24,4 +24,4 @@ __vfprintf (FILE *fp, const char *format, va_list ap)
}
ldbl_strong_alias (__vfprintf, _IO_vfprintf);
ldbl_strong_alias (__vfprintf, vfprintf);
-ldbl_hidden_def (__vfprintf, vfprintf)
+libc_hidden_def (__vfprintf)
diff --git a/sunrpc/netname.c b/sunrpc/netname.c
index bf7f0b81c4..97a881c3af 100644
--- a/sunrpc/netname.c
+++ b/sunrpc/netname.c
@@ -48,7 +48,7 @@ user2netname (char netname[MAXNETNAMELEN + 1], const uid_t uid,
if ((strlen (dfltdom) + OPSYS_LEN + 3 + MAXIPRINT) > (size_t) MAXNETNAMELEN)
return 0;
- sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
+ __sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
i = strlen (netname);
if (netname[i - 1] == '.')
netname[i - 1] = '\0';
@@ -112,7 +112,7 @@ host2netname (char netname[MAXNETNAMELEN + 1], const char *host,
> MAXNETNAMELEN)
return 0;
- sprintf (netname, "%s.%s@%s", OPSYS, hostname, domainname);
+ __sprintf (netname, "%s.%s@%s", OPSYS, hostname, domainname);
return 1;
}
#ifdef EXPORT_RPC_SYMBOLS
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
index f683836678..59f6e31d2d 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128___asprintf (char **string_ptr, const char *format, ...)
+int
+__asprintfieee128 (char **string_ptr, const char *format, ...)
{
va_list ap;
int done;
@@ -32,5 +32,4 @@ ___ieee128___asprintf (char **string_ptr, const char *format, ...)
return done;
}
-hidden_def (___ieee128___asprintf)
-strong_alias (___ieee128___asprintf, __asprintfieee128)
+libc_hidden_def (__asprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
index cf3b46c37a..ceba219dc7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_dprintf (int d, const char *format, ...)
+int
+__dprintfieee128 (int d, const char *format, ...)
{
va_list ap;
int done;
@@ -31,5 +31,4 @@ ___ieee128_dprintf (int d, const char *format, ...)
return done;
}
-strong_alias (___ieee128_dprintf, __dprintfieee128)
-hidden_def (___ieee128_dprintf);
+libc_hidden_def (__dprintfieee128);
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
index 4462588675..b58f27afb7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_fprintf (FILE *fp, const char *format, ...)
+int
+__fprintfieee128 (FILE *fp, const char *format, ...)
{
va_list ap;
int done;
@@ -31,5 +31,4 @@ ___ieee128_fprintf (FILE *fp, const char *format, ...)
return done;
}
-strong_alias (___ieee128_fprintf, __fprintfieee128)
-hidden_def (___ieee128_fprintf)
+libc_hidden_def (__fprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
index 9703069b95..243eb65629 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
@@ -18,8 +18,8 @@
/* When in IEEE long double mode, call ___ieee128_sprintf. */
#include <stdio.h>
-typeof (sprintf) ___ieee128_sprintf attribute_hidden;
-#define SPRINTF ___ieee128_sprintf
+typeof (sprintf) __sprintfieee128 attribute_hidden;
+#define SPRINTF __sprintfieee128
/* Declare internal functions: ___qecvtieee128_r and ___qfcvtieee128_r,
built from a different compiling unit, and called from here. */
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
index 0be5bb2810..8046f5fd46 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
@@ -18,8 +18,8 @@
/* When in IEEE long double mode, call ___ieee128_snprintf. */
#include <stdio.h>
-typeof (snprintf) ___ieee128_snprintf attribute_hidden;
-#define SNPRINTF ___ieee128_snprintf
+typeof (snprintf) __snprintfieee128 attribute_hidden;
+#define SNPRINTF __snprintfieee128
#define ECVT_R __qecvtieee128_r
#define FCVT_R __qfcvtieee128_r
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
index 5f51b3ec9e..da3d9441d7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_snprintf (char *s, size_t maxlen, const char *format, ...)
+int
+__snprintfieee128 (char *s, size_t maxlen, const char *format, ...)
{
va_list ap;
int done;
@@ -32,4 +32,4 @@ ___ieee128_snprintf (char *s, size_t maxlen, const char *format, ...)
return done;
}
-strong_alias (___ieee128_snprintf, __snprintfieee128)
+libc_hidden_def (__snprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
index 0cad130788..007a71659a 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_sprintf (char *s, const char *format, ...)
+int
+__sprintfieee128 (char *s, const char *format, ...)
{
va_list ap;
int done;
@@ -32,5 +32,4 @@ ___ieee128_sprintf (char *s, const char *format, ...)
return done;
}
-strong_alias (___ieee128_sprintf, __sprintfieee128)
-hidden_def (___ieee128_sprintf)
+libc_hidden_def (__sprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
index e340c9b457..4df1e485a5 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
@@ -18,10 +18,9 @@
#include <libio/libioP.h>
-extern int
-___ieee128_vfprintf (FILE *fp, const char *format, va_list ap)
+int
+__vfprintfieee128 (FILE *fp, const char *format, va_list ap)
{
return __vfprintf_internal (fp, format, ap, PRINTF_LDBL_USES_FLOAT128);
}
-strong_alias (___ieee128_vfprintf, __vfprintfieee128)
-hidden_def (___ieee128_vfprintf)
+libc_hidden_def (__vfprintfieee128)
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
index ebd2a43951..5b167d45ff 100644
--- a/sysdeps/posix/tempname.c
+++ b/sysdeps/posix/tempname.c
@@ -161,7 +161,7 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
return -1;
}
- sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
+ __sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
return 0;
}
#endif /* _LIBC */
diff --git a/sysdeps/unix/sysv/linux/ia64/makecontext.c b/sysdeps/unix/sysv/linux/ia64/makecontext.c
index 0bc4211dfc..0cf05d5999 100644
--- a/sysdeps/unix/sysv/linux/ia64/makecontext.c
+++ b/sysdeps/unix/sysv/linux/ia64/makecontext.c
@@ -54,7 +54,7 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
if (argc > 8)
{
- fprintf (stderr, _("\
+ __fprintf (stderr, _("\
makecontext: does not know how to handle more than 8 arguments\n"));
exit (-1);
}
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index 0e017f458b..f2dca7711a 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -233,10 +233,13 @@ extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
const wchar_t *__restrict __format, ...)
__THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
-extern int __REDIRECT_NTH_LDBL (__swprintf_alias,
- (wchar_t *__restrict __s, size_t __n,
- const wchar_t *__restrict __fmt, ...),
- swprintf);
+extern int __swprintf_alias (wchar_t *__restrict __s, size_t __n,
+ const wchar_t *__restrict __fmt, ...)
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+ __asm__ (__ASMNAME ("swprintf"))
+#endif
+ ;
+
#ifdef __va_arg_pack
__fortify_function int
@@ -264,10 +267,13 @@ extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
__gnuc_va_list __arg)
__THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-extern int __REDIRECT_NTH_LDBL (__vswprintf_alias,
- (wchar_t *__restrict __s, size_t __n,
- const wchar_t *__restrict __fmt,
- __gnuc_va_list __ap), vswprintf);
+extern int __vswprintf_alias (wchar_t *__restrict __s, size_t __n,
+ const wchar_t *__restrict __fmt,
+ __gnuc_va_list __ap)
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+ __asm__ (__ASMNAME ("vswprintf"))
+#endif
+ ;
__fortify_function int
__NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
^ permalink raw reply [flat|nested] 14+ messages in thread
* [glibc/azanella/clang] Remove stdio-ldbl.h
@ 2022-04-04 12:50 Adhemerval Zanella
0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-04-04 12:50 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f5a47561fed31a960f6e801a5b0f25d69e245a4a
commit f5a47561fed31a960f6e801a5b0f25d69e245a4a
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Thu Feb 24 14:13:12 2022 -0300
Remove stdio-ldbl.h
The functions which require different alias to long double depending
of the ABI now uses a set os macros that defines the expected alias
on the function prototype, instead of redefine them using the
__LDBL_REDIR_DEC macros.
The __REDIRECT_LDBL, __REDIRECT_LDBL_NTH, __REDIRECT_LDBL_NTHNL
are refactores to be similar to __REDIRECT with the difference it
now expects the aliases for binary128 and for the long double being
double (which __LDBL_REDIR_DEC does).
All printf internal usage are also replaced to use internal alias
instead.
Diff:
---
argp/argp-parse.c | 4 +-
debug/backtracesyms.c | 18 +-
grp/putgrent.c | 6 +-
gshadow/putsgent.c | 6 +-
include/bits/stdio-ldbl.h | 1 -
include/stdio.h | 34 ++-
inet/ether_ntoa_r.c | 8 +-
inet/rexec.c | 2 +-
libio/Makefile | 2 +-
libio/bits/stdio-ldbl.h | 108 --------
libio/bits/stdio2.h | 115 ++++++---
libio/stdio.h | 286 +++++++++++++--------
malloc/malloc-check.c | 1 +
malloc/malloc.c | 32 +--
misc/efgcvt-template.c | 2 +-
misc/mntent_r.c | 2 +-
misc/sys/cdefs.h | 70 +++--
misc/syslog.c | 4 +-
nis/nis_subr.c | 8 +-
nptl/pthread_getname.c | 2 +-
nptl/pthread_setname.c | 2 +-
pwd/getpw.c | 6 +-
pwd/putpwent.c | 4 +-
resolv/inet_ntop.c | 4 +-
resolv/nss_dns/dns-host.c | 4 +-
resolv/nss_dns/dns-network.c | 12 +-
shadow/putspent.c | 16 +-
stdio-common/dprintf.c | 1 -
stdio-common/fprintf.c | 2 +-
stdio-common/psiginfo.c | 32 +--
stdio-common/sprintf.c | 2 +-
stdio-common/vfprintf.c | 2 +-
sunrpc/netname.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-asprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-dprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-fprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-snprintf.c | 6 +-
.../ieee754/ldbl-128ibm-compat/ieee128-sprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c | 7 +-
sysdeps/posix/tempname.c | 2 +-
sysdeps/unix/sysv/linux/ia64/makecontext.c | 2 +-
wcsmbs/bits/wchar2.h | 22 +-
44 files changed, 450 insertions(+), 427 deletions(-)
diff --git a/argp/argp-parse.c b/argp/argp-parse.c
index 13cd84dd33..c26c0fc27f 100644
--- a/argp/argp-parse.c
+++ b/argp/argp-parse.c
@@ -177,7 +177,7 @@ argp_version_parser (int key, char *arg, struct argp_state *state)
if (argp_program_version_hook)
(*argp_program_version_hook) (state->out_stream, state);
else if (argp_program_version)
- fprintf (state->out_stream, "%s\n", argp_program_version);
+ __fprintf (state->out_stream, "%s\n", argp_program_version);
else
__argp_error (state, dgettext (state->root_argp->argp_domain,
"(PROGRAM ERROR) No version known!?"));
@@ -618,7 +618,7 @@ parser_finalize (struct parser *parser,
{
if (!(parser->state.flags & ARGP_NO_ERRS)
&& parser->state.err_stream)
- fprintf (parser->state.err_stream,
+ __fprintf (parser->state.err_stream,
dgettext (parser->argp->argp_domain,
"%s: Too many arguments\n"),
parser->state.name);
diff --git a/debug/backtracesyms.c b/debug/backtracesyms.c
index 17e0626df8..adb939f888 100644
--- a/debug/backtracesyms.c
+++ b/debug/backtracesyms.c
@@ -83,10 +83,10 @@ __backtrace_symbols (void *const *array, int size)
info[cnt].dli_saddr = info[cnt].dli_fbase;
if (info[cnt].dli_sname == NULL && info[cnt].dli_saddr == 0)
- last += 1 + sprintf (last, "%s(%s) [%p]",
- info[cnt].dli_fname ?: "",
- info[cnt].dli_sname ?: "",
- array[cnt]);
+ last += 1 + __sprintf (last, "%s(%s) [%p]",
+ info[cnt].dli_fname ?: "",
+ info[cnt].dli_sname ?: "",
+ array[cnt]);
else
{
char sign;
@@ -102,14 +102,14 @@ __backtrace_symbols (void *const *array, int size)
offset = info[cnt].dli_saddr - array[cnt];
}
- last += 1 + sprintf (last, "%s(%s%c%#tx) [%p]",
- info[cnt].dli_fname ?: "",
- info[cnt].dli_sname ?: "",
- sign, offset, array[cnt]);
+ last += 1 + __sprintf (last, "%s(%s%c%#tx) [%p]",
+ info[cnt].dli_fname ?: "",
+ info[cnt].dli_sname ?: "",
+ sign, offset, array[cnt]);
}
}
else
- last += 1 + sprintf (last, "[%p]", array[cnt]);
+ last += 1 + __sprintf (last, "[%p]", array[cnt]);
}
assert (last <= (char *) result + size * sizeof (char *) + total);
}
diff --git a/grp/putgrent.c b/grp/putgrent.c
index 966ba2a763..305ff44359 100644
--- a/grp/putgrent.c
+++ b/grp/putgrent.c
@@ -45,10 +45,10 @@ putgrent (const struct group *gr, FILE *stream)
flockfile (stream);
if (gr->gr_name[0] == '+' || gr->gr_name[0] == '-')
- retval = fprintf (stream, "%s:%s::",
+ retval = __fprintf (stream, "%s:%s::",
gr->gr_name, _S (gr->gr_passwd));
else
- retval = fprintf (stream, "%s:%s:%lu:",
+ retval = __fprintf (stream, "%s:%s:%lu:",
gr->gr_name, _S (gr->gr_passwd),
(unsigned long int) gr->gr_gid);
if (__builtin_expect (retval, 0) < 0)
@@ -60,7 +60,7 @@ putgrent (const struct group *gr, FILE *stream)
if (gr->gr_mem != NULL)
{
for (size_t i = 0; gr->gr_mem[i] != NULL; i++)
- if (fprintf (stream, i == 0 ? "%s" : ",%s", gr->gr_mem[i]) < 0)
+ if (__fprintf (stream, i == 0 ? "%s" : ",%s", gr->gr_mem[i]) < 0)
{
/* What else can we do? */
funlockfile (stream);
diff --git a/gshadow/putsgent.c b/gshadow/putsgent.c
index 9e2dca7eaf..870438de6d 100644
--- a/gshadow/putsgent.c
+++ b/gshadow/putsgent.c
@@ -42,7 +42,7 @@ putsgent (const struct sgrp *g, FILE *stream)
_IO_flockfile (stream);
- if (fprintf (stream, "%s:%s:", g->sg_namp, _S (g->sg_passwd)) < 0)
+ if (__fprintf (stream, "%s:%s:", g->sg_namp, _S (g->sg_passwd)) < 0)
++errors;
bool first = true;
@@ -50,7 +50,7 @@ putsgent (const struct sgrp *g, FILE *stream)
if (sp != NULL)
while (*sp != NULL)
{
- if (fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
+ if (__fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
{
++errors;
break;
@@ -65,7 +65,7 @@ putsgent (const struct sgrp *g, FILE *stream)
if (sp != NULL)
while (*sp != NULL)
{
- if (fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
+ if (__fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
{
++errors;
break;
diff --git a/include/bits/stdio-ldbl.h b/include/bits/stdio-ldbl.h
deleted file mode 100644
index 1f7d3ce1c6..0000000000
--- a/include/bits/stdio-ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <libio/bits/stdio-ldbl.h>
diff --git a/include/stdio.h b/include/stdio.h
index 23b7fd288c..a645a1bf99 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -22,13 +22,17 @@
/* Some libc_hidden_ldbl_proto's do not map to a unique symbol when
redirecting ldouble to _Float128 variants. We can therefore safely
directly alias them to their internal name. */
-# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc)
-# define stdio_hidden_ldbl_proto(p, f) \
- extern __typeof (p ## f) p ## f __asm (__ASMNAME ("___ieee128_" #f));
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# define stdio_hidden_ldbl_proto(p,f) __LDBL_REDIR1_DECL (p ## f, p ## f ## ieee128)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc) && defined SHARED
+# define __stdio_hidden_ldbl_proto(name, alias) \
+ extern __typeof (name) __##name __asm__ (__hidden_asmname (#alias));
+# define stdio_hidden_ldbl_proto(name) \
+ extern typeof (name) __##name##ieee128; \
+ libc_hidden_proto (__##name##ieee128); \
+ __stdio_hidden_ldbl_proto (name, __GI___##name##ieee128)
# else
-# define stdio_hidden_ldbl_proto(p,f) libc_hidden_proto (p ## f)
+# define stdio_hidden_ldbl_proto(name) \
+ extern __typeof (name) __##name; \
+ libc_hidden_proto (__##name)
# endif
/* Set the error indicator on FP. */
@@ -39,10 +43,7 @@ fseterr_unlocked (FILE *fp)
}
extern int __fcloseall (void) attribute_hidden;
-extern int __snprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, ...)
- __attribute__ ((__format__ (__printf__, 3, 4)));
-stdio_hidden_ldbl_proto (__, snprintf)
+stdio_hidden_ldbl_proto (snprintf);
extern int __vfscanf (FILE *__restrict __s,
const char *__restrict __format,
@@ -183,7 +184,7 @@ extern const char *const _sys_errlist_internal[] attribute_hidden;
extern const char *__get_errlist (int) attribute_hidden;
extern const char *__get_errname (int) attribute_hidden;
-libc_hidden_ldbl_proto (__asprintf)
+stdio_hidden_ldbl_proto (asprintf);
# if IS_IN (libc)
extern FILE *_IO_new_fopen (const char*, const char*);
@@ -205,13 +206,10 @@ extern int _IO_new_fgetpos (FILE *, __fpos_t *);
# define fgetpos(fp, posp) _IO_new_fgetpos (fp, posp)
# endif
-extern __typeof (dprintf) __dprintf
- __attribute__ ((__format__ (__printf__, 2, 3)));
-stdio_hidden_ldbl_proto (__, dprintf)
-libc_hidden_ldbl_proto (dprintf)
-libc_hidden_ldbl_proto (fprintf)
-libc_hidden_ldbl_proto (vfprintf)
-libc_hidden_ldbl_proto (sprintf)
+stdio_hidden_ldbl_proto (dprintf);
+stdio_hidden_ldbl_proto (fprintf);
+stdio_hidden_ldbl_proto (vfprintf);
+stdio_hidden_ldbl_proto (sprintf);
libc_hidden_proto (ungetc)
libc_hidden_proto (__getdelim)
libc_hidden_proto (fwrite)
diff --git a/inet/ether_ntoa_r.c b/inet/ether_ntoa_r.c
index 03011ffef6..f111e5234c 100644
--- a/inet/ether_ntoa_r.c
+++ b/inet/ether_ntoa_r.c
@@ -23,10 +23,10 @@
char *
ether_ntoa_r (const struct ether_addr *addr, char *buf)
{
- sprintf (buf, "%x:%x:%x:%x:%x:%x",
- addr->ether_addr_octet[0], addr->ether_addr_octet[1],
- addr->ether_addr_octet[2], addr->ether_addr_octet[3],
- addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
+ __sprintf (buf, "%x:%x:%x:%x:%x:%x",
+ addr->ether_addr_octet[0], addr->ether_addr_octet[1],
+ addr->ether_addr_octet[2], addr->ether_addr_octet[3],
+ addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
return buf;
}
libc_hidden_def (ether_ntoa_r)
diff --git a/inet/rexec.c b/inet/rexec.c
index 330282ac16..809475d976 100644
--- a/inet/rexec.c
+++ b/inet/rexec.c
@@ -135,7 +135,7 @@ retry:
NULL, 0, servbuff, sizeof(servbuff),
NI_NUMERICSERV))
port = (int) __strtol (servbuff, NULL, 10);
- (void) sprintf(num, "%u", port);
+ (void) __sprintf(num, "%u", port);
(void) __write(s, num, strlen(num)+1);
{ socklen_t len = sizeof (from);
s3 = TEMP_FAILURE_RETRY (accept(s2, (struct sockaddr *)&from,
diff --git a/libio/Makefile b/libio/Makefile
index e97387743f..a4830ddf42 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -23,7 +23,7 @@ subdir := libio
include ../Makeconfig
headers := stdio.h \
- bits/stdio.h bits/stdio2.h bits/stdio-ldbl.h \
+ bits/stdio.h bits/stdio2.h \
bits/types/FILE.h bits/types/__FILE.h bits/types/struct_FILE.h \
bits/types/__fpos_t.h bits/types/__fpos64_t.h \
bits/types/cookie_io_functions_t.h
diff --git a/libio/bits/stdio-ldbl.h b/libio/bits/stdio-ldbl.h
deleted file mode 100644
index 6b63394b50..0000000000
--- a/libio/bits/stdio-ldbl.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -mlong-double-64 compatibility mode for stdio functions.
- Copyright (C) 2006-2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#ifndef _STDIO_H
-# error "Never include <bits/stdio-ldbl.h> directly; use <stdio.h> instead."
-#endif
-
-__LDBL_REDIR_DECL (fprintf)
-__LDBL_REDIR_DECL (printf)
-__LDBL_REDIR_DECL (sprintf)
-__LDBL_REDIR_DECL (vfprintf)
-__LDBL_REDIR_DECL (vprintf)
-__LDBL_REDIR_DECL (vsprintf)
-#if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (fscanf, __nldbl___isoc99_fscanf)
-__LDBL_REDIR1_DECL (scanf, __nldbl___isoc99_scanf)
-__LDBL_REDIR1_DECL (sscanf, __nldbl___isoc99_sscanf)
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (fscanf, __isoc99_fscanfieee128)
-__LDBL_REDIR1_DECL (scanf, __isoc99_scanfieee128)
-__LDBL_REDIR1_DECL (sscanf, __isoc99_sscanfieee128)
-# else
-# error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-# endif
-#else
-__LDBL_REDIR_DECL (fscanf)
-__LDBL_REDIR_DECL (scanf)
-__LDBL_REDIR_DECL (sscanf)
-#endif
-
-#if defined __USE_ISOC99 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (snprintf)
-__LDBL_REDIR_DECL (vsnprintf)
-#endif
-
-#ifdef __USE_ISOC99
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (vfscanf, __nldbl___isoc99_vfscanf)
-__LDBL_REDIR1_DECL (vscanf, __nldbl___isoc99_vscanf)
-__LDBL_REDIR1_DECL (vsscanf, __nldbl___isoc99_vsscanf)
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (vfscanf, __isoc99_vfscanfieee128)
-__LDBL_REDIR1_DECL (vscanf, __isoc99_vscanfieee128)
-__LDBL_REDIR1_DECL (vsscanf, __isoc99_vsscanfieee128)
-# else
-# error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-# endif
-# else
-__LDBL_REDIR_DECL (vfscanf)
-__LDBL_REDIR_DECL (vsscanf)
-__LDBL_REDIR_DECL (vscanf)
-# endif
-#endif
-
-#ifdef __USE_XOPEN2K8
-__LDBL_REDIR_DECL (vdprintf)
-__LDBL_REDIR_DECL (dprintf)
-#endif
-
-#ifdef __USE_GNU
-__LDBL_REDIR_DECL (vasprintf)
-__LDBL_REDIR2_DECL (asprintf)
-__LDBL_REDIR_DECL (asprintf)
-__LDBL_REDIR_DECL (obstack_printf)
-__LDBL_REDIR_DECL (obstack_vprintf)
-#endif
-
-#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR2_DECL (sprintf_chk)
-__LDBL_REDIR2_DECL (vsprintf_chk)
-# if defined __USE_ISOC99 || defined __USE_UNIX98
-__LDBL_REDIR2_DECL (snprintf_chk)
-__LDBL_REDIR2_DECL (vsnprintf_chk)
-# endif
-# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR2_DECL (fprintf_chk)
-__LDBL_REDIR2_DECL (printf_chk)
-__LDBL_REDIR2_DECL (vfprintf_chk)
-__LDBL_REDIR2_DECL (vprintf_chk)
-# ifdef __USE_XOPEN2K8
-__LDBL_REDIR2_DECL (dprintf_chk)
-__LDBL_REDIR2_DECL (vdprintf_chk)
-# endif
-# ifdef __USE_GNU
-__LDBL_REDIR2_DECL (asprintf_chk)
-__LDBL_REDIR2_DECL (vasprintf_chk)
-__LDBL_REDIR2_DECL (obstack_printf_chk)
-__LDBL_REDIR2_DECL (obstack_vprintf_chk)
-# endif
-# endif
-#endif
diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h
index b0b655ee7a..de7f1f04aa 100644
--- a/libio/bits/stdio2.h
+++ b/libio/bits/stdio2.h
@@ -23,12 +23,17 @@
# error "Never include <bits/stdio2.h> directly; use <stdio.h> instead."
#endif
-extern int __sprintf_chk (char *__restrict __s, int __flag, size_t __slen,
- const char *__restrict __format, ...) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__sprintf_chk, (char *__restrict __s,
+ int __flag, size_t __slen,
+ const char *__restrict __format,
+ ...),
+ __sprintf_chkieee128, __nldbl___sprintf_chk)
__attr_access ((__write_only__, 1, 3));
-extern int __vsprintf_chk (char *__restrict __s, int __flag, size_t __slen,
- const char *__restrict __format,
- __gnuc_va_list __ap) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__vsprintf_chk, (char *__restrict __s,
+ int __flag, size_t __slen,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vsprintf_chkieee128, __nldbl___vsprintf_chk)
__attr_access ((__write_only__, 1, 3));
#ifdef __va_arg_pack
@@ -54,14 +59,19 @@ __NTH (vsprintf (char *__restrict __s, const char *__restrict __fmt,
}
#if defined __USE_ISOC99 || defined __USE_UNIX98
-
-extern int __snprintf_chk (char *__restrict __s, size_t __n, int __flag,
- size_t __slen, const char *__restrict __format,
- ...) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__snprintf_chk, (char *__restrict __s,
+ size_t __n, int __flag,
+ size_t __slen,
+ const char *__restrict __format,
+ ...),
+ __snprintf_chkieee128, __nldbl___snprintf_chk)
__attr_access ((__write_only__, 1, 2));
-extern int __vsnprintf_chk (char *__restrict __s, size_t __n, int __flag,
- size_t __slen, const char *__restrict __format,
- __gnuc_va_list __ap) __THROW;
+extern int __REDIRECT_LDBL_NTHNL (__vsnprintf_chk, (char *__restrict __s,
+ size_t __n, int __flag,
+ size_t __slen,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vsnprintf_chkieee128, __nldbl___vsnprintf_chk);
# ifdef __va_arg_pack
__fortify_function int
@@ -89,14 +99,24 @@ __NTH (vsnprintf (char *__restrict __s, size_t __n,
#endif
#if __USE_FORTIFY_LEVEL > 1
-
-extern int __fprintf_chk (FILE *__restrict __stream, int __flag,
- const char *__restrict __format, ...);
-extern int __printf_chk (int __flag, const char *__restrict __format, ...);
-extern int __vfprintf_chk (FILE *__restrict __stream, int __flag,
- const char *__restrict __format, __gnuc_va_list __ap);
-extern int __vprintf_chk (int __flag, const char *__restrict __format,
- __gnuc_va_list __ap);
+extern int __REDIRECT_LDBL (__fprintf_chk, (FILE *__restrict __stream,
+ int __flag,
+ const char *__restrict __format,
+ ...),
+ __fprintf_chkieee128, __nldbl___fprintf_chk);
+extern int __REDIRECT_LDBL (__printf_chk, (int __flag,
+ const char *__restrict __format,
+ ...),
+ __printf_chkieee128, __nldbl___printf_chk);
+extern int __REDIRECT_LDBL (__vfprintf_chk, (FILE *__restrict __stream,
+ int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vfprintf_chkieee128, __nldbl___vfprintf_chk);
+extern int __REDIRECT_LDBL (__vprintf_chk, (int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vprintf_chkieee128, __nldbl___vprintf_chk);
# ifdef __va_arg_pack
__fortify_function int
@@ -136,10 +156,15 @@ vfprintf (FILE *__restrict __stream,
}
# ifdef __USE_XOPEN2K8
-extern int __dprintf_chk (int __fd, int __flag, const char *__restrict __fmt,
- ...) __attribute__ ((__format__ (__printf__, 3, 4)));
-extern int __vdprintf_chk (int __fd, int __flag,
- const char *__restrict __fmt, __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL (__dprintf_chk, (int __fd, int __flag,
+ const char *__restrict __fmt,
+ ...),
+ __dprintf_chkieee128, __nldbl___dprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL (__vdprintf_chk, (int __fd, int __flag,
+ const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vdprintf_chkieee128, __nldbl___vdprintf_chk)
__attribute__ ((__format__ (__printf__, 3, 0)));
# ifdef __va_arg_pack
@@ -162,22 +187,32 @@ vdprintf (int __fd, const char *__restrict __fmt, __gnuc_va_list __ap)
# endif
# ifdef __USE_GNU
-
-extern int __asprintf_chk (char **__restrict __ptr, int __flag,
- const char *__restrict __fmt, ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4))) __wur;
-extern int __vasprintf_chk (char **__restrict __ptr, int __flag,
- const char *__restrict __fmt, __gnuc_va_list __arg)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
-extern int __obstack_printf_chk (struct obstack *__restrict __obstack,
- int __flag, const char *__restrict __format,
- ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
-extern int __obstack_vprintf_chk (struct obstack *__restrict __obstack,
- int __flag,
- const char *__restrict __format,
- __gnuc_va_list __args)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
+extern int __REDIRECT_LDBL_NTHNL (__asprintf_chk, (char **__restrict __ptr,
+ int __flag,
+ const char *__restrict __fmt,
+ ...),
+ __asprintf_chkieee128, __nldbl___asprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (__vasprintf_chk, (char **__restrict __ptr,
+ int __flag,
+ const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vasprintf_chkieee128, __nldbl___vasnprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (__obstack_printf_chk, (struct obstack *__restrict __obstack,
+ int __flag,
+ const char *__restrict __format,
+ ...),
+ __obstack_printf_chkieee128,
+ __nldbl___obstack_printf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL_NTHNL (__obstack_vprintf_chk, (struct obstack *__restrict __obstack,
+ int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __args),
+ __obstack_vprintf_chkieee128,
+ __nldbl___obstack_vprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
# ifdef __va_arg_pack
__fortify_function int
diff --git a/libio/stdio.h b/libio/stdio.h
index e6425341ce..54c9796a46 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -41,6 +41,7 @@ __BEGIN_DECLS
#include <bits/types/__FILE.h>
#include <bits/types/FILE.h>
#include <bits/types/struct_FILE.h>
+#include <bits/floatn.h>
#ifdef __USE_GNU
# include <bits/types/cookie_io_functions_t.h>
@@ -342,78 +343,143 @@ extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
extern void setlinebuf (FILE *__stream) __THROW;
#endif
-
/* Write formatted output to STREAM.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int fprintf (FILE *__restrict __stream,
- const char *__restrict __format, ...);
+extern int __REDIRECT_LDBL (fprintf, (FILE *__restrict __stream,
+ const char *__restrict __format, ...),
+ __fprintfieee128, __nldbl_fprintf);
/* Write formatted output to stdout.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int printf (const char *__restrict __format, ...);
+extern int __REDIRECT_LDBL (printf, (const char *__restrict __format, ...),
+ __printfieee128, __nldbl_printf);
/* Write formatted output to S. */
-extern int sprintf (char *__restrict __s,
- const char *__restrict __format, ...) __THROWNL;
+extern int __REDIRECT_LDBL_NTHNL (sprintf, (char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __sprintfieee128, __nldbl_sprintf);
/* Write formatted output to S from argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg);
+extern int __REDIRECT_LDBL (vfprintf, (FILE *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vfprintfieee128, __nldbl_vfprintf);
/* Write formatted output to stdout from argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
+extern int __REDIRECT_LDBL (vprintf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vprintfieee128, __nldbl_vprintf);
/* Write formatted output to S from argument list ARG. */
-extern int vsprintf (char *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg) __THROWNL;
+extern int __REDIRECT_LDBL_NTHNL (vsprintf, (char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsprintfieee128, __nldbl_vsprintf);
#if defined __USE_ISOC99 || defined __USE_UNIX98
/* Maximum chars of output to write in MAXLEN. */
-extern int snprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 3, 4)));
-
-extern int vsnprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, __gnuc_va_list __arg)
- __THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
+extern int __REDIRECT_LDBL_NTHNL (snprintf, (char *__restrict __s,
+ size_t __maxlen,
+ const char *__restrict __format,
+ ...),
+ __snprintfieee128, __nldbl_snprintf)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL_NTHNL (vsnprintf, (char *__restrict __s,
+ size_t __maxlen,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsnprintfieee128, __nldbl_vsnprintf)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
#endif
#if __GLIBC_USE (LIB_EXT2)
/* Write formatted output to a string dynamically allocated with `malloc'.
Store the address of the string in *PTR. */
-extern int vasprintf (char **__restrict __ptr, const char *__restrict __f,
- __gnuc_va_list __arg)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
-extern int __asprintf (char **__restrict __ptr,
- const char *__restrict __fmt, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
-extern int asprintf (char **__restrict __ptr,
- const char *__restrict __fmt, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (vasprintf, (char **__restrict __ptr,
+ const char *__restrict __f,
+ __gnuc_va_list __arg),
+ __vasprintfieee128, __nldbl_vasprintf)
+ __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (asprintf, (char **__restrict __ptr,
+ const char *__restrict __fmt,
+ ...),
+ __asprintfieee128, __nldbl_asprintf)
+ __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
#endif
#ifdef __USE_XOPEN2K8
/* Write formatted output to a file descriptor. */
-extern int vdprintf (int __fd, const char *__restrict __fmt,
- __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL (vdprintf, (int __fd, const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vdprintfieee128, __nldbl_vdprintf)
__attribute__ ((__format__ (__printf__, 2, 0)));
-extern int dprintf (int __fd, const char *__restrict __fmt, ...)
+extern int __REDIRECT_LDBL (dprintf, (int __fd, const char *__restrict __fmt,
+ ...),
+ __dprintfieee128, __nldbl_dprintf)
__attribute__ ((__format__ (__printf__, 2, 3)));
#endif
-
+#if !__GLIBC_USE (DEPRECATED_SCANF)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ ...),
+ __isoc99_fscanfieee128, __nldbl___isoc99_fscanf) __wur;
+extern int __REDIRECT_LDBL (scanf, (const char *__restrict __format,
+ ...),
+ __isoc99_scanfieee128, __nldbl___isoc99_scanf) __wur;
+extern int __REDIRECT_LDBL_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __isoc99_sscanfieee128, __nldbl___isoc99_sscanf);
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format, ...),
+ __isoc99_fscanf) __wur;
+extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
+ __isoc99_scanf) __wur;
+extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format, ...),
+ __isoc99_sscanf);
+# else
+extern int __isoc99_fscanf (FILE *__restrict __stream,
+ const char *__restrict __format, ...) __wur;
+extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
+extern int __isoc99_sscanf (const char *__restrict __s,
+ const char *__restrict __format, ...) __THROW;
+# define fscanf __isoc99_fscanf
+# define scanf __isoc99_scanf
+# define sscanf __isoc99_sscanf
+# endif /* __REDIRECT */
+# endif
+#else
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ ...),
+ __fscanfieee128, __nldbl_fscanf) __wur;
+extern int __REDIRECT_LDBL (scanf, (const char *__restrict __format,
+ ...),
+ __scanfieee128, __nldbl_scanf) __wur;
+extern int __REDIRECT_LDBL_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __sscanfieee128, __nldbl_sscanf) __wur;
+# else
/* Read formatted input from STREAM.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int fscanf (FILE *__restrict __stream,
- const char *__restrict __format, ...) __wur;
+ const char *__restrict __format, ...) __wur;
/* Read formatted input from stdin.
This function is a possible cancellation point and therefore not
@@ -421,43 +487,81 @@ extern int fscanf (FILE *__restrict __stream,
extern int scanf (const char *__restrict __format, ...) __wur;
/* Read formatted input from S. */
extern int sscanf (const char *__restrict __s,
- const char *__restrict __format, ...) __THROW;
-
-/* For historical reasons, the C99-compliant versions of the scanf
- functions are at alternative names. When __LDBL_COMPAT or
- __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
- bits/stdio-ldbl.h. */
-#include <bits/floatn.h>
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
- && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-# ifdef __REDIRECT
-extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
- const char *__restrict __format, ...),
- __isoc99_fscanf) __wur;
-extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
- __isoc99_scanf) __wur;
-extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
- const char *__restrict __format, ...),
- __isoc99_sscanf);
-# else
-extern int __isoc99_fscanf (FILE *__restrict __stream,
- const char *__restrict __format, ...) __wur;
-extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
-extern int __isoc99_sscanf (const char *__restrict __s,
- const char *__restrict __format, ...) __THROW;
-# define fscanf __isoc99_fscanf
-# define scanf __isoc99_scanf
-# define sscanf __isoc99_sscanf
+ const char *__restrict __format, ...) __THROW;
# endif
-#endif
+#endif /* DEPRECATED_SCANF */
-#ifdef __USE_ISOC99
+#ifdef __USE_ISOC99
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vfscanfieee128, __nldbl___isoc99_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vscanfieee128, __nldbl___isoc99_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_LDBL_NTH (vsscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vsscanfieee128, __nldbl___isoc99_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (vfscanf,
+ (FILE *__restrict __s,
+ const char *__restrict __format, __gnuc_va_list __arg),
+ __isoc99_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_NTH (vsscanf,
+ (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
+extern int __isoc99_vfscanf (FILE *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg) __wur;
+extern int __isoc99_vscanf (const char *__restrict __format,
+ __gnuc_va_list __arg) __wur;
+extern int __isoc99_vsscanf (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg) __THROW;
+# define vfscanf __isoc99_vfscanf
+# define vscanf __isoc99_vscanf
+# define vsscanf __isoc99_vsscanf
+# endif /* __REDIRECT */
+# endif
+# else /* DEPRECATED_SCANF */
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vfscanfieee128, __nldbl_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vscanfieee128, __nldbl_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_LDBL_NTH (vsscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsscanfieee128, __nldbl_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
/* Read formatted input from S into argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg)
+ __gnuc_va_list __arg)
__attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
/* Read formatted input from stdin into argument list ARG.
@@ -469,42 +573,11 @@ extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
/* Read formatted input from S into argument list ARG. */
extern int vsscanf (const char *__restrict __s,
- const char *__restrict __format, __gnuc_va_list __arg)
+ const char *__restrict __format, __gnuc_va_list __arg)
__THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
-
-/* Same redirection as above for the v*scanf family. */
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __REDIRECT && !defined __LDBL_COMPAT \
- && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-extern int __REDIRECT (vfscanf,
- (FILE *__restrict __s,
- const char *__restrict __format, __gnuc_va_list __arg),
- __isoc99_vfscanf)
- __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
-extern int __REDIRECT (vscanf, (const char *__restrict __format,
- __gnuc_va_list __arg), __isoc99_vscanf)
- __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
-extern int __REDIRECT_NTH (vsscanf,
- (const char *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg), __isoc99_vsscanf)
- __attribute__ ((__format__ (__scanf__, 2, 0)));
-# elif !defined __REDIRECT
-extern int __isoc99_vfscanf (FILE *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg) __wur;
-extern int __isoc99_vscanf (const char *__restrict __format,
- __gnuc_va_list __arg) __wur;
-extern int __isoc99_vsscanf (const char *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg) __THROW;
-# define vfscanf __isoc99_vfscanf
-# define vscanf __isoc99_vscanf
-# define vsscanf __isoc99_vsscanf
# endif
# endif
-#endif /* Use ISO C9x. */
-
+#endif /* __USE_ISOC99 */
/* Read a character from STREAM.
@@ -850,13 +923,17 @@ extern char *cuserid (char *__s)
struct obstack; /* See <obstack.h>. */
/* Write formatted output to an obstack. */
-extern int obstack_printf (struct obstack *__restrict __obstack,
- const char *__restrict __format, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3)));
-extern int obstack_vprintf (struct obstack *__restrict __obstack,
- const char *__restrict __format,
- __gnuc_va_list __args)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 0)));
+extern int __REDIRECT_LDBL_NTHNL (obstack_printf,
+ (struct obstack *__restrict __obstack,
+ const char *__restrict __format, ...),
+ __obstack_printfieee128, __nldbl_obstack_printf)
+ __attribute__ ((__format__ (__printf__, 2, 3)));
+extern int __REDIRECT_LDBL_NTHNL (obstack_vprintf,
+ (struct obstack *__restrict __obstack,
+ const char *__restrict __format,
+ __gnuc_va_list __args),
+ __obstack_vprintfieee128, __nldbl_obstack_vprintf)
+ __attribute__ ((__format__ (__printf__, 2, 0)));
#endif /* Use GNU. */
@@ -894,11 +971,6 @@ extern int __overflow (FILE *, int);
# include <bits/stdio2.h>
#endif
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/stdio-ldbl.h>
-#endif
-
__END_DECLS
#endif /* <stdio.h> included. */
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index 0299fe99a7..e1f68bddfb 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -17,6 +17,7 @@
not, see <https://www.gnu.org/licenses/>. */
#define __mremap mremap
+#define __fprintf fprintf
#include "malloc.c"
/* When memory is tagged, the checking data is stored in the user part
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 09e5ff2bce..aa35846e55 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5279,9 +5279,9 @@ __malloc_stats (void)
memset (&mi, 0, sizeof (mi));
__libc_lock_lock (ar_ptr->mutex);
int_mallinfo (ar_ptr, &mi);
- fprintf (stderr, "Arena %d:\n", i);
- fprintf (stderr, "system bytes = %10u\n", (unsigned int) mi.arena);
- fprintf (stderr, "in use bytes = %10u\n", (unsigned int) mi.uordblks);
+ __fprintf (stderr, "Arena %d:\n", i);
+ __fprintf (stderr, "system bytes = %10u\n", (unsigned int) mi.arena);
+ __fprintf (stderr, "in use bytes = %10u\n", (unsigned int) mi.uordblks);
#if MALLOC_DEBUG > 1
if (i > 0)
dump_heap (heap_for_ptr (top (ar_ptr)));
@@ -5293,12 +5293,12 @@ __malloc_stats (void)
if (ar_ptr == &main_arena)
break;
}
- fprintf (stderr, "Total (incl. mmap):\n");
- fprintf (stderr, "system bytes = %10u\n", system_b);
- fprintf (stderr, "in use bytes = %10u\n", in_use_b);
- fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps);
- fprintf (stderr, "max mmap bytes = %10lu\n",
- (unsigned long) mp_.max_mmapped_mem);
+ __fprintf (stderr, "Total (incl. mmap):\n");
+ __fprintf (stderr, "system bytes = %10u\n", system_b);
+ __fprintf (stderr, "in use bytes = %10u\n", in_use_b);
+ __fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps);
+ __fprintf (stderr, "max mmap bytes = %10lu\n",
+ (unsigned long) mp_.max_mmapped_mem);
stderr->_flags2 = old_flags2;
_IO_funlockfile (stderr);
}
@@ -5728,7 +5728,7 @@ __malloc_info (int options, FILE *fp)
mstate ar_ptr = &main_arena;
do
{
- fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
+ __fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
size_t nblocks = 0;
size_t nfastblocks = 0;
@@ -5839,12 +5839,12 @@ __malloc_info (int options, FILE *fp)
for (size_t i = 0; i < nsizes; ++i)
if (sizes[i].count != 0 && i != NFASTBINS)
- fprintf (fp, "\
+ __fprintf (fp, "\
<size from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
sizes[i].from, sizes[i].to, sizes[i].total, sizes[i].count);
if (sizes[NFASTBINS].count != 0)
- fprintf (fp, "\
+ __fprintf (fp, "\
<unsorted from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
sizes[NFASTBINS].from, sizes[NFASTBINS].to,
sizes[NFASTBINS].total, sizes[NFASTBINS].count);
@@ -5852,7 +5852,7 @@ __malloc_info (int options, FILE *fp)
total_system += ar_ptr->system_mem;
total_max_system += ar_ptr->max_system_mem;
- fprintf (fp,
+ __fprintf (fp,
"</sizes>\n<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
"<system type=\"current\" size=\"%zu\"/>\n"
@@ -5862,7 +5862,7 @@ __malloc_info (int options, FILE *fp)
if (ar_ptr != &main_arena)
{
- fprintf (fp,
+ __fprintf (fp,
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n"
"<aspace type=\"subheaps\" size=\"%zu\"/>\n",
@@ -5872,7 +5872,7 @@ __malloc_info (int options, FILE *fp)
}
else
{
- fprintf (fp,
+ __fprintf (fp,
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n",
ar_ptr->system_mem, ar_ptr->system_mem);
@@ -5885,7 +5885,7 @@ __malloc_info (int options, FILE *fp)
}
while (ar_ptr != &main_arena);
- fprintf (fp,
+ __fprintf (fp,
"<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"mmap\" count=\"%d\" size=\"%zu\"/>\n"
diff --git a/misc/efgcvt-template.c b/misc/efgcvt-template.c
index 87a90e78d4..f1630fd780 100644
--- a/misc/efgcvt-template.c
+++ b/misc/efgcvt-template.c
@@ -24,7 +24,7 @@
#include <math_ldbl_opt.h>
#ifndef SPRINTF
-# define SPRINTF sprintf
+# define SPRINTF __sprintf
#endif
#define APPEND(a, b) APPEND2 (a, b)
diff --git a/misc/mntent_r.c b/misc/mntent_r.c
index 3311ba0b50..65f29b97e9 100644
--- a/misc/mntent_r.c
+++ b/misc/mntent_r.c
@@ -251,7 +251,7 @@ __addmntent (FILE *stream, const struct mntent *mnt)
write_string (stream, mnt->mnt_dir);
write_string (stream, mnt->mnt_type);
write_string (stream, mnt->mnt_opts);
- fprintf (stream, "%d %d\n", mnt->mnt_freq, mnt->mnt_passno);
+ __fprintf (stream, "%d %d\n", mnt->mnt_freq, mnt->mnt_passno);
ret = __ferror_unlocked (stream) != 0 || fflush (stream) != 0;
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 44d3826bca..e43b5d4b36 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -560,6 +560,54 @@
# include <bits/long-double.h>
#endif
+#if (defined __GNUC__ && __GNUC__ >= 2) || (__clang_major__ >= 4)
+# define __REDIRECT_LDBL1(name, prenth, posnth, proto, alias) \
+ name proto prenth __asm__ (__ASMNAME (__ASMNAME (#alias))) posnth
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+# ifdef __REDIRECT
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , , proto, ieee128)
+# ifdef __cplusplus
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROW, , proto, ieee128)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROWNL, , proto, ieee128)
+# else
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROW, proto, ieee128)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROWNL, proto, ieee128)
+# endif /* __cplusplus */
+# else
+_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
+# endif /* __REDIRECT */
+# elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
+# ifdef __REDIRECT
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , , proto, compat)
+# ifdef __cplusplus
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROW, , proto, compat)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROWNL, , proto, compat)
+# else
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROW, proto, compat)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROWNL, proto, compat)
+# endif /* __cplusplus */
+# else
+_Static_assert (0, "Compat long double requires redirection on this platform");
+# endif /* __REDIRECT */
+# endif
+#endif
+
+#ifndef __REDIRECT_LDBL
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) name proto
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) name proto __THROW
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) name proto __THROWNL
+#endif
+
#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
# ifdef __REDIRECT
@@ -583,10 +631,6 @@
# define __REDIRECT_NTH_LDBL(name, proto, alias) \
__LDBL_REDIR1_NTH (name, proto, __##alias##ieee128)
-/* Unused. */
-# define __REDIRECT_LDBL(name, proto, alias) ... unused__redirect_ldbl
-# define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth
-
# else
_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
# endif
@@ -605,24 +649,6 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf
extern __typeof (name) name __asm (__ASMNAME (#alias));
# define __LDBL_REDIR_DECL(name) \
extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name));
-# define __REDIRECT_LDBL(name, proto, alias) \
- __LDBL_REDIR1 (name, proto, __nldbl_##alias)
-# define __REDIRECT_NTH_LDBL(name, proto, alias) \
- __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias)
-# endif
-#endif
-#if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \
- || !defined __REDIRECT
-# define __LDBL_REDIR1(name, proto, alias) name proto
-# define __LDBL_REDIR(name, proto) name proto
-# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW
-# define __LDBL_REDIR_NTH(name, proto) name proto __THROW
-# define __LDBL_REDIR2_DECL(name)
-# define __LDBL_REDIR_DECL(name)
-# ifdef __REDIRECT
-# define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias)
-# define __REDIRECT_NTH_LDBL(name, proto, alias) \
- __REDIRECT_NTH (name, proto, alias)
# endif
#endif
diff --git a/misc/syslog.c b/misc/syslog.c
index ee83b1bb76..0076361f6c 100644
--- a/misc/syslog.c
+++ b/misc/syslog.c
@@ -200,7 +200,7 @@ __vsyslog_internal(int pri, const char *fmt, va_list ap,
else
{
__fsetlocking (f, FSETLOCKING_BYCALLER);
- fprintf (f, "<%d>", pri);
+ __fprintf (f, "<%d>", pri);
now = time_now ();
f->_IO_write_ptr += __strftime_l (f->_IO_write_ptr,
f->_IO_write_end
@@ -214,7 +214,7 @@ __vsyslog_internal(int pri, const char *fmt, va_list ap,
if (LogTag != NULL)
__fputs_unlocked (LogTag, f);
if (LogStat & LOG_PID)
- fprintf (f, "[%d]", (int) __getpid ());
+ __fprintf (f, "[%d]", (int) __getpid ());
if (LogTag != NULL)
{
__putc_unlocked (':', f);
diff --git a/nis/nis_subr.c b/nis/nis_subr.c
index 385f221062..0e02cd19b5 100644
--- a/nis/nis_subr.c
+++ b/nis/nis_subr.c
@@ -280,10 +280,10 @@ nis_getnames (const_nis_name name)
}
if (pos == 0
- && __asprintf (&getnames[pos++], "%s%s%s%s",
- name, name[name_len - 1] == '.' ? "" : ".",
- local_domain,
- local_domain[local_domain_len - 1] == '.' ? "" : ".") < 0)
+ && asprintf (&getnames[pos++], "%s%s%s%s",
+ name, name[name_len - 1] == '.' ? "" : ".",
+ local_domain,
+ local_domain[local_domain_len - 1] == '.' ? "" : ".") < 0)
goto free_null;
getnames[pos] = NULL;
diff --git a/nptl/pthread_getname.c b/nptl/pthread_getname.c
index ebec06e23f..a424b3e4f8 100644
--- a/nptl/pthread_getname.c
+++ b/nptl/pthread_getname.c
@@ -42,7 +42,7 @@ __pthread_getname_np (pthread_t th, char *buf, size_t len)
#define FMT "/proc/self/task/%u/comm"
char fname[sizeof (FMT) + 8];
- sprintf (fname, FMT, (unsigned int) pd->tid);
+ __sprintf (fname, FMT, (unsigned int) pd->tid);
int fd = __open64_nocancel (fname, O_RDONLY);
if (fd == -1)
diff --git a/nptl/pthread_setname.c b/nptl/pthread_setname.c
index f24560db47..8520bac4be 100644
--- a/nptl/pthread_setname.c
+++ b/nptl/pthread_setname.c
@@ -44,7 +44,7 @@ __pthread_setname_np (pthread_t th, const char *name)
#define FMT "/proc/self/task/%u/comm"
char fname[sizeof (FMT) + 8];
- sprintf (fname, FMT, (unsigned int) pd->tid);
+ __sprintf (fname, FMT, (unsigned int) pd->tid);
int fd = __open64_nocancel (fname, O_RDWR);
if (fd == -1)
diff --git a/pwd/getpw.c b/pwd/getpw.c
index 547489a863..4784eaf00b 100644
--- a/pwd/getpw.c
+++ b/pwd/getpw.c
@@ -50,9 +50,9 @@ __getpw (__uid_t uid, char *buf)
if (p == NULL)
return -1;
- if (sprintf (buf, "%s:%s:%lu:%lu:%s:%s:%s", p->pw_name, p->pw_passwd,
- (unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
- p->pw_gecos, p->pw_dir, p->pw_shell) < 0)
+ if (__sprintf (buf, "%s:%s:%lu:%lu:%s:%s:%s", p->pw_name, p->pw_passwd,
+ (unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
+ p->pw_gecos, p->pw_dir, p->pw_shell) < 0)
return -1;
return 0;
diff --git a/pwd/putpwent.c b/pwd/putpwent.c
index e3f2f4e09e..480dd59813 100644
--- a/pwd/putpwent.c
+++ b/pwd/putpwent.c
@@ -48,11 +48,11 @@ putpwent (const struct passwd *p, FILE *stream)
return -1;
if (p->pw_name[0] == '+' || p->pw_name[0] == '-')
- ret = fprintf (stream, "%s:%s:::%s:%s:%s\n",
+ ret = __fprintf (stream, "%s:%s:::%s:%s:%s\n",
p->pw_name, _S (p->pw_passwd),
gecos, _S (p->pw_dir), _S (p->pw_shell));
else
- ret = fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
+ ret = __fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
p->pw_name, _S (p->pw_passwd),
(unsigned long int) p->pw_uid,
(unsigned long int) p->pw_gid,
diff --git a/resolv/inet_ntop.c b/resolv/inet_ntop.c
index c4d38c0f95..53725d805a 100644
--- a/resolv/inet_ntop.c
+++ b/resolv/inet_ntop.c
@@ -28,9 +28,9 @@
#include <string.h>
#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
+# define SPRINTF(x) strlen(__sprintf/**/x)
#else
-# define SPRINTF(x) ((size_t)sprintf x)
+# define SPRINTF(x) ((size_t)__sprintf x)
#endif
/*
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index 913a5cb82f..06a91b23ca 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -507,8 +507,8 @@ _nss_dns_gethostbyaddr2_r (const void *addr, socklen_t len, int af,
switch (af)
{
case AF_INET:
- sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", (uaddr[3] & 0xff),
- (uaddr[2] & 0xff), (uaddr[1] & 0xff), (uaddr[0] & 0xff));
+ __sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", (uaddr[3] & 0xff),
+ (uaddr[2] & 0xff), (uaddr[1] & 0xff), (uaddr[0] & 0xff));
break;
case AF_INET6:
qp = qbuf;
diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
index 09cd917444..304ae35b8b 100644
--- a/resolv/nss_dns/dns-network.c
+++ b/resolv/nss_dns/dns-network.c
@@ -191,21 +191,21 @@ _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result,
{
case 3:
/* Class A network. */
- sprintf (qbuf, "0.0.0.%u.in-addr.arpa", net_bytes[3]);
+ __sprintf (qbuf, "0.0.0.%u.in-addr.arpa", net_bytes[3]);
break;
case 2:
/* Class B network. */
- sprintf (qbuf, "0.0.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2]);
+ __sprintf (qbuf, "0.0.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2]);
break;
case 1:
/* Class C network. */
- sprintf (qbuf, "0.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
- net_bytes[1]);
+ __sprintf (qbuf, "0.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
+ net_bytes[1]);
break;
case 0:
/* Class D - E network. */
- sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
- net_bytes[1], net_bytes[0]);
+ __sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
+ net_bytes[1], net_bytes[0]);
break;
}
diff --git a/shadow/putspent.c b/shadow/putspent.c
index cbbb840d5b..d675e28210 100644
--- a/shadow/putspent.c
+++ b/shadow/putspent.c
@@ -42,47 +42,47 @@ putspent (const struct spwd *p, FILE *stream)
flockfile (stream);
- if (fprintf (stream, "%s:%s:", p->sp_namp, _S (p->sp_pwdp)) < 0)
+ if (__fprintf (stream, "%s:%s:", p->sp_namp, _S (p->sp_pwdp)) < 0)
++errors;
if ((p->sp_lstchg != (long int) -1
- && fprintf (stream, "%ld:", p->sp_lstchg) < 0)
+ && __fprintf (stream, "%ld:", p->sp_lstchg) < 0)
|| (p->sp_lstchg == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_min != (long int) -1
- && fprintf (stream, "%ld:", p->sp_min) < 0)
+ && __fprintf (stream, "%ld:", p->sp_min) < 0)
|| (p->sp_min == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_max != (long int) -1
- && fprintf (stream, "%ld:", p->sp_max) < 0)
+ && __fprintf (stream, "%ld:", p->sp_max) < 0)
|| (p->sp_max == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_warn != (long int) -1
- && fprintf (stream, "%ld:", p->sp_warn) < 0)
+ && __fprintf (stream, "%ld:", p->sp_warn) < 0)
|| (p->sp_warn == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_inact != (long int) -1
- && fprintf (stream, "%ld:", p->sp_inact) < 0)
+ && __fprintf (stream, "%ld:", p->sp_inact) < 0)
|| (p->sp_inact == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_expire != (long int) -1
- && fprintf (stream, "%ld:", p->sp_expire) < 0)
+ && __fprintf (stream, "%ld:", p->sp_expire) < 0)
|| (p->sp_expire == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if (p->sp_flag != ~0ul
- && fprintf (stream, "%ld", p->sp_flag) < 0)
+ && __fprintf (stream, "%ld", p->sp_flag) < 0)
++errors;
if (putc_unlocked ('\n', stream) == EOF)
diff --git a/stdio-common/dprintf.c b/stdio-common/dprintf.c
index 2e26d59714..6fbe5d4862 100644
--- a/stdio-common/dprintf.c
+++ b/stdio-common/dprintf.c
@@ -33,5 +33,4 @@ __dprintf (int d, const char *format, ...)
return done;
}
libc_hidden_def (__dprintf)
-ldbl_hidden_def (__dprintf, dprintf)
ldbl_weak_alias (__dprintf, dprintf)
diff --git a/stdio-common/fprintf.c b/stdio-common/fprintf.c
index 8d2cd37433..af7190c5b4 100644
--- a/stdio-common/fprintf.c
+++ b/stdio-common/fprintf.c
@@ -34,7 +34,7 @@ __fprintf (FILE *stream, const char *format, ...)
return done;
}
-ldbl_hidden_def (__fprintf, fprintf)
+libc_hidden_def (__fprintf)
ldbl_strong_alias (__fprintf, fprintf)
/* We define the function with the real name here. But deep down in
diff --git a/stdio-common/psiginfo.c b/stdio-common/psiginfo.c
index adf3b71b77..f99c51da17 100644
--- a/stdio-common/psiginfo.c
+++ b/stdio-common/psiginfo.c
@@ -76,7 +76,7 @@ psiginfo (const siginfo_t *pinfo, const char *s)
}
if (s != NULL && *s != '\0')
- fprintf (fp, "%s: ", s);
+ __fprintf (fp, "%s: ", s);
const char *desc;
if (pinfo->si_signo >= 0 && pinfo->si_signo < NSIG
@@ -92,21 +92,21 @@ psiginfo (const siginfo_t *pinfo, const char *s)
if (pinfo->si_signo - SIGRTMIN < SIGRTMAX - pinfo->si_signo)
{
if (pinfo->si_signo == SIGRTMIN)
- fprintf (fp, "SIGRTMIN (");
+ __fprintf (fp, "SIGRTMIN (");
else
- fprintf (fp, "SIGRTMIN+%d (", pinfo->si_signo - SIGRTMIN);
+ __fprintf (fp, "SIGRTMIN+%d (", pinfo->si_signo - SIGRTMIN);
}
else
{
if (pinfo->si_signo == SIGRTMAX)
- fprintf (fp, "SIGRTMAX (");
+ __fprintf (fp, "SIGRTMAX (");
else
- fprintf (fp, "SIGRTMAX-%d (", SIGRTMAX - pinfo->si_signo);
+ __fprintf (fp, "SIGRTMAX-%d (", SIGRTMAX - pinfo->si_signo);
}
}
else
#endif
- fprintf (fp, "%s (", _(desc));
+ __fprintf (fp, "%s (", _(desc));
const char *base = NULL;
const uint8_t *offarr = NULL;
@@ -178,25 +178,25 @@ Signal generated by the completion of an I/O request");
}
if (str != NULL)
- fprintf (fp, "%s ", _(str));
+ __fprintf (fp, "%s ", _(str));
else
- fprintf (fp, "%d ", pinfo->si_code);
+ __fprintf (fp, "%d ", pinfo->si_code);
if (pinfo->si_signo == SIGILL || pinfo->si_signo == SIGFPE
|| pinfo->si_signo == SIGSEGV || pinfo->si_signo == SIGBUS)
- fprintf (fp, "[%p])\n", pinfo->si_addr);
+ __fprintf (fp, "[%p])\n", pinfo->si_addr);
else if (pinfo->si_signo == SIGCHLD)
- fprintf (fp, "%ld %d %ld)\n",
- (long int) pinfo->si_pid, pinfo->si_status,
- (long int) pinfo->si_uid);
+ __fprintf (fp, "%ld %d %ld)\n",
+ (long int) pinfo->si_pid, pinfo->si_status,
+ (long int) pinfo->si_uid);
else if (pinfo->si_signo == SIGPOLL)
- fprintf (fp, "%ld)\n", (long int) pinfo->si_band);
+ __fprintf (fp, "%ld)\n", (long int) pinfo->si_band);
else
- fprintf (fp, "%ld %ld)\n",
- (long int) pinfo->si_pid, (long int) pinfo->si_uid);
+ __fprintf (fp, "%ld %ld)\n",
+ (long int) pinfo->si_pid, (long int) pinfo->si_uid);
}
else
- fprintf (fp, _("Unknown signal %d\n"), pinfo->si_signo);
+ __fprintf (fp, _("Unknown signal %d\n"), pinfo->si_signo);
fclose (fp);
diff --git a/stdio-common/sprintf.c b/stdio-common/sprintf.c
index a9665f753a..f1f43a49ec 100644
--- a/stdio-common/sprintf.c
+++ b/stdio-common/sprintf.c
@@ -32,6 +32,6 @@ __sprintf (char *s, const char *format, ...)
return done;
}
-ldbl_hidden_def (__sprintf, sprintf)
+libc_hidden_def (__sprintf)
ldbl_strong_alias (__sprintf, sprintf)
ldbl_strong_alias (__sprintf, _IO_sprintf)
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 7559fd239d..c5912788bd 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -24,4 +24,4 @@ __vfprintf (FILE *fp, const char *format, va_list ap)
}
ldbl_strong_alias (__vfprintf, _IO_vfprintf);
ldbl_strong_alias (__vfprintf, vfprintf);
-ldbl_hidden_def (__vfprintf, vfprintf)
+libc_hidden_def (__vfprintf)
diff --git a/sunrpc/netname.c b/sunrpc/netname.c
index bf7f0b81c4..97a881c3af 100644
--- a/sunrpc/netname.c
+++ b/sunrpc/netname.c
@@ -48,7 +48,7 @@ user2netname (char netname[MAXNETNAMELEN + 1], const uid_t uid,
if ((strlen (dfltdom) + OPSYS_LEN + 3 + MAXIPRINT) > (size_t) MAXNETNAMELEN)
return 0;
- sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
+ __sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
i = strlen (netname);
if (netname[i - 1] == '.')
netname[i - 1] = '\0';
@@ -112,7 +112,7 @@ host2netname (char netname[MAXNETNAMELEN + 1], const char *host,
> MAXNETNAMELEN)
return 0;
- sprintf (netname, "%s.%s@%s", OPSYS, hostname, domainname);
+ __sprintf (netname, "%s.%s@%s", OPSYS, hostname, domainname);
return 1;
}
#ifdef EXPORT_RPC_SYMBOLS
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
index f683836678..59f6e31d2d 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128___asprintf (char **string_ptr, const char *format, ...)
+int
+__asprintfieee128 (char **string_ptr, const char *format, ...)
{
va_list ap;
int done;
@@ -32,5 +32,4 @@ ___ieee128___asprintf (char **string_ptr, const char *format, ...)
return done;
}
-hidden_def (___ieee128___asprintf)
-strong_alias (___ieee128___asprintf, __asprintfieee128)
+libc_hidden_def (__asprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
index cf3b46c37a..ceba219dc7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_dprintf (int d, const char *format, ...)
+int
+__dprintfieee128 (int d, const char *format, ...)
{
va_list ap;
int done;
@@ -31,5 +31,4 @@ ___ieee128_dprintf (int d, const char *format, ...)
return done;
}
-strong_alias (___ieee128_dprintf, __dprintfieee128)
-hidden_def (___ieee128_dprintf);
+libc_hidden_def (__dprintfieee128);
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
index 4462588675..b58f27afb7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_fprintf (FILE *fp, const char *format, ...)
+int
+__fprintfieee128 (FILE *fp, const char *format, ...)
{
va_list ap;
int done;
@@ -31,5 +31,4 @@ ___ieee128_fprintf (FILE *fp, const char *format, ...)
return done;
}
-strong_alias (___ieee128_fprintf, __fprintfieee128)
-hidden_def (___ieee128_fprintf)
+libc_hidden_def (__fprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
index 9703069b95..243eb65629 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
@@ -18,8 +18,8 @@
/* When in IEEE long double mode, call ___ieee128_sprintf. */
#include <stdio.h>
-typeof (sprintf) ___ieee128_sprintf attribute_hidden;
-#define SPRINTF ___ieee128_sprintf
+typeof (sprintf) __sprintfieee128 attribute_hidden;
+#define SPRINTF __sprintfieee128
/* Declare internal functions: ___qecvtieee128_r and ___qfcvtieee128_r,
built from a different compiling unit, and called from here. */
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
index 0be5bb2810..8046f5fd46 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
@@ -18,8 +18,8 @@
/* When in IEEE long double mode, call ___ieee128_snprintf. */
#include <stdio.h>
-typeof (snprintf) ___ieee128_snprintf attribute_hidden;
-#define SNPRINTF ___ieee128_snprintf
+typeof (snprintf) __snprintfieee128 attribute_hidden;
+#define SNPRINTF __snprintfieee128
#define ECVT_R __qecvtieee128_r
#define FCVT_R __qfcvtieee128_r
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
index 5f51b3ec9e..da3d9441d7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_snprintf (char *s, size_t maxlen, const char *format, ...)
+int
+__snprintfieee128 (char *s, size_t maxlen, const char *format, ...)
{
va_list ap;
int done;
@@ -32,4 +32,4 @@ ___ieee128_snprintf (char *s, size_t maxlen, const char *format, ...)
return done;
}
-strong_alias (___ieee128_snprintf, __snprintfieee128)
+libc_hidden_def (__snprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
index 0cad130788..007a71659a 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_sprintf (char *s, const char *format, ...)
+int
+__sprintfieee128 (char *s, const char *format, ...)
{
va_list ap;
int done;
@@ -32,5 +32,4 @@ ___ieee128_sprintf (char *s, const char *format, ...)
return done;
}
-strong_alias (___ieee128_sprintf, __sprintfieee128)
-hidden_def (___ieee128_sprintf)
+libc_hidden_def (__sprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
index e340c9b457..4df1e485a5 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
@@ -18,10 +18,9 @@
#include <libio/libioP.h>
-extern int
-___ieee128_vfprintf (FILE *fp, const char *format, va_list ap)
+int
+__vfprintfieee128 (FILE *fp, const char *format, va_list ap)
{
return __vfprintf_internal (fp, format, ap, PRINTF_LDBL_USES_FLOAT128);
}
-strong_alias (___ieee128_vfprintf, __vfprintfieee128)
-hidden_def (___ieee128_vfprintf)
+libc_hidden_def (__vfprintfieee128)
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
index ebd2a43951..5b167d45ff 100644
--- a/sysdeps/posix/tempname.c
+++ b/sysdeps/posix/tempname.c
@@ -161,7 +161,7 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
return -1;
}
- sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
+ __sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
return 0;
}
#endif /* _LIBC */
diff --git a/sysdeps/unix/sysv/linux/ia64/makecontext.c b/sysdeps/unix/sysv/linux/ia64/makecontext.c
index 0bc4211dfc..0cf05d5999 100644
--- a/sysdeps/unix/sysv/linux/ia64/makecontext.c
+++ b/sysdeps/unix/sysv/linux/ia64/makecontext.c
@@ -54,7 +54,7 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
if (argc > 8)
{
- fprintf (stderr, _("\
+ __fprintf (stderr, _("\
makecontext: does not know how to handle more than 8 arguments\n"));
exit (-1);
}
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index 0e017f458b..f2dca7711a 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -233,10 +233,13 @@ extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
const wchar_t *__restrict __format, ...)
__THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
-extern int __REDIRECT_NTH_LDBL (__swprintf_alias,
- (wchar_t *__restrict __s, size_t __n,
- const wchar_t *__restrict __fmt, ...),
- swprintf);
+extern int __swprintf_alias (wchar_t *__restrict __s, size_t __n,
+ const wchar_t *__restrict __fmt, ...)
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+ __asm__ (__ASMNAME ("swprintf"))
+#endif
+ ;
+
#ifdef __va_arg_pack
__fortify_function int
@@ -264,10 +267,13 @@ extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
__gnuc_va_list __arg)
__THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-extern int __REDIRECT_NTH_LDBL (__vswprintf_alias,
- (wchar_t *__restrict __s, size_t __n,
- const wchar_t *__restrict __fmt,
- __gnuc_va_list __ap), vswprintf);
+extern int __vswprintf_alias (wchar_t *__restrict __s, size_t __n,
+ const wchar_t *__restrict __fmt,
+ __gnuc_va_list __ap)
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+ __asm__ (__ASMNAME ("vswprintf"))
+#endif
+ ;
__fortify_function int
__NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
^ permalink raw reply [flat|nested] 14+ messages in thread
* [glibc/azanella/clang] Remove stdio-ldbl.h
@ 2022-03-29 20:26 Adhemerval Zanella
0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-03-29 20:26 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a3014e86c8e8ef3fc672cfbbc2726f92165ed3f7
commit a3014e86c8e8ef3fc672cfbbc2726f92165ed3f7
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Thu Feb 24 14:13:12 2022 -0300
Remove stdio-ldbl.h
The functions which require different alias to long double depending
of the ABI now uses a set os macros that defines the expected alias
on the function prototype, instead of redefine them using the
__LDBL_REDIR_DEC macros.
The __REDIRECT_LDBL, __REDIRECT_LDBL_NTH, __REDIRECT_LDBL_NTHNL
are refactores to be similar to __REDIRECT with the difference it
now expects the aliases for binary128 and for the long double being
double (which __LDBL_REDIR_DEC does).
All printf internal usage are also replaced to use internal alias
instead.
Diff:
---
argp/argp-parse.c | 4 +-
debug/backtracesyms.c | 18 +-
grp/putgrent.c | 6 +-
gshadow/putsgent.c | 6 +-
include/bits/stdio-ldbl.h | 1 -
include/stdio.h | 34 ++-
inet/ether_ntoa_r.c | 8 +-
inet/rexec.c | 2 +-
libio/Makefile | 2 +-
libio/bits/stdio-ldbl.h | 108 --------
libio/bits/stdio2.h | 115 ++++++---
libio/stdio.h | 286 +++++++++++++--------
malloc/malloc-check.c | 1 +
malloc/malloc.c | 32 +--
misc/efgcvt-template.c | 2 +-
misc/mntent_r.c | 2 +-
misc/sys/cdefs.h | 70 +++--
misc/syslog.c | 4 +-
nis/nis_subr.c | 8 +-
nptl/pthread_getname.c | 2 +-
nptl/pthread_setname.c | 2 +-
pwd/getpw.c | 6 +-
pwd/putpwent.c | 4 +-
resolv/inet_ntop.c | 4 +-
resolv/nss_dns/dns-host.c | 4 +-
resolv/nss_dns/dns-network.c | 12 +-
shadow/putspent.c | 16 +-
stdio-common/dprintf.c | 1 -
stdio-common/fprintf.c | 2 +-
stdio-common/psiginfo.c | 32 +--
stdio-common/sprintf.c | 2 +-
stdio-common/vfprintf.c | 2 +-
sunrpc/netname.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-asprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-dprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-fprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-snprintf.c | 6 +-
.../ieee754/ldbl-128ibm-compat/ieee128-sprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c | 7 +-
sysdeps/posix/tempname.c | 2 +-
sysdeps/unix/sysv/linux/ia64/makecontext.c | 2 +-
wcsmbs/bits/wchar2.h | 22 +-
44 files changed, 450 insertions(+), 427 deletions(-)
diff --git a/argp/argp-parse.c b/argp/argp-parse.c
index 13cd84dd33..c26c0fc27f 100644
--- a/argp/argp-parse.c
+++ b/argp/argp-parse.c
@@ -177,7 +177,7 @@ argp_version_parser (int key, char *arg, struct argp_state *state)
if (argp_program_version_hook)
(*argp_program_version_hook) (state->out_stream, state);
else if (argp_program_version)
- fprintf (state->out_stream, "%s\n", argp_program_version);
+ __fprintf (state->out_stream, "%s\n", argp_program_version);
else
__argp_error (state, dgettext (state->root_argp->argp_domain,
"(PROGRAM ERROR) No version known!?"));
@@ -618,7 +618,7 @@ parser_finalize (struct parser *parser,
{
if (!(parser->state.flags & ARGP_NO_ERRS)
&& parser->state.err_stream)
- fprintf (parser->state.err_stream,
+ __fprintf (parser->state.err_stream,
dgettext (parser->argp->argp_domain,
"%s: Too many arguments\n"),
parser->state.name);
diff --git a/debug/backtracesyms.c b/debug/backtracesyms.c
index 17e0626df8..adb939f888 100644
--- a/debug/backtracesyms.c
+++ b/debug/backtracesyms.c
@@ -83,10 +83,10 @@ __backtrace_symbols (void *const *array, int size)
info[cnt].dli_saddr = info[cnt].dli_fbase;
if (info[cnt].dli_sname == NULL && info[cnt].dli_saddr == 0)
- last += 1 + sprintf (last, "%s(%s) [%p]",
- info[cnt].dli_fname ?: "",
- info[cnt].dli_sname ?: "",
- array[cnt]);
+ last += 1 + __sprintf (last, "%s(%s) [%p]",
+ info[cnt].dli_fname ?: "",
+ info[cnt].dli_sname ?: "",
+ array[cnt]);
else
{
char sign;
@@ -102,14 +102,14 @@ __backtrace_symbols (void *const *array, int size)
offset = info[cnt].dli_saddr - array[cnt];
}
- last += 1 + sprintf (last, "%s(%s%c%#tx) [%p]",
- info[cnt].dli_fname ?: "",
- info[cnt].dli_sname ?: "",
- sign, offset, array[cnt]);
+ last += 1 + __sprintf (last, "%s(%s%c%#tx) [%p]",
+ info[cnt].dli_fname ?: "",
+ info[cnt].dli_sname ?: "",
+ sign, offset, array[cnt]);
}
}
else
- last += 1 + sprintf (last, "[%p]", array[cnt]);
+ last += 1 + __sprintf (last, "[%p]", array[cnt]);
}
assert (last <= (char *) result + size * sizeof (char *) + total);
}
diff --git a/grp/putgrent.c b/grp/putgrent.c
index 966ba2a763..305ff44359 100644
--- a/grp/putgrent.c
+++ b/grp/putgrent.c
@@ -45,10 +45,10 @@ putgrent (const struct group *gr, FILE *stream)
flockfile (stream);
if (gr->gr_name[0] == '+' || gr->gr_name[0] == '-')
- retval = fprintf (stream, "%s:%s::",
+ retval = __fprintf (stream, "%s:%s::",
gr->gr_name, _S (gr->gr_passwd));
else
- retval = fprintf (stream, "%s:%s:%lu:",
+ retval = __fprintf (stream, "%s:%s:%lu:",
gr->gr_name, _S (gr->gr_passwd),
(unsigned long int) gr->gr_gid);
if (__builtin_expect (retval, 0) < 0)
@@ -60,7 +60,7 @@ putgrent (const struct group *gr, FILE *stream)
if (gr->gr_mem != NULL)
{
for (size_t i = 0; gr->gr_mem[i] != NULL; i++)
- if (fprintf (stream, i == 0 ? "%s" : ",%s", gr->gr_mem[i]) < 0)
+ if (__fprintf (stream, i == 0 ? "%s" : ",%s", gr->gr_mem[i]) < 0)
{
/* What else can we do? */
funlockfile (stream);
diff --git a/gshadow/putsgent.c b/gshadow/putsgent.c
index 9e2dca7eaf..870438de6d 100644
--- a/gshadow/putsgent.c
+++ b/gshadow/putsgent.c
@@ -42,7 +42,7 @@ putsgent (const struct sgrp *g, FILE *stream)
_IO_flockfile (stream);
- if (fprintf (stream, "%s:%s:", g->sg_namp, _S (g->sg_passwd)) < 0)
+ if (__fprintf (stream, "%s:%s:", g->sg_namp, _S (g->sg_passwd)) < 0)
++errors;
bool first = true;
@@ -50,7 +50,7 @@ putsgent (const struct sgrp *g, FILE *stream)
if (sp != NULL)
while (*sp != NULL)
{
- if (fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
+ if (__fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
{
++errors;
break;
@@ -65,7 +65,7 @@ putsgent (const struct sgrp *g, FILE *stream)
if (sp != NULL)
while (*sp != NULL)
{
- if (fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
+ if (__fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
{
++errors;
break;
diff --git a/include/bits/stdio-ldbl.h b/include/bits/stdio-ldbl.h
deleted file mode 100644
index 1f7d3ce1c6..0000000000
--- a/include/bits/stdio-ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <libio/bits/stdio-ldbl.h>
diff --git a/include/stdio.h b/include/stdio.h
index 23b7fd288c..a645a1bf99 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -22,13 +22,17 @@
/* Some libc_hidden_ldbl_proto's do not map to a unique symbol when
redirecting ldouble to _Float128 variants. We can therefore safely
directly alias them to their internal name. */
-# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc)
-# define stdio_hidden_ldbl_proto(p, f) \
- extern __typeof (p ## f) p ## f __asm (__ASMNAME ("___ieee128_" #f));
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# define stdio_hidden_ldbl_proto(p,f) __LDBL_REDIR1_DECL (p ## f, p ## f ## ieee128)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc) && defined SHARED
+# define __stdio_hidden_ldbl_proto(name, alias) \
+ extern __typeof (name) __##name __asm__ (__hidden_asmname (#alias));
+# define stdio_hidden_ldbl_proto(name) \
+ extern typeof (name) __##name##ieee128; \
+ libc_hidden_proto (__##name##ieee128); \
+ __stdio_hidden_ldbl_proto (name, __GI___##name##ieee128)
# else
-# define stdio_hidden_ldbl_proto(p,f) libc_hidden_proto (p ## f)
+# define stdio_hidden_ldbl_proto(name) \
+ extern __typeof (name) __##name; \
+ libc_hidden_proto (__##name)
# endif
/* Set the error indicator on FP. */
@@ -39,10 +43,7 @@ fseterr_unlocked (FILE *fp)
}
extern int __fcloseall (void) attribute_hidden;
-extern int __snprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, ...)
- __attribute__ ((__format__ (__printf__, 3, 4)));
-stdio_hidden_ldbl_proto (__, snprintf)
+stdio_hidden_ldbl_proto (snprintf);
extern int __vfscanf (FILE *__restrict __s,
const char *__restrict __format,
@@ -183,7 +184,7 @@ extern const char *const _sys_errlist_internal[] attribute_hidden;
extern const char *__get_errlist (int) attribute_hidden;
extern const char *__get_errname (int) attribute_hidden;
-libc_hidden_ldbl_proto (__asprintf)
+stdio_hidden_ldbl_proto (asprintf);
# if IS_IN (libc)
extern FILE *_IO_new_fopen (const char*, const char*);
@@ -205,13 +206,10 @@ extern int _IO_new_fgetpos (FILE *, __fpos_t *);
# define fgetpos(fp, posp) _IO_new_fgetpos (fp, posp)
# endif
-extern __typeof (dprintf) __dprintf
- __attribute__ ((__format__ (__printf__, 2, 3)));
-stdio_hidden_ldbl_proto (__, dprintf)
-libc_hidden_ldbl_proto (dprintf)
-libc_hidden_ldbl_proto (fprintf)
-libc_hidden_ldbl_proto (vfprintf)
-libc_hidden_ldbl_proto (sprintf)
+stdio_hidden_ldbl_proto (dprintf);
+stdio_hidden_ldbl_proto (fprintf);
+stdio_hidden_ldbl_proto (vfprintf);
+stdio_hidden_ldbl_proto (sprintf);
libc_hidden_proto (ungetc)
libc_hidden_proto (__getdelim)
libc_hidden_proto (fwrite)
diff --git a/inet/ether_ntoa_r.c b/inet/ether_ntoa_r.c
index 03011ffef6..f111e5234c 100644
--- a/inet/ether_ntoa_r.c
+++ b/inet/ether_ntoa_r.c
@@ -23,10 +23,10 @@
char *
ether_ntoa_r (const struct ether_addr *addr, char *buf)
{
- sprintf (buf, "%x:%x:%x:%x:%x:%x",
- addr->ether_addr_octet[0], addr->ether_addr_octet[1],
- addr->ether_addr_octet[2], addr->ether_addr_octet[3],
- addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
+ __sprintf (buf, "%x:%x:%x:%x:%x:%x",
+ addr->ether_addr_octet[0], addr->ether_addr_octet[1],
+ addr->ether_addr_octet[2], addr->ether_addr_octet[3],
+ addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
return buf;
}
libc_hidden_def (ether_ntoa_r)
diff --git a/inet/rexec.c b/inet/rexec.c
index 330282ac16..809475d976 100644
--- a/inet/rexec.c
+++ b/inet/rexec.c
@@ -135,7 +135,7 @@ retry:
NULL, 0, servbuff, sizeof(servbuff),
NI_NUMERICSERV))
port = (int) __strtol (servbuff, NULL, 10);
- (void) sprintf(num, "%u", port);
+ (void) __sprintf(num, "%u", port);
(void) __write(s, num, strlen(num)+1);
{ socklen_t len = sizeof (from);
s3 = TEMP_FAILURE_RETRY (accept(s2, (struct sockaddr *)&from,
diff --git a/libio/Makefile b/libio/Makefile
index e97387743f..a4830ddf42 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -23,7 +23,7 @@ subdir := libio
include ../Makeconfig
headers := stdio.h \
- bits/stdio.h bits/stdio2.h bits/stdio-ldbl.h \
+ bits/stdio.h bits/stdio2.h \
bits/types/FILE.h bits/types/__FILE.h bits/types/struct_FILE.h \
bits/types/__fpos_t.h bits/types/__fpos64_t.h \
bits/types/cookie_io_functions_t.h
diff --git a/libio/bits/stdio-ldbl.h b/libio/bits/stdio-ldbl.h
deleted file mode 100644
index 6b63394b50..0000000000
--- a/libio/bits/stdio-ldbl.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -mlong-double-64 compatibility mode for stdio functions.
- Copyright (C) 2006-2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#ifndef _STDIO_H
-# error "Never include <bits/stdio-ldbl.h> directly; use <stdio.h> instead."
-#endif
-
-__LDBL_REDIR_DECL (fprintf)
-__LDBL_REDIR_DECL (printf)
-__LDBL_REDIR_DECL (sprintf)
-__LDBL_REDIR_DECL (vfprintf)
-__LDBL_REDIR_DECL (vprintf)
-__LDBL_REDIR_DECL (vsprintf)
-#if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (fscanf, __nldbl___isoc99_fscanf)
-__LDBL_REDIR1_DECL (scanf, __nldbl___isoc99_scanf)
-__LDBL_REDIR1_DECL (sscanf, __nldbl___isoc99_sscanf)
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (fscanf, __isoc99_fscanfieee128)
-__LDBL_REDIR1_DECL (scanf, __isoc99_scanfieee128)
-__LDBL_REDIR1_DECL (sscanf, __isoc99_sscanfieee128)
-# else
-# error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-# endif
-#else
-__LDBL_REDIR_DECL (fscanf)
-__LDBL_REDIR_DECL (scanf)
-__LDBL_REDIR_DECL (sscanf)
-#endif
-
-#if defined __USE_ISOC99 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (snprintf)
-__LDBL_REDIR_DECL (vsnprintf)
-#endif
-
-#ifdef __USE_ISOC99
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (vfscanf, __nldbl___isoc99_vfscanf)
-__LDBL_REDIR1_DECL (vscanf, __nldbl___isoc99_vscanf)
-__LDBL_REDIR1_DECL (vsscanf, __nldbl___isoc99_vsscanf)
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (vfscanf, __isoc99_vfscanfieee128)
-__LDBL_REDIR1_DECL (vscanf, __isoc99_vscanfieee128)
-__LDBL_REDIR1_DECL (vsscanf, __isoc99_vsscanfieee128)
-# else
-# error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-# endif
-# else
-__LDBL_REDIR_DECL (vfscanf)
-__LDBL_REDIR_DECL (vsscanf)
-__LDBL_REDIR_DECL (vscanf)
-# endif
-#endif
-
-#ifdef __USE_XOPEN2K8
-__LDBL_REDIR_DECL (vdprintf)
-__LDBL_REDIR_DECL (dprintf)
-#endif
-
-#ifdef __USE_GNU
-__LDBL_REDIR_DECL (vasprintf)
-__LDBL_REDIR2_DECL (asprintf)
-__LDBL_REDIR_DECL (asprintf)
-__LDBL_REDIR_DECL (obstack_printf)
-__LDBL_REDIR_DECL (obstack_vprintf)
-#endif
-
-#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR2_DECL (sprintf_chk)
-__LDBL_REDIR2_DECL (vsprintf_chk)
-# if defined __USE_ISOC99 || defined __USE_UNIX98
-__LDBL_REDIR2_DECL (snprintf_chk)
-__LDBL_REDIR2_DECL (vsnprintf_chk)
-# endif
-# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR2_DECL (fprintf_chk)
-__LDBL_REDIR2_DECL (printf_chk)
-__LDBL_REDIR2_DECL (vfprintf_chk)
-__LDBL_REDIR2_DECL (vprintf_chk)
-# ifdef __USE_XOPEN2K8
-__LDBL_REDIR2_DECL (dprintf_chk)
-__LDBL_REDIR2_DECL (vdprintf_chk)
-# endif
-# ifdef __USE_GNU
-__LDBL_REDIR2_DECL (asprintf_chk)
-__LDBL_REDIR2_DECL (vasprintf_chk)
-__LDBL_REDIR2_DECL (obstack_printf_chk)
-__LDBL_REDIR2_DECL (obstack_vprintf_chk)
-# endif
-# endif
-#endif
diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h
index b0b655ee7a..de7f1f04aa 100644
--- a/libio/bits/stdio2.h
+++ b/libio/bits/stdio2.h
@@ -23,12 +23,17 @@
# error "Never include <bits/stdio2.h> directly; use <stdio.h> instead."
#endif
-extern int __sprintf_chk (char *__restrict __s, int __flag, size_t __slen,
- const char *__restrict __format, ...) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__sprintf_chk, (char *__restrict __s,
+ int __flag, size_t __slen,
+ const char *__restrict __format,
+ ...),
+ __sprintf_chkieee128, __nldbl___sprintf_chk)
__attr_access ((__write_only__, 1, 3));
-extern int __vsprintf_chk (char *__restrict __s, int __flag, size_t __slen,
- const char *__restrict __format,
- __gnuc_va_list __ap) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__vsprintf_chk, (char *__restrict __s,
+ int __flag, size_t __slen,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vsprintf_chkieee128, __nldbl___vsprintf_chk)
__attr_access ((__write_only__, 1, 3));
#ifdef __va_arg_pack
@@ -54,14 +59,19 @@ __NTH (vsprintf (char *__restrict __s, const char *__restrict __fmt,
}
#if defined __USE_ISOC99 || defined __USE_UNIX98
-
-extern int __snprintf_chk (char *__restrict __s, size_t __n, int __flag,
- size_t __slen, const char *__restrict __format,
- ...) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__snprintf_chk, (char *__restrict __s,
+ size_t __n, int __flag,
+ size_t __slen,
+ const char *__restrict __format,
+ ...),
+ __snprintf_chkieee128, __nldbl___snprintf_chk)
__attr_access ((__write_only__, 1, 2));
-extern int __vsnprintf_chk (char *__restrict __s, size_t __n, int __flag,
- size_t __slen, const char *__restrict __format,
- __gnuc_va_list __ap) __THROW;
+extern int __REDIRECT_LDBL_NTHNL (__vsnprintf_chk, (char *__restrict __s,
+ size_t __n, int __flag,
+ size_t __slen,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vsnprintf_chkieee128, __nldbl___vsnprintf_chk);
# ifdef __va_arg_pack
__fortify_function int
@@ -89,14 +99,24 @@ __NTH (vsnprintf (char *__restrict __s, size_t __n,
#endif
#if __USE_FORTIFY_LEVEL > 1
-
-extern int __fprintf_chk (FILE *__restrict __stream, int __flag,
- const char *__restrict __format, ...);
-extern int __printf_chk (int __flag, const char *__restrict __format, ...);
-extern int __vfprintf_chk (FILE *__restrict __stream, int __flag,
- const char *__restrict __format, __gnuc_va_list __ap);
-extern int __vprintf_chk (int __flag, const char *__restrict __format,
- __gnuc_va_list __ap);
+extern int __REDIRECT_LDBL (__fprintf_chk, (FILE *__restrict __stream,
+ int __flag,
+ const char *__restrict __format,
+ ...),
+ __fprintf_chkieee128, __nldbl___fprintf_chk);
+extern int __REDIRECT_LDBL (__printf_chk, (int __flag,
+ const char *__restrict __format,
+ ...),
+ __printf_chkieee128, __nldbl___printf_chk);
+extern int __REDIRECT_LDBL (__vfprintf_chk, (FILE *__restrict __stream,
+ int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vfprintf_chkieee128, __nldbl___vfprintf_chk);
+extern int __REDIRECT_LDBL (__vprintf_chk, (int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vprintf_chkieee128, __nldbl___vprintf_chk);
# ifdef __va_arg_pack
__fortify_function int
@@ -136,10 +156,15 @@ vfprintf (FILE *__restrict __stream,
}
# ifdef __USE_XOPEN2K8
-extern int __dprintf_chk (int __fd, int __flag, const char *__restrict __fmt,
- ...) __attribute__ ((__format__ (__printf__, 3, 4)));
-extern int __vdprintf_chk (int __fd, int __flag,
- const char *__restrict __fmt, __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL (__dprintf_chk, (int __fd, int __flag,
+ const char *__restrict __fmt,
+ ...),
+ __dprintf_chkieee128, __nldbl___dprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL (__vdprintf_chk, (int __fd, int __flag,
+ const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vdprintf_chkieee128, __nldbl___vdprintf_chk)
__attribute__ ((__format__ (__printf__, 3, 0)));
# ifdef __va_arg_pack
@@ -162,22 +187,32 @@ vdprintf (int __fd, const char *__restrict __fmt, __gnuc_va_list __ap)
# endif
# ifdef __USE_GNU
-
-extern int __asprintf_chk (char **__restrict __ptr, int __flag,
- const char *__restrict __fmt, ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4))) __wur;
-extern int __vasprintf_chk (char **__restrict __ptr, int __flag,
- const char *__restrict __fmt, __gnuc_va_list __arg)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
-extern int __obstack_printf_chk (struct obstack *__restrict __obstack,
- int __flag, const char *__restrict __format,
- ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
-extern int __obstack_vprintf_chk (struct obstack *__restrict __obstack,
- int __flag,
- const char *__restrict __format,
- __gnuc_va_list __args)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
+extern int __REDIRECT_LDBL_NTHNL (__asprintf_chk, (char **__restrict __ptr,
+ int __flag,
+ const char *__restrict __fmt,
+ ...),
+ __asprintf_chkieee128, __nldbl___asprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (__vasprintf_chk, (char **__restrict __ptr,
+ int __flag,
+ const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vasprintf_chkieee128, __nldbl___vasnprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (__obstack_printf_chk, (struct obstack *__restrict __obstack,
+ int __flag,
+ const char *__restrict __format,
+ ...),
+ __obstack_printf_chkieee128,
+ __nldbl___obstack_printf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL_NTHNL (__obstack_vprintf_chk, (struct obstack *__restrict __obstack,
+ int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __args),
+ __obstack_vprintf_chkieee128,
+ __nldbl___obstack_vprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
# ifdef __va_arg_pack
__fortify_function int
diff --git a/libio/stdio.h b/libio/stdio.h
index e6425341ce..54c9796a46 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -41,6 +41,7 @@ __BEGIN_DECLS
#include <bits/types/__FILE.h>
#include <bits/types/FILE.h>
#include <bits/types/struct_FILE.h>
+#include <bits/floatn.h>
#ifdef __USE_GNU
# include <bits/types/cookie_io_functions_t.h>
@@ -342,78 +343,143 @@ extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
extern void setlinebuf (FILE *__stream) __THROW;
#endif
-
/* Write formatted output to STREAM.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int fprintf (FILE *__restrict __stream,
- const char *__restrict __format, ...);
+extern int __REDIRECT_LDBL (fprintf, (FILE *__restrict __stream,
+ const char *__restrict __format, ...),
+ __fprintfieee128, __nldbl_fprintf);
/* Write formatted output to stdout.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int printf (const char *__restrict __format, ...);
+extern int __REDIRECT_LDBL (printf, (const char *__restrict __format, ...),
+ __printfieee128, __nldbl_printf);
/* Write formatted output to S. */
-extern int sprintf (char *__restrict __s,
- const char *__restrict __format, ...) __THROWNL;
+extern int __REDIRECT_LDBL_NTHNL (sprintf, (char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __sprintfieee128, __nldbl_sprintf);
/* Write formatted output to S from argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg);
+extern int __REDIRECT_LDBL (vfprintf, (FILE *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vfprintfieee128, __nldbl_vfprintf);
/* Write formatted output to stdout from argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
+extern int __REDIRECT_LDBL (vprintf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vprintfieee128, __nldbl_vprintf);
/* Write formatted output to S from argument list ARG. */
-extern int vsprintf (char *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg) __THROWNL;
+extern int __REDIRECT_LDBL_NTHNL (vsprintf, (char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsprintfieee128, __nldbl_vsprintf);
#if defined __USE_ISOC99 || defined __USE_UNIX98
/* Maximum chars of output to write in MAXLEN. */
-extern int snprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 3, 4)));
-
-extern int vsnprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, __gnuc_va_list __arg)
- __THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
+extern int __REDIRECT_LDBL_NTHNL (snprintf, (char *__restrict __s,
+ size_t __maxlen,
+ const char *__restrict __format,
+ ...),
+ __snprintfieee128, __nldbl_snprintf)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL_NTHNL (vsnprintf, (char *__restrict __s,
+ size_t __maxlen,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsnprintfieee128, __nldbl_vsnprintf)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
#endif
#if __GLIBC_USE (LIB_EXT2)
/* Write formatted output to a string dynamically allocated with `malloc'.
Store the address of the string in *PTR. */
-extern int vasprintf (char **__restrict __ptr, const char *__restrict __f,
- __gnuc_va_list __arg)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
-extern int __asprintf (char **__restrict __ptr,
- const char *__restrict __fmt, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
-extern int asprintf (char **__restrict __ptr,
- const char *__restrict __fmt, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (vasprintf, (char **__restrict __ptr,
+ const char *__restrict __f,
+ __gnuc_va_list __arg),
+ __vasprintfieee128, __nldbl_vasprintf)
+ __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (asprintf, (char **__restrict __ptr,
+ const char *__restrict __fmt,
+ ...),
+ __asprintfieee128, __nldbl_asprintf)
+ __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
#endif
#ifdef __USE_XOPEN2K8
/* Write formatted output to a file descriptor. */
-extern int vdprintf (int __fd, const char *__restrict __fmt,
- __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL (vdprintf, (int __fd, const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vdprintfieee128, __nldbl_vdprintf)
__attribute__ ((__format__ (__printf__, 2, 0)));
-extern int dprintf (int __fd, const char *__restrict __fmt, ...)
+extern int __REDIRECT_LDBL (dprintf, (int __fd, const char *__restrict __fmt,
+ ...),
+ __dprintfieee128, __nldbl_dprintf)
__attribute__ ((__format__ (__printf__, 2, 3)));
#endif
-
+#if !__GLIBC_USE (DEPRECATED_SCANF)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ ...),
+ __isoc99_fscanfieee128, __nldbl___isoc99_fscanf) __wur;
+extern int __REDIRECT_LDBL (scanf, (const char *__restrict __format,
+ ...),
+ __isoc99_scanfieee128, __nldbl___isoc99_scanf) __wur;
+extern int __REDIRECT_LDBL_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __isoc99_sscanfieee128, __nldbl___isoc99_sscanf);
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format, ...),
+ __isoc99_fscanf) __wur;
+extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
+ __isoc99_scanf) __wur;
+extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format, ...),
+ __isoc99_sscanf);
+# else
+extern int __isoc99_fscanf (FILE *__restrict __stream,
+ const char *__restrict __format, ...) __wur;
+extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
+extern int __isoc99_sscanf (const char *__restrict __s,
+ const char *__restrict __format, ...) __THROW;
+# define fscanf __isoc99_fscanf
+# define scanf __isoc99_scanf
+# define sscanf __isoc99_sscanf
+# endif /* __REDIRECT */
+# endif
+#else
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ ...),
+ __fscanfieee128, __nldbl_fscanf) __wur;
+extern int __REDIRECT_LDBL (scanf, (const char *__restrict __format,
+ ...),
+ __scanfieee128, __nldbl_scanf) __wur;
+extern int __REDIRECT_LDBL_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __sscanfieee128, __nldbl_sscanf) __wur;
+# else
/* Read formatted input from STREAM.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int fscanf (FILE *__restrict __stream,
- const char *__restrict __format, ...) __wur;
+ const char *__restrict __format, ...) __wur;
/* Read formatted input from stdin.
This function is a possible cancellation point and therefore not
@@ -421,43 +487,81 @@ extern int fscanf (FILE *__restrict __stream,
extern int scanf (const char *__restrict __format, ...) __wur;
/* Read formatted input from S. */
extern int sscanf (const char *__restrict __s,
- const char *__restrict __format, ...) __THROW;
-
-/* For historical reasons, the C99-compliant versions of the scanf
- functions are at alternative names. When __LDBL_COMPAT or
- __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
- bits/stdio-ldbl.h. */
-#include <bits/floatn.h>
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
- && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-# ifdef __REDIRECT
-extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
- const char *__restrict __format, ...),
- __isoc99_fscanf) __wur;
-extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
- __isoc99_scanf) __wur;
-extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
- const char *__restrict __format, ...),
- __isoc99_sscanf);
-# else
-extern int __isoc99_fscanf (FILE *__restrict __stream,
- const char *__restrict __format, ...) __wur;
-extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
-extern int __isoc99_sscanf (const char *__restrict __s,
- const char *__restrict __format, ...) __THROW;
-# define fscanf __isoc99_fscanf
-# define scanf __isoc99_scanf
-# define sscanf __isoc99_sscanf
+ const char *__restrict __format, ...) __THROW;
# endif
-#endif
+#endif /* DEPRECATED_SCANF */
-#ifdef __USE_ISOC99
+#ifdef __USE_ISOC99
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vfscanfieee128, __nldbl___isoc99_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vscanfieee128, __nldbl___isoc99_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_LDBL_NTH (vsscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vsscanfieee128, __nldbl___isoc99_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (vfscanf,
+ (FILE *__restrict __s,
+ const char *__restrict __format, __gnuc_va_list __arg),
+ __isoc99_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_NTH (vsscanf,
+ (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
+extern int __isoc99_vfscanf (FILE *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg) __wur;
+extern int __isoc99_vscanf (const char *__restrict __format,
+ __gnuc_va_list __arg) __wur;
+extern int __isoc99_vsscanf (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg) __THROW;
+# define vfscanf __isoc99_vfscanf
+# define vscanf __isoc99_vscanf
+# define vsscanf __isoc99_vsscanf
+# endif /* __REDIRECT */
+# endif
+# else /* DEPRECATED_SCANF */
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vfscanfieee128, __nldbl_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vscanfieee128, __nldbl_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_LDBL_NTH (vsscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsscanfieee128, __nldbl_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
/* Read formatted input from S into argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg)
+ __gnuc_va_list __arg)
__attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
/* Read formatted input from stdin into argument list ARG.
@@ -469,42 +573,11 @@ extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
/* Read formatted input from S into argument list ARG. */
extern int vsscanf (const char *__restrict __s,
- const char *__restrict __format, __gnuc_va_list __arg)
+ const char *__restrict __format, __gnuc_va_list __arg)
__THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
-
-/* Same redirection as above for the v*scanf family. */
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __REDIRECT && !defined __LDBL_COMPAT \
- && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-extern int __REDIRECT (vfscanf,
- (FILE *__restrict __s,
- const char *__restrict __format, __gnuc_va_list __arg),
- __isoc99_vfscanf)
- __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
-extern int __REDIRECT (vscanf, (const char *__restrict __format,
- __gnuc_va_list __arg), __isoc99_vscanf)
- __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
-extern int __REDIRECT_NTH (vsscanf,
- (const char *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg), __isoc99_vsscanf)
- __attribute__ ((__format__ (__scanf__, 2, 0)));
-# elif !defined __REDIRECT
-extern int __isoc99_vfscanf (FILE *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg) __wur;
-extern int __isoc99_vscanf (const char *__restrict __format,
- __gnuc_va_list __arg) __wur;
-extern int __isoc99_vsscanf (const char *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg) __THROW;
-# define vfscanf __isoc99_vfscanf
-# define vscanf __isoc99_vscanf
-# define vsscanf __isoc99_vsscanf
# endif
# endif
-#endif /* Use ISO C9x. */
-
+#endif /* __USE_ISOC99 */
/* Read a character from STREAM.
@@ -850,13 +923,17 @@ extern char *cuserid (char *__s)
struct obstack; /* See <obstack.h>. */
/* Write formatted output to an obstack. */
-extern int obstack_printf (struct obstack *__restrict __obstack,
- const char *__restrict __format, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3)));
-extern int obstack_vprintf (struct obstack *__restrict __obstack,
- const char *__restrict __format,
- __gnuc_va_list __args)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 0)));
+extern int __REDIRECT_LDBL_NTHNL (obstack_printf,
+ (struct obstack *__restrict __obstack,
+ const char *__restrict __format, ...),
+ __obstack_printfieee128, __nldbl_obstack_printf)
+ __attribute__ ((__format__ (__printf__, 2, 3)));
+extern int __REDIRECT_LDBL_NTHNL (obstack_vprintf,
+ (struct obstack *__restrict __obstack,
+ const char *__restrict __format,
+ __gnuc_va_list __args),
+ __obstack_vprintfieee128, __nldbl_obstack_vprintf)
+ __attribute__ ((__format__ (__printf__, 2, 0)));
#endif /* Use GNU. */
@@ -894,11 +971,6 @@ extern int __overflow (FILE *, int);
# include <bits/stdio2.h>
#endif
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/stdio-ldbl.h>
-#endif
-
__END_DECLS
#endif /* <stdio.h> included. */
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index 0299fe99a7..e1f68bddfb 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -17,6 +17,7 @@
not, see <https://www.gnu.org/licenses/>. */
#define __mremap mremap
+#define __fprintf fprintf
#include "malloc.c"
/* When memory is tagged, the checking data is stored in the user part
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 09e5ff2bce..aa35846e55 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5279,9 +5279,9 @@ __malloc_stats (void)
memset (&mi, 0, sizeof (mi));
__libc_lock_lock (ar_ptr->mutex);
int_mallinfo (ar_ptr, &mi);
- fprintf (stderr, "Arena %d:\n", i);
- fprintf (stderr, "system bytes = %10u\n", (unsigned int) mi.arena);
- fprintf (stderr, "in use bytes = %10u\n", (unsigned int) mi.uordblks);
+ __fprintf (stderr, "Arena %d:\n", i);
+ __fprintf (stderr, "system bytes = %10u\n", (unsigned int) mi.arena);
+ __fprintf (stderr, "in use bytes = %10u\n", (unsigned int) mi.uordblks);
#if MALLOC_DEBUG > 1
if (i > 0)
dump_heap (heap_for_ptr (top (ar_ptr)));
@@ -5293,12 +5293,12 @@ __malloc_stats (void)
if (ar_ptr == &main_arena)
break;
}
- fprintf (stderr, "Total (incl. mmap):\n");
- fprintf (stderr, "system bytes = %10u\n", system_b);
- fprintf (stderr, "in use bytes = %10u\n", in_use_b);
- fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps);
- fprintf (stderr, "max mmap bytes = %10lu\n",
- (unsigned long) mp_.max_mmapped_mem);
+ __fprintf (stderr, "Total (incl. mmap):\n");
+ __fprintf (stderr, "system bytes = %10u\n", system_b);
+ __fprintf (stderr, "in use bytes = %10u\n", in_use_b);
+ __fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps);
+ __fprintf (stderr, "max mmap bytes = %10lu\n",
+ (unsigned long) mp_.max_mmapped_mem);
stderr->_flags2 = old_flags2;
_IO_funlockfile (stderr);
}
@@ -5728,7 +5728,7 @@ __malloc_info (int options, FILE *fp)
mstate ar_ptr = &main_arena;
do
{
- fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
+ __fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
size_t nblocks = 0;
size_t nfastblocks = 0;
@@ -5839,12 +5839,12 @@ __malloc_info (int options, FILE *fp)
for (size_t i = 0; i < nsizes; ++i)
if (sizes[i].count != 0 && i != NFASTBINS)
- fprintf (fp, "\
+ __fprintf (fp, "\
<size from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
sizes[i].from, sizes[i].to, sizes[i].total, sizes[i].count);
if (sizes[NFASTBINS].count != 0)
- fprintf (fp, "\
+ __fprintf (fp, "\
<unsorted from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
sizes[NFASTBINS].from, sizes[NFASTBINS].to,
sizes[NFASTBINS].total, sizes[NFASTBINS].count);
@@ -5852,7 +5852,7 @@ __malloc_info (int options, FILE *fp)
total_system += ar_ptr->system_mem;
total_max_system += ar_ptr->max_system_mem;
- fprintf (fp,
+ __fprintf (fp,
"</sizes>\n<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
"<system type=\"current\" size=\"%zu\"/>\n"
@@ -5862,7 +5862,7 @@ __malloc_info (int options, FILE *fp)
if (ar_ptr != &main_arena)
{
- fprintf (fp,
+ __fprintf (fp,
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n"
"<aspace type=\"subheaps\" size=\"%zu\"/>\n",
@@ -5872,7 +5872,7 @@ __malloc_info (int options, FILE *fp)
}
else
{
- fprintf (fp,
+ __fprintf (fp,
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n",
ar_ptr->system_mem, ar_ptr->system_mem);
@@ -5885,7 +5885,7 @@ __malloc_info (int options, FILE *fp)
}
while (ar_ptr != &main_arena);
- fprintf (fp,
+ __fprintf (fp,
"<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"mmap\" count=\"%d\" size=\"%zu\"/>\n"
diff --git a/misc/efgcvt-template.c b/misc/efgcvt-template.c
index 87a90e78d4..f1630fd780 100644
--- a/misc/efgcvt-template.c
+++ b/misc/efgcvt-template.c
@@ -24,7 +24,7 @@
#include <math_ldbl_opt.h>
#ifndef SPRINTF
-# define SPRINTF sprintf
+# define SPRINTF __sprintf
#endif
#define APPEND(a, b) APPEND2 (a, b)
diff --git a/misc/mntent_r.c b/misc/mntent_r.c
index 3311ba0b50..65f29b97e9 100644
--- a/misc/mntent_r.c
+++ b/misc/mntent_r.c
@@ -251,7 +251,7 @@ __addmntent (FILE *stream, const struct mntent *mnt)
write_string (stream, mnt->mnt_dir);
write_string (stream, mnt->mnt_type);
write_string (stream, mnt->mnt_opts);
- fprintf (stream, "%d %d\n", mnt->mnt_freq, mnt->mnt_passno);
+ __fprintf (stream, "%d %d\n", mnt->mnt_freq, mnt->mnt_passno);
ret = __ferror_unlocked (stream) != 0 || fflush (stream) != 0;
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 44d3826bca..e43b5d4b36 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -560,6 +560,54 @@
# include <bits/long-double.h>
#endif
+#if (defined __GNUC__ && __GNUC__ >= 2) || (__clang_major__ >= 4)
+# define __REDIRECT_LDBL1(name, prenth, posnth, proto, alias) \
+ name proto prenth __asm__ (__ASMNAME (__ASMNAME (#alias))) posnth
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+# ifdef __REDIRECT
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , , proto, ieee128)
+# ifdef __cplusplus
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROW, , proto, ieee128)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROWNL, , proto, ieee128)
+# else
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROW, proto, ieee128)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROWNL, proto, ieee128)
+# endif /* __cplusplus */
+# else
+_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
+# endif /* __REDIRECT */
+# elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
+# ifdef __REDIRECT
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , , proto, compat)
+# ifdef __cplusplus
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROW, , proto, compat)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROWNL, , proto, compat)
+# else
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROW, proto, compat)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROWNL, proto, compat)
+# endif /* __cplusplus */
+# else
+_Static_assert (0, "Compat long double requires redirection on this platform");
+# endif /* __REDIRECT */
+# endif
+#endif
+
+#ifndef __REDIRECT_LDBL
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) name proto
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) name proto __THROW
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) name proto __THROWNL
+#endif
+
#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
# ifdef __REDIRECT
@@ -583,10 +631,6 @@
# define __REDIRECT_NTH_LDBL(name, proto, alias) \
__LDBL_REDIR1_NTH (name, proto, __##alias##ieee128)
-/* Unused. */
-# define __REDIRECT_LDBL(name, proto, alias) ... unused__redirect_ldbl
-# define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth
-
# else
_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
# endif
@@ -605,24 +649,6 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf
extern __typeof (name) name __asm (__ASMNAME (#alias));
# define __LDBL_REDIR_DECL(name) \
extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name));
-# define __REDIRECT_LDBL(name, proto, alias) \
- __LDBL_REDIR1 (name, proto, __nldbl_##alias)
-# define __REDIRECT_NTH_LDBL(name, proto, alias) \
- __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias)
-# endif
-#endif
-#if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \
- || !defined __REDIRECT
-# define __LDBL_REDIR1(name, proto, alias) name proto
-# define __LDBL_REDIR(name, proto) name proto
-# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW
-# define __LDBL_REDIR_NTH(name, proto) name proto __THROW
-# define __LDBL_REDIR2_DECL(name)
-# define __LDBL_REDIR_DECL(name)
-# ifdef __REDIRECT
-# define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias)
-# define __REDIRECT_NTH_LDBL(name, proto, alias) \
- __REDIRECT_NTH (name, proto, alias)
# endif
#endif
diff --git a/misc/syslog.c b/misc/syslog.c
index ee83b1bb76..0076361f6c 100644
--- a/misc/syslog.c
+++ b/misc/syslog.c
@@ -200,7 +200,7 @@ __vsyslog_internal(int pri, const char *fmt, va_list ap,
else
{
__fsetlocking (f, FSETLOCKING_BYCALLER);
- fprintf (f, "<%d>", pri);
+ __fprintf (f, "<%d>", pri);
now = time_now ();
f->_IO_write_ptr += __strftime_l (f->_IO_write_ptr,
f->_IO_write_end
@@ -214,7 +214,7 @@ __vsyslog_internal(int pri, const char *fmt, va_list ap,
if (LogTag != NULL)
__fputs_unlocked (LogTag, f);
if (LogStat & LOG_PID)
- fprintf (f, "[%d]", (int) __getpid ());
+ __fprintf (f, "[%d]", (int) __getpid ());
if (LogTag != NULL)
{
__putc_unlocked (':', f);
diff --git a/nis/nis_subr.c b/nis/nis_subr.c
index 385f221062..0e02cd19b5 100644
--- a/nis/nis_subr.c
+++ b/nis/nis_subr.c
@@ -280,10 +280,10 @@ nis_getnames (const_nis_name name)
}
if (pos == 0
- && __asprintf (&getnames[pos++], "%s%s%s%s",
- name, name[name_len - 1] == '.' ? "" : ".",
- local_domain,
- local_domain[local_domain_len - 1] == '.' ? "" : ".") < 0)
+ && asprintf (&getnames[pos++], "%s%s%s%s",
+ name, name[name_len - 1] == '.' ? "" : ".",
+ local_domain,
+ local_domain[local_domain_len - 1] == '.' ? "" : ".") < 0)
goto free_null;
getnames[pos] = NULL;
diff --git a/nptl/pthread_getname.c b/nptl/pthread_getname.c
index ebec06e23f..a424b3e4f8 100644
--- a/nptl/pthread_getname.c
+++ b/nptl/pthread_getname.c
@@ -42,7 +42,7 @@ __pthread_getname_np (pthread_t th, char *buf, size_t len)
#define FMT "/proc/self/task/%u/comm"
char fname[sizeof (FMT) + 8];
- sprintf (fname, FMT, (unsigned int) pd->tid);
+ __sprintf (fname, FMT, (unsigned int) pd->tid);
int fd = __open64_nocancel (fname, O_RDONLY);
if (fd == -1)
diff --git a/nptl/pthread_setname.c b/nptl/pthread_setname.c
index f24560db47..8520bac4be 100644
--- a/nptl/pthread_setname.c
+++ b/nptl/pthread_setname.c
@@ -44,7 +44,7 @@ __pthread_setname_np (pthread_t th, const char *name)
#define FMT "/proc/self/task/%u/comm"
char fname[sizeof (FMT) + 8];
- sprintf (fname, FMT, (unsigned int) pd->tid);
+ __sprintf (fname, FMT, (unsigned int) pd->tid);
int fd = __open64_nocancel (fname, O_RDWR);
if (fd == -1)
diff --git a/pwd/getpw.c b/pwd/getpw.c
index 547489a863..4784eaf00b 100644
--- a/pwd/getpw.c
+++ b/pwd/getpw.c
@@ -50,9 +50,9 @@ __getpw (__uid_t uid, char *buf)
if (p == NULL)
return -1;
- if (sprintf (buf, "%s:%s:%lu:%lu:%s:%s:%s", p->pw_name, p->pw_passwd,
- (unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
- p->pw_gecos, p->pw_dir, p->pw_shell) < 0)
+ if (__sprintf (buf, "%s:%s:%lu:%lu:%s:%s:%s", p->pw_name, p->pw_passwd,
+ (unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
+ p->pw_gecos, p->pw_dir, p->pw_shell) < 0)
return -1;
return 0;
diff --git a/pwd/putpwent.c b/pwd/putpwent.c
index e3f2f4e09e..480dd59813 100644
--- a/pwd/putpwent.c
+++ b/pwd/putpwent.c
@@ -48,11 +48,11 @@ putpwent (const struct passwd *p, FILE *stream)
return -1;
if (p->pw_name[0] == '+' || p->pw_name[0] == '-')
- ret = fprintf (stream, "%s:%s:::%s:%s:%s\n",
+ ret = __fprintf (stream, "%s:%s:::%s:%s:%s\n",
p->pw_name, _S (p->pw_passwd),
gecos, _S (p->pw_dir), _S (p->pw_shell));
else
- ret = fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
+ ret = __fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
p->pw_name, _S (p->pw_passwd),
(unsigned long int) p->pw_uid,
(unsigned long int) p->pw_gid,
diff --git a/resolv/inet_ntop.c b/resolv/inet_ntop.c
index c4d38c0f95..53725d805a 100644
--- a/resolv/inet_ntop.c
+++ b/resolv/inet_ntop.c
@@ -28,9 +28,9 @@
#include <string.h>
#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
+# define SPRINTF(x) strlen(__sprintf/**/x)
#else
-# define SPRINTF(x) ((size_t)sprintf x)
+# define SPRINTF(x) ((size_t)__sprintf x)
#endif
/*
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index 913a5cb82f..06a91b23ca 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -507,8 +507,8 @@ _nss_dns_gethostbyaddr2_r (const void *addr, socklen_t len, int af,
switch (af)
{
case AF_INET:
- sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", (uaddr[3] & 0xff),
- (uaddr[2] & 0xff), (uaddr[1] & 0xff), (uaddr[0] & 0xff));
+ __sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", (uaddr[3] & 0xff),
+ (uaddr[2] & 0xff), (uaddr[1] & 0xff), (uaddr[0] & 0xff));
break;
case AF_INET6:
qp = qbuf;
diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
index 09cd917444..304ae35b8b 100644
--- a/resolv/nss_dns/dns-network.c
+++ b/resolv/nss_dns/dns-network.c
@@ -191,21 +191,21 @@ _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result,
{
case 3:
/* Class A network. */
- sprintf (qbuf, "0.0.0.%u.in-addr.arpa", net_bytes[3]);
+ __sprintf (qbuf, "0.0.0.%u.in-addr.arpa", net_bytes[3]);
break;
case 2:
/* Class B network. */
- sprintf (qbuf, "0.0.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2]);
+ __sprintf (qbuf, "0.0.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2]);
break;
case 1:
/* Class C network. */
- sprintf (qbuf, "0.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
- net_bytes[1]);
+ __sprintf (qbuf, "0.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
+ net_bytes[1]);
break;
case 0:
/* Class D - E network. */
- sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
- net_bytes[1], net_bytes[0]);
+ __sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
+ net_bytes[1], net_bytes[0]);
break;
}
diff --git a/shadow/putspent.c b/shadow/putspent.c
index cbbb840d5b..d675e28210 100644
--- a/shadow/putspent.c
+++ b/shadow/putspent.c
@@ -42,47 +42,47 @@ putspent (const struct spwd *p, FILE *stream)
flockfile (stream);
- if (fprintf (stream, "%s:%s:", p->sp_namp, _S (p->sp_pwdp)) < 0)
+ if (__fprintf (stream, "%s:%s:", p->sp_namp, _S (p->sp_pwdp)) < 0)
++errors;
if ((p->sp_lstchg != (long int) -1
- && fprintf (stream, "%ld:", p->sp_lstchg) < 0)
+ && __fprintf (stream, "%ld:", p->sp_lstchg) < 0)
|| (p->sp_lstchg == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_min != (long int) -1
- && fprintf (stream, "%ld:", p->sp_min) < 0)
+ && __fprintf (stream, "%ld:", p->sp_min) < 0)
|| (p->sp_min == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_max != (long int) -1
- && fprintf (stream, "%ld:", p->sp_max) < 0)
+ && __fprintf (stream, "%ld:", p->sp_max) < 0)
|| (p->sp_max == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_warn != (long int) -1
- && fprintf (stream, "%ld:", p->sp_warn) < 0)
+ && __fprintf (stream, "%ld:", p->sp_warn) < 0)
|| (p->sp_warn == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_inact != (long int) -1
- && fprintf (stream, "%ld:", p->sp_inact) < 0)
+ && __fprintf (stream, "%ld:", p->sp_inact) < 0)
|| (p->sp_inact == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_expire != (long int) -1
- && fprintf (stream, "%ld:", p->sp_expire) < 0)
+ && __fprintf (stream, "%ld:", p->sp_expire) < 0)
|| (p->sp_expire == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if (p->sp_flag != ~0ul
- && fprintf (stream, "%ld", p->sp_flag) < 0)
+ && __fprintf (stream, "%ld", p->sp_flag) < 0)
++errors;
if (putc_unlocked ('\n', stream) == EOF)
diff --git a/stdio-common/dprintf.c b/stdio-common/dprintf.c
index 2e26d59714..6fbe5d4862 100644
--- a/stdio-common/dprintf.c
+++ b/stdio-common/dprintf.c
@@ -33,5 +33,4 @@ __dprintf (int d, const char *format, ...)
return done;
}
libc_hidden_def (__dprintf)
-ldbl_hidden_def (__dprintf, dprintf)
ldbl_weak_alias (__dprintf, dprintf)
diff --git a/stdio-common/fprintf.c b/stdio-common/fprintf.c
index 8d2cd37433..af7190c5b4 100644
--- a/stdio-common/fprintf.c
+++ b/stdio-common/fprintf.c
@@ -34,7 +34,7 @@ __fprintf (FILE *stream, const char *format, ...)
return done;
}
-ldbl_hidden_def (__fprintf, fprintf)
+libc_hidden_def (__fprintf)
ldbl_strong_alias (__fprintf, fprintf)
/* We define the function with the real name here. But deep down in
diff --git a/stdio-common/psiginfo.c b/stdio-common/psiginfo.c
index adf3b71b77..f99c51da17 100644
--- a/stdio-common/psiginfo.c
+++ b/stdio-common/psiginfo.c
@@ -76,7 +76,7 @@ psiginfo (const siginfo_t *pinfo, const char *s)
}
if (s != NULL && *s != '\0')
- fprintf (fp, "%s: ", s);
+ __fprintf (fp, "%s: ", s);
const char *desc;
if (pinfo->si_signo >= 0 && pinfo->si_signo < NSIG
@@ -92,21 +92,21 @@ psiginfo (const siginfo_t *pinfo, const char *s)
if (pinfo->si_signo - SIGRTMIN < SIGRTMAX - pinfo->si_signo)
{
if (pinfo->si_signo == SIGRTMIN)
- fprintf (fp, "SIGRTMIN (");
+ __fprintf (fp, "SIGRTMIN (");
else
- fprintf (fp, "SIGRTMIN+%d (", pinfo->si_signo - SIGRTMIN);
+ __fprintf (fp, "SIGRTMIN+%d (", pinfo->si_signo - SIGRTMIN);
}
else
{
if (pinfo->si_signo == SIGRTMAX)
- fprintf (fp, "SIGRTMAX (");
+ __fprintf (fp, "SIGRTMAX (");
else
- fprintf (fp, "SIGRTMAX-%d (", SIGRTMAX - pinfo->si_signo);
+ __fprintf (fp, "SIGRTMAX-%d (", SIGRTMAX - pinfo->si_signo);
}
}
else
#endif
- fprintf (fp, "%s (", _(desc));
+ __fprintf (fp, "%s (", _(desc));
const char *base = NULL;
const uint8_t *offarr = NULL;
@@ -178,25 +178,25 @@ Signal generated by the completion of an I/O request");
}
if (str != NULL)
- fprintf (fp, "%s ", _(str));
+ __fprintf (fp, "%s ", _(str));
else
- fprintf (fp, "%d ", pinfo->si_code);
+ __fprintf (fp, "%d ", pinfo->si_code);
if (pinfo->si_signo == SIGILL || pinfo->si_signo == SIGFPE
|| pinfo->si_signo == SIGSEGV || pinfo->si_signo == SIGBUS)
- fprintf (fp, "[%p])\n", pinfo->si_addr);
+ __fprintf (fp, "[%p])\n", pinfo->si_addr);
else if (pinfo->si_signo == SIGCHLD)
- fprintf (fp, "%ld %d %ld)\n",
- (long int) pinfo->si_pid, pinfo->si_status,
- (long int) pinfo->si_uid);
+ __fprintf (fp, "%ld %d %ld)\n",
+ (long int) pinfo->si_pid, pinfo->si_status,
+ (long int) pinfo->si_uid);
else if (pinfo->si_signo == SIGPOLL)
- fprintf (fp, "%ld)\n", (long int) pinfo->si_band);
+ __fprintf (fp, "%ld)\n", (long int) pinfo->si_band);
else
- fprintf (fp, "%ld %ld)\n",
- (long int) pinfo->si_pid, (long int) pinfo->si_uid);
+ __fprintf (fp, "%ld %ld)\n",
+ (long int) pinfo->si_pid, (long int) pinfo->si_uid);
}
else
- fprintf (fp, _("Unknown signal %d\n"), pinfo->si_signo);
+ __fprintf (fp, _("Unknown signal %d\n"), pinfo->si_signo);
fclose (fp);
diff --git a/stdio-common/sprintf.c b/stdio-common/sprintf.c
index a9665f753a..f1f43a49ec 100644
--- a/stdio-common/sprintf.c
+++ b/stdio-common/sprintf.c
@@ -32,6 +32,6 @@ __sprintf (char *s, const char *format, ...)
return done;
}
-ldbl_hidden_def (__sprintf, sprintf)
+libc_hidden_def (__sprintf)
ldbl_strong_alias (__sprintf, sprintf)
ldbl_strong_alias (__sprintf, _IO_sprintf)
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 7559fd239d..c5912788bd 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -24,4 +24,4 @@ __vfprintf (FILE *fp, const char *format, va_list ap)
}
ldbl_strong_alias (__vfprintf, _IO_vfprintf);
ldbl_strong_alias (__vfprintf, vfprintf);
-ldbl_hidden_def (__vfprintf, vfprintf)
+libc_hidden_def (__vfprintf)
diff --git a/sunrpc/netname.c b/sunrpc/netname.c
index bf7f0b81c4..97a881c3af 100644
--- a/sunrpc/netname.c
+++ b/sunrpc/netname.c
@@ -48,7 +48,7 @@ user2netname (char netname[MAXNETNAMELEN + 1], const uid_t uid,
if ((strlen (dfltdom) + OPSYS_LEN + 3 + MAXIPRINT) > (size_t) MAXNETNAMELEN)
return 0;
- sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
+ __sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
i = strlen (netname);
if (netname[i - 1] == '.')
netname[i - 1] = '\0';
@@ -112,7 +112,7 @@ host2netname (char netname[MAXNETNAMELEN + 1], const char *host,
> MAXNETNAMELEN)
return 0;
- sprintf (netname, "%s.%s@%s", OPSYS, hostname, domainname);
+ __sprintf (netname, "%s.%s@%s", OPSYS, hostname, domainname);
return 1;
}
#ifdef EXPORT_RPC_SYMBOLS
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
index f683836678..59f6e31d2d 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128___asprintf (char **string_ptr, const char *format, ...)
+int
+__asprintfieee128 (char **string_ptr, const char *format, ...)
{
va_list ap;
int done;
@@ -32,5 +32,4 @@ ___ieee128___asprintf (char **string_ptr, const char *format, ...)
return done;
}
-hidden_def (___ieee128___asprintf)
-strong_alias (___ieee128___asprintf, __asprintfieee128)
+libc_hidden_def (__asprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
index cf3b46c37a..ceba219dc7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_dprintf (int d, const char *format, ...)
+int
+__dprintfieee128 (int d, const char *format, ...)
{
va_list ap;
int done;
@@ -31,5 +31,4 @@ ___ieee128_dprintf (int d, const char *format, ...)
return done;
}
-strong_alias (___ieee128_dprintf, __dprintfieee128)
-hidden_def (___ieee128_dprintf);
+libc_hidden_def (__dprintfieee128);
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
index 4462588675..b58f27afb7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_fprintf (FILE *fp, const char *format, ...)
+int
+__fprintfieee128 (FILE *fp, const char *format, ...)
{
va_list ap;
int done;
@@ -31,5 +31,4 @@ ___ieee128_fprintf (FILE *fp, const char *format, ...)
return done;
}
-strong_alias (___ieee128_fprintf, __fprintfieee128)
-hidden_def (___ieee128_fprintf)
+libc_hidden_def (__fprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
index 9703069b95..243eb65629 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
@@ -18,8 +18,8 @@
/* When in IEEE long double mode, call ___ieee128_sprintf. */
#include <stdio.h>
-typeof (sprintf) ___ieee128_sprintf attribute_hidden;
-#define SPRINTF ___ieee128_sprintf
+typeof (sprintf) __sprintfieee128 attribute_hidden;
+#define SPRINTF __sprintfieee128
/* Declare internal functions: ___qecvtieee128_r and ___qfcvtieee128_r,
built from a different compiling unit, and called from here. */
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
index 0be5bb2810..8046f5fd46 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
@@ -18,8 +18,8 @@
/* When in IEEE long double mode, call ___ieee128_snprintf. */
#include <stdio.h>
-typeof (snprintf) ___ieee128_snprintf attribute_hidden;
-#define SNPRINTF ___ieee128_snprintf
+typeof (snprintf) __snprintfieee128 attribute_hidden;
+#define SNPRINTF __snprintfieee128
#define ECVT_R __qecvtieee128_r
#define FCVT_R __qfcvtieee128_r
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
index 5f51b3ec9e..da3d9441d7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_snprintf (char *s, size_t maxlen, const char *format, ...)
+int
+__snprintfieee128 (char *s, size_t maxlen, const char *format, ...)
{
va_list ap;
int done;
@@ -32,4 +32,4 @@ ___ieee128_snprintf (char *s, size_t maxlen, const char *format, ...)
return done;
}
-strong_alias (___ieee128_snprintf, __snprintfieee128)
+libc_hidden_def (__snprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
index 0cad130788..007a71659a 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_sprintf (char *s, const char *format, ...)
+int
+__sprintfieee128 (char *s, const char *format, ...)
{
va_list ap;
int done;
@@ -32,5 +32,4 @@ ___ieee128_sprintf (char *s, const char *format, ...)
return done;
}
-strong_alias (___ieee128_sprintf, __sprintfieee128)
-hidden_def (___ieee128_sprintf)
+libc_hidden_def (__sprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
index e340c9b457..4df1e485a5 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
@@ -18,10 +18,9 @@
#include <libio/libioP.h>
-extern int
-___ieee128_vfprintf (FILE *fp, const char *format, va_list ap)
+int
+__vfprintfieee128 (FILE *fp, const char *format, va_list ap)
{
return __vfprintf_internal (fp, format, ap, PRINTF_LDBL_USES_FLOAT128);
}
-strong_alias (___ieee128_vfprintf, __vfprintfieee128)
-hidden_def (___ieee128_vfprintf)
+libc_hidden_def (__vfprintfieee128)
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
index ebd2a43951..5b167d45ff 100644
--- a/sysdeps/posix/tempname.c
+++ b/sysdeps/posix/tempname.c
@@ -161,7 +161,7 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
return -1;
}
- sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
+ __sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
return 0;
}
#endif /* _LIBC */
diff --git a/sysdeps/unix/sysv/linux/ia64/makecontext.c b/sysdeps/unix/sysv/linux/ia64/makecontext.c
index 0bc4211dfc..0cf05d5999 100644
--- a/sysdeps/unix/sysv/linux/ia64/makecontext.c
+++ b/sysdeps/unix/sysv/linux/ia64/makecontext.c
@@ -54,7 +54,7 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
if (argc > 8)
{
- fprintf (stderr, _("\
+ __fprintf (stderr, _("\
makecontext: does not know how to handle more than 8 arguments\n"));
exit (-1);
}
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index 0e017f458b..f2dca7711a 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -233,10 +233,13 @@ extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
const wchar_t *__restrict __format, ...)
__THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
-extern int __REDIRECT_NTH_LDBL (__swprintf_alias,
- (wchar_t *__restrict __s, size_t __n,
- const wchar_t *__restrict __fmt, ...),
- swprintf);
+extern int __swprintf_alias (wchar_t *__restrict __s, size_t __n,
+ const wchar_t *__restrict __fmt, ...)
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+ __asm__ (__ASMNAME ("swprintf"))
+#endif
+ ;
+
#ifdef __va_arg_pack
__fortify_function int
@@ -264,10 +267,13 @@ extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
__gnuc_va_list __arg)
__THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-extern int __REDIRECT_NTH_LDBL (__vswprintf_alias,
- (wchar_t *__restrict __s, size_t __n,
- const wchar_t *__restrict __fmt,
- __gnuc_va_list __ap), vswprintf);
+extern int __vswprintf_alias (wchar_t *__restrict __s, size_t __n,
+ const wchar_t *__restrict __fmt,
+ __gnuc_va_list __ap)
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+ __asm__ (__ASMNAME ("vswprintf"))
+#endif
+ ;
__fortify_function int
__NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
^ permalink raw reply [flat|nested] 14+ messages in thread
* [glibc/azanella/clang] Remove stdio-ldbl.h
@ 2022-03-16 17:57 Adhemerval Zanella
0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-03-16 17:57 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5509c58c43d2dd06de3fae832af17b5cf653d614
commit 5509c58c43d2dd06de3fae832af17b5cf653d614
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Thu Feb 24 14:13:12 2022 -0300
Remove stdio-ldbl.h
The functions which require different alias to long double depending
of the ABI now uses a set os macros that defines the expected alias
on the function prototype, instead of redefine them using the
__LDBL_REDIR_DEC macros.
The __REDIRECT_LDBL, __REDIRECT_LDBL_NTH, __REDIRECT_LDBL_NTHNL
are refactores to be similar to __REDIRECT with the difference it
now expects the aliases for binary128 and for the long double being
double (which __LDBL_REDIR_DEC does).
All printf internal usage are also replaced to use internal alias
instead.
Diff:
---
argp/argp-parse.c | 4 +-
debug/backtracesyms.c | 18 +-
grp/putgrent.c | 6 +-
gshadow/putsgent.c | 6 +-
include/bits/stdio-ldbl.h | 1 -
include/stdio.h | 34 ++-
inet/ether_ntoa_r.c | 8 +-
inet/rexec.c | 2 +-
libio/Makefile | 2 +-
libio/bits/stdio-ldbl.h | 108 --------
libio/bits/stdio2.h | 115 ++++++---
libio/stdio.h | 286 +++++++++++++--------
malloc/malloc-check.c | 1 +
malloc/malloc.c | 32 +--
misc/efgcvt-template.c | 2 +-
misc/mntent_r.c | 2 +-
misc/sys/cdefs.h | 70 +++--
misc/syslog.c | 4 +-
nis/nis_subr.c | 8 +-
nptl/pthread_getname.c | 2 +-
nptl/pthread_setname.c | 2 +-
pwd/getpw.c | 6 +-
pwd/putpwent.c | 4 +-
resolv/inet_ntop.c | 4 +-
resolv/nss_dns/dns-host.c | 4 +-
resolv/nss_dns/dns-network.c | 12 +-
shadow/putspent.c | 16 +-
stdio-common/dprintf.c | 1 -
stdio-common/fprintf.c | 2 +-
stdio-common/psiginfo.c | 32 +--
stdio-common/sprintf.c | 2 +-
stdio-common/vfprintf.c | 2 +-
sunrpc/netname.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-asprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-dprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-fprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c | 4 +-
.../ieee754/ldbl-128ibm-compat/ieee128-snprintf.c | 6 +-
.../ieee754/ldbl-128ibm-compat/ieee128-sprintf.c | 7 +-
.../ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c | 7 +-
sysdeps/posix/tempname.c | 2 +-
sysdeps/unix/sysv/linux/ia64/makecontext.c | 2 +-
wcsmbs/bits/wchar2.h | 22 +-
44 files changed, 450 insertions(+), 427 deletions(-)
diff --git a/argp/argp-parse.c b/argp/argp-parse.c
index 13cd84dd33..c26c0fc27f 100644
--- a/argp/argp-parse.c
+++ b/argp/argp-parse.c
@@ -177,7 +177,7 @@ argp_version_parser (int key, char *arg, struct argp_state *state)
if (argp_program_version_hook)
(*argp_program_version_hook) (state->out_stream, state);
else if (argp_program_version)
- fprintf (state->out_stream, "%s\n", argp_program_version);
+ __fprintf (state->out_stream, "%s\n", argp_program_version);
else
__argp_error (state, dgettext (state->root_argp->argp_domain,
"(PROGRAM ERROR) No version known!?"));
@@ -618,7 +618,7 @@ parser_finalize (struct parser *parser,
{
if (!(parser->state.flags & ARGP_NO_ERRS)
&& parser->state.err_stream)
- fprintf (parser->state.err_stream,
+ __fprintf (parser->state.err_stream,
dgettext (parser->argp->argp_domain,
"%s: Too many arguments\n"),
parser->state.name);
diff --git a/debug/backtracesyms.c b/debug/backtracesyms.c
index 17e0626df8..adb939f888 100644
--- a/debug/backtracesyms.c
+++ b/debug/backtracesyms.c
@@ -83,10 +83,10 @@ __backtrace_symbols (void *const *array, int size)
info[cnt].dli_saddr = info[cnt].dli_fbase;
if (info[cnt].dli_sname == NULL && info[cnt].dli_saddr == 0)
- last += 1 + sprintf (last, "%s(%s) [%p]",
- info[cnt].dli_fname ?: "",
- info[cnt].dli_sname ?: "",
- array[cnt]);
+ last += 1 + __sprintf (last, "%s(%s) [%p]",
+ info[cnt].dli_fname ?: "",
+ info[cnt].dli_sname ?: "",
+ array[cnt]);
else
{
char sign;
@@ -102,14 +102,14 @@ __backtrace_symbols (void *const *array, int size)
offset = info[cnt].dli_saddr - array[cnt];
}
- last += 1 + sprintf (last, "%s(%s%c%#tx) [%p]",
- info[cnt].dli_fname ?: "",
- info[cnt].dli_sname ?: "",
- sign, offset, array[cnt]);
+ last += 1 + __sprintf (last, "%s(%s%c%#tx) [%p]",
+ info[cnt].dli_fname ?: "",
+ info[cnt].dli_sname ?: "",
+ sign, offset, array[cnt]);
}
}
else
- last += 1 + sprintf (last, "[%p]", array[cnt]);
+ last += 1 + __sprintf (last, "[%p]", array[cnt]);
}
assert (last <= (char *) result + size * sizeof (char *) + total);
}
diff --git a/grp/putgrent.c b/grp/putgrent.c
index 966ba2a763..305ff44359 100644
--- a/grp/putgrent.c
+++ b/grp/putgrent.c
@@ -45,10 +45,10 @@ putgrent (const struct group *gr, FILE *stream)
flockfile (stream);
if (gr->gr_name[0] == '+' || gr->gr_name[0] == '-')
- retval = fprintf (stream, "%s:%s::",
+ retval = __fprintf (stream, "%s:%s::",
gr->gr_name, _S (gr->gr_passwd));
else
- retval = fprintf (stream, "%s:%s:%lu:",
+ retval = __fprintf (stream, "%s:%s:%lu:",
gr->gr_name, _S (gr->gr_passwd),
(unsigned long int) gr->gr_gid);
if (__builtin_expect (retval, 0) < 0)
@@ -60,7 +60,7 @@ putgrent (const struct group *gr, FILE *stream)
if (gr->gr_mem != NULL)
{
for (size_t i = 0; gr->gr_mem[i] != NULL; i++)
- if (fprintf (stream, i == 0 ? "%s" : ",%s", gr->gr_mem[i]) < 0)
+ if (__fprintf (stream, i == 0 ? "%s" : ",%s", gr->gr_mem[i]) < 0)
{
/* What else can we do? */
funlockfile (stream);
diff --git a/gshadow/putsgent.c b/gshadow/putsgent.c
index 9e2dca7eaf..870438de6d 100644
--- a/gshadow/putsgent.c
+++ b/gshadow/putsgent.c
@@ -42,7 +42,7 @@ putsgent (const struct sgrp *g, FILE *stream)
_IO_flockfile (stream);
- if (fprintf (stream, "%s:%s:", g->sg_namp, _S (g->sg_passwd)) < 0)
+ if (__fprintf (stream, "%s:%s:", g->sg_namp, _S (g->sg_passwd)) < 0)
++errors;
bool first = true;
@@ -50,7 +50,7 @@ putsgent (const struct sgrp *g, FILE *stream)
if (sp != NULL)
while (*sp != NULL)
{
- if (fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
+ if (__fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
{
++errors;
break;
@@ -65,7 +65,7 @@ putsgent (const struct sgrp *g, FILE *stream)
if (sp != NULL)
while (*sp != NULL)
{
- if (fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
+ if (__fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
{
++errors;
break;
diff --git a/include/bits/stdio-ldbl.h b/include/bits/stdio-ldbl.h
deleted file mode 100644
index 1f7d3ce1c6..0000000000
--- a/include/bits/stdio-ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <libio/bits/stdio-ldbl.h>
diff --git a/include/stdio.h b/include/stdio.h
index 23b7fd288c..a645a1bf99 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -22,13 +22,17 @@
/* Some libc_hidden_ldbl_proto's do not map to a unique symbol when
redirecting ldouble to _Float128 variants. We can therefore safely
directly alias them to their internal name. */
-# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc)
-# define stdio_hidden_ldbl_proto(p, f) \
- extern __typeof (p ## f) p ## f __asm (__ASMNAME ("___ieee128_" #f));
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# define stdio_hidden_ldbl_proto(p,f) __LDBL_REDIR1_DECL (p ## f, p ## f ## ieee128)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc) && defined SHARED
+# define __stdio_hidden_ldbl_proto(name, alias) \
+ extern __typeof (name) __##name __asm__ (__hidden_asmname (#alias));
+# define stdio_hidden_ldbl_proto(name) \
+ extern typeof (name) __##name##ieee128; \
+ libc_hidden_proto (__##name##ieee128); \
+ __stdio_hidden_ldbl_proto (name, __GI___##name##ieee128)
# else
-# define stdio_hidden_ldbl_proto(p,f) libc_hidden_proto (p ## f)
+# define stdio_hidden_ldbl_proto(name) \
+ extern __typeof (name) __##name; \
+ libc_hidden_proto (__##name)
# endif
/* Set the error indicator on FP. */
@@ -39,10 +43,7 @@ fseterr_unlocked (FILE *fp)
}
extern int __fcloseall (void) attribute_hidden;
-extern int __snprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, ...)
- __attribute__ ((__format__ (__printf__, 3, 4)));
-stdio_hidden_ldbl_proto (__, snprintf)
+stdio_hidden_ldbl_proto (snprintf);
extern int __vfscanf (FILE *__restrict __s,
const char *__restrict __format,
@@ -183,7 +184,7 @@ extern const char *const _sys_errlist_internal[] attribute_hidden;
extern const char *__get_errlist (int) attribute_hidden;
extern const char *__get_errname (int) attribute_hidden;
-libc_hidden_ldbl_proto (__asprintf)
+stdio_hidden_ldbl_proto (asprintf);
# if IS_IN (libc)
extern FILE *_IO_new_fopen (const char*, const char*);
@@ -205,13 +206,10 @@ extern int _IO_new_fgetpos (FILE *, __fpos_t *);
# define fgetpos(fp, posp) _IO_new_fgetpos (fp, posp)
# endif
-extern __typeof (dprintf) __dprintf
- __attribute__ ((__format__ (__printf__, 2, 3)));
-stdio_hidden_ldbl_proto (__, dprintf)
-libc_hidden_ldbl_proto (dprintf)
-libc_hidden_ldbl_proto (fprintf)
-libc_hidden_ldbl_proto (vfprintf)
-libc_hidden_ldbl_proto (sprintf)
+stdio_hidden_ldbl_proto (dprintf);
+stdio_hidden_ldbl_proto (fprintf);
+stdio_hidden_ldbl_proto (vfprintf);
+stdio_hidden_ldbl_proto (sprintf);
libc_hidden_proto (ungetc)
libc_hidden_proto (__getdelim)
libc_hidden_proto (fwrite)
diff --git a/inet/ether_ntoa_r.c b/inet/ether_ntoa_r.c
index 03011ffef6..f111e5234c 100644
--- a/inet/ether_ntoa_r.c
+++ b/inet/ether_ntoa_r.c
@@ -23,10 +23,10 @@
char *
ether_ntoa_r (const struct ether_addr *addr, char *buf)
{
- sprintf (buf, "%x:%x:%x:%x:%x:%x",
- addr->ether_addr_octet[0], addr->ether_addr_octet[1],
- addr->ether_addr_octet[2], addr->ether_addr_octet[3],
- addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
+ __sprintf (buf, "%x:%x:%x:%x:%x:%x",
+ addr->ether_addr_octet[0], addr->ether_addr_octet[1],
+ addr->ether_addr_octet[2], addr->ether_addr_octet[3],
+ addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
return buf;
}
libc_hidden_def (ether_ntoa_r)
diff --git a/inet/rexec.c b/inet/rexec.c
index 330282ac16..809475d976 100644
--- a/inet/rexec.c
+++ b/inet/rexec.c
@@ -135,7 +135,7 @@ retry:
NULL, 0, servbuff, sizeof(servbuff),
NI_NUMERICSERV))
port = (int) __strtol (servbuff, NULL, 10);
- (void) sprintf(num, "%u", port);
+ (void) __sprintf(num, "%u", port);
(void) __write(s, num, strlen(num)+1);
{ socklen_t len = sizeof (from);
s3 = TEMP_FAILURE_RETRY (accept(s2, (struct sockaddr *)&from,
diff --git a/libio/Makefile b/libio/Makefile
index e97387743f..a4830ddf42 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -23,7 +23,7 @@ subdir := libio
include ../Makeconfig
headers := stdio.h \
- bits/stdio.h bits/stdio2.h bits/stdio-ldbl.h \
+ bits/stdio.h bits/stdio2.h \
bits/types/FILE.h bits/types/__FILE.h bits/types/struct_FILE.h \
bits/types/__fpos_t.h bits/types/__fpos64_t.h \
bits/types/cookie_io_functions_t.h
diff --git a/libio/bits/stdio-ldbl.h b/libio/bits/stdio-ldbl.h
deleted file mode 100644
index 6b63394b50..0000000000
--- a/libio/bits/stdio-ldbl.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -mlong-double-64 compatibility mode for stdio functions.
- Copyright (C) 2006-2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#ifndef _STDIO_H
-# error "Never include <bits/stdio-ldbl.h> directly; use <stdio.h> instead."
-#endif
-
-__LDBL_REDIR_DECL (fprintf)
-__LDBL_REDIR_DECL (printf)
-__LDBL_REDIR_DECL (sprintf)
-__LDBL_REDIR_DECL (vfprintf)
-__LDBL_REDIR_DECL (vprintf)
-__LDBL_REDIR_DECL (vsprintf)
-#if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (fscanf, __nldbl___isoc99_fscanf)
-__LDBL_REDIR1_DECL (scanf, __nldbl___isoc99_scanf)
-__LDBL_REDIR1_DECL (sscanf, __nldbl___isoc99_sscanf)
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (fscanf, __isoc99_fscanfieee128)
-__LDBL_REDIR1_DECL (scanf, __isoc99_scanfieee128)
-__LDBL_REDIR1_DECL (sscanf, __isoc99_sscanfieee128)
-# else
-# error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-# endif
-#else
-__LDBL_REDIR_DECL (fscanf)
-__LDBL_REDIR_DECL (scanf)
-__LDBL_REDIR_DECL (sscanf)
-#endif
-
-#if defined __USE_ISOC99 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (snprintf)
-__LDBL_REDIR_DECL (vsnprintf)
-#endif
-
-#ifdef __USE_ISOC99
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (vfscanf, __nldbl___isoc99_vfscanf)
-__LDBL_REDIR1_DECL (vscanf, __nldbl___isoc99_vscanf)
-__LDBL_REDIR1_DECL (vsscanf, __nldbl___isoc99_vsscanf)
-# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (vfscanf, __isoc99_vfscanfieee128)
-__LDBL_REDIR1_DECL (vscanf, __isoc99_vscanfieee128)
-__LDBL_REDIR1_DECL (vsscanf, __isoc99_vsscanfieee128)
-# else
-# error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-# endif
-# else
-__LDBL_REDIR_DECL (vfscanf)
-__LDBL_REDIR_DECL (vsscanf)
-__LDBL_REDIR_DECL (vscanf)
-# endif
-#endif
-
-#ifdef __USE_XOPEN2K8
-__LDBL_REDIR_DECL (vdprintf)
-__LDBL_REDIR_DECL (dprintf)
-#endif
-
-#ifdef __USE_GNU
-__LDBL_REDIR_DECL (vasprintf)
-__LDBL_REDIR2_DECL (asprintf)
-__LDBL_REDIR_DECL (asprintf)
-__LDBL_REDIR_DECL (obstack_printf)
-__LDBL_REDIR_DECL (obstack_vprintf)
-#endif
-
-#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR2_DECL (sprintf_chk)
-__LDBL_REDIR2_DECL (vsprintf_chk)
-# if defined __USE_ISOC99 || defined __USE_UNIX98
-__LDBL_REDIR2_DECL (snprintf_chk)
-__LDBL_REDIR2_DECL (vsnprintf_chk)
-# endif
-# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR2_DECL (fprintf_chk)
-__LDBL_REDIR2_DECL (printf_chk)
-__LDBL_REDIR2_DECL (vfprintf_chk)
-__LDBL_REDIR2_DECL (vprintf_chk)
-# ifdef __USE_XOPEN2K8
-__LDBL_REDIR2_DECL (dprintf_chk)
-__LDBL_REDIR2_DECL (vdprintf_chk)
-# endif
-# ifdef __USE_GNU
-__LDBL_REDIR2_DECL (asprintf_chk)
-__LDBL_REDIR2_DECL (vasprintf_chk)
-__LDBL_REDIR2_DECL (obstack_printf_chk)
-__LDBL_REDIR2_DECL (obstack_vprintf_chk)
-# endif
-# endif
-#endif
diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h
index b0b655ee7a..de7f1f04aa 100644
--- a/libio/bits/stdio2.h
+++ b/libio/bits/stdio2.h
@@ -23,12 +23,17 @@
# error "Never include <bits/stdio2.h> directly; use <stdio.h> instead."
#endif
-extern int __sprintf_chk (char *__restrict __s, int __flag, size_t __slen,
- const char *__restrict __format, ...) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__sprintf_chk, (char *__restrict __s,
+ int __flag, size_t __slen,
+ const char *__restrict __format,
+ ...),
+ __sprintf_chkieee128, __nldbl___sprintf_chk)
__attr_access ((__write_only__, 1, 3));
-extern int __vsprintf_chk (char *__restrict __s, int __flag, size_t __slen,
- const char *__restrict __format,
- __gnuc_va_list __ap) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__vsprintf_chk, (char *__restrict __s,
+ int __flag, size_t __slen,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vsprintf_chkieee128, __nldbl___vsprintf_chk)
__attr_access ((__write_only__, 1, 3));
#ifdef __va_arg_pack
@@ -54,14 +59,19 @@ __NTH (vsprintf (char *__restrict __s, const char *__restrict __fmt,
}
#if defined __USE_ISOC99 || defined __USE_UNIX98
-
-extern int __snprintf_chk (char *__restrict __s, size_t __n, int __flag,
- size_t __slen, const char *__restrict __format,
- ...) __THROW
+extern int __REDIRECT_LDBL_NTHNL (__snprintf_chk, (char *__restrict __s,
+ size_t __n, int __flag,
+ size_t __slen,
+ const char *__restrict __format,
+ ...),
+ __snprintf_chkieee128, __nldbl___snprintf_chk)
__attr_access ((__write_only__, 1, 2));
-extern int __vsnprintf_chk (char *__restrict __s, size_t __n, int __flag,
- size_t __slen, const char *__restrict __format,
- __gnuc_va_list __ap) __THROW;
+extern int __REDIRECT_LDBL_NTHNL (__vsnprintf_chk, (char *__restrict __s,
+ size_t __n, int __flag,
+ size_t __slen,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vsnprintf_chkieee128, __nldbl___vsnprintf_chk);
# ifdef __va_arg_pack
__fortify_function int
@@ -89,14 +99,24 @@ __NTH (vsnprintf (char *__restrict __s, size_t __n,
#endif
#if __USE_FORTIFY_LEVEL > 1
-
-extern int __fprintf_chk (FILE *__restrict __stream, int __flag,
- const char *__restrict __format, ...);
-extern int __printf_chk (int __flag, const char *__restrict __format, ...);
-extern int __vfprintf_chk (FILE *__restrict __stream, int __flag,
- const char *__restrict __format, __gnuc_va_list __ap);
-extern int __vprintf_chk (int __flag, const char *__restrict __format,
- __gnuc_va_list __ap);
+extern int __REDIRECT_LDBL (__fprintf_chk, (FILE *__restrict __stream,
+ int __flag,
+ const char *__restrict __format,
+ ...),
+ __fprintf_chkieee128, __nldbl___fprintf_chk);
+extern int __REDIRECT_LDBL (__printf_chk, (int __flag,
+ const char *__restrict __format,
+ ...),
+ __printf_chkieee128, __nldbl___printf_chk);
+extern int __REDIRECT_LDBL (__vfprintf_chk, (FILE *__restrict __stream,
+ int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vfprintf_chkieee128, __nldbl___vfprintf_chk);
+extern int __REDIRECT_LDBL (__vprintf_chk, (int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __ap),
+ __vprintf_chkieee128, __nldbl___vprintf_chk);
# ifdef __va_arg_pack
__fortify_function int
@@ -136,10 +156,15 @@ vfprintf (FILE *__restrict __stream,
}
# ifdef __USE_XOPEN2K8
-extern int __dprintf_chk (int __fd, int __flag, const char *__restrict __fmt,
- ...) __attribute__ ((__format__ (__printf__, 3, 4)));
-extern int __vdprintf_chk (int __fd, int __flag,
- const char *__restrict __fmt, __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL (__dprintf_chk, (int __fd, int __flag,
+ const char *__restrict __fmt,
+ ...),
+ __dprintf_chkieee128, __nldbl___dprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL (__vdprintf_chk, (int __fd, int __flag,
+ const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vdprintf_chkieee128, __nldbl___vdprintf_chk)
__attribute__ ((__format__ (__printf__, 3, 0)));
# ifdef __va_arg_pack
@@ -162,22 +187,32 @@ vdprintf (int __fd, const char *__restrict __fmt, __gnuc_va_list __ap)
# endif
# ifdef __USE_GNU
-
-extern int __asprintf_chk (char **__restrict __ptr, int __flag,
- const char *__restrict __fmt, ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4))) __wur;
-extern int __vasprintf_chk (char **__restrict __ptr, int __flag,
- const char *__restrict __fmt, __gnuc_va_list __arg)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
-extern int __obstack_printf_chk (struct obstack *__restrict __obstack,
- int __flag, const char *__restrict __format,
- ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
-extern int __obstack_vprintf_chk (struct obstack *__restrict __obstack,
- int __flag,
- const char *__restrict __format,
- __gnuc_va_list __args)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
+extern int __REDIRECT_LDBL_NTHNL (__asprintf_chk, (char **__restrict __ptr,
+ int __flag,
+ const char *__restrict __fmt,
+ ...),
+ __asprintf_chkieee128, __nldbl___asprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (__vasprintf_chk, (char **__restrict __ptr,
+ int __flag,
+ const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vasprintf_chkieee128, __nldbl___vasnprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (__obstack_printf_chk, (struct obstack *__restrict __obstack,
+ int __flag,
+ const char *__restrict __format,
+ ...),
+ __obstack_printf_chkieee128,
+ __nldbl___obstack_printf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL_NTHNL (__obstack_vprintf_chk, (struct obstack *__restrict __obstack,
+ int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __args),
+ __obstack_vprintf_chkieee128,
+ __nldbl___obstack_vprintf_chk)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
# ifdef __va_arg_pack
__fortify_function int
diff --git a/libio/stdio.h b/libio/stdio.h
index e6425341ce..54c9796a46 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -41,6 +41,7 @@ __BEGIN_DECLS
#include <bits/types/__FILE.h>
#include <bits/types/FILE.h>
#include <bits/types/struct_FILE.h>
+#include <bits/floatn.h>
#ifdef __USE_GNU
# include <bits/types/cookie_io_functions_t.h>
@@ -342,78 +343,143 @@ extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
extern void setlinebuf (FILE *__stream) __THROW;
#endif
-
/* Write formatted output to STREAM.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int fprintf (FILE *__restrict __stream,
- const char *__restrict __format, ...);
+extern int __REDIRECT_LDBL (fprintf, (FILE *__restrict __stream,
+ const char *__restrict __format, ...),
+ __fprintfieee128, __nldbl_fprintf);
/* Write formatted output to stdout.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int printf (const char *__restrict __format, ...);
+extern int __REDIRECT_LDBL (printf, (const char *__restrict __format, ...),
+ __printfieee128, __nldbl_printf);
/* Write formatted output to S. */
-extern int sprintf (char *__restrict __s,
- const char *__restrict __format, ...) __THROWNL;
+extern int __REDIRECT_LDBL_NTHNL (sprintf, (char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __sprintfieee128, __nldbl_sprintf);
/* Write formatted output to S from argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg);
+extern int __REDIRECT_LDBL (vfprintf, (FILE *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vfprintfieee128, __nldbl_vfprintf);
/* Write formatted output to stdout from argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
+extern int __REDIRECT_LDBL (vprintf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vprintfieee128, __nldbl_vprintf);
/* Write formatted output to S from argument list ARG. */
-extern int vsprintf (char *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg) __THROWNL;
+extern int __REDIRECT_LDBL_NTHNL (vsprintf, (char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsprintfieee128, __nldbl_vsprintf);
#if defined __USE_ISOC99 || defined __USE_UNIX98
/* Maximum chars of output to write in MAXLEN. */
-extern int snprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 3, 4)));
-
-extern int vsnprintf (char *__restrict __s, size_t __maxlen,
- const char *__restrict __format, __gnuc_va_list __arg)
- __THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
+extern int __REDIRECT_LDBL_NTHNL (snprintf, (char *__restrict __s,
+ size_t __maxlen,
+ const char *__restrict __format,
+ ...),
+ __snprintfieee128, __nldbl_snprintf)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __REDIRECT_LDBL_NTHNL (vsnprintf, (char *__restrict __s,
+ size_t __maxlen,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsnprintfieee128, __nldbl_vsnprintf)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
#endif
#if __GLIBC_USE (LIB_EXT2)
/* Write formatted output to a string dynamically allocated with `malloc'.
Store the address of the string in *PTR. */
-extern int vasprintf (char **__restrict __ptr, const char *__restrict __f,
- __gnuc_va_list __arg)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
-extern int __asprintf (char **__restrict __ptr,
- const char *__restrict __fmt, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
-extern int asprintf (char **__restrict __ptr,
- const char *__restrict __fmt, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (vasprintf, (char **__restrict __ptr,
+ const char *__restrict __f,
+ __gnuc_va_list __arg),
+ __vasprintfieee128, __nldbl_vasprintf)
+ __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL_NTHNL (asprintf, (char **__restrict __ptr,
+ const char *__restrict __fmt,
+ ...),
+ __asprintfieee128, __nldbl_asprintf)
+ __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
#endif
#ifdef __USE_XOPEN2K8
/* Write formatted output to a file descriptor. */
-extern int vdprintf (int __fd, const char *__restrict __fmt,
- __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL (vdprintf, (int __fd, const char *__restrict __fmt,
+ __gnuc_va_list __arg),
+ __vdprintfieee128, __nldbl_vdprintf)
__attribute__ ((__format__ (__printf__, 2, 0)));
-extern int dprintf (int __fd, const char *__restrict __fmt, ...)
+extern int __REDIRECT_LDBL (dprintf, (int __fd, const char *__restrict __fmt,
+ ...),
+ __dprintfieee128, __nldbl_dprintf)
__attribute__ ((__format__ (__printf__, 2, 3)));
#endif
-
+#if !__GLIBC_USE (DEPRECATED_SCANF)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ ...),
+ __isoc99_fscanfieee128, __nldbl___isoc99_fscanf) __wur;
+extern int __REDIRECT_LDBL (scanf, (const char *__restrict __format,
+ ...),
+ __isoc99_scanfieee128, __nldbl___isoc99_scanf) __wur;
+extern int __REDIRECT_LDBL_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __isoc99_sscanfieee128, __nldbl___isoc99_sscanf);
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format, ...),
+ __isoc99_fscanf) __wur;
+extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
+ __isoc99_scanf) __wur;
+extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format, ...),
+ __isoc99_sscanf);
+# else
+extern int __isoc99_fscanf (FILE *__restrict __stream,
+ const char *__restrict __format, ...) __wur;
+extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
+extern int __isoc99_sscanf (const char *__restrict __s,
+ const char *__restrict __format, ...) __THROW;
+# define fscanf __isoc99_fscanf
+# define scanf __isoc99_scanf
+# define sscanf __isoc99_sscanf
+# endif /* __REDIRECT */
+# endif
+#else
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ ...),
+ __fscanfieee128, __nldbl_fscanf) __wur;
+extern int __REDIRECT_LDBL (scanf, (const char *__restrict __format,
+ ...),
+ __scanfieee128, __nldbl_scanf) __wur;
+extern int __REDIRECT_LDBL_NTH (sscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ ...),
+ __sscanfieee128, __nldbl_sscanf) __wur;
+# else
/* Read formatted input from STREAM.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int fscanf (FILE *__restrict __stream,
- const char *__restrict __format, ...) __wur;
+ const char *__restrict __format, ...) __wur;
/* Read formatted input from stdin.
This function is a possible cancellation point and therefore not
@@ -421,43 +487,81 @@ extern int fscanf (FILE *__restrict __stream,
extern int scanf (const char *__restrict __format, ...) __wur;
/* Read formatted input from S. */
extern int sscanf (const char *__restrict __s,
- const char *__restrict __format, ...) __THROW;
-
-/* For historical reasons, the C99-compliant versions of the scanf
- functions are at alternative names. When __LDBL_COMPAT or
- __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
- bits/stdio-ldbl.h. */
-#include <bits/floatn.h>
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
- && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-# ifdef __REDIRECT
-extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
- const char *__restrict __format, ...),
- __isoc99_fscanf) __wur;
-extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
- __isoc99_scanf) __wur;
-extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
- const char *__restrict __format, ...),
- __isoc99_sscanf);
-# else
-extern int __isoc99_fscanf (FILE *__restrict __stream,
- const char *__restrict __format, ...) __wur;
-extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
-extern int __isoc99_sscanf (const char *__restrict __s,
- const char *__restrict __format, ...) __THROW;
-# define fscanf __isoc99_fscanf
-# define scanf __isoc99_scanf
-# define sscanf __isoc99_sscanf
+ const char *__restrict __format, ...) __THROW;
# endif
-#endif
+#endif /* DEPRECATED_SCANF */
-#ifdef __USE_ISOC99
+#ifdef __USE_ISOC99
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vfscanfieee128, __nldbl___isoc99_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vscanfieee128, __nldbl___isoc99_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_LDBL_NTH (vsscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vsscanfieee128, __nldbl___isoc99_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (vfscanf,
+ (FILE *__restrict __s,
+ const char *__restrict __format, __gnuc_va_list __arg),
+ __isoc99_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_NTH (vsscanf,
+ (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __isoc99_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
+extern int __isoc99_vfscanf (FILE *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg) __wur;
+extern int __isoc99_vscanf (const char *__restrict __format,
+ __gnuc_va_list __arg) __wur;
+extern int __isoc99_vsscanf (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg) __THROW;
+# define vfscanf __isoc99_vfscanf
+# define vscanf __isoc99_vscanf
+# define vsscanf __isoc99_vsscanf
+# endif /* __REDIRECT */
+# endif
+# else /* DEPRECATED_SCANF */
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfscanf, (FILE *__restrict __stream,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vfscanfieee128, __nldbl_vfscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT_LDBL (vscanf, (const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vscanfieee128, __nldbl_vscanf)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT_LDBL_NTH (vsscanf, (const char *__restrict __s,
+ const char *__restrict __format,
+ __gnuc_va_list __arg),
+ __vsscanfieee128, __nldbl_vsscanf)
+ __attribute__ ((__format__ (__scanf__, 2, 0)));
+# else
/* Read formatted input from S into argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg)
+ __gnuc_va_list __arg)
__attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
/* Read formatted input from stdin into argument list ARG.
@@ -469,42 +573,11 @@ extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
/* Read formatted input from S into argument list ARG. */
extern int vsscanf (const char *__restrict __s,
- const char *__restrict __format, __gnuc_va_list __arg)
+ const char *__restrict __format, __gnuc_va_list __arg)
__THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
-
-/* Same redirection as above for the v*scanf family. */
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __REDIRECT && !defined __LDBL_COMPAT \
- && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-extern int __REDIRECT (vfscanf,
- (FILE *__restrict __s,
- const char *__restrict __format, __gnuc_va_list __arg),
- __isoc99_vfscanf)
- __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
-extern int __REDIRECT (vscanf, (const char *__restrict __format,
- __gnuc_va_list __arg), __isoc99_vscanf)
- __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
-extern int __REDIRECT_NTH (vsscanf,
- (const char *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg), __isoc99_vsscanf)
- __attribute__ ((__format__ (__scanf__, 2, 0)));
-# elif !defined __REDIRECT
-extern int __isoc99_vfscanf (FILE *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg) __wur;
-extern int __isoc99_vscanf (const char *__restrict __format,
- __gnuc_va_list __arg) __wur;
-extern int __isoc99_vsscanf (const char *__restrict __s,
- const char *__restrict __format,
- __gnuc_va_list __arg) __THROW;
-# define vfscanf __isoc99_vfscanf
-# define vscanf __isoc99_vscanf
-# define vsscanf __isoc99_vsscanf
# endif
# endif
-#endif /* Use ISO C9x. */
-
+#endif /* __USE_ISOC99 */
/* Read a character from STREAM.
@@ -850,13 +923,17 @@ extern char *cuserid (char *__s)
struct obstack; /* See <obstack.h>. */
/* Write formatted output to an obstack. */
-extern int obstack_printf (struct obstack *__restrict __obstack,
- const char *__restrict __format, ...)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 3)));
-extern int obstack_vprintf (struct obstack *__restrict __obstack,
- const char *__restrict __format,
- __gnuc_va_list __args)
- __THROWNL __attribute__ ((__format__ (__printf__, 2, 0)));
+extern int __REDIRECT_LDBL_NTHNL (obstack_printf,
+ (struct obstack *__restrict __obstack,
+ const char *__restrict __format, ...),
+ __obstack_printfieee128, __nldbl_obstack_printf)
+ __attribute__ ((__format__ (__printf__, 2, 3)));
+extern int __REDIRECT_LDBL_NTHNL (obstack_vprintf,
+ (struct obstack *__restrict __obstack,
+ const char *__restrict __format,
+ __gnuc_va_list __args),
+ __obstack_vprintfieee128, __nldbl_obstack_vprintf)
+ __attribute__ ((__format__ (__printf__, 2, 0)));
#endif /* Use GNU. */
@@ -894,11 +971,6 @@ extern int __overflow (FILE *, int);
# include <bits/stdio2.h>
#endif
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/stdio-ldbl.h>
-#endif
-
__END_DECLS
#endif /* <stdio.h> included. */
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index 0299fe99a7..e1f68bddfb 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -17,6 +17,7 @@
not, see <https://www.gnu.org/licenses/>. */
#define __mremap mremap
+#define __fprintf fprintf
#include "malloc.c"
/* When memory is tagged, the checking data is stored in the user part
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 1a1ac1d8f0..f5a6d87160 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5279,9 +5279,9 @@ __malloc_stats (void)
memset (&mi, 0, sizeof (mi));
__libc_lock_lock (ar_ptr->mutex);
int_mallinfo (ar_ptr, &mi);
- fprintf (stderr, "Arena %d:\n", i);
- fprintf (stderr, "system bytes = %10u\n", (unsigned int) mi.arena);
- fprintf (stderr, "in use bytes = %10u\n", (unsigned int) mi.uordblks);
+ __fprintf (stderr, "Arena %d:\n", i);
+ __fprintf (stderr, "system bytes = %10u\n", (unsigned int) mi.arena);
+ __fprintf (stderr, "in use bytes = %10u\n", (unsigned int) mi.uordblks);
#if MALLOC_DEBUG > 1
if (i > 0)
dump_heap (heap_for_ptr (top (ar_ptr)));
@@ -5293,12 +5293,12 @@ __malloc_stats (void)
if (ar_ptr == &main_arena)
break;
}
- fprintf (stderr, "Total (incl. mmap):\n");
- fprintf (stderr, "system bytes = %10u\n", system_b);
- fprintf (stderr, "in use bytes = %10u\n", in_use_b);
- fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps);
- fprintf (stderr, "max mmap bytes = %10lu\n",
- (unsigned long) mp_.max_mmapped_mem);
+ __fprintf (stderr, "Total (incl. mmap):\n");
+ __fprintf (stderr, "system bytes = %10u\n", system_b);
+ __fprintf (stderr, "in use bytes = %10u\n", in_use_b);
+ __fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps);
+ __fprintf (stderr, "max mmap bytes = %10lu\n",
+ (unsigned long) mp_.max_mmapped_mem);
stderr->_flags2 = old_flags2;
_IO_funlockfile (stderr);
}
@@ -5729,7 +5729,7 @@ __malloc_info (int options, FILE *fp)
mstate ar_ptr = &main_arena;
do
{
- fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
+ __fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
size_t nblocks = 0;
size_t nfastblocks = 0;
@@ -5840,12 +5840,12 @@ __malloc_info (int options, FILE *fp)
for (size_t i = 0; i < nsizes; ++i)
if (sizes[i].count != 0 && i != NFASTBINS)
- fprintf (fp, "\
+ __fprintf (fp, "\
<size from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
sizes[i].from, sizes[i].to, sizes[i].total, sizes[i].count);
if (sizes[NFASTBINS].count != 0)
- fprintf (fp, "\
+ __fprintf (fp, "\
<unsorted from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
sizes[NFASTBINS].from, sizes[NFASTBINS].to,
sizes[NFASTBINS].total, sizes[NFASTBINS].count);
@@ -5853,7 +5853,7 @@ __malloc_info (int options, FILE *fp)
total_system += ar_ptr->system_mem;
total_max_system += ar_ptr->max_system_mem;
- fprintf (fp,
+ __fprintf (fp,
"</sizes>\n<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
"<system type=\"current\" size=\"%zu\"/>\n"
@@ -5863,7 +5863,7 @@ __malloc_info (int options, FILE *fp)
if (ar_ptr != &main_arena)
{
- fprintf (fp,
+ __fprintf (fp,
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n"
"<aspace type=\"subheaps\" size=\"%zu\"/>\n",
@@ -5873,7 +5873,7 @@ __malloc_info (int options, FILE *fp)
}
else
{
- fprintf (fp,
+ __fprintf (fp,
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n",
ar_ptr->system_mem, ar_ptr->system_mem);
@@ -5886,7 +5886,7 @@ __malloc_info (int options, FILE *fp)
}
while (ar_ptr != &main_arena);
- fprintf (fp,
+ __fprintf (fp,
"<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"mmap\" count=\"%d\" size=\"%zu\"/>\n"
diff --git a/misc/efgcvt-template.c b/misc/efgcvt-template.c
index 87a90e78d4..f1630fd780 100644
--- a/misc/efgcvt-template.c
+++ b/misc/efgcvt-template.c
@@ -24,7 +24,7 @@
#include <math_ldbl_opt.h>
#ifndef SPRINTF
-# define SPRINTF sprintf
+# define SPRINTF __sprintf
#endif
#define APPEND(a, b) APPEND2 (a, b)
diff --git a/misc/mntent_r.c b/misc/mntent_r.c
index 3311ba0b50..65f29b97e9 100644
--- a/misc/mntent_r.c
+++ b/misc/mntent_r.c
@@ -251,7 +251,7 @@ __addmntent (FILE *stream, const struct mntent *mnt)
write_string (stream, mnt->mnt_dir);
write_string (stream, mnt->mnt_type);
write_string (stream, mnt->mnt_opts);
- fprintf (stream, "%d %d\n", mnt->mnt_freq, mnt->mnt_passno);
+ __fprintf (stream, "%d %d\n", mnt->mnt_freq, mnt->mnt_passno);
ret = __ferror_unlocked (stream) != 0 || fflush (stream) != 0;
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 44d3826bca..e43b5d4b36 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -560,6 +560,54 @@
# include <bits/long-double.h>
#endif
+#if (defined __GNUC__ && __GNUC__ >= 2) || (__clang_major__ >= 4)
+# define __REDIRECT_LDBL1(name, prenth, posnth, proto, alias) \
+ name proto prenth __asm__ (__ASMNAME (__ASMNAME (#alias))) posnth
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+# ifdef __REDIRECT
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , , proto, ieee128)
+# ifdef __cplusplus
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROW, , proto, ieee128)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROWNL, , proto, ieee128)
+# else
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROW, proto, ieee128)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROWNL, proto, ieee128)
+# endif /* __cplusplus */
+# else
+_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
+# endif /* __REDIRECT */
+# elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
+# ifdef __REDIRECT
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , , proto, compat)
+# ifdef __cplusplus
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROW, , proto, compat)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, __THROWNL, , proto, compat)
+# else
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROW, proto, compat)
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
+ __REDIRECT_LDBL1 (name, , __THROWNL, proto, compat)
+# endif /* __cplusplus */
+# else
+_Static_assert (0, "Compat long double requires redirection on this platform");
+# endif /* __REDIRECT */
+# endif
+#endif
+
+#ifndef __REDIRECT_LDBL
+# define __REDIRECT_LDBL(name, proto, ieee128, compat) name proto
+# define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) name proto __THROW
+# define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) name proto __THROWNL
+#endif
+
#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
# ifdef __REDIRECT
@@ -583,10 +631,6 @@
# define __REDIRECT_NTH_LDBL(name, proto, alias) \
__LDBL_REDIR1_NTH (name, proto, __##alias##ieee128)
-/* Unused. */
-# define __REDIRECT_LDBL(name, proto, alias) ... unused__redirect_ldbl
-# define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth
-
# else
_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
# endif
@@ -605,24 +649,6 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf
extern __typeof (name) name __asm (__ASMNAME (#alias));
# define __LDBL_REDIR_DECL(name) \
extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name));
-# define __REDIRECT_LDBL(name, proto, alias) \
- __LDBL_REDIR1 (name, proto, __nldbl_##alias)
-# define __REDIRECT_NTH_LDBL(name, proto, alias) \
- __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias)
-# endif
-#endif
-#if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \
- || !defined __REDIRECT
-# define __LDBL_REDIR1(name, proto, alias) name proto
-# define __LDBL_REDIR(name, proto) name proto
-# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW
-# define __LDBL_REDIR_NTH(name, proto) name proto __THROW
-# define __LDBL_REDIR2_DECL(name)
-# define __LDBL_REDIR_DECL(name)
-# ifdef __REDIRECT
-# define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias)
-# define __REDIRECT_NTH_LDBL(name, proto, alias) \
- __REDIRECT_NTH (name, proto, alias)
# endif
#endif
diff --git a/misc/syslog.c b/misc/syslog.c
index ee83b1bb76..0076361f6c 100644
--- a/misc/syslog.c
+++ b/misc/syslog.c
@@ -200,7 +200,7 @@ __vsyslog_internal(int pri, const char *fmt, va_list ap,
else
{
__fsetlocking (f, FSETLOCKING_BYCALLER);
- fprintf (f, "<%d>", pri);
+ __fprintf (f, "<%d>", pri);
now = time_now ();
f->_IO_write_ptr += __strftime_l (f->_IO_write_ptr,
f->_IO_write_end
@@ -214,7 +214,7 @@ __vsyslog_internal(int pri, const char *fmt, va_list ap,
if (LogTag != NULL)
__fputs_unlocked (LogTag, f);
if (LogStat & LOG_PID)
- fprintf (f, "[%d]", (int) __getpid ());
+ __fprintf (f, "[%d]", (int) __getpid ());
if (LogTag != NULL)
{
__putc_unlocked (':', f);
diff --git a/nis/nis_subr.c b/nis/nis_subr.c
index 385f221062..0e02cd19b5 100644
--- a/nis/nis_subr.c
+++ b/nis/nis_subr.c
@@ -280,10 +280,10 @@ nis_getnames (const_nis_name name)
}
if (pos == 0
- && __asprintf (&getnames[pos++], "%s%s%s%s",
- name, name[name_len - 1] == '.' ? "" : ".",
- local_domain,
- local_domain[local_domain_len - 1] == '.' ? "" : ".") < 0)
+ && asprintf (&getnames[pos++], "%s%s%s%s",
+ name, name[name_len - 1] == '.' ? "" : ".",
+ local_domain,
+ local_domain[local_domain_len - 1] == '.' ? "" : ".") < 0)
goto free_null;
getnames[pos] = NULL;
diff --git a/nptl/pthread_getname.c b/nptl/pthread_getname.c
index ebec06e23f..a424b3e4f8 100644
--- a/nptl/pthread_getname.c
+++ b/nptl/pthread_getname.c
@@ -42,7 +42,7 @@ __pthread_getname_np (pthread_t th, char *buf, size_t len)
#define FMT "/proc/self/task/%u/comm"
char fname[sizeof (FMT) + 8];
- sprintf (fname, FMT, (unsigned int) pd->tid);
+ __sprintf (fname, FMT, (unsigned int) pd->tid);
int fd = __open64_nocancel (fname, O_RDONLY);
if (fd == -1)
diff --git a/nptl/pthread_setname.c b/nptl/pthread_setname.c
index f24560db47..8520bac4be 100644
--- a/nptl/pthread_setname.c
+++ b/nptl/pthread_setname.c
@@ -44,7 +44,7 @@ __pthread_setname_np (pthread_t th, const char *name)
#define FMT "/proc/self/task/%u/comm"
char fname[sizeof (FMT) + 8];
- sprintf (fname, FMT, (unsigned int) pd->tid);
+ __sprintf (fname, FMT, (unsigned int) pd->tid);
int fd = __open64_nocancel (fname, O_RDWR);
if (fd == -1)
diff --git a/pwd/getpw.c b/pwd/getpw.c
index 547489a863..4784eaf00b 100644
--- a/pwd/getpw.c
+++ b/pwd/getpw.c
@@ -50,9 +50,9 @@ __getpw (__uid_t uid, char *buf)
if (p == NULL)
return -1;
- if (sprintf (buf, "%s:%s:%lu:%lu:%s:%s:%s", p->pw_name, p->pw_passwd,
- (unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
- p->pw_gecos, p->pw_dir, p->pw_shell) < 0)
+ if (__sprintf (buf, "%s:%s:%lu:%lu:%s:%s:%s", p->pw_name, p->pw_passwd,
+ (unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
+ p->pw_gecos, p->pw_dir, p->pw_shell) < 0)
return -1;
return 0;
diff --git a/pwd/putpwent.c b/pwd/putpwent.c
index e3f2f4e09e..480dd59813 100644
--- a/pwd/putpwent.c
+++ b/pwd/putpwent.c
@@ -48,11 +48,11 @@ putpwent (const struct passwd *p, FILE *stream)
return -1;
if (p->pw_name[0] == '+' || p->pw_name[0] == '-')
- ret = fprintf (stream, "%s:%s:::%s:%s:%s\n",
+ ret = __fprintf (stream, "%s:%s:::%s:%s:%s\n",
p->pw_name, _S (p->pw_passwd),
gecos, _S (p->pw_dir), _S (p->pw_shell));
else
- ret = fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
+ ret = __fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
p->pw_name, _S (p->pw_passwd),
(unsigned long int) p->pw_uid,
(unsigned long int) p->pw_gid,
diff --git a/resolv/inet_ntop.c b/resolv/inet_ntop.c
index c4d38c0f95..53725d805a 100644
--- a/resolv/inet_ntop.c
+++ b/resolv/inet_ntop.c
@@ -28,9 +28,9 @@
#include <string.h>
#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
+# define SPRINTF(x) strlen(__sprintf/**/x)
#else
-# define SPRINTF(x) ((size_t)sprintf x)
+# define SPRINTF(x) ((size_t)__sprintf x)
#endif
/*
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index 913a5cb82f..06a91b23ca 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -507,8 +507,8 @@ _nss_dns_gethostbyaddr2_r (const void *addr, socklen_t len, int af,
switch (af)
{
case AF_INET:
- sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", (uaddr[3] & 0xff),
- (uaddr[2] & 0xff), (uaddr[1] & 0xff), (uaddr[0] & 0xff));
+ __sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", (uaddr[3] & 0xff),
+ (uaddr[2] & 0xff), (uaddr[1] & 0xff), (uaddr[0] & 0xff));
break;
case AF_INET6:
qp = qbuf;
diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
index 09cd917444..304ae35b8b 100644
--- a/resolv/nss_dns/dns-network.c
+++ b/resolv/nss_dns/dns-network.c
@@ -191,21 +191,21 @@ _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result,
{
case 3:
/* Class A network. */
- sprintf (qbuf, "0.0.0.%u.in-addr.arpa", net_bytes[3]);
+ __sprintf (qbuf, "0.0.0.%u.in-addr.arpa", net_bytes[3]);
break;
case 2:
/* Class B network. */
- sprintf (qbuf, "0.0.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2]);
+ __sprintf (qbuf, "0.0.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2]);
break;
case 1:
/* Class C network. */
- sprintf (qbuf, "0.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
- net_bytes[1]);
+ __sprintf (qbuf, "0.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
+ net_bytes[1]);
break;
case 0:
/* Class D - E network. */
- sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
- net_bytes[1], net_bytes[0]);
+ __sprintf (qbuf, "%u.%u.%u.%u.in-addr.arpa", net_bytes[3], net_bytes[2],
+ net_bytes[1], net_bytes[0]);
break;
}
diff --git a/shadow/putspent.c b/shadow/putspent.c
index cbbb840d5b..d675e28210 100644
--- a/shadow/putspent.c
+++ b/shadow/putspent.c
@@ -42,47 +42,47 @@ putspent (const struct spwd *p, FILE *stream)
flockfile (stream);
- if (fprintf (stream, "%s:%s:", p->sp_namp, _S (p->sp_pwdp)) < 0)
+ if (__fprintf (stream, "%s:%s:", p->sp_namp, _S (p->sp_pwdp)) < 0)
++errors;
if ((p->sp_lstchg != (long int) -1
- && fprintf (stream, "%ld:", p->sp_lstchg) < 0)
+ && __fprintf (stream, "%ld:", p->sp_lstchg) < 0)
|| (p->sp_lstchg == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_min != (long int) -1
- && fprintf (stream, "%ld:", p->sp_min) < 0)
+ && __fprintf (stream, "%ld:", p->sp_min) < 0)
|| (p->sp_min == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_max != (long int) -1
- && fprintf (stream, "%ld:", p->sp_max) < 0)
+ && __fprintf (stream, "%ld:", p->sp_max) < 0)
|| (p->sp_max == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_warn != (long int) -1
- && fprintf (stream, "%ld:", p->sp_warn) < 0)
+ && __fprintf (stream, "%ld:", p->sp_warn) < 0)
|| (p->sp_warn == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_inact != (long int) -1
- && fprintf (stream, "%ld:", p->sp_inact) < 0)
+ && __fprintf (stream, "%ld:", p->sp_inact) < 0)
|| (p->sp_inact == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if ((p->sp_expire != (long int) -1
- && fprintf (stream, "%ld:", p->sp_expire) < 0)
+ && __fprintf (stream, "%ld:", p->sp_expire) < 0)
|| (p->sp_expire == (long int) -1
&& putc_unlocked (':', stream) == EOF))
++errors;
if (p->sp_flag != ~0ul
- && fprintf (stream, "%ld", p->sp_flag) < 0)
+ && __fprintf (stream, "%ld", p->sp_flag) < 0)
++errors;
if (putc_unlocked ('\n', stream) == EOF)
diff --git a/stdio-common/dprintf.c b/stdio-common/dprintf.c
index 2e26d59714..6fbe5d4862 100644
--- a/stdio-common/dprintf.c
+++ b/stdio-common/dprintf.c
@@ -33,5 +33,4 @@ __dprintf (int d, const char *format, ...)
return done;
}
libc_hidden_def (__dprintf)
-ldbl_hidden_def (__dprintf, dprintf)
ldbl_weak_alias (__dprintf, dprintf)
diff --git a/stdio-common/fprintf.c b/stdio-common/fprintf.c
index 8d2cd37433..af7190c5b4 100644
--- a/stdio-common/fprintf.c
+++ b/stdio-common/fprintf.c
@@ -34,7 +34,7 @@ __fprintf (FILE *stream, const char *format, ...)
return done;
}
-ldbl_hidden_def (__fprintf, fprintf)
+libc_hidden_def (__fprintf)
ldbl_strong_alias (__fprintf, fprintf)
/* We define the function with the real name here. But deep down in
diff --git a/stdio-common/psiginfo.c b/stdio-common/psiginfo.c
index adf3b71b77..f99c51da17 100644
--- a/stdio-common/psiginfo.c
+++ b/stdio-common/psiginfo.c
@@ -76,7 +76,7 @@ psiginfo (const siginfo_t *pinfo, const char *s)
}
if (s != NULL && *s != '\0')
- fprintf (fp, "%s: ", s);
+ __fprintf (fp, "%s: ", s);
const char *desc;
if (pinfo->si_signo >= 0 && pinfo->si_signo < NSIG
@@ -92,21 +92,21 @@ psiginfo (const siginfo_t *pinfo, const char *s)
if (pinfo->si_signo - SIGRTMIN < SIGRTMAX - pinfo->si_signo)
{
if (pinfo->si_signo == SIGRTMIN)
- fprintf (fp, "SIGRTMIN (");
+ __fprintf (fp, "SIGRTMIN (");
else
- fprintf (fp, "SIGRTMIN+%d (", pinfo->si_signo - SIGRTMIN);
+ __fprintf (fp, "SIGRTMIN+%d (", pinfo->si_signo - SIGRTMIN);
}
else
{
if (pinfo->si_signo == SIGRTMAX)
- fprintf (fp, "SIGRTMAX (");
+ __fprintf (fp, "SIGRTMAX (");
else
- fprintf (fp, "SIGRTMAX-%d (", SIGRTMAX - pinfo->si_signo);
+ __fprintf (fp, "SIGRTMAX-%d (", SIGRTMAX - pinfo->si_signo);
}
}
else
#endif
- fprintf (fp, "%s (", _(desc));
+ __fprintf (fp, "%s (", _(desc));
const char *base = NULL;
const uint8_t *offarr = NULL;
@@ -178,25 +178,25 @@ Signal generated by the completion of an I/O request");
}
if (str != NULL)
- fprintf (fp, "%s ", _(str));
+ __fprintf (fp, "%s ", _(str));
else
- fprintf (fp, "%d ", pinfo->si_code);
+ __fprintf (fp, "%d ", pinfo->si_code);
if (pinfo->si_signo == SIGILL || pinfo->si_signo == SIGFPE
|| pinfo->si_signo == SIGSEGV || pinfo->si_signo == SIGBUS)
- fprintf (fp, "[%p])\n", pinfo->si_addr);
+ __fprintf (fp, "[%p])\n", pinfo->si_addr);
else if (pinfo->si_signo == SIGCHLD)
- fprintf (fp, "%ld %d %ld)\n",
- (long int) pinfo->si_pid, pinfo->si_status,
- (long int) pinfo->si_uid);
+ __fprintf (fp, "%ld %d %ld)\n",
+ (long int) pinfo->si_pid, pinfo->si_status,
+ (long int) pinfo->si_uid);
else if (pinfo->si_signo == SIGPOLL)
- fprintf (fp, "%ld)\n", (long int) pinfo->si_band);
+ __fprintf (fp, "%ld)\n", (long int) pinfo->si_band);
else
- fprintf (fp, "%ld %ld)\n",
- (long int) pinfo->si_pid, (long int) pinfo->si_uid);
+ __fprintf (fp, "%ld %ld)\n",
+ (long int) pinfo->si_pid, (long int) pinfo->si_uid);
}
else
- fprintf (fp, _("Unknown signal %d\n"), pinfo->si_signo);
+ __fprintf (fp, _("Unknown signal %d\n"), pinfo->si_signo);
fclose (fp);
diff --git a/stdio-common/sprintf.c b/stdio-common/sprintf.c
index a9665f753a..f1f43a49ec 100644
--- a/stdio-common/sprintf.c
+++ b/stdio-common/sprintf.c
@@ -32,6 +32,6 @@ __sprintf (char *s, const char *format, ...)
return done;
}
-ldbl_hidden_def (__sprintf, sprintf)
+libc_hidden_def (__sprintf)
ldbl_strong_alias (__sprintf, sprintf)
ldbl_strong_alias (__sprintf, _IO_sprintf)
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 7559fd239d..c5912788bd 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -24,4 +24,4 @@ __vfprintf (FILE *fp, const char *format, va_list ap)
}
ldbl_strong_alias (__vfprintf, _IO_vfprintf);
ldbl_strong_alias (__vfprintf, vfprintf);
-ldbl_hidden_def (__vfprintf, vfprintf)
+libc_hidden_def (__vfprintf)
diff --git a/sunrpc/netname.c b/sunrpc/netname.c
index bf7f0b81c4..97a881c3af 100644
--- a/sunrpc/netname.c
+++ b/sunrpc/netname.c
@@ -48,7 +48,7 @@ user2netname (char netname[MAXNETNAMELEN + 1], const uid_t uid,
if ((strlen (dfltdom) + OPSYS_LEN + 3 + MAXIPRINT) > (size_t) MAXNETNAMELEN)
return 0;
- sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
+ __sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
i = strlen (netname);
if (netname[i - 1] == '.')
netname[i - 1] = '\0';
@@ -112,7 +112,7 @@ host2netname (char netname[MAXNETNAMELEN + 1], const char *host,
> MAXNETNAMELEN)
return 0;
- sprintf (netname, "%s.%s@%s", OPSYS, hostname, domainname);
+ __sprintf (netname, "%s.%s@%s", OPSYS, hostname, domainname);
return 1;
}
#ifdef EXPORT_RPC_SYMBOLS
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
index f683836678..59f6e31d2d 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128___asprintf (char **string_ptr, const char *format, ...)
+int
+__asprintfieee128 (char **string_ptr, const char *format, ...)
{
va_list ap;
int done;
@@ -32,5 +32,4 @@ ___ieee128___asprintf (char **string_ptr, const char *format, ...)
return done;
}
-hidden_def (___ieee128___asprintf)
-strong_alias (___ieee128___asprintf, __asprintfieee128)
+libc_hidden_def (__asprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
index cf3b46c37a..ceba219dc7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_dprintf (int d, const char *format, ...)
+int
+__dprintfieee128 (int d, const char *format, ...)
{
va_list ap;
int done;
@@ -31,5 +31,4 @@ ___ieee128_dprintf (int d, const char *format, ...)
return done;
}
-strong_alias (___ieee128_dprintf, __dprintfieee128)
-hidden_def (___ieee128_dprintf);
+libc_hidden_def (__dprintfieee128);
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
index 4462588675..b58f27afb7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_fprintf (FILE *fp, const char *format, ...)
+int
+__fprintfieee128 (FILE *fp, const char *format, ...)
{
va_list ap;
int done;
@@ -31,5 +31,4 @@ ___ieee128_fprintf (FILE *fp, const char *format, ...)
return done;
}
-strong_alias (___ieee128_fprintf, __fprintfieee128)
-hidden_def (___ieee128_fprintf)
+libc_hidden_def (__fprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
index 9703069b95..243eb65629 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
@@ -18,8 +18,8 @@
/* When in IEEE long double mode, call ___ieee128_sprintf. */
#include <stdio.h>
-typeof (sprintf) ___ieee128_sprintf attribute_hidden;
-#define SPRINTF ___ieee128_sprintf
+typeof (sprintf) __sprintfieee128 attribute_hidden;
+#define SPRINTF __sprintfieee128
/* Declare internal functions: ___qecvtieee128_r and ___qfcvtieee128_r,
built from a different compiling unit, and called from here. */
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
index 0be5bb2810..8046f5fd46 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt_r.c
@@ -18,8 +18,8 @@
/* When in IEEE long double mode, call ___ieee128_snprintf. */
#include <stdio.h>
-typeof (snprintf) ___ieee128_snprintf attribute_hidden;
-#define SNPRINTF ___ieee128_snprintf
+typeof (snprintf) __snprintfieee128 attribute_hidden;
+#define SNPRINTF __snprintfieee128
#define ECVT_R __qecvtieee128_r
#define FCVT_R __qfcvtieee128_r
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
index 5f51b3ec9e..da3d9441d7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_snprintf (char *s, size_t maxlen, const char *format, ...)
+int
+__snprintfieee128 (char *s, size_t maxlen, const char *format, ...)
{
va_list ap;
int done;
@@ -32,4 +32,4 @@ ___ieee128_snprintf (char *s, size_t maxlen, const char *format, ...)
return done;
}
-strong_alias (___ieee128_snprintf, __snprintfieee128)
+libc_hidden_def (__snprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
index 0cad130788..007a71659a 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
@@ -19,8 +19,8 @@
#include <stdarg.h>
#include <libio/libioP.h>
-extern int
-___ieee128_sprintf (char *s, const char *format, ...)
+int
+__sprintfieee128 (char *s, const char *format, ...)
{
va_list ap;
int done;
@@ -32,5 +32,4 @@ ___ieee128_sprintf (char *s, const char *format, ...)
return done;
}
-strong_alias (___ieee128_sprintf, __sprintfieee128)
-hidden_def (___ieee128_sprintf)
+libc_hidden_def (__sprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
index e340c9b457..4df1e485a5 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
@@ -18,10 +18,9 @@
#include <libio/libioP.h>
-extern int
-___ieee128_vfprintf (FILE *fp, const char *format, va_list ap)
+int
+__vfprintfieee128 (FILE *fp, const char *format, va_list ap)
{
return __vfprintf_internal (fp, format, ap, PRINTF_LDBL_USES_FLOAT128);
}
-strong_alias (___ieee128_vfprintf, __vfprintfieee128)
-hidden_def (___ieee128_vfprintf)
+libc_hidden_def (__vfprintfieee128)
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
index ebd2a43951..5b167d45ff 100644
--- a/sysdeps/posix/tempname.c
+++ b/sysdeps/posix/tempname.c
@@ -161,7 +161,7 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
return -1;
}
- sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
+ __sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
return 0;
}
#endif /* _LIBC */
diff --git a/sysdeps/unix/sysv/linux/ia64/makecontext.c b/sysdeps/unix/sysv/linux/ia64/makecontext.c
index 0bc4211dfc..0cf05d5999 100644
--- a/sysdeps/unix/sysv/linux/ia64/makecontext.c
+++ b/sysdeps/unix/sysv/linux/ia64/makecontext.c
@@ -54,7 +54,7 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
if (argc > 8)
{
- fprintf (stderr, _("\
+ __fprintf (stderr, _("\
makecontext: does not know how to handle more than 8 arguments\n"));
exit (-1);
}
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index 0e017f458b..f2dca7711a 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -233,10 +233,13 @@ extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
const wchar_t *__restrict __format, ...)
__THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
-extern int __REDIRECT_NTH_LDBL (__swprintf_alias,
- (wchar_t *__restrict __s, size_t __n,
- const wchar_t *__restrict __fmt, ...),
- swprintf);
+extern int __swprintf_alias (wchar_t *__restrict __s, size_t __n,
+ const wchar_t *__restrict __fmt, ...)
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+ __asm__ (__ASMNAME ("swprintf"))
+#endif
+ ;
+
#ifdef __va_arg_pack
__fortify_function int
@@ -264,10 +267,13 @@ extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
__gnuc_va_list __arg)
__THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-extern int __REDIRECT_NTH_LDBL (__vswprintf_alias,
- (wchar_t *__restrict __s, size_t __n,
- const wchar_t *__restrict __fmt,
- __gnuc_va_list __ap), vswprintf);
+extern int __vswprintf_alias (wchar_t *__restrict __s, size_t __n,
+ const wchar_t *__restrict __fmt,
+ __gnuc_va_list __ap)
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+ __asm__ (__ASMNAME ("vswprintf"))
+#endif
+ ;
__fortify_function int
__NTH (vswprintf (wchar_t *__restrict __s, size_t __n,