aboutsummaryrefslogtreecommitdiff
path: root/misc/err.c
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gabriel@inconstante.eti.br>2018-06-06 11:48:49 -0300
committerGabriel F. T. Gomes <gabriel@inconstante.eti.br>2019-02-21 10:28:50 -0300
commitf43b8dd55588c32d12a461251e4f7598c5fed97f (patch)
treef4d0ba0396fc8740476256e709075302d7e60d4e /misc/err.c
parentdc0afac3252d0c53716ccaf0b424f7769a66d695 (diff)
downloadglibc-f43b8dd55588c32d12a461251e4f7598c5fed97f.zip
glibc-f43b8dd55588c32d12a461251e4f7598c5fed97f.tar.gz
glibc-f43b8dd55588c32d12a461251e4f7598c5fed97f.tar.bz2
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.
Diffstat (limited to 'misc/err.c')
-rw-r--r--misc/err.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/misc/err.c b/misc/err.c
index 7c8f539..988ec8f 100644
--- a/misc/err.c
+++ b/misc/err.c
@@ -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, ...)