unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v4 0/5] Add missing nldbl functions to libc
@ 2019-02-21 20:57 Gabriel F. T. Gomes
  2019-02-21 20:57 ` [PATCH v4 1/5] ldbl-opt: Add arpg_error and argp_failure (bug 23983) Gabriel F. T. Gomes
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Gabriel F. T. Gomes @ 2019-02-21 20:57 UTC (permalink / raw)
  To: libc-alpha

Since v3, I updated the ABI version to GLIBC 2.30 and the copyright years.

Gabriel F. T. Gomes (5):
  ldbl-opt: Add arpg_error and argp_failure (bug 23983)
  ldbl-opt: Reuse argp tests that print long double
  ldbl-opt: Add err, errx, verr, verrx, warn, warnx, vwarn, and vwarnx
    (bug 23984)
  ldbl-opt: Add error and error_at_line (bug 23984)
  ldbl-opt: Reuse test cases from misc/ that check long double

 argp/Makefile                                      |   2 +-
 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/err.h                                      |   9 ++
 include/error.h                                    |  14 +++
 misc/Makefile                                      |   3 +-
 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/be/libc.abilist   |  12 +++
 .../sysv/linux/powerpc/powerpc64/le/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 +++
 28 files changed, 409 insertions(+), 23 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 misc/bits/err-ldbl.h
 create mode 100644 misc/bits/error-ldbl.h

-- 
2.14.5


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v4 1/5] ldbl-opt: Add arpg_error and argp_failure (bug 23983)
  2019-02-21 20:57 [PATCH v4 0/5] Add missing nldbl functions to libc Gabriel F. T. Gomes
@ 2019-02-21 20:57 ` Gabriel F. T. Gomes
  2019-02-28 18:35   ` Joseph Myers
  2019-02-21 20:57 ` [PATCH v4 2/5] ldbl-opt: Reuse argp tests that print long double Gabriel F. T. Gomes
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Gabriel F. T. Gomes @ 2019-02-21 20:57 UTC (permalink / raw)
  To: libc-alpha

Changes since v3:

  - Updated symbol version to the 2.30 development cycle.
  - Updated copyright years.

Changes since v2:

  - Added bits/argp-ldbl.h to the list of installed headers.

Changes since v1:

  - Added include/bits/argp-ldbl.h.
  - Added mention to bugzilla fix.

