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 17:26:22 -0300
committerGabriel F. T. Gomes <gabriel@inconstante.eti.br>2019-03-01 15:26:36 -0300
commitd11086a9391b6066458947b80c0d0059b6b461d8 (patch)
tree91d537afc5f7a3c50c2b0002ec626de9353abc69 /sysdeps/ieee754/ldbl-opt/nldbl-compat.c
parent90188e7d1adc5d8743d7933c9ed1bf95f91dda62 (diff)
downloadglibc-d11086a9391b6066458947b80c0d0059b6b461d8.tar
glibc-d11086a9391b6066458947b80c0d0059b6b461d8.tar.gz
glibc-d11086a9391b6066458947b80c0d0059b6b461d8.tar.bz2
glibc-d11086a9391b6066458947b80c0d0059b6b461d8.zip
ldbl-opt: Add error and error_at_line (bug 23984)
On platforms where long double may have the same format as double (-mlong-double-64), error and error_at_line do not take that into account and might produce wrong output if a long double conversion is requested by the format string ('%Lf'). This patch adds compatibility functions for this situation and redirects calls via header magic. 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.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-compat.c b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
index 6883814d58..86ac418007 100644
--- a/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
@@ -24,6 +24,7 @@
#include <argp.h>
#include <err.h>
+#include <error.h>
#include <stdarg.h>
#include <stdio.h>
#include <libio/strfile.h>
@@ -1072,6 +1073,27 @@ __nldbl_vwarnx (const char *format, __gnuc_va_list ap)
__vwarnx_internal (format, ap, PRINTF_LDBL_IS_DBL);
}
+void
+__nldbl_error (int status, int errnum, const char *message, ...)
+{
+ va_list ap;
+ va_start (ap, message);
+ __error_internal (status, errnum, message, ap, PRINTF_LDBL_IS_DBL);
+ va_end (ap);
+}
+
+void
+__nldbl_error_at_line (int status, int errnum, const char *file_name,
+ unsigned int line_number, const char *message,
+ ...)
+{
+ va_list ap;
+ va_start (ap, message);
+ __error_at_line_internal (status, errnum, file_name, line_number,
+ message, ap, PRINTF_LDBL_IS_DBL);
+ va_end (ap);
+}
+
#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);