From patchwork Thu Feb 21 20:57:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gabriel F. T. Gomes" X-Patchwork-Id: 1046452 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-100203-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=inconstante.eti.br Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="aamerOH/"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4456HG5Qqvz9s70 for ; Fri, 22 Feb 2019 07:57:30 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-type; q=dns; s=default; b=JhCgX +dOB5IElHetKwUNwqaWXd3IXOGPXzSLtKGROWsHeW8VsNvHi/JIWF3rInxZre4rd bSPDNQnp38RXghTkNrlsp7xfgK5lifWGmdCQe4nFpyIXf1w9lwpfoDewpb22geQY PyRuGBZFgW3OA2dSzBfNcPf/urC4728tLIASS4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-type; s=default; bh=x3ldizrJJFu cQn19fXuIDrFfYIs=; b=aamerOH/IRZ2K1pI/AJxnknJUTwM/obRul1jSIysXnK ldFFGHw4/pQs5d1ce3i6yrFVKXy2QysgfkdphLHFCeIKDtCaCWg29hROD1yP3t8E Gv9EqXv2xQOf24j4kdf9vEZ4AtCxdyz7PwZst1rJH7Glq5CBWq+C6Br1eaiFOh3Q = Received: (qmail 52725 invoked by alias); 21 Feb 2019 20:57:23 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 52641 invoked by uid 89); 21 Feb 2019 20:57:23 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT autolearn=ham version=3.3.2 spammy=distributed X-HELO: smtpout1.mo803.mail-out.ovh.net From: "Gabriel F. T. Gomes" To: Subject: [PATCH v4 1/5] ldbl-opt: Add arpg_error and argp_failure (bug 23983) Date: Thu, 21 Feb 2019 17:57:02 -0300 Message-ID: <20190221205706.12225-2-gabriel@inconstante.eti.br> In-Reply-To: <20190221205706.12225-1-gabriel@inconstante.eti.br> References: <20190221205706.12225-1-gabriel@inconstante.eti.br> MIME-Version: 1.0 X-Ovh-Tracer-Id: 1201335204332883651 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedutddrtdekgddugeeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenuc 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 +#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 + . */ + +#ifndef _ARGP_H +# error "Never include directly; use 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 +/* Prototypes for internal argp.h functions. */ +#include +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 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 #include #include #include @@ -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 #include #include #include @@ -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 From patchwork Thu Feb 21 20:57:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gabriel F. T. Gomes" X-Patchwork-Id: 1046453 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-100204-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=inconstante.eti.br Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="Ozi8n4P7"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4456HS0qPGz9s70 for ; Fri, 22 Feb 2019 07:57:39 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-type; q=dns; s=default; b=l7Sk6 TDFDmeDom8lcE7zezuE/cDSjtpwYKp5zox5VzziWDuYGlTkJn7fZbjv57ZouN3VZ Z9GIjcHBLW3E3vcwY+92TO9B422BxWTJBtEMA6tUXDSNZGYUR/dMhxPQ2OW6puNj 1OtMHaQHASz+EkvVSh2ObUMNMfIdPqTFJb7JdQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-type; s=default; bh=KteMw6jaAM2 SuQHXM/GB7txTxHU=; b=Ozi8n4P7DZ+C7Ahx163zsJMDepJ9i1QuKzm0FoW521q bkyAlb0x1kBIymel72qcxSxR+awGFmLOHQPy3RponeQqwddNQFc8OfRQPGvw7xhL xPmRBryub4DGwSHYFkvSymHxFJFKmvqV2pWJRjIpaekQE50j6upKAFuqPLjAFozk = Received: (qmail 52859 invoked by alias); 21 Feb 2019 20:57:24 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 52752 invoked by uid 89); 21 Feb 2019 20:57:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY autolearn=ham version=3.3.2 spammy=H*F:D*br X-HELO: smtpout1.mo528.mail-out.ovh.net From: "Gabriel F. T. Gomes" To: Subject: [PATCH v4 2/5] ldbl-opt: Reuse argp tests that print long double Date: Thu, 21 Feb 2019 17:57:03 -0300 Message-ID: <20190221205706.12225-3-gabriel@inconstante.eti.br> In-Reply-To: <20190221205706.12225-1-gabriel@inconstante.eti.br> References: <20190221205706.12225-1-gabriel@inconstante.eti.br> MIME-Version: 1.0 X-Ovh-Tracer-Id: 1202461104577302211 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedutddrtdekgddugeeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenuc 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 From patchwork Thu Feb 21 20:57:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gabriel F. T. Gomes" X-Patchwork-Id: 1046454 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-100205-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=inconstante.eti.br Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="CapyJOOC"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4456Hd4kqRz9s71 for ; Fri, 22 Feb 2019 07:57:49 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-type; q=dns; s=default; b=YzviW rvGzjBTH9raSf3pIvGh6ltyk2twu9vMFxoWLc5y9mJwkleF/7mog4i+o9CMATVw4 /URgECtEiiMO+0nxZ9j9hB7cBBE9x7CPF3XV7SZUN3NMElAV66qJwJJxDB5mDvZ0 PfasYoVElm54jT4FvFp89FNLBJINbldDRHwaNQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-type; s=default; bh=TfrR7ARxo+I 8EcbVmOWxwKzMomk=; b=CapyJOOCpaQ99B8M/xJUJiMJ09/mvfmehSWlLNId51r 4YAFQP7sTwOAaPmns7E3ca8e9fMFoIiuhBuaNEB7GgwVcWqp9R+xl4+yqsPrKYST Cjlb9xYxShoRQIMuvsh64csfCT88J1rA49DHz++z/nEnQCR2JXNqn07rIxNUeUtg = Received: (qmail 53903 invoked by alias); 21 Feb 2019 20:57:32 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 53813 invoked by uid 89); 21 Feb 2019 20:57:31 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT autolearn=ham version=3.3.2 spammy= X-HELO: smtpout1.mo803.mail-out.ovh.net From: "Gabriel F. T. Gomes" To: Subject: [PATCH v4 3/5] ldbl-opt: Add err, errx, verr, verrx, warn, warnx, vwarn, and vwarnx (bug 23984) Date: Thu, 21 Feb 2019 17:57:04 -0300 Message-ID: <20190221205706.12225-4-gabriel@inconstante.eti.br> In-Reply-To: <20190221205706.12225-1-gabriel@inconstante.eti.br> References: <20190221205706.12225-1-gabriel@inconstante.eti.br> MIME-Version: 1.0 X-Ovh-Tracer-Id: 1203868477304262339 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedutddrtdekgddugeeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenuc 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 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 +/* 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 + . */ + +#ifndef _ERR_H +# error "Never include directly; use 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 +#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 +#include #include #include #include @@ -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 +#include #include #include #include @@ -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 From patchwork Thu Feb 21 20:57:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gabriel F. T. Gomes" X-Patchwork-Id: 1046455 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-100206-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=inconstante.eti.br Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="NcbW3cfd"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4456Ht4Yttz9s71 for ; Fri, 22 Feb 2019 07:58:02 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-type; q=dns; s=default; b=LhXF+ 5Jw6sZDGuc01IvMLwpDsUdpGYYeZygQOlohgWBI/dNKQb9vzzARN+fzU1TusobMi O7E3CkqOmuiK0DQCYXA2G/6jbenFleNwgfXnb7XkK/4injctWyfjvOsnYuPsJmw5 Kr29SeT34xXaWAbC1u/CCOikJ6vtQKjixVLrbM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-type; s=default; bh=SzDiJxV8lq6 Ghw2pV+II7EPL0a0=; b=NcbW3cfdHCNjTdImFmDo91P5iRuNLKWJw8PrQAUW8QR IsLZsBSScylZdPmjungvEu53l241Sy0Acaq5f/WhLa7hZuG0eYJfzx2YPTpx+0am PpV8CsIErcKjb4QBfOeoogYhTgWBViYj9iqV3i0hF7M+ZCXrwEmcRVexBcLAe/cU = Received: (qmail 54773 invoked by alias); 21 Feb 2019 20:57:39 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 54678 invoked by uid 89); 21 Feb 2019 20:57:38 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT autolearn=ham version=3.3.2 spammy= X-HELO: smtpout1.mo528.mail-out.ovh.net From: "Gabriel F. T. Gomes" To: Subject: [PATCH v4 4/5] ldbl-opt: Add error and error_at_line (bug 23984) Date: Thu, 21 Feb 2019 17:57:05 -0300 Message-ID: <20190221205706.12225-5-gabriel@inconstante.eti.br> In-Reply-To: <20190221205706.12225-1-gabriel@inconstante.eti.br> References: <20190221205706.12225-1-gabriel@inconstante.eti.br> MIME-Version: 1.0 X-Ovh-Tracer-Id: 1206120277594066627 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedutddrtdekgddugeeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenuc 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 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 + +#include + +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 + . */ + +#ifndef _ERROR_H +# error "Never include directly; use 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 +#ifdef __LDBL_COMPAT +# include +#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 +# 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 #include +#include #include #include #include @@ -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 #include +#include #include #include #include @@ -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 From patchwork Thu Feb 21 20:57:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gabriel F. T. Gomes" X-Patchwork-Id: 1046456 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-100207-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=inconstante.eti.br Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="trUpxcD9"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4456J63gwkz9s70 for ; Fri, 22 Feb 2019 07:58:14 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-type; q=dns; s=default; b=yPjjQ ZY4Z4f2iDpynVs1BRjAVsJsnoNKUUmeyiMr5T3UBc8k5zsC15oHqtQWpFmgb5a+k hBLCpwL1PR/KElXbhcbfCxH213atx2zpoThhDkJ2FzsQOvrVk1LNVdcfq9owRus0 1/jKY4waNE+au4Z0enIRWm0+R5Q0bV0zN+HplU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-type; s=default; bh=r7s/PdB1pU0 4fsR0v5j/p46G94E=; b=trUpxcD9eEA+47Wc1UuMXR2tI9JtmNruFJWcZPoZHSz gUDzIZyr5XhiUPJABHqOnOSnP95d1XL0KQInkGEO7545GhydbqkEgvf1dAotRdRK l5cAJYEq3K5M2WMc2BWnzm5WUq2TvMaJvtTCyt1iBDsqZlgSi6gue0dpyUEkAvLA = Received: (qmail 55321 invoked by alias); 21 Feb 2019 20:57:42 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 55194 invoked by uid 89); 21 Feb 2019 20:57:41 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY autolearn=ham version=3.3.2 spammy=9210, 2000000 X-HELO: smtpout1.mo528.mail-out.ovh.net From: "Gabriel F. T. Gomes" To: Subject: [PATCH v4 5/5] ldbl-opt: Reuse test cases from misc/ that check long double Date: Thu, 21 Feb 2019 17:57:06 -0300 Message-ID: <20190221205706.12225-6-gabriel@inconstante.eti.br> In-Reply-To: <20190221205706.12225-1-gabriel@inconstante.eti.br> References: <20190221205706.12225-1-gabriel@inconstante.eti.br> MIME-Version: 1.0 X-Ovh-Tracer-Id: 1207246178063994563 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedutddrtdekgddugeeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenuc 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