1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

Add internal implementations for argp.h, err.h, and error.h functions

Since the introduction of explicit flags in the internal implementation
of the printf family of functions, the 'mode' parameter can be used to
select which format long double parameters have (with the mode flag:
PRINTF_LDBL_IS_DBL).  This patch uses this feature in the implementation
of some functions in argp.h, err.h, and error.h (only those that take a
format string and positional parameters).  Future patches will add
support for 'nldbl' and 'ieee128' versions of these functions.

Tested for powerpc64le and x86_64.
This commit is contained in:
Gabriel F. T. Gomes
2018-06-06 11:48:49 -03:00
parent dc0afac325
commit f43b8dd555
6 changed files with 111 additions and 44 deletions

View File

@ -38,19 +38,20 @@ extern char *__progname;
}
void
vwarnx (const char *format, __gnuc_va_list ap)
__vwarnx_internal (const char *format, __gnuc_va_list ap,
unsigned int mode_flags)
{
flockfile (stderr);
__fxprintf (stderr, "%s: ", __progname);
if (format != NULL)
__vfxprintf (stderr, format, ap);
__vfxprintf (stderr, format, ap, mode_flags);
__fxprintf (stderr, "\n");
funlockfile (stderr);
}
libc_hidden_def (vwarnx)
void
vwarn (const char *format, __gnuc_va_list ap)
__vwarn_internal (const char *format, __gnuc_va_list ap,
unsigned int mode_flags)
{
int error = errno;
@ -58,7 +59,7 @@ vwarn (const char *format, __gnuc_va_list ap)
if (format != NULL)
{
__fxprintf (stderr, "%s: ", __progname);
__vfxprintf (stderr, format, ap);
__vfxprintf (stderr, format, ap, mode_flags);
__set_errno (error);
__fxprintf (stderr, ": %m\n");
}
@ -69,8 +70,20 @@ vwarn (const char *format, __gnuc_va_list ap)
}
funlockfile (stderr);
}
void
vwarn (const char *format, __gnuc_va_list ap)
{
__vwarn_internal (format, ap, 0);
}
libc_hidden_def (vwarn)
void
vwarnx (const char *format, __gnuc_va_list ap)
{
__vwarnx_internal (format, ap, 0);
}
libc_hidden_def (vwarnx)
void
warn (const char *format, ...)