[PATCH v1 0/7] Add missing nldbl functions to libc

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH v1 0/7] Add missing nldbl functions to libc

Gabriel F. T. Gomes-2
The functions: argp_error and argp_failure (from argp.h); err, errx,
verr, verrx, warn, warnx, vwarn, and vwarnx (from err.h); error and
error_at_line (from error.h); can take long double arguments if
requested by the format string.  However, on platforms where long double
format changed in GLIBC 2.4, a compat function (nldbl) has never been
added.  This patch set adds these functions, as well as header magic to
redirect function calls when user code is built with -mlong-double-64.

The first patch in the set is a fix for the recently integrated rework
to printf and scanf functions, which did not cause test case failures
with the current set of tests in the master branch.  The tests added by
this patch set expose the problem.

The second patch also fixes a problem exposed by the new tests, where
the redirection for strtold causes a problem on a Debian 9 machine,
because /usr/include/powerpc64le-linux-gnu/bits/stdlib-ldbl.h still
contains the __BEGIN_NAMESPACE_C99 and __END_NAMESPACE_C99 macros.

Gabriel F. T. Gomes (7):
  Remove redirection of _IO_vfprintf
  Add *-ldbl.h headers to include/bits
  ldbl-opt: Add arpg_error and argp_failure
  ldbl-opt: Reuse argp tests that print long double
  ldbl-opt: Add err, errx, verr, verrx, warn, warnx, vwarn, and vwarnx
  ldbl-opt: Add error and error_at_line
  ldbl-opt: Reuse test cases from misc/ that check long double

 argp/argp.h                                        |   4 +
 argp/bits/argp-ldbl.h                              |  24 +++++
 include/argp.h                                     |  11 +++
 include/bits/argp-ldbl.h                           |   1 +
 include/bits/err-ldbl.h                            |   1 +
 include/bits/error-ldbl.h                          |   1 +
 include/bits/monetary-ldbl.h                       |   1 +
 include/bits/printf-ldbl.h                         |   1 +
 include/bits/stdio-ldbl.h                          |   1 +
 include/bits/stdlib-ldbl.h                         |   1 +
 include/bits/syslog-ldbl.h                         |   1 +
 include/bits/wchar-ldbl.h                          |   1 +
 include/err.h                                      |   9 ++
 include/error.h                                    |  14 +++
 libio/libio.h                                      |   1 -
 misc/bits/err-ldbl.h                               |  30 ++++++
 misc/bits/error-ldbl.h                             |  24 +++++
 misc/err.h                                         |   4 +
 misc/error.h                                       |  12 ++-
 misc/tst-ldbl-error.c                              |  25 ++---
 misc/tst-ldbl-warn.c                               |  20 ++--
 sysdeps/ieee754/ldbl-opt/Makefile                  |  26 ++++++
 sysdeps/ieee754/ldbl-opt/Versions                  |   6 ++
 sysdeps/ieee754/ldbl-opt/nldbl-compat.c            | 104 +++++++++++++++++++++
 sysdeps/ieee754/ldbl-opt/nldbl-compat.h            |  15 +++
 sysdeps/unix/sysv/linux/alpha/libc.abilist         |  12 +++
 .../sysv/linux/powerpc/powerpc32/fpu/libc.abilist  |  12 +++
 .../linux/powerpc/powerpc32/nofpu/libc.abilist     |  12 +++
 .../sysv/linux/powerpc/powerpc64/libc-le.abilist   |  12 +++
 .../unix/sysv/linux/powerpc/powerpc64/libc.abilist |  12 +++
 sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist  |  12 +++
 sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist  |  12 +++
 sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist |  12 +++
 33 files changed, 412 insertions(+), 22 deletions(-)
 create mode 100644 argp/bits/argp-ldbl.h
 create mode 100644 include/bits/argp-ldbl.h
 create mode 100644 include/bits/err-ldbl.h
 create mode 100644 include/bits/error-ldbl.h
 create mode 100644 include/bits/monetary-ldbl.h
 create mode 100644 include/bits/printf-ldbl.h
 create mode 100644 include/bits/stdio-ldbl.h
 create mode 100644 include/bits/stdlib-ldbl.h
 create mode 100644 include/bits/syslog-ldbl.h
 create mode 100644 include/bits/wchar-ldbl.h
 create mode 100644 misc/bits/err-ldbl.h
 create mode 100644 misc/bits/error-ldbl.h

--
2.14.5

Reply | Threaded
Open this post in threaded view
|

[PATCH v1 1/7] Remove redirection of _IO_vfprintf

Gabriel F. T. Gomes-2
Since the commit

commit 698fb75b9ff5ae454a1344b5f9fafa0ca367c555
Author: Zack Weinberg <[hidden email]>
Date:   Wed Mar 7 14:32:01 2018 -0500

    Add __v*printf_internal with flags arguments

_IO_vfprintf is gone.  This did not trigger any test case failures on
powerpc and powerpc64le, because there were no tests that covered it.
However, new test cases for nldbl versions of argp.h functions exposed
the problem.

Tested for powerpc64 and powerpc64le.

        * libio/libio.h: Remove redirection for _IO_vfprintf.
---
 libio/libio.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libio/libio.h b/libio/libio.h
index 3a93807efc..e19d860dc6 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -300,7 +300,6 @@ extern void _IO_free_wbackup_area (FILE *) __THROW;
 
 #ifdef __LDBL_COMPAT
 __LDBL_REDIR_DECL (_IO_vfscanf)
-__LDBL_REDIR_DECL (_IO_vfprintf)
 #endif
 
 libc_hidden_proto (__overflow)
--
2.14.5

Reply | Threaded
Open this post in threaded view
|

[PATCH v1 2/7] Add *-ldbl.h headers to include/bits

Gabriel F. T. Gomes-2
In reply to this post by Gabriel F. T. Gomes-2
On some platforms, long double may have either the same format as double
or another, wider format, such as the Quadruple IEC 60559 long double
format or the IBM Extended Precision format (both 128-bits wide).
Selecting between the available formats is done by using one of the
following compiler switches: -mlong-double-128, for the wider format, or
-mlong-double-64, for the narrower.  On all platforms that provide this
choice, the wider format is the default.

When the non-default format is selected by user code (i.e.: when
building with -mlong-double-64) calls to functions that take long double
parameters or return a long double type (e.g.: strfroml) are redirected
to a compat function, via assembler redirection, by headers such as
bits/stdlib-ldbl.h or bits/misc-ldbl.h.

In glibc builds, however, these headers are currently being read from
the system directories (/usr/include/bits) rather than from the source
directory.  Although this works correctly today, it raises
reproducibility concerns.  Besides that, builds for powerpc64le will
need these files from the source directory, because on powerpc64le, the
new redirections for long double with IEEE binary128 format will be
implemented in these headers.

Tested for powerpc64 and powerpc64le.

        * include/bits/argp-ldbl.h: New file.
        * include/bits/err-ldbl.h: Likewise.
        * include/bits/error-ldbl.h: Likewise.
        * include/bits/monetary-ldbl.h: Likewise.
        * include/bits/printf-ldbl.h: Likewise.
        * include/bits/stdio-ldbl.h: Likewise.
        * include/bits/stdlib-ldbl.h: Likewise.
        * include/bits/syslog-ldbl.h: Likewise.
        * include/bits/wchar-ldbl.h: Likewise.
