aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gabriel@inconstante.eti.br>2018-08-08 09:58:36 -0300
committerGabriel F. T. Gomes <gabriel@inconstante.eti.br>2019-03-01 15:24:51 -0300
commit90188e7d1adc5d8743d7933c9ed1bf95f91dda62 (patch)
treeb95a92a1f310ed52f9340a905bf1da7835106a3d /sysdeps/ieee754/ldbl-opt/nldbl-compat.c
parentea2d89d01c2be3e87eced8bb51ce5dc66d09ac35 (diff)
downloadglibc-90188e7d1adc5d8743d7933c9ed1bf95f91dda62.tar
glibc-90188e7d1adc5d8743d7933c9ed1bf95f91dda62.tar.gz
glibc-90188e7d1adc5d8743d7933c9ed1bf95f91dda62.tar.bz2
glibc-90188e7d1adc5d8743d7933c9ed1bf95f91dda62.zip
ldbl-opt: Add err, errx, verr, verrx, warn, warnx, vwarn, and vwarnx (bug 23984)
When support for long double format with 128-bits (-mlong-double-128) was added for platforms where long double had the same format as double, such as powerpc, compatibility versions for the functions listed in the commit title were missed. Since the older format of long double can still be used (with -mlong-double-64), using these functions with a format string that requests the printing of long double variables will produce wrong outputs. This patch adds the missing compatibility functions and header magic to redirect calls to them when -mlong-double-64 is in use. Tested for powerpc, powerpc64 and powerpc64le.
Diffstat (limited to 'sysdeps/ieee754/ldbl-opt/nldbl-compat.c')
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-compat.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-compat.c b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
index 4f70207f2d..6883814d58 100644
--- a/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
@@ -23,6 +23,7 @@
#define __GLIBC_USE_DEPRECATED_SCANF 1
#include <argp.h>
+#include <err.h>
#include <stdarg.h>
#include <stdio.h>
#include <libio/strfile.h>
@@ -1011,6 +1012,66 @@ __nldbl_argp_failure (const struct argp_state *state, int status,
va_end (ap);
}
+#define VA_CALL(call) \
+{ \
+ va_list ap; \
+ va_start (ap, format); \
+ call (format, ap, PRINTF_LDBL_IS_DBL); \
+ va_end (ap); \
+}
+
+void
+__nldbl_err (int status, const char *format, ...)
+{
+ VA_CALL (__vwarn_internal)
+ exit (status);
+}
+
+void
+__nldbl_errx (int status, const char *format, ...)
+{
+ VA_CALL (__vwarnx_internal)
+ exit (status);
+}
+
+void
+__nldbl_verr (int status, const char *format, __gnuc_va_list ap)
+{
+ __vwarn_internal (format, ap, PRINTF_LDBL_IS_DBL);
+ exit (status);
+}
+
+void
+__nldbl_verrx (int status, const char *format, __gnuc_va_list ap)
+{
+ __vwarnx_internal (format, ap, PRINTF_LDBL_IS_DBL);
+ exit (status);
+}
+
+void
+__nldbl_warn (const char *format, ...)
+{
+ VA_CALL (__vwarn_internal)
+}
+
+void
+__nldbl_warnx (const char *format, ...)
+{
+ VA_CALL (__vwarnx_internal)
+}
+
+void
+__nldbl_vwarn (const char *format, __gnuc_va_list ap)
+{
+ __vwarn_internal (format, ap, PRINTF_LDBL_IS_DBL);
+}
+
+void
+__nldbl_vwarnx (const char *format, __gnuc_va_list ap)
+{
+ __vwarnx_internal (format, ap, PRINTF_LDBL_IS_DBL);
+}
+
#if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
compat_symbol (libc, __nldbl__IO_printf, _IO_printf, GLIBC_2_0);
compat_symbol (libc, __nldbl__IO_sprintf, _IO_sprintf, GLIBC_2_0);