-- 8< --
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.

	[BZ #23983]
	* argp/Makefile (headers): Add bits/argp-ldbl.h.
	* 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.
	* include/bits/argp-ldbl.h: New file.
	* 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/Makefile                                      |  2 +-
 argp/argp.h                                        |  4 ++++
 argp/bits/argp-ldbl.h                              | 24 ++++++++++++++++++++++
 include/argp.h                                     | 11 ++++++++++
 include/bits/argp-ldbl.h                           |  1 +
 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/be/libc.abilist   |  2 ++
 .../sysv/linux/powerpc/powerpc64/le/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 ++
 16 files changed, 84 insertions(+), 1 deletion(-)
 create mode 100644 argp/bits/argp-ldbl.h
 create mode 100644 include/bits/argp-ldbl.h

diff --git a/argp/Makefile b/argp/Makefile
index bebd71c564..d5c2d77658 100644
--- a/argp/Makefile
+++ b/argp/Makefile
@@ -22,7 +22,7 @@ subdir	:= argp
 
 include ../Makeconfig
 
-headers		= argp.h
+headers		= argp.h bits/argp-ldbl.h
 routines	= $(addprefix argp-, ba fmtstream fs-xinl help parse pv \
 				     pvh xinl eexst)
 
diff --git a/argp/argp.h b/argp/argp.h
index fae6dfb3ef..c7322581bf 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..86022a04ac
--- /dev/null
+++ b/argp/bits/argp-ldbl.h
@@ -0,0 +1,24 @@
+/* Redirections for argp functions for -mlong-double-64.
+   Copyright (C) 2019 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/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/sysdeps/ieee754/ldbl-opt/Versions b/sysdeps/ieee754/ldbl-opt/Versions
index af0c4a098c..1842a1a3ef 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.30 {
+    __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 76ef8a8f74..4f70207f2d 100644
--- a/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
@@ -22,6 +22,7 @@
 #undef __GLIBC_USE_DEPRECATED_SCANF
 #define __GLIBC_USE_DEPRECATED_SCANF 1
 
+#include <argp.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <libio/strfile.h>
@@ -990,6 +991,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 f2079066cf..9f5836586c 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 fe0de20b2b..454a01dcc5 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -2204,6 +2204,8 @@ GLIBC_2.3.4 setipv4sourcefilter F
 GLIBC_2.3.4 setsourcefilter F
 GLIBC_2.3.4 xdr_quad_t F
 GLIBC_2.3.4 xdr_u_quad_t F
+GLIBC_2.30 __nldbl_argp_error F
+GLIBC_2.30 __nldbl_argp_failure F
 GLIBC_2.30 gettid F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index d99a835544..b689f20112 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -2164,6 +2164,8 @@ GLIBC_2.3.4 siglongjmp F
 GLIBC_2.3.4 swapcontext F
 GLIBC_2.3.4 xdr_quad_t F
 GLIBC_2.3.4 xdr_u_quad_t F
+GLIBC_2.30 __nldbl_argp_error F
+GLIBC_2.30 __nldbl_argp_failure F
 GLIBC_2.30 gettid F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index 826772777a..8b6d72abb6 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -2197,6 +2197,8 @@ GLIBC_2.3.4 siglongjmp F
 GLIBC_2.3.4 swapcontext F
 GLIBC_2.3.4 xdr_quad_t F
 GLIBC_2.3.4 xdr_u_quad_t F
+GLIBC_2.30 __nldbl_argp_error F
+GLIBC_2.30 __nldbl_argp_failure F
 GLIBC_2.30 gettid F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
index 5aa038971b..2c14eae34c 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
@@ -2027,6 +2027,8 @@ GLIBC_2.3.4 siglongjmp F
 GLIBC_2.3.4 swapcontext F
 GLIBC_2.3.4 xdr_quad_t F
 GLIBC_2.3.4 xdr_u_quad_t F
+GLIBC_2.30 __nldbl_argp_error F
+GLIBC_2.30 __nldbl_argp_failure F
 GLIBC_2.30 gettid F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
index c630d0c37d..450d42736a 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
@@ -2231,4 +2231,6 @@ GLIBC_2.28 thrd_yield F
 GLIBC_2.29 getcpu F
 GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
 GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
+GLIBC_2.30 __nldbl_argp_error F
+GLIBC_2.30 __nldbl_argp_failure F
 GLIBC_2.30 gettid F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index 361240400c..9e6184044c 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -2159,6 +2159,8 @@ GLIBC_2.3.4 setipv4sourcefilter F
 GLIBC_2.3.4 setsourcefilter F
 GLIBC_2.3.4 xdr_quad_t F
 GLIBC_2.3.4 xdr_u_quad_t F
+GLIBC_2.30 __nldbl_argp_error F
+GLIBC_2.30 __nldbl_argp_failure F
 GLIBC_2.30 gettid F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index f44f178a08..9a8a4b247e 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -2063,6 +2063,8 @@ GLIBC_2.3.4 setipv4sourcefilter F
 GLIBC_2.3.4 setsourcefilter F
 GLIBC_2.3.4 xdr_quad_t F
 GLIBC_2.3.4 xdr_u_quad_t F
+GLIBC_2.30 __nldbl_argp_error F
+GLIBC_2.30 __nldbl_argp_failure F
 GLIBC_2.30 gettid F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index 37957959e2..e1d35a40aa 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -2153,6 +2153,8 @@ GLIBC_2.3.4 setipv4sourcefilter F
 GLIBC_2.3.4 setsourcefilter F
 GLIBC_2.3.4 xdr_quad_t F
 GLIBC_2.3.4 xdr_u_quad_t F
+GLIBC_2.30 __nldbl_argp_error F
+GLIBC_2.30 __nldbl_argp_failure F
 GLIBC_2.30 gettid F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
-- 
2.14.5


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v4 2/5] ldbl-opt: Reuse argp tests that print long double
  2019-02-21 20:57 [PATCH v4 0/5] Add missing nldbl functions to libc Gabriel F. T. Gomes
  2019-02-21 20:57 ` [PATCH v4 1/5] ldbl-opt: Add arpg_error and argp_failure (bug 23983) Gabriel F. T. Gomes
@ 2019-02-21 20:57 ` Gabriel F. T. Gomes
  2019-02-28 18:36   ` Joseph Myers
  2019-02-21 20:57 ` [PATCH v4 3/5] ldbl-opt: Add err, errx, verr, verrx, warn, warnx, vwarn, and vwarnx (bug 23984) Gabriel F. T. Gomes
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Gabriel F. T. Gomes @ 2019-02-21 20:57 UTC (permalink / raw)
  To: libc-alpha

No changes since v3.

No changes since v2.

No changes since v1.

-- 8< --
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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v4 3/5] ldbl-opt: Add err, errx, verr, verrx, warn, warnx, vwarn, and vwarnx (bug 23984)
  2019-02-21 20:57 [PATCH v4 0/5] Add missing nldbl functions to libc Gabriel F. T. Gomes
  2019-02-21 20:57 ` [PATCH v4 1/5] ldbl-opt: Add arpg_error and argp_failure (bug 23983) Gabriel F. T. Gomes
  2019-02-21 20:57 ` [PATCH v4 2/5] ldbl-opt: Reuse argp tests that print long double Gabriel F. T. Gomes
@ 2019-02-21 20:57 ` Gabriel F. T. Gomes
  2019-02-28 18:38   ` Joseph Myers
  2019-02-21 20:57 ` [PATCH v4 4/5] ldbl-opt: Add error and error_at_line " Gabriel F. T. Gomes
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Gabriel F. T. Gomes @ 2019-02-21 20:57 UTC (permalink / raw)
  To: libc-alpha

Changes since v3:

  - Updated symbol version to the 2.30 development cycle.
  - Updated copyright years.

Changes since v2:

  - Added bits/err-ldbl.h to the list of installed headers.

Changes since v1:

  - Added include/bits/err-ldbl.h
  - Added mention to bugzilla fix.

-- 8< --
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.

	[BZ #23984]
	* include/bits/err-ldbl.h: New file.
	* include/err.h: Add prototypes for the internal functions:
	__vwarnx_internal and __vwarn_internal.
	* misc/Makefile (headers): Add bits/err-ldbl.h.
	* 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/bits/err-ldbl.h                            |  1 +
 include/err.h                                      |  9 ++++
 misc/Makefile                                      |  3 +-
 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/be/libc.abilist   |  8 +++
 .../sysv/linux/powerpc/powerpc64/le/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 +++
 16 files changed, 182 insertions(+), 1 deletion(-)
 create mode 100644 include/bits/err-ldbl.h
 create mode 100644 misc/bits/err-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/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/Makefile b/misc/Makefile
index cf0daa1161..6cb660bd3e 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -36,7 +36,8 @@ headers	:= sys/uio.h bits/uio-ext.h bits/uio_lim.h \
 	   syslog.h sys/syslog.h \
 	   bits/syslog.h bits/syslog-ldbl.h bits/syslog-path.h bits/error.h \
 	   bits/select2.h bits/hwcap.h sys/auxv.h \
-	   sys/sysmacros.h bits/sysmacros.h bits/types/struct_iovec.h
+	   sys/sysmacros.h bits/sysmacros.h bits/types/struct_iovec.h \
+	   bits/err-ldbl.h
 
 routines := brk sbrk sstk ioctl \
 	    readv writev preadv preadv64 pwritev pwritev64 \
diff --git a/misc/bits/err-ldbl.h b/misc/bits/err-ldbl.h
new file mode 100644
index 0000000000..e62f679e35
--- /dev/null
+++ b/misc/bits/err-ldbl.h
@@ -0,0 +1,30 @@
+/* Redirections for err.h functions for -mlong-double-64.
+   Copyright (C) 2019 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 4690d04d6a..4dfd9a6f5d 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 1842a1a3ef..5d6051a12d 100644
--- a/sysdeps/ieee754/ldbl-opt/Versions
+++ b/sysdeps/ieee754/ldbl-opt/Versions
@@ -80,6 +80,8 @@ libc {
   }
   GLIBC_2.30 {
     __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 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);
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-compat.h b/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
index 9f5836586c..eeda11b420 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 454a01dcc5..1b95af13bc 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -2206,6 +2206,14 @@ GLIBC_2.3.4 xdr_quad_t F
 GLIBC_2.3.4 xdr_u_quad_t F
 GLIBC_2.30 __nldbl_argp_error F
 GLIBC_2.30 __nldbl_argp_failure F
+GLIBC_2.30 __nldbl_err F
+GLIBC_2.30 __nldbl_errx F
+GLIBC_2.30 __nldbl_verr F
+GLIBC_2.30 __nldbl_verrx F
+GLIBC_2.30 __nldbl_vwarn F
+GLIBC_2.30 __nldbl_vwarnx F
+GLIBC_2.30 __nldbl_warn F
+GLIBC_2.30 __nldbl_warnx F
 GLIBC_2.30 gettid F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index b689f20112..8973a44b56 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -2166,6 +2166,14 @@ GLIBC_2.3.4 xdr_quad_t F
 GLIBC_2.3.4 xdr_u_quad_t F
 GLIBC_2.30 __nldbl_argp_error F
 GLIBC_2.30 __nldbl_argp_failure F
+GLIBC_2.30 __nldbl_err F
+GLIBC_2.30 __nldbl_errx F
+GLIBC_2.30 __nldbl_verr F
+GLIBC_2.30 __nldbl_verrx F
+GLIBC_2.30 __nldbl_vwarn F
+GLIBC_2.30 __nldbl_vwarnx F
+GLIBC_2.30 __nldbl_warn F
+GLIBC_2.30 __nldbl_warnx F
 GLIBC_2.30 gettid F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index 8b6d72abb6..c89ca3efaa 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -2199,6 +2199,14 @@ GLIBC_2.3.4 xdr_quad_t F
 GLIBC_2.3.4 xdr_u_quad_t F
 GLIBC_2.30 __nldbl_argp_error F
 GLIBC_2.30 __nldbl_argp_failure F
+GLIBC_2.30 __nldbl_err F
+GLIBC_2.30 __nldbl_errx F
+GLIBC_2.30 __nldbl_verr F
+GLIBC_2.30 __nldbl_verrx F
+GLIBC_2.30 __nldbl_vwarn F
+GLIBC_2.30 __nldbl_vwarnx F
+GLIBC_2.30 __nldbl_warn F
+GLIBC_2.30 __nldbl_warnx F
 GLIBC_2.30 gettid F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
index 2c14eae34c..1b0f108c19 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
@@ -2029,6 +2029,14 @@ GLIBC_2.3.4 xdr_quad_t F
 GLIBC_2.3.4 xdr_u_quad_t F
 GLIBC_2.30 __nldbl_argp_error F
 GLIBC_2.30 __nldbl_argp_failure F
+GLIBC_2.30 __nldbl_err F
+GLIBC_2.30 __nldbl_errx F
+GLIBC_2.30 __nldbl_verr F
+GLIBC_2.30 __nldbl_verrx F
+GLIBC_2.30 __nldbl_vwarn F
+GLIBC_2.30 __nldbl_vwarnx F
+GLIBC_2.30 __nldbl_warn F
+GLIBC_2.30 __nldbl_warnx F
 GLIBC_2.30 gettid F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
index 450d42736a..02504aeb58 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
@@ -2233,4 +2233,12 @@ GLIBC_2.29 posix_spawn_file_actions_addchdir_np F
 GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
 GLIBC_2.30 __nldbl_argp_error F
 GLIBC_2.30 __nldbl_argp_failure F
+GLIBC_2.30 __nldbl_err F
+GLIBC_2.30 __nldbl_errx F
+GLIBC_2.30 __nldbl_verr F
+GLIBC_2.30 __nldbl_verrx F
+GLIBC_2.30 __nldbl_vwarn F
+GLIBC_2.30 __nldbl_vwarnx F
+GLIBC_2.30 __nldbl_warn F
+GLIBC_2.30 __nldbl_warnx F
 GLIBC_2.30 gettid F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index 9e6184044c..c46f1119d4 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -2161,6 +2161,14 @@ GLIBC_2.3.4 xdr_quad_t F
 GLIBC_2.3.4 xdr_u_quad_t F
 GLIBC_2.30 __nldbl_argp_error F
 GLIBC_2.30 __nldbl_argp_failure F
+GLIBC_2.30 __nldbl_err F
+GLIBC_2.30 __nldbl_errx F
+GLIBC_2.30 __nldbl_verr F
+GLIBC_2.30 __nldbl_verrx F
+GLIBC_2.30 __nldbl_vwarn F
+GLIBC_2.30 __nldbl_vwarnx F
+GLIBC_2.30 __nldbl_warn F
+GLIBC_2.30 __nldbl_warnx F
 GLIBC_2.30 gettid F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index 9a8a4b247e..47b0be5e50 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -2065,6 +2065,14 @@ GLIBC_2.3.4 xdr_quad_t F
 GLIBC_2.3.4 xdr_u_quad_t F
 GLIBC_2.30 __nldbl_argp_error F
 GLIBC_2.30 __nldbl_argp_failure F
+GLIBC_2.30 __nldbl_err F
+GLIBC_2.30 __nldbl_errx F
+GLIBC_2.30 __nldbl_verr F
+GLIBC_2.30 __nldbl_verrx F
+GLIBC_2.30 __nldbl_vwarn F
+GLIBC_2.30 __nldbl_vwarnx F
+GLIBC_2.30 __nldbl_warn F
+GLIBC_2.30 __nldbl_warnx F
 GLIBC_2.30 gettid F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index e1d35a40aa..854708e37c 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -2155,6 +2155,14 @@ GLIBC_2.3.4 xdr_quad_t F
 GLIBC_2.3.4 xdr_u_quad_t F
 GLIBC_2.30 __nldbl_argp_error F
 GLIBC_2.30 __nldbl_argp_failure F
+GLIBC_2.30 __nldbl_err F
+GLIBC_2.30 __nldbl_errx F
+GLIBC_2.30 __nldbl_verr F
+GLIBC_2.30 __nldbl_verrx F
+GLIBC_2.30 __nldbl_vwarn F
+GLIBC_2.30 __nldbl_vwarnx F
+GLIBC_2.30 __nldbl_warn F
+GLIBC_2.30 __nldbl_warnx F
 GLIBC_2.30 gettid F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
-- 
2.14.5


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v4 4/5] ldbl-opt: Add error and error_at_line (bug 23984)
  2019-02-21 20:57 [PATCH v4 0/5] Add missing nldbl functions to libc Gabriel F. T. Gomes
                   ` (2 preceding siblings ...)
  2019-02-21 20:57 ` [PATCH v4 3/5] ldbl-opt: Add err, errx, verr, verrx, warn, warnx, vwarn, and vwarnx (bug 23984) Gabriel F. T. Gomes
@ 2019-02-21 20:57 ` Gabriel F. T. Gomes
  2019-02-28 18:40   ` Joseph Myers
  2019-02-21 20:57 ` [PATCH v4 5/5] ldbl-opt: Reuse test cases from misc/ that check long double Gabriel F. T. Gomes
  2019-02-28 14:02 ` Ping. Re: [PATCH v4 0/5] Add missing nldbl functions to libc Gabriel F. T. Gomes
  5 siblings, 1 reply; 12+ messages in thread
From: Gabriel F. T. Gomes @ 2019-02-21 20:57 UTC (permalink / raw)
  To: libc-alpha

Changes since v3:

  - Updated symbol version to the 2.30 development cycle.
  - Updated copyright years.

Changes since v2:

  - Added bits/error-ldbl.h to the list of installed headers.

Changes since v1:

  - Added include/bits/error-ldbl.h
  - Added mention to bugzilla fix.

-- 8< --
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.

	[BZ #23984]
	* include/bits/error-ldbl.h: New file.
	* include/error.h: Include stdarg.h.  Declare internal functions
	__error_internal and __error_at_line_internal.
	* misc/Makefile (headers): Add bits/error-ldbl.h.
	* 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/bits/error-ldbl.h                          |  1 +
 include/error.h                                    | 14 +++++++++++++
 misc/Makefile                                      |  2 +-
 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/be/libc.abilist   |  2 ++
 .../sysv/linux/powerpc/powerpc64/le/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 ++
 16 files changed, 91 insertions(+), 4 deletions(-)
 create mode 100644 include/bits/error-ldbl.h
 create mode 100644 misc/bits/error-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/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/Makefile b/misc/Makefile
index 6cb660bd3e..032f28fc38 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -37,7 +37,7 @@ headers	:= sys/uio.h bits/uio-ext.h bits/uio_lim.h \
 	   bits/syslog.h bits/syslog-ldbl.h bits/syslog-path.h bits/error.h \
 	   bits/select2.h bits/hwcap.h sys/auxv.h \
 	   sys/sysmacros.h bits/sysmacros.h bits/types/struct_iovec.h \
-	   bits/err-ldbl.h
+	   bits/err-ldbl.h bits/error-ldbl.h
 
 routines := brk sbrk sstk ioctl \
 	    readv writev preadv preadv64 pwritev pwritev64 \
diff --git a/misc/bits/error-ldbl.h b/misc/bits/error-ldbl.h
new file mode 100644
index 0000000000..c3883da299
--- /dev/null
+++ b/misc/bits/error-ldbl.h
@@ -0,0 +1,24 @@
+/* Redirections for error.h functions for -mlong-double-64.
+   Copyright (C) 2019 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 34d4a6d4c6..ba0c9293ed 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 5d6051a12d..21a2db6888 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 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);
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-compat.h b/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
index eeda11b420..aed1cc1497 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 1b95af13bc..fd81fc4ad0 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -2207,6 +2207,8 @@ GLIBC_2.3.4 xdr_u_quad_t F
 GLIBC_2.30 __nldbl_argp_error F
 GLIBC_2.30 __nldbl_argp_failure F
 GLIBC_2.30 __nldbl_err F
+GLIBC_2.30 __nldbl_error F
+GLIBC_2.30 __nldbl_error_at_line F
 GLIBC_2.30 __nldbl_errx F
 GLIBC_2.30 __nldbl_verr F
 GLIBC_2.30 __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 8973a44b56..a701584422 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -2167,6 +2167,8 @@ GLIBC_2.3.4 xdr_u_quad_t F
 GLIBC_2.30 __nldbl_argp_error F
 GLIBC_2.30 __nldbl_argp_failure F
 GLIBC_2.30 __nldbl_err F
+GLIBC_2.30 __nldbl_error F
+GLIBC_2.30 __nldbl_error_at_line F
 GLIBC_2.30 __nldbl_errx F
 GLIBC_2.30 __nldbl_verr F
 GLIBC_2.30 __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 c89ca3efaa..bbb647cd98 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -2200,6 +2200,8 @@ GLIBC_2.3.4 xdr_u_quad_t F
 GLIBC_2.30 __nldbl_argp_error F
 GLIBC_2.30 __nldbl_argp_failure F
 GLIBC_2.30 __nldbl_err F
+GLIBC_2.30 __nldbl_error F
+GLIBC_2.30 __nldbl_error_at_line F
 GLIBC_2.30 __nldbl_errx F
 GLIBC_2.30 __nldbl_verr F
 GLIBC_2.30 __nldbl_verrx F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
index 1b0f108c19..bb23bf61a8 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
@@ -2030,6 +2030,8 @@ GLIBC_2.3.4 xdr_u_quad_t F
 GLIBC_2.30 __nldbl_argp_error F
 GLIBC_2.30 __nldbl_argp_failure F
 GLIBC_2.30 __nldbl_err F
+GLIBC_2.30 __nldbl_error F
+GLIBC_2.30 __nldbl_error_at_line F
 GLIBC_2.30 __nldbl_errx F
 GLIBC_2.30 __nldbl_verr F
 GLIBC_2.30 __nldbl_verrx F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
index 02504aeb58..7921dda979 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
@@ -2234,6 +2234,8 @@ GLIBC_2.29 posix_spawn_file_actions_addfchdir_np F
 GLIBC_2.30 __nldbl_argp_error F
 GLIBC_2.30 __nldbl_argp_failure F
 GLIBC_2.30 __nldbl_err F
+GLIBC_2.30 __nldbl_error F
+GLIBC_2.30 __nldbl_error_at_line F
 GLIBC_2.30 __nldbl_errx F
 GLIBC_2.30 __nldbl_verr F
 GLIBC_2.30 __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 c46f1119d4..2aed339af4 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -2162,6 +2162,8 @@ GLIBC_2.3.4 xdr_u_quad_t F
 GLIBC_2.30 __nldbl_argp_error F
 GLIBC_2.30 __nldbl_argp_failure F
 GLIBC_2.30 __nldbl_err F
+GLIBC_2.30 __nldbl_error F
+GLIBC_2.30 __nldbl_error_at_line F
 GLIBC_2.30 __nldbl_errx F
 GLIBC_2.30 __nldbl_verr F
 GLIBC_2.30 __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 47b0be5e50..e46feb56e5 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -2066,6 +2066,8 @@ GLIBC_2.3.4 xdr_u_quad_t F
 GLIBC_2.30 __nldbl_argp_error F
 GLIBC_2.30 __nldbl_argp_failure F
 GLIBC_2.30 __nldbl_err F
+GLIBC_2.30 __nldbl_error F
+GLIBC_2.30 __nldbl_error_at_line F
 GLIBC_2.30 __nldbl_errx F
 GLIBC_2.30 __nldbl_verr F
 GLIBC_2.30 __nldbl_verrx F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index 854708e37c..ebdbd2c5ae 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -2156,6 +2156,8 @@ GLIBC_2.3.4 xdr_u_quad_t F
 GLIBC_2.30 __nldbl_argp_error F
 GLIBC_2.30 __nldbl_argp_failure F
 GLIBC_2.30 __nldbl_err F
+GLIBC_2.30 __nldbl_error F
+GLIBC_2.30 __nldbl_error_at_line F
 GLIBC_2.30 __nldbl_errx F
 GLIBC_2.30 __nldbl_verr F
 GLIBC_2.30 __nldbl_verrx F
-- 
2.14.5


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v4 5/5] ldbl-opt: Reuse test cases from misc/ that check long double
  2019-02-21 20:57 [PATCH v4 0/5] Add missing nldbl functions to libc Gabriel F. T. Gomes
                   ` (3 preceding siblings ...)
  2019-02-21 20:57 ` [PATCH v4 4/5] ldbl-opt: Add error and error_at_line " Gabriel F. T. Gomes
@ 2019-02-21 20:57 ` Gabriel F. T. Gomes
  2019-02-28 18:41   ` Joseph Myers
  2019-02-28 14:02 ` Ping. Re: [PATCH v4 0/5] Add missing nldbl functions to libc Gabriel F. T. Gomes
  5 siblings, 1 reply; 12+ messages in thread
From: Gabriel F. T. Gomes @ 2019-02-21 20:57 UTC (permalink / raw)
  To: libc-alpha

No changes since v3.

No changes since v2.

No changes since v1.

-- 8< --
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 d6609f7fe9..0f13fee9f3 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 7d15b55db8..90375a97ea 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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Ping. Re: [PATCH v4 0/5] Add missing nldbl functions to libc
  2019-02-21 20:57 [PATCH v4 0/5] Add missing nldbl functions to libc Gabriel F. T. Gomes
                   ` (4 preceding siblings ...)
  2019-02-21 20:57 ` [PATCH v4 5/5] ldbl-opt: Reuse test cases from misc/ that check long double Gabriel F. T. Gomes
@ 2019-02-28 14:02 ` Gabriel F. T. Gomes
  5 siblings, 0 replies; 12+ messages in thread
From: Gabriel F. T. Gomes @ 2019-02-28 14:02 UTC (permalink / raw)
  To: libc-alpha

Ping.  The patches in this thread are pending review.
<https://sourceware.org/ml/libc-alpha/2019-02/msg00542.html>

On Thu, Feb 21 2019, Gabriel F. T. Gomes wrote:
> Since v3, I updated the ABI version to GLIBC 2.30 and the copyright years.
> 
> Gabriel F. T. Gomes (5):
>   ldbl-opt: Add arpg_error and argp_failure (bug 23983)
>   ldbl-opt: Reuse argp tests that print long double
>   ldbl-opt: Add err, errx, verr, verrx, warn, warnx, vwarn, and vwarnx
>     (bug 23984)
>   ldbl-opt: Add error and error_at_line (bug 23984)
>   ldbl-opt: Reuse test cases from misc/ that check long double
> 
>  argp/Makefile                                      |   2 +-
>  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/err.h                                      |   9 ++
>  include/error.h                                    |  14 +++
>  misc/Makefile                                      |   3 +-
>  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/be/libc.abilist   |  12 +++
>  .../sysv/linux/powerpc/powerpc64/le/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 +++
>  28 files changed, 409 insertions(+), 23 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 misc/bits/err-ldbl.h
>  create mode 100644 misc/bits/error-ldbl.h
> 
> -- 
> 2.14.5
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v4 1/5] ldbl-opt: Add arpg_error and argp_failure (bug 23983)
  2019-02-21 20:57 ` [PATCH v4 1/5] ldbl-opt: Add arpg_error and argp_failure (bug 23983) Gabriel F. T. Gomes
@ 2019-02-28 18:35   ` Joseph Myers
  0 siblings, 0 replies; 12+ messages in thread
From: Joseph Myers @ 2019-02-28 18:35 UTC (permalink / raw)
  To: Gabriel F. T. Gomes; +Cc: libc-alpha

s/arpg_error/argp_error/ in the subject.

OK with that change.  This is on the basis that, while this patch is 
missing additions to libnldbl_nonshared.a, that library probably isn't 
useful (it's for the case of -mlong-double-64 with compilers not 
supporting asm redirection, but there is evidence that case has been 
broken for a long time) and so isn't worth adding additional exports 
solely for its use (it would require va_list versions of the new functions 
to be exported, much like __nldbl___vstrfmon and __nldbl___vstrfmon_l 
exist even though there is no normal public vstrfmon interface).

We should perhaps consider removing support for libnldbl_nonshared.a and 
officially requiring asm redirection support for any compiler used with 
glibc for configurations with more than one long double format (or more 
generally for any compiler used with glibc headers at all), but that 
should not be a requirement for these patches.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v4 2/5] ldbl-opt: Reuse argp tests that print long double
  2019-02-21 20:57 ` [PATCH v4 2/5] ldbl-opt: Reuse argp tests that print long double Gabriel F. T. Gomes
@ 2019-02-28 18:36   ` Joseph Myers
  0 siblings, 0 replies; 12+ messages in thread
From: Joseph Myers @ 2019-02-28 18:36 UTC (permalink / raw)
  To: Gabriel F. T. Gomes; +Cc: libc-alpha

On Thu, 21 Feb 2019, Gabriel F. T. Gomes wrote:

> 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).

OK.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v4 3/5] ldbl-opt: Add err, errx, verr, verrx, warn, warnx, vwarn, and vwarnx (bug 23984)
  2019-02-21 20:57 ` [PATCH v4 3/5] ldbl-opt: Add err, errx, verr, verrx, warn, warnx, vwarn, and vwarnx (bug 23984) Gabriel F. T. Gomes
@ 2019-02-28 18:38   ` Joseph Myers
  0 siblings, 0 replies; 12+ messages in thread
From: Joseph Myers @ 2019-02-28 18:38 UTC (permalink / raw)
  To: Gabriel F. T. Gomes; +Cc: libc-alpha

OK, although this is missing libnldbl_nonshared.a additions, and unlike in 
patch 1 adding those would not require any further exports from libc.so.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v4 4/5] ldbl-opt: Add error and error_at_line (bug 23984)
  2019-02-21 20:57 ` [PATCH v4 4/5] ldbl-opt: Add error and error_at_line " Gabriel F. T. Gomes
@ 2019-02-28 18:40   ` Joseph Myers
  0 siblings, 0 replies; 12+ messages in thread
From: Joseph Myers @ 2019-02-28 18:40 UTC (permalink / raw)
  To: Gabriel F. T. Gomes; +Cc: libc-alpha

OK (this is like patch 1 as regards libnldbl_nonshared.a, i.e. adding 
these functions to that would require extra libm.so exports with no other 
use).

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v4 5/5] ldbl-opt: Reuse test cases from misc/ that check long double
  2019-02-21 20:57 ` [PATCH v4 5/5] ldbl-opt: Reuse test cases from misc/ that check long double Gabriel F. T. Gomes
@ 2019-02-28 18:41   ` Joseph Myers
  0 siblings, 0 replies; 12+ messages in thread
From: Joseph Myers @ 2019-02-28 18:41 UTC (permalink / raw)
  To: Gabriel F. T. Gomes; +Cc: libc-alpha

This patch is OK.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-02-28 18:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-21 20:57 [PATCH v4 0/5] Add missing nldbl functions to libc Gabriel F. T. Gomes
2019-02-21 20:57 ` [PATCH v4 1/5] ldbl-opt: Add arpg_error and argp_failure (bug 23983) Gabriel F. T. Gomes
2019-02-28 18:35   ` Joseph Myers
2019-02-21 20:57 ` [PATCH v4 2/5] ldbl-opt: Reuse argp tests that print long double Gabriel F. T. Gomes
2019-02-28 18:36   ` Joseph Myers
2019-02-21 20:57 ` [PATCH v4 3/5] ldbl-opt: Add err, errx, verr, verrx, warn, warnx, vwarn, and vwarnx (bug 23984) Gabriel F. T. Gomes
2019-02-28 18:38   ` Joseph Myers
2019-02-21 20:57 ` [PATCH v4 4/5] ldbl-opt: Add error and error_at_line " Gabriel F. T. Gomes
2019-02-28 18:40   ` Joseph Myers
2019-02-21 20:57 ` [PATCH v4 5/5] ldbl-opt: Reuse test cases from misc/ that check long double Gabriel F. T. Gomes
2019-02-28 18:41   ` Joseph Myers
2019-02-28 14:02 ` Ping. Re: [PATCH v4 0/5] Add missing nldbl functions to libc Gabriel F. T. Gomes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).