---
 include/bits/argp-ldbl.h     | 1 +
 include/bits/err-ldbl.h      | 1 +
 include/bits/error-ldbl.h    | 1 +
 include/bits/monetary-ldbl.h | 1 +
 include/bits/printf-ldbl.h   | 1 +
 include/bits/stdio-ldbl.h    | 1 +
 include/bits/stdlib-ldbl.h   | 1 +
 include/bits/syslog-ldbl.h   | 1 +
 include/bits/wchar-ldbl.h    | 1 +
 9 files changed, 9 insertions(+)
 create mode 100644 include/bits/argp-ldbl.h
 create mode 100644 include/bits/err-ldbl.h
 create mode 100644 include/bits/error-ldbl.h
 create mode 100644 include/bits/monetary-ldbl.h
 create mode 100644 include/bits/printf-ldbl.h
 create mode 100644 include/bits/stdio-ldbl.h
 create mode 100644 include/bits/stdlib-ldbl.h
 create mode 100644 include/bits/syslog-ldbl.h
 create mode 100644 include/bits/wchar-ldbl.h

diff --git a/include/bits/argp-ldbl.h b/include/bits/argp-ldbl.h
new file mode 100644
index 0000000000..7c1a343d1b
--- /dev/null
+++ b/include/bits/argp-ldbl.h
@@ -0,0 +1 @@
+#include <argp/bits/argp-ldbl.h>
diff --git a/include/bits/err-ldbl.h b/include/bits/err-ldbl.h
new file mode 100644
index 0000000000..aa04305eae
--- /dev/null
+++ b/include/bits/err-ldbl.h
@@ -0,0 +1 @@
+#include <misc/bits/err-ldbl.h>
diff --git a/include/bits/error-ldbl.h b/include/bits/error-ldbl.h
new file mode 100644
index 0000000000..84b2646867
--- /dev/null
+++ b/include/bits/error-ldbl.h
@@ -0,0 +1 @@
+#include <misc/bits/error-ldbl.h>
diff --git a/include/bits/monetary-ldbl.h b/include/bits/monetary-ldbl.h
new file mode 100644
index 0000000000..6b6713ffc1
--- /dev/null
+++ b/include/bits/monetary-ldbl.h
@@ -0,0 +1 @@
+#include <stdlib/bits/monetary-ldbl.h>
diff --git a/include/bits/printf-ldbl.h b/include/bits/printf-ldbl.h
new file mode 100644
index 0000000000..10d534b9b3
--- /dev/null
+++ b/include/bits/printf-ldbl.h
@@ -0,0 +1 @@
+#include <stdio-common/bits/printf-ldbl.h>
diff --git a/include/bits/stdio-ldbl.h b/include/bits/stdio-ldbl.h
new file mode 100644
index 0000000000..1f7d3ce1c6
--- /dev/null
+++ b/include/bits/stdio-ldbl.h
@@ -0,0 +1 @@
+#include <libio/bits/stdio-ldbl.h>
diff --git a/include/bits/stdlib-ldbl.h b/include/bits/stdlib-ldbl.h
new file mode 100644
index 0000000000..62509494a3
--- /dev/null
+++ b/include/bits/stdlib-ldbl.h
@@ -0,0 +1 @@
+#include <stdlib/bits/stdlib-ldbl.h>
diff --git a/include/bits/syslog-ldbl.h b/include/bits/syslog-ldbl.h
new file mode 100644
index 0000000000..e86815632b
--- /dev/null
+++ b/include/bits/syslog-ldbl.h
@@ -0,0 +1 @@
+#include <misc/bits/syslog-ldbl.h>
diff --git a/include/bits/wchar-ldbl.h b/include/bits/wchar-ldbl.h
new file mode 100644
index 0000000000..29baa2f4d5
--- /dev/null
+++ b/include/bits/wchar-ldbl.h
@@ -0,0 +1 @@
+#include <wcsmbs/bits/wchar-ldbl.h>
--
2.14.5

Reply | Threaded
Open this post in threaded view
|

[PATCH v1 3/7] ldbl-opt: Add arpg_error and argp_failure

Gabriel F. T. Gomes-2
In reply to this post by Gabriel F. T. Gomes-2
The functions argp_error and argp_failure are missing support for
printing long double values when long double has the same format as
double.  This patch adds the new functions __nldbl_argp_error and
__nldbl_argp_failure, as well as header magic to redirect calls to them
when -mlong-double-64 is in use.

Tested for powerpc64 and powerpc64le.

        * argp/argp.h [defined __LDBL_COMPAT]: Include bits/argp-ldbl.h.
        * argp/bits/argp-ldbl.h: New file.
        * include/argp.h: Include stdarg.h.  Add prototypes for internal
        functions: __argp_error_internal and __argp_failure_internal.
        * sysdeps/ieee754/ldbl-opt/Versions (libc) Add
        __nldbl_argp_error and __nldbl_argp_failure.
        * sysdeps/ieee754/ldbl-opt/nldbl-compat.c: Include argp.h.
        (__nldbl_argp_error, __nldbl_argp_failure): New functions.
        * sysdeps/ieee754/ldbl-opt/nldbl-compat.h: Include argp.h.
        Redirect argp_error and argp_failure calls.
        * sysdeps/unix/sysv/linux/alpha/libc.abilist: Update.
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist:
        Likewise.
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist:
        Likewise.
        * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist:
        Likewise.
        * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist:
        Likewise.
        * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise.
        * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
        * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
---
 argp/argp.h                                        |  4 ++++
 argp/bits/argp-ldbl.h                              | 24 ++++++++++++++++++++++
 include/argp.h                                     | 11 ++++++++++
 sysdeps/ieee754/ldbl-opt/Versions                  |  3 +++
 sysdeps/ieee754/ldbl-opt/nldbl-compat.c            | 21 +++++++++++++++++++
 sysdeps/ieee754/ldbl-opt/nldbl-compat.h            |  3 +++
 sysdeps/unix/sysv/linux/alpha/libc.abilist         |  2 ++
 .../sysv/linux/powerpc/powerpc32/fpu/libc.abilist  |  2 ++
 .../linux/powerpc/powerpc32/nofpu/libc.abilist     |  2 ++
 .../sysv/linux/powerpc/powerpc64/libc-le.abilist   |  2 ++
 .../unix/sysv/linux/powerpc/powerpc64/libc.abilist |  2 ++
 sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist  |  2 ++
 sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist  |  2 ++
 sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist |  2 ++
 14 files changed, 82 insertions(+)
 create mode 100644 argp/bits/argp-ldbl.h

diff --git a/argp/argp.h b/argp/argp.h
index 0f2583340f..fd2b20d2a1 100644
--- a/argp/argp.h
+++ b/argp/argp.h
@@ -554,6 +554,10 @@ __NTH (__option_is_end (const struct argp_option *__opt))
 # endif
 #endif /* Use extern inlines.  */
 
+#ifdef __LDBL_COMPAT
+# include <bits/argp-ldbl.h>
+#endif
+
 __END_DECLS
 
 #endif /* argp.h */
diff --git a/argp/bits/argp-ldbl.h b/argp/bits/argp-ldbl.h
new file mode 100644
index 0000000000..e3a3ed97d2
--- /dev/null
+++ b/argp/bits/argp-ldbl.h
@@ -0,0 +1,24 @@
+/* Redirections for argp functions for -mlong-double-64.
+   Copyright (C) 2018 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
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _ARGP_H
+# error "Never include <bits/argp-ldbl.h> directly; use <argp.h> instead."
+#endif
+
+__LDBL_REDIR_DECL (argp_error)
+__LDBL_REDIR_DECL (argp_failure)
diff --git a/include/argp.h b/include/argp.h
index 6cf8782060..7077471d99 100644
--- a/include/argp.h
+++ b/include/argp.h
@@ -1,6 +1,17 @@
 #ifndef _ARGP_H
 #include <argp/argp.h>
 
+/* Prototypes for internal argp.h functions.  */
+#include <stdarg.h>
+void
+__argp_error_internal (const struct argp_state *state, const char *fmt,
+       va_list ap, unsigned int mode_flags);
+
+void
+__argp_failure_internal (const struct argp_state *state, int status,
+ int errnum, const char *fmt, va_list ap,
+ unsigned int mode_flags);
+
 #ifndef _ISOMAC
 extern __typeof (__argp_error) __argp_error attribute_hidden;
 extern __typeof (__argp_failure) __argp_failure attribute_hidden;
diff --git a/sysdeps/ieee754/ldbl-opt/Versions b/sysdeps/ieee754/ldbl-opt/Versions
index af0c4a098c..855f541c48 100644
--- a/sysdeps/ieee754/ldbl-opt/Versions
+++ b/sysdeps/ieee754/ldbl-opt/Versions
@@ -78,6 +78,9 @@ libc {
     __nldbl___dprintf_chk; __nldbl___vdprintf_chk;
     __nldbl___obstack_printf_chk; __nldbl___obstack_vprintf_chk;
   }
+  GLIBC_2.29 {
+    __nldbl_argp_error; __nldbl_argp_failure;
+  }
 }
 libm {
   NLDBL_VERSION {
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-compat.c b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
index f6dd81759d..0cc9ab0f7a 100644
--- a/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
@@ -17,6 +17,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <argp.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <libio/strfile.h>
@@ -985,6 +986,26 @@ __nldbl___isoc99_wscanf (const wchar_t *fmt, ...)
   return ret;
 }
 
+void
+__nldbl_argp_error (const struct argp_state *state, const char *fmt, ...)
+{
+  va_list ap;
+  va_start (ap, fmt);
+  __argp_error_internal (state, fmt, ap, PRINTF_LDBL_IS_DBL);
+  va_end (ap);
+}
+
+void
+__nldbl_argp_failure (const struct argp_state *state, int status,
+ int errnum, const char *fmt, ...)
+{
+  va_list ap;
+  va_start (ap, fmt);
+  __argp_failure_internal (state, status, errnum, fmt, 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);
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-compat.h b/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
index b7606c3c2d..d263b19c5b 100644
--- a/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
@@ -26,6 +26,7 @@
 
 /* Avoid long double prototypes.  */
 #define __NO_LONG_DOUBLE_MATH 1
+#include <argp.h>
 #include <stdarg.h>
 #include <stdlib.h>
 #include <stdint.h>
@@ -76,6 +77,8 @@ NLDBL_DECL (__isoc99_swscanf);
 NLDBL_DECL (__isoc99_vwscanf);
 NLDBL_DECL (__isoc99_vfwscanf);
 NLDBL_DECL (__isoc99_vswscanf);
+NLDBL_DECL (argp_error);
+NLDBL_DECL (argp_failure);
 
 /* These do not exist in the normal interface, but must exist in the
    __nldbl interface so that they can be called from libnldbl.  */
diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
index 8df162fe99..3a7c918c93 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -2033,6 +2033,8 @@ GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
+GLIBC_2.29 __nldbl_argp_error F
+GLIBC_2.29 __nldbl_argp_failure F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index e9ecbccb71..481b689b0e 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -1993,6 +1993,8 @@ GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
+GLIBC_2.29 __nldbl_argp_error F
+GLIBC_2.29 __nldbl_argp_failure F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index da83ea6028..35f413c0cc 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -1997,6 +1997,8 @@ GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
+GLIBC_2.29 __nldbl_argp_error F
+GLIBC_2.29 __nldbl_argp_failure F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
index 4535b40d15..8b011c93a0 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
@@ -2228,4 +2228,6 @@ GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
+GLIBC_2.29 __nldbl_argp_error F
+GLIBC_2.29 __nldbl_argp_failure F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
index 65725de4f0..565f32e53a 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
@@ -123,6 +123,8 @@ GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
+GLIBC_2.29 __nldbl_argp_error F
+GLIBC_2.29 __nldbl_argp_failure F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
 GLIBC_2.3 _Exit F
 GLIBC_2.3 _IO_2_1_stderr_ D 0xe0
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index e85ac2a178..0233991ff0 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -2002,6 +2002,8 @@ GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
+GLIBC_2.29 __nldbl_argp_error F
+GLIBC_2.29 __nldbl_argp_failure F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index d56931022c..a1ebf17ee0 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -1908,6 +1908,8 @@ GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 __fentry__ F
+GLIBC_2.29 __nldbl_argp_error F
+GLIBC_2.29 __nldbl_argp_failure F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index 64fa9e10a5..76c5b297c3 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -1996,6 +1996,8 @@ GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
+GLIBC_2.29 __nldbl_argp_error F
+GLIBC_2.29 __nldbl_argp_failure F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
--
2.14.5

Reply | Threaded
Open this post in threaded view
|

[PATCH v1 4/7] ldbl-opt: Reuse argp tests that print long double

Gabriel F. T. Gomes-2
In reply to this post by Gabriel F. T. Gomes-2
The test case tst-ldbl-argp checks that the conversion specifier '%Lf'
correctly prints long double values with the default long double format
for a platform.  This patch reuses the test case for long double with
the same format as double (-mlong-double-64).

Tested for powerpc64 and powerpc64le.

        * sysdeps/ieee754/ldbl-opt/Makefile
        [subdir == argp] (tests-internal): Add tst-nldbl-argp.
        [subdir == argp] ($(objpfx)tst-nldbl-argp.c): New rule.
        [subdir == argp] (CFLAGS-tst-nldbl-argp.c): New variable.
---
 sysdeps/ieee754/ldbl-opt/Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sysdeps/ieee754/ldbl-opt/Makefile b/sysdeps/ieee754/ldbl-opt/Makefile
index 64fdb8cb9e..8a2c129f5f 100644
--- a/sysdeps/ieee754/ldbl-opt/Makefile
+++ b/sysdeps/ieee754/ldbl-opt/Makefile
@@ -179,3 +179,13 @@ CFLAGS-test-nldbl-redirect.c += -mlong-double-64
 $(objpfx)test-nldbl-redirect: $(objpfx)libnldbl_nonshared.a
 
 endif
+
+# Tests for argp.h functions (reusing the relevant tests from argp/)
+ifeq ($(subdir),argp)
+tests-internal += tst-nldbl-argp
+
+$(objpfx)tst-nldbl-argp.c: tst-ldbl-argp.c
+ cp $< $@
+
+CFLAGS-tst-nldbl-argp.c += -mlong-double-64
+endif
--
2.14.5

Reply | Threaded
Open this post in threaded view
|

[PATCH v1 5/7] ldbl-opt: Add err, errx, verr, verrx, warn, warnx, vwarn, and vwarnx

Gabriel F. T. Gomes-2
In reply to this post by Gabriel F. T. Gomes-2
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 powerpc64 and powerpc64le.

        * include/err.h: Add prototypes for the internal functions:
        __vwarnx_internal and __vwarn_internal.
        * misc/bits/err-ldbl.h: New file.
        * misc/err.h: Include bits/err-ldbl.h when __LDBL_COMPAT is
        defined, i.e.: when -mlong-double-64 is in use.
        * sysdeps/ieee754/ldbl-opt/Versions (libc): Add __nldbl_warn,
        __nldbl_vwarn, __nldbl_warnx, __nldbl_vwarnx, __nldbl_err,
        __nldbl_verr, __nldbl_errx, and __nldbl_verrx.
        * sysdeps/ieee754/ldbl-opt/nldbl-compat.c: Include err.h.
        (VA_CALL): New macro.
        (__nldbl_vwarn, __nldbl_vwarnx, __nldbl_warn, __nldbl_warnx)
        (__nldbl_verr, __nldbl_verrx, __nldbl_err, __nldbl_errx): New
        functions.
        * sysdeps/ieee754/ldbl-opt/nldbl-compat.h: Include err.h and
        declare prototypes for the new functions.
        * sysdeps/unix/sysv/linux/alpha/libc.abilist: Update.
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist:
        Likewise.
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist:
        Likewise.
        * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist:
        Likewise.
        * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist:
        Likewise.
        * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise.
        * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
        * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
---
 include/err.h                                      |  9 ++++
 misc/bits/err-ldbl.h                               | 30 +++++++++++
 misc/err.h                                         |  4 ++
 sysdeps/ieee754/ldbl-opt/Versions                  |  2 +
 sysdeps/ieee754/ldbl-opt/nldbl-compat.c            | 61 ++++++++++++++++++++++
 sysdeps/ieee754/ldbl-opt/nldbl-compat.h            |  9 ++++
 sysdeps/unix/sysv/linux/alpha/libc.abilist         |  8 +++
 .../sysv/linux/powerpc/powerpc32/fpu/libc.abilist  |  8 +++
 .../linux/powerpc/powerpc32/nofpu/libc.abilist     |  8 +++
 .../sysv/linux/powerpc/powerpc64/libc-le.abilist   |  8 +++
 .../unix/sysv/linux/powerpc/powerpc64/libc.abilist |  8 +++
 sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist  |  8 +++
 sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist  |  8 +++
 sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist |  8 +++
 14 files changed, 179 insertions(+)
 create mode 100644 misc/bits/err-ldbl.h

diff --git a/include/err.h b/include/err.h
index 382855938e..7c05cd1dbb 100644
--- a/include/err.h
+++ b/include/err.h
@@ -1,6 +1,15 @@
 #ifndef _ERR_H
 #include <misc/err.h>
 
+/* Prototypes for internal err.h functions.  */
+void
+__vwarnx_internal (const char *format, __gnuc_va_list ap,
+   unsigned int mode_flags);
+
+void
+__vwarn_internal (const char *format, __gnuc_va_list ap,
+   unsigned int mode_flags);
+
 # ifndef _ISOMAC
 
 libc_hidden_proto (warn)
diff --git a/misc/bits/err-ldbl.h b/misc/bits/err-ldbl.h
new file mode 100644
index 0000000000..dd74c0ee67
--- /dev/null
+++ b/misc/bits/err-ldbl.h
@@ -0,0 +1,30 @@
+/* Redirections for err.h functions for -mlong-double-64.
+   Copyright (C) 2018 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
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _ERR_H
+# error "Never include <bits/err-ldbl.h> directly; use <err.h> instead."
+#endif
+
+__LDBL_REDIR_DECL (warn)
+__LDBL_REDIR_DECL (vwarn)
+__LDBL_REDIR_DECL (warnx)
+__LDBL_REDIR_DECL (vwarnx)
+__LDBL_REDIR_DECL (err)
+__LDBL_REDIR_DECL (verr)
+__LDBL_REDIR_DECL (errx)
+__LDBL_REDIR_DECL (verrx)
diff --git a/misc/err.h b/misc/err.h
index fec4fd2f77..f2d4befd95 100644
--- a/misc/err.h
+++ b/misc/err.h
@@ -52,6 +52,10 @@ extern void errx (int __status, const char *__format, ...)
 extern void verrx (int __status, const char *, __gnuc_va_list)
      __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
 
+#ifdef __LDBL_COMPAT
+# include <bits/err-ldbl.h>
+#endif
+
 __END_DECLS
 
 #endif /* err.h */
diff --git a/sysdeps/ieee754/ldbl-opt/Versions b/sysdeps/ieee754/ldbl-opt/Versions
index 855f541c48..5bc88ddb8f 100644
--- a/sysdeps/ieee754/ldbl-opt/Versions
+++ b/sysdeps/ieee754/ldbl-opt/Versions
@@ -80,6 +80,8 @@ libc {
   }
   GLIBC_2.29 {
     __nldbl_argp_error; __nldbl_argp_failure;
+    __nldbl_warn; __nldbl_vwarn; __nldbl_warnx; __nldbl_vwarnx;
+    __nldbl_err; __nldbl_verr; __nldbl_errx; __nldbl_verrx;
   }
 }
 libm {
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-compat.c b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
index 0cc9ab0f7a..10c0fe6ac9 100644
--- a/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
@@ -18,6 +18,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <argp.h>
+#include <err.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <libio/strfile.h>
@@ -1006,6 +1007,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);
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-compat.h b/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
index d263b19c5b..35f49165e2 100644
--- a/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
@@ -27,6 +27,7 @@
 /* Avoid long double prototypes.  */
 #define __NO_LONG_DOUBLE_MATH 1
 #include <argp.h>
+#include <err.h>
 #include <stdarg.h>
 #include <stdlib.h>
 #include <stdint.h>
@@ -79,6 +80,14 @@ NLDBL_DECL (__isoc99_vfwscanf);
 NLDBL_DECL (__isoc99_vswscanf);
 NLDBL_DECL (argp_error);
 NLDBL_DECL (argp_failure);
+NLDBL_DECL (warn);
+NLDBL_DECL (vwarn);
+NLDBL_DECL (warnx);
+NLDBL_DECL (vwarnx);
+NLDBL_DECL (err);
+NLDBL_DECL (verr);
+NLDBL_DECL (errx);
+NLDBL_DECL (verrx);
 
 /* These do not exist in the normal interface, but must exist in the
    __nldbl interface so that they can be called from libnldbl.  */
diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
index 3a7c918c93..e56a55b90b 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -2035,6 +2035,14 @@ GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 __nldbl_argp_error F
 GLIBC_2.29 __nldbl_argp_failure F
+GLIBC_2.29 __nldbl_err F
+GLIBC_2.29 __nldbl_errx F
+GLIBC_2.29 __nldbl_verr F
+GLIBC_2.29 __nldbl_verrx F
+GLIBC_2.29 __nldbl_vwarn F
+GLIBC_2.29 __nldbl_vwarnx F
+GLIBC_2.29 __nldbl_warn F
+GLIBC_2.29 __nldbl_warnx F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index 481b689b0e..5e8255daa2 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -1995,6 +1995,14 @@ GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 __nldbl_argp_error F
 GLIBC_2.29 __nldbl_argp_failure F
+GLIBC_2.29 __nldbl_err F
+GLIBC_2.29 __nldbl_errx F
+GLIBC_2.29 __nldbl_verr F
+GLIBC_2.29 __nldbl_verrx F
+GLIBC_2.29 __nldbl_vwarn F
+GLIBC_2.29 __nldbl_vwarnx F
+GLIBC_2.29 __nldbl_warn F
+GLIBC_2.29 __nldbl_warnx F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index 35f413c0cc..14d6045c25 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -1999,6 +1999,14 @@ GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 __nldbl_argp_error F
 GLIBC_2.29 __nldbl_argp_failure F
+GLIBC_2.29 __nldbl_err F
+GLIBC_2.29 __nldbl_errx F
+GLIBC_2.29 __nldbl_verr F
+GLIBC_2.29 __nldbl_verrx F
+GLIBC_2.29 __nldbl_vwarn F
+GLIBC_2.29 __nldbl_vwarnx F
+GLIBC_2.29 __nldbl_warn F
+GLIBC_2.29 __nldbl_warnx F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
index 8b011c93a0..b20910a051 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
@@ -2230,4 +2230,12 @@ GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 __nldbl_argp_error F
 GLIBC_2.29 __nldbl_argp_failure F
+GLIBC_2.29 __nldbl_err F
+GLIBC_2.29 __nldbl_errx F
+GLIBC_2.29 __nldbl_verr F
+GLIBC_2.29 __nldbl_verrx F
+GLIBC_2.29 __nldbl_vwarn F
+GLIBC_2.29 __nldbl_vwarnx F
+GLIBC_2.29 __nldbl_warn F
+GLIBC_2.29 __nldbl_warnx F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
index 565f32e53a..2b8be65990 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
@@ -125,6 +125,14 @@ GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 __nldbl_argp_error F
 GLIBC_2.29 __nldbl_argp_failure F
+GLIBC_2.29 __nldbl_err F
+GLIBC_2.29 __nldbl_errx F
+GLIBC_2.29 __nldbl_verr F
+GLIBC_2.29 __nldbl_verrx F
+GLIBC_2.29 __nldbl_vwarn F
+GLIBC_2.29 __nldbl_vwarnx F
+GLIBC_2.29 __nldbl_warn F
+GLIBC_2.29 __nldbl_warnx F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
 GLIBC_2.3 _Exit F
 GLIBC_2.3 _IO_2_1_stderr_ D 0xe0
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index 0233991ff0..424b21c486 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -2004,6 +2004,14 @@ GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 __nldbl_argp_error F
 GLIBC_2.29 __nldbl_argp_failure F
+GLIBC_2.29 __nldbl_err F
+GLIBC_2.29 __nldbl_errx F
+GLIBC_2.29 __nldbl_verr F
+GLIBC_2.29 __nldbl_verrx F
+GLIBC_2.29 __nldbl_vwarn F
+GLIBC_2.29 __nldbl_vwarnx F
+GLIBC_2.29 __nldbl_warn F
+GLIBC_2.29 __nldbl_warnx F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index a1ebf17ee0..7745cc2a66 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -1910,6 +1910,14 @@ GLIBC_2.28 thrd_yield F
 GLIBC_2.29 __fentry__ F
 GLIBC_2.29 __nldbl_argp_error F
 GLIBC_2.29 __nldbl_argp_failure F
+GLIBC_2.29 __nldbl_err F
+GLIBC_2.29 __nldbl_errx F
+GLIBC_2.29 __nldbl_verr F
+GLIBC_2.29 __nldbl_verrx F
+GLIBC_2.29 __nldbl_vwarn F
+GLIBC_2.29 __nldbl_vwarnx F
+GLIBC_2.29 __nldbl_warn F
+GLIBC_2.29 __nldbl_warnx F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index 76c5b297c3..b1dc3f0aaa 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -1998,6 +1998,14 @@ GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
 GLIBC_2.29 __nldbl_argp_error F
 GLIBC_2.29 __nldbl_argp_failure F
+GLIBC_2.29 __nldbl_err F
+GLIBC_2.29 __nldbl_errx F
+GLIBC_2.29 __nldbl_verr F
+GLIBC_2.29 __nldbl_verrx F
+GLIBC_2.29 __nldbl_vwarn F
+GLIBC_2.29 __nldbl_vwarnx F
+GLIBC_2.29 __nldbl_warn F
+GLIBC_2.29 __nldbl_warnx F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
--
2.14.5

Reply | Threaded
Open this post in threaded view
|

[PATCH v1 6/7] ldbl-opt: Add error and error_at_line

Gabriel F. T. Gomes-2
In reply to this post by Gabriel F. T. Gomes-2
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 powerpc64 and powerpc64le.

        * include/error.h: Include stdarg.h.  Declare internal functions
        __error_internal and __error_at_line_internal.
        * misc/bits/error-ldbl.h: New file.
        * misc/error.h [__LDBL_COMPAT]: Include bits/error-ldbl.h and
        avoid the inclusion of bits/error.h.
        * sysdeps/ieee754/ldbl-opt/Versions (libc): Add __nldbl_error,
        and __nldbl_error_at_line.
        * sysdeps/ieee754/ldbl-opt/nldbl-compat.c: Include error.h.
        (__nldbl_error, __ndlbl_error_at_line): New functions.
        * sysdeps/ieee754/ldbl-opt/nldbl-compat.h: Include error.h.
        Redirect error and error_at_line.
        * sysdeps/unix/sysv/linux/alpha/libc.abilist: Update.
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist:
        Likewise.
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist:
        Likewise.
        * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist:
        Likewise.
        * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist:
        Likewise.
        * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise.
        * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
        * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
---
 include/error.h                                    | 14 +++++++++++++
 misc/bits/error-ldbl.h                             | 24 ++++++++++++++++++++++
 misc/error.h                                       | 12 ++++++++---
 sysdeps/ieee754/ldbl-opt/Versions                  |  1 +
 sysdeps/ieee754/ldbl-opt/nldbl-compat.c            | 22 ++++++++++++++++++++
 sysdeps/ieee754/ldbl-opt/nldbl-compat.h            |  3 +++
 sysdeps/unix/sysv/linux/alpha/libc.abilist         |  2 ++
 .../sysv/linux/powerpc/powerpc32/fpu/libc.abilist  |  2 ++
 .../linux/powerpc/powerpc32/nofpu/libc.abilist     |  2 ++
 .../sysv/linux/powerpc/powerpc64/libc-le.abilist   |  2 ++
 .../unix/sysv/linux/powerpc/powerpc64/libc.abilist |  2 ++
 sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist  |  2 ++
 sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist  |  2 ++
 sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist |  2 ++
 14 files changed, 89 insertions(+), 3 deletions(-)
 create mode 100644 misc/bits/error-ldbl.h

diff --git a/include/error.h b/include/error.h
index 70f3192fa6..9e96262fc5 100644
--- a/include/error.h
+++ b/include/error.h
@@ -1 +1,15 @@
+#ifndef _ERROR_H
 #include <misc/error.h>
+
+#include <stdarg.h>
+
+void
+__error_internal (int status, int errnum, const char *message,
+  va_list args, unsigned int mode_flags);
+
+void
+__error_at_line_internal (int status, int errnum, const char *file_name,
+  unsigned int line_number, const char *message,
+  va_list args, unsigned int mode_flags);
+
+#endif
diff --git a/misc/bits/error-ldbl.h b/misc/bits/error-ldbl.h
new file mode 100644
index 0000000000..d89a3f1181
--- /dev/null
+++ b/misc/bits/error-ldbl.h
@@ -0,0 +1,24 @@
+/* Redirections for error.h functions for -mlong-double-64.
+   Copyright (C) 2018 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
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _ERROR_H
+# error "Never include <bits/error-ldbl.h> directly; use <error.h> instead."
+#endif
+
+__LDBL_REDIR_DECL (error)
+__LDBL_REDIR_DECL (error_at_line)
diff --git a/misc/error.h b/misc/error.h
index fcd5ad90dc..ac0c58622a 100644
--- a/misc/error.h
+++ b/misc/error.h
@@ -47,9 +47,15 @@ extern unsigned int error_message_count;
    variable controls whether this mode is selected or not.  */
 extern int error_one_per_line;
 
-
-#if defined __extern_always_inline && defined __va_arg_pack
-# include <bits/error.h>
+#ifdef __LDBL_COMPAT
+# include <bits/error-ldbl.h>
+#else
+/* Do not inline error and error_at_line when long double has the same
+   size of double, because that would invalidate the redirections to the
+   compatibility functions.  */
+# if defined __extern_always_inline && defined __va_arg_pack
+#  include <bits/error.h>
+# endif
 #endif
 
 __END_DECLS
diff --git a/sysdeps/ieee754/ldbl-opt/Versions b/sysdeps/ieee754/ldbl-opt/Versions
index 5bc88ddb8f..ced253cf66 100644
--- a/sysdeps/ieee754/ldbl-opt/Versions
+++ b/sysdeps/ieee754/ldbl-opt/Versions
@@ -82,6 +82,7 @@ libc {
     __nldbl_argp_error; __nldbl_argp_failure;
     __nldbl_warn; __nldbl_vwarn; __nldbl_warnx; __nldbl_vwarnx;
     __nldbl_err; __nldbl_verr; __nldbl_errx; __nldbl_verrx;
+    __nldbl_error; __nldbl_error_at_line;
   }
 }
 libm {
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-compat.c b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
index 10c0fe6ac9..d9c6ac2e2c 100644
--- a/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
@@ -19,6 +19,7 @@
 
 #include <argp.h>
 #include <err.h>
+#include <error.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <libio/strfile.h>
@@ -1067,6 +1068,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);
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-compat.h b/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
index 35f49165e2..02f4988d40 100644
--- a/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
@@ -28,6 +28,7 @@
 #define __NO_LONG_DOUBLE_MATH 1
 #include <argp.h>
 #include <err.h>
+#include <error.h>
 #include <stdarg.h>
 #include <stdlib.h>
 #include <stdint.h>
@@ -88,6 +89,8 @@ NLDBL_DECL (err);
 NLDBL_DECL (verr);
 NLDBL_DECL (errx);
 NLDBL_DECL (verrx);
+NLDBL_DECL (error);
+NLDBL_DECL (error_at_line);
 
 /* These do not exist in the normal interface, but must exist in the
    __nldbl interface so that they can be called from libnldbl.  */
diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
index e56a55b90b..336b1424de 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -2036,6 +2036,8 @@ GLIBC_2.28 thrd_yield F
 GLIBC_2.29 __nldbl_argp_error F
 GLIBC_2.29 __nldbl_argp_failure F
 GLIBC_2.29 __nldbl_err F
+GLIBC_2.29 __nldbl_error F
+GLIBC_2.29 __nldbl_error_at_line F
 GLIBC_2.29 __nldbl_errx F
 GLIBC_2.29 __nldbl_verr F
 GLIBC_2.29 __nldbl_verrx F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index 5e8255daa2..df19e681c8 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -1996,6 +1996,8 @@ GLIBC_2.28 thrd_yield F
 GLIBC_2.29 __nldbl_argp_error F
 GLIBC_2.29 __nldbl_argp_failure F
 GLIBC_2.29 __nldbl_err F
+GLIBC_2.29 __nldbl_error F
+GLIBC_2.29 __nldbl_error_at_line F
 GLIBC_2.29 __nldbl_errx F
 GLIBC_2.29 __nldbl_verr F
 GLIBC_2.29 __nldbl_verrx F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index 14d6045c25..e6fe179164 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -2000,6 +2000,8 @@ GLIBC_2.28 thrd_yield F
 GLIBC_2.29 __nldbl_argp_error F
 GLIBC_2.29 __nldbl_argp_failure F
 GLIBC_2.29 __nldbl_err F
+GLIBC_2.29 __nldbl_error F
+GLIBC_2.29 __nldbl_error_at_line F
 GLIBC_2.29 __nldbl_errx F
 GLIBC_2.29 __nldbl_verr F
 GLIBC_2.29 __nldbl_verrx F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
index b20910a051..089600f2e5 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
@@ -2231,6 +2231,8 @@ GLIBC_2.28 thrd_yield F
 GLIBC_2.29 __nldbl_argp_error F
 GLIBC_2.29 __nldbl_argp_failure F
 GLIBC_2.29 __nldbl_err F
+GLIBC_2.29 __nldbl_error F
+GLIBC_2.29 __nldbl_error_at_line F
 GLIBC_2.29 __nldbl_errx F
 GLIBC_2.29 __nldbl_verr F
 GLIBC_2.29 __nldbl_verrx F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
index 2b8be65990..d08ddcaa23 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
@@ -126,6 +126,8 @@ GLIBC_2.28 thrd_yield F
 GLIBC_2.29 __nldbl_argp_error F
 GLIBC_2.29 __nldbl_argp_failure F
 GLIBC_2.29 __nldbl_err F
+GLIBC_2.29 __nldbl_error F
+GLIBC_2.29 __nldbl_error_at_line F
 GLIBC_2.29 __nldbl_errx F
 GLIBC_2.29 __nldbl_verr F
 GLIBC_2.29 __nldbl_verrx F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index 424b21c486..2a7e81afe8 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -2005,6 +2005,8 @@ GLIBC_2.28 thrd_yield F
 GLIBC_2.29 __nldbl_argp_error F
 GLIBC_2.29 __nldbl_argp_failure F
 GLIBC_2.29 __nldbl_err F
+GLIBC_2.29 __nldbl_error F
+GLIBC_2.29 __nldbl_error_at_line F
 GLIBC_2.29 __nldbl_errx F
 GLIBC_2.29 __nldbl_verr F
 GLIBC_2.29 __nldbl_verrx F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index 7745cc2a66..0f18a744de 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -1911,6 +1911,8 @@ GLIBC_2.29 __fentry__ F
 GLIBC_2.29 __nldbl_argp_error F
 GLIBC_2.29 __nldbl_argp_failure F
 GLIBC_2.29 __nldbl_err F
+GLIBC_2.29 __nldbl_error F
+GLIBC_2.29 __nldbl_error_at_line F
 GLIBC_2.29 __nldbl_errx F
 GLIBC_2.29 __nldbl_verr F
 GLIBC_2.29 __nldbl_verrx F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index b1dc3f0aaa..31d1e13a49 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -1999,6 +1999,8 @@ GLIBC_2.28 thrd_yield F
 GLIBC_2.29 __nldbl_argp_error F
 GLIBC_2.29 __nldbl_argp_failure F
 GLIBC_2.29 __nldbl_err F
+GLIBC_2.29 __nldbl_error F
+GLIBC_2.29 __nldbl_error_at_line F
 GLIBC_2.29 __nldbl_errx F
 GLIBC_2.29 __nldbl_verr F
 GLIBC_2.29 __nldbl_verrx F
--
2.14.5

Reply | Threaded
Open this post in threaded view
|

[PATCH v1 7/7] ldbl-opt: Reuse test cases from misc/ that check long double

Gabriel F. T. Gomes-2
In reply to this post by Gabriel F. T. Gomes-2
This patch adds test cases for the compatibility versions of the
functions: err, errx, verr, verrx, warn, warnx, vwarn, vwarnx (from
err.h), error, and error_at_line (from error.h), when long double has
the same format as double (-mlong-double-64).

Tested for powerpc64 and powerpc64le.

        * sysdeps/ieee754/ldbl-opt/Makefile
        [subdir == misc] (tests-internal): Add tst-nldbl-warn,
        tst-nldbl-error.
        (CFLAGS-tst-nldbl-warn.c, CFLAGS-tst-nldbl-error.c):
        New variables.
---
 misc/tst-ldbl-error.c             | 25 +++++++++++++------------
 misc/tst-ldbl-warn.c              | 20 ++++++++++++++------
 sysdeps/ieee754/ldbl-opt/Makefile | 16 ++++++++++++++++
 3 files changed, 43 insertions(+), 18 deletions(-)

diff --git a/misc/tst-ldbl-error.c b/misc/tst-ldbl-error.c
index 76b2c8f784..37ac9b65db 100644
--- a/misc/tst-ldbl-error.c
+++ b/misc/tst-ldbl-error.c
@@ -85,14 +85,15 @@ do_one_test (void *callback, const char *expected, ...)
   /* Call 'callback', which fills in the output and error buffers.  */
   result = support_capture_subprocess (callback, NULL);
 
-  /* The functions err, errx, verr, and verrx print just the program
-     name followed by a colon, whereas error and error_at_line print the
-     whole path to the program.  Since the whole path depends on the
-     working directory used to build and test glibc, remove it from the
-     comparison against the expected result.  */
-  const char *needle = "tst-ldbl-error:";
+  /* Filter out the name of the program (which should always end with
+     -error), so that the test case can be reused by ldbl-opt and
+     ldbl-128ibm-compat.  */
+  const char *needle = "-error:";
   char *message;
   message = strstr (result.err.buffer, needle);
+  if (message == NULL)
+    FAIL_EXIT1 ("test case error");
+  message += strlen (needle);
 
   /* Verify that the output message is as expected.  */
   TEST_COMPARE_STRING (message, expected);
@@ -104,12 +105,12 @@ static int
 do_test (void)
 {
   struct tests tests[] = {
-    { &callback_err, "tst-ldbl-error: -1.000000: Success\n" },
-    { &callback_errx, "tst-ldbl-error: -1.000000\n" },
-    { &callback_verr, "tst-ldbl-error: -1.000000: Success\n" },
-    { &callback_verrx, "tst-ldbl-error: -1.000000\n" },
-    { &callback_error, "tst-ldbl-error: -1.000000\n" },
-    { &callback_error_at_line, "tst-ldbl-error::0: -1.000000\n" }
+    { &callback_err, " -1.000000: Success\n" },
+    { &callback_errx, " -1.000000\n" },
+    { &callback_verr, " -1.000000: Success\n" },
+    { &callback_verrx, " -1.000000\n" },
+    { &callback_error, " -1.000000\n" },
+    { &callback_error_at_line, ":0: -1.000000\n" }
   };
 
   for (int i = 0; i < sizeof (tests) / sizeof (tests[0]); i++)
diff --git a/misc/tst-ldbl-warn.c b/misc/tst-ldbl-warn.c
index 69a528755c..f452d34f24 100644
--- a/misc/tst-ldbl-warn.c
+++ b/misc/tst-ldbl-warn.c
@@ -59,9 +59,21 @@ do_one_test (int select, const char *format, va_list args,
 
   stderr = old_stderr;
 
-  /* Close the in-memory stream and check the output buffer.  */
+  /* Close the in-memory stream.  */
   xfclose_memstream (&stream);
-  TEST_COMPARE_STRING (stream.buffer, expected);
+
+  /* Filter out the name of the program (which should always end with
+     warn), so that the test case can be reused by ldbl-opt and
+     ldbl-128ibm-compat.  */
+  const char *needle = "warn: ";
+  char *message;
+  message = strstr (stream.buffer, needle);
+  if (message == NULL)
+    FAIL_EXIT1 ("test case error");
+  message += strlen (needle);
+
+  /* Check that the rest of the output is as expected.  */
+  TEST_COMPARE_STRING (message, expected);
 
   if (stream.buffer != NULL)
     free (stream.buffer);
@@ -74,13 +86,11 @@ do_test_call_varg (const char *format, ...)
 
   va_start (args, format);
   do_one_test (VWARN, format, args, 0, 0, 0, 0,
-       "tst-ldbl-warn: "
        "-1.000000 - -2.000000 - -3.000000 - -4.000000: Success\n");
   va_end (args);
 
   va_start (args, format);
   do_one_test (VWARNX, format, args, 0, 0, 0, 0,
-       "tst-ldbl-warn: "
        "-1.000000 - -2.000000 - -3.000000 - -4.000000\n");
   va_end (args);
 }
@@ -92,10 +102,8 @@ do_test_call_rarg (const char *format, long double arg1, double arg2,
   va_list args;
   memset (&args, 0, sizeof (args));
   do_one_test (WARN, format, args, arg1, arg2, arg3, arg4,
-       "tst-ldbl-warn: "
        "-1.000000 - -2.000000 - -3.000000 - -4.000000: Success\n");
   do_one_test (WARNX, format, args, arg1, arg2, arg3, arg4,
-       "tst-ldbl-warn: "
        "-1.000000 - -2.000000 - -3.000000 - -4.000000\n");
 }
 
diff --git a/sysdeps/ieee754/ldbl-opt/Makefile b/sysdeps/ieee754/ldbl-opt/Makefile
index 8a2c129f5f..791a5eabd2 100644
--- a/sysdeps/ieee754/ldbl-opt/Makefile
+++ b/sysdeps/ieee754/ldbl-opt/Makefile
@@ -189,3 +189,19 @@ $(objpfx)tst-nldbl-argp.c: tst-ldbl-argp.c
 
 CFLAGS-tst-nldbl-argp.c += -mlong-double-64
 endif
+
+# Tests for err.h and error.h functions (reusing the relevant tests from
+# misc/).
+ifeq ($(subdir), misc)
+tests-internal += tst-nldbl-warn
+tests-internal += tst-nldbl-error
+
+$(objpfx)tst-nldbl-warn.c: tst-ldbl-warn.c
+ cp $< $@
+
+$(objpfx)tst-nldbl-error.c: tst-ldbl-error.c
+ cp $< $@
+
+CFLAGS-tst-nldbl-warn.c += -mlong-double-64
+CFLAGS-tst-nldbl-error.c += -mlong-double-64
+endif
--
2.14.5

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v1 0/7] Add missing nldbl functions to libc

Gabriel F. T. Gomes-2
In reply to this post by Gabriel F. T. Gomes-2
On Thu, 06 Dec 2018, Gabriel F. T. Gomes wrote:

>Gabriel F. T. Gomes (7):
>  Remove redirection of _IO_vfprintf
>  Add *-ldbl.h headers to include/bits
>  ldbl-opt: Add arpg_error and argp_failure
>  ldbl-opt: Reuse argp tests that print long double
>  ldbl-opt: Add err, errx, verr, verrx, warn, warnx, vwarn, and vwarnx
>  ldbl-opt: Add error and error_at_line
>  ldbl-opt: Reuse test cases from misc/ that check long double

I forgot to mention that these patches are relative to a branch with the
patch to add internal functions for argp*, err* and warn* functions (and
I sent them in the wrong order... sorry):

https://sourceware.org/ml/libc-alpha/2018-12/msg00220.html
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v1 1/7] Remove redirection of _IO_vfprintf

Joseph Myers
In reply to this post by Gabriel F. T. Gomes-2
On Thu, 6 Dec 2018, Gabriel F. T. Gomes wrote:

> Since the commit
>
> commit 698fb75b9ff5ae454a1344b5f9fafa0ca367c555
> Author: Zack Weinberg <[hidden email]>
> Date:   Wed Mar 7 14:32:01 2018 -0500
>
>     Add __v*printf_internal with flags arguments
>
> _IO_vfprintf is gone.  This did not trigger any test case failures on

I see that libio/iolibio.h has a call to _IO_vfprintf in a definition of
_IO_vprintf as a macro.  I suppose that's just left over from a previous
patch?  Other than that, yes, _IO_vfprintf seems gone apart from the
aliases for ABI compatibility, so this patch is OK.

--
Joseph S. Myers
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v1 2/7] Add *-ldbl.h headers to include/bits

Joseph Myers
In reply to this post by Gabriel F. T. Gomes-2
On Thu, 6 Dec 2018, Gabriel F. T. Gomes wrote:

> * include/bits/argp-ldbl.h: New file.
> * include/bits/err-ldbl.h: Likewise.
> * include/bits/error-ldbl.h: Likewise.

These depend on subsequent patches in the series that add the real
bits/*-ldbl.h implementations, so should be later in the series (or merged
with those patches).

> * include/bits/monetary-ldbl.h: Likewise.
> * include/bits/printf-ldbl.h: Likewise.
> * include/bits/stdio-ldbl.h: Likewise.
> * include/bits/stdlib-ldbl.h: Likewise.
> * include/bits/syslog-ldbl.h: Likewise.
> * include/bits/wchar-ldbl.h: Likewise.

This part of the patch is OK (as is the rest once the underlying patches
to add the relevant bits/ headers are approved).

--
Joseph S. Myers
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v1 0/7] Add missing nldbl functions to libc

Joseph Myers
In reply to this post by Gabriel F. T. Gomes-2
On Thu, 6 Dec 2018, Gabriel F. T. Gomes wrote:

> The functions: argp_error and argp_failure (from argp.h); err, errx,
> verr, verrx, warn, warnx, vwarn, and vwarnx (from err.h); error and
> error_at_line (from error.h); can take long double arguments if
> requested by the format string.  However, on platforms where long double
> format changed in GLIBC 2.4, a compat function (nldbl) has never been
> added.  This patch set adds these functions, as well as header magic to
> redirect function calls when user code is built with -mlong-double-64.

As this is a bug that's user-visible in releases, it should be filed in
Bugzilla if not already there, then the relevant patches should reference
that bug (which should be resolved as FIXED with target milestone set once
all the patches are in).

--
Joseph S. Myers
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v1 1/7] Remove redirection of _IO_vfprintf

Zack Weinberg-2
In reply to this post by Joseph Myers
On Thu, Dec 6, 2018 at 3:34 PM Joseph Myers <[hidden email]> wrote:
> On Thu, 6 Dec 2018, Gabriel F. T. Gomes wrote:
> >
> > _IO_vfprintf is gone.  This did not trigger any test case failures on
>
> I see that libio/iolibio.h has a call to _IO_vfprintf in a definition of
> _IO_vprintf as a macro.  I suppose that's just left over from a previous
> patch?

When I did the patches to stop installing libio.h, I noticed there
were a whole bunch of stale definitions and prototypes in iolibio.h,
but I decided it wasn't worth cleaning them up in that patch series,
since iolibio.h has never (AFAICT) been installed.  "Minimize the use
of _IO_ interfaces throughout glibc" would be a good patch series for
someone [who has more time than I do right now ;-)] to tackle, and
maybe we would discover that iolibio.h was completely redundant at the
end of it.

zw
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v1 2/7] Add *-ldbl.h headers to include/bits

Gabriel F. T. Gomes-2
In reply to this post by Joseph Myers
On Thu, 06 Dec 2018, Joseph Myers wrote:

>On Thu, 6 Dec 2018, Gabriel F. T. Gomes wrote:
>
>> * include/bits/argp-ldbl.h: New file.
>> * include/bits/err-ldbl.h: Likewise.
>> * include/bits/error-ldbl.h: Likewise.  
>
>These depend on subsequent patches in the series that add the real
>bits/*-ldbl.h implementations, so should be later in the series (or merged
>with those patches).

Thanks, I merged this part of the patch into the subsequent patches.

>> * include/bits/monetary-ldbl.h: Likewise.
>> * include/bits/printf-ldbl.h: Likewise.
>> * include/bits/stdio-ldbl.h: Likewise.
>> * include/bits/stdlib-ldbl.h: Likewise.
>> * include/bits/syslog-ldbl.h: Likewise.
>> * include/bits/wchar-ldbl.h: Likewise.  
>
>This part of the patch is OK (as is the rest once the underlying patches
>to add the relevant bits/ headers are approved).

This part is now committed.

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v1 1/7] Remove redirection of _IO_vfprintf

Gabriel F. T. Gomes-2
In reply to this post by Joseph Myers
On Thu, 06 Dec 2018, Joseph Myers wrote:

>I see that libio/iolibio.h has a call to _IO_vfprintf in a definition of
>_IO_vprintf as a macro.  I suppose that's just left over from a previous
>patch?  Other than that, yes, _IO_vfprintf seems gone apart from the
>aliases for ABI compatibility, so this patch is OK.

Thanks, now committed.