From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 450CA3839430; Thu, 31 Mar 2022 19:03:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 450CA3839430 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc/azanella/clang] Remove err-ldbl.h X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/azanella/clang X-Git-Oldrev: 4670cfb9a61d25a1dccaa99a128060b65e4a293f X-Git-Newrev: 99f78ebdaa76942aa668e984864224a458dbcdd1 Message-Id: <20220331190328.450CA3839430@sourceware.org> Date: Thu, 31 Mar 2022 19:03:28 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Mar 2022 19:03:28 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=99f78ebdaa76942aa668e984864224a458dbcdd1 commit 99f78ebdaa76942aa668e984864224a458dbcdd1 Author: Adhemerval Zanella Date: Mon Feb 28 19:49:31 2022 -0300 Remove err-ldbl.h The functions which require different alias to long double depending of the ABI now uses a set os macros that defines the expected alias on the function prototype, instead of redefine them using the __LDBL_REDIR_DEC macros. All err internal usage are also replaced to use internal alias instead. Checked on x86_64-linux-gnu and powerpc64le-linux-gnu. Diff: --- include/bits/err-ldbl.h | 1 - include/err.h | 28 +++++++++++--- inet/ruserpass.c | 12 +++--- misc/Makefile | 2 +- misc/bits/err-ldbl.h | 30 --------------- misc/err.c | 36 ++++++++++-------- misc/err.h | 31 +++++++++------- sysdeps/ieee754/ldbl-128ibm-compat/ieee128-err.c | 47 ++++++++++-------------- 8 files changed, 87 insertions(+), 100 deletions(-) diff --git a/include/bits/err-ldbl.h b/include/bits/err-ldbl.h deleted file mode 100644 index aa04305eae..0000000000 --- a/include/bits/err-ldbl.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/include/err.h b/include/err.h index b9b7516287..afbd55d39e 100644 --- a/include/err.h +++ b/include/err.h @@ -12,12 +12,28 @@ __vwarn_internal (const char *format, __gnuc_va_list ap, # ifndef _ISOMAC -libc_hidden_ldbl_proto (warn) -libc_hidden_ldbl_proto (warnx) -libc_hidden_ldbl_proto (vwarn) -libc_hidden_ldbl_proto (vwarnx) -libc_hidden_ldbl_proto (verr) -libc_hidden_ldbl_proto (verrx) +/* Some libc_hidden_ldbl_proto's do not map to a unique symbol when + redirecting ldouble to _Float128 variants. We can therefore safely + directly alias them to their internal name. */ +# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc) && defined SHARED +# define __err_hidden_ldbl_proto(name, alias) \ + extern __typeof (name) __##name __asm__ (__hidden_asmname (#alias)); +# define err_hidden_ldbl_proto(name) \ + extern typeof (name) __##name##ieee128; \ + libc_hidden_proto (__##name##ieee128); \ + __err_hidden_ldbl_proto (name, __GI___##name##ieee128) +# else +# define err_hidden_ldbl_proto(name) \ + extern __typeof (name) __##name __attribute_copy__ (name); \ + libc_hidden_proto (__##name) +# endif + +err_hidden_ldbl_proto (warn); +err_hidden_ldbl_proto (warnx); +err_hidden_ldbl_proto (vwarn); +err_hidden_ldbl_proto (vwarnx); +err_hidden_ldbl_proto (verr); +err_hidden_ldbl_proto (verrx); # endif /* !_ISOMAC */ #endif /* err.h */ diff --git a/inet/ruserpass.c b/inet/ruserpass.c index d61a72877d..742aa0cfa0 100644 --- a/inet/ruserpass.c +++ b/inet/ruserpass.c @@ -112,7 +112,7 @@ ruserpass (const char *host, const char **aname, const char **apass) cfile = fopen(buf, "rce"); if (cfile == NULL) { if (errno != ENOENT) - warn("%s", buf); + __warn("%s", buf); return (0); } /* No threads use this stream. */ @@ -162,7 +162,7 @@ next: newp = malloc((unsigned) strlen(tokval) + 1); if (newp == NULL) { - warnx(_("out of memory")); + __warnx(_("out of memory")); goto bad; } *aname = strcpy(newp, tokval); @@ -176,8 +176,8 @@ next: if (strcmp(*aname, "anonymous") && __fstat64(fileno(cfile), &stb) >= 0 && (stb.st_mode & 077) != 0) { - warnx(_("Error: .netrc file is readable by others.")); - warnx(_("Remove 'password' line or make file unreadable by others.")); + __warnx(_("Error: .netrc file is readable by others.")); + __warnx(_("Remove 'password' line or make file unreadable by others.")); goto bad; } if (token() && *apass == 0) { @@ -185,7 +185,7 @@ next: newp = malloc((unsigned) strlen(tokval) + 1); if (newp == NULL) { - warnx(_("out of memory")); + __warnx(_("out of memory")); goto bad; } *apass = strcpy(newp, tokval); @@ -196,7 +196,7 @@ next: case MACDEF: break; default: - warnx(_("Unknown .netrc keyword %s"), tokval); + __warnx(_("Unknown .netrc keyword %s"), tokval); break; } goto done; diff --git a/misc/Makefile b/misc/Makefile index 3d8a569d06..b0302a5b40 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/error-ldbl.h \ + bits/error-ldbl.h \ sys/single_threaded.h routines := brk sbrk sstk ioctl \ diff --git a/misc/bits/err-ldbl.h b/misc/bits/err-ldbl.h deleted file mode 100644 index 7b1153da90..0000000000 --- a/misc/bits/err-ldbl.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Redirections for err.h functions for -mlong-double-64. - Copyright (C) 2019-2022 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.c b/misc/err.c index e8d988400e..0a6eb72f2d 100644 --- a/misc/err.c +++ b/misc/err.c @@ -33,7 +33,7 @@ extern char *__progname; { \ va_list ap; \ va_start (ap, format); \ - call; \ + __##call; \ va_end (ap); \ } @@ -72,48 +72,54 @@ __vwarn_internal (const char *format, __gnuc_va_list ap, } void -vwarn (const char *format, __gnuc_va_list ap) +__vwarn (const char *format, __gnuc_va_list ap) { __vwarn_internal (format, ap, 0); } -libc_hidden_def (vwarn) +libc_hidden_def (__vwarn) +weak_alias (__vwarn, vwarn) void -vwarnx (const char *format, __gnuc_va_list ap) +__vwarnx (const char *format, __gnuc_va_list ap) { __vwarnx_internal (format, ap, 0); } -libc_hidden_def (vwarnx) +libc_hidden_def (__vwarnx) +weak_alias (__vwarnx, vwarnx) void -warn (const char *format, ...) +__warn (const char *format, ...) { VA (vwarn (format, ap)) } -libc_hidden_def (warn) +libc_hidden_def (__warn) +weak_alias (__warn, warn) void -warnx (const char *format, ...) +__warnx (const char *format, ...) { VA (vwarnx (format, ap)) } -libc_hidden_def (warnx) +libc_hidden_def (__warnx) +weak_alias (__warnx, warnx) void -verr (int status, const char *format, __gnuc_va_list ap) +__verr (int status, const char *format, __gnuc_va_list ap) { - vwarn (format, ap); + __vwarn (format, ap); exit (status); } -libc_hidden_def (verr) +libc_hidden_def (__verr) +weak_alias (__verr, verr) void -verrx (int status, const char *format, __gnuc_va_list ap) +__verrx (int status, const char *format, __gnuc_va_list ap) { - vwarnx (format, ap); + __vwarnx (format, ap); exit (status); } -libc_hidden_def (verrx) +libc_hidden_def (__verrx) +weak_alias (__verrx, verrx) void err (int status, const char *format, ...) diff --git a/misc/err.h b/misc/err.h index 3b4177360c..b2164980d2 100644 --- a/misc/err.h +++ b/misc/err.h @@ -31,32 +31,37 @@ __BEGIN_DECLS /* Print "program: ", FORMAT, ": ", the standard error string for errno, and a newline, on stderr. */ -extern void warn (const char *__format, ...) +extern void __REDIRECT_LDBL (warn, (const char *__format, ...), + __warnieee128, __nldbl_warn) __attribute__ ((__format__ (__printf__, 1, 2))); -extern void vwarn (const char *__format, __gnuc_va_list) +extern void __REDIRECT_LDBL (vwarn, (const char *__format, __gnuc_va_list), + __vwarnieee128, __nldbl_vwarn) __attribute__ ((__format__ (__printf__, 1, 0))); /* Likewise, but without ": " and the standard error string. */ -extern void warnx (const char *__format, ...) +extern void __REDIRECT_LDBL (warnx, (const char *__format, ...), + __warnxieee128, __nldbl_warnx) __attribute__ ((__format__ (__printf__, 1, 2))); -extern void vwarnx (const char *__format, __gnuc_va_list) +extern void __REDIRECT_LDBL (vwarnx, (const char *__format, __gnuc_va_list), + __vwarnxieee128, __nldbl_vwarnx) __attribute__ ((__format__ (__printf__, 1, 0))); /* Likewise, and then exit with STATUS. */ -extern void err (int __status, const char *__format, ...) +extern void __REDIRECT_LDBL (err, (int __status, const char *__format, ...), + __errieee128, __nldbl_err) __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3))); -extern void verr (int __status, const char *__format, __gnuc_va_list) +extern void __REDIRECT_LDBL (verr, (int __status, const char *__format, + __gnuc_va_list), + __verrieee128, __nldbl_verr) __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0))); -extern void errx (int __status, const char *__format, ...) +extern void __REDIRECT_LDBL (errx, (int __status, const char *__format, ...), + __errxieee128, __nldbl_errx) __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3))); -extern void verrx (int __status, const char *, __gnuc_va_list) +extern void __REDIRECT_LDBL (verrx, (int __status, const char *__format, + __gnuc_va_list), + __verrxieee128, __nldbl_verrx) __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0))); -#include -#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 -# include -#endif - __END_DECLS #endif /* err.h */ diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-err.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-err.c index ad52efa8fa..41ac47c7af 100644 --- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-err.c +++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-err.c @@ -20,81 +20,72 @@ #include #include -#define VA(call) \ +#define IEEE128_NAME(name) __ ## name ## ieee128 + +#define VA(name, ...) \ { \ va_list ap; \ va_start (ap, format); \ - IEEE128_CALL (call); \ + IEEE128_NAME (name) (__VA_ARGS__); \ va_end (ap); \ } #define IEEE128_ALIAS(name) \ - strong_alias (___ieee128_##name, __##name##ieee128) + libc_hidden_def (IEEE128_NAME(name)) -#define IEEE128_DECL(name) ___ieee128_##name -#define IEEE128_CALL(name) ___ieee128_##name void -IEEE128_DECL (vwarn) (const char *format, __gnuc_va_list ap) +IEEE128_NAME (vwarn) (const char *format, __gnuc_va_list ap) { __vwarn_internal (format, ap, PRINTF_LDBL_USES_FLOAT128); } IEEE128_ALIAS (vwarn) void -IEEE128_DECL (vwarnx) (const char *format, __gnuc_va_list ap) +IEEE128_NAME (vwarnx) (const char *format, __gnuc_va_list ap) { __vwarnx_internal (format, ap, PRINTF_LDBL_USES_FLOAT128); } IEEE128_ALIAS (vwarnx) void -IEEE128_DECL (warn) (const char *format, ...) +IEEE128_NAME (warn) (const char *format, ...) { - VA (vwarn (format, ap)) + VA (vwarn, format, ap) } IEEE128_ALIAS (warn) void -IEEE128_DECL (warnx) (const char *format, ...) +IEEE128_NAME (warnx) (const char *format, ...) { - VA (vwarnx (format, ap)) + VA (vwarnx, format, ap) } IEEE128_ALIAS (warnx) void -IEEE128_DECL (verr) (int status, const char *format, __gnuc_va_list ap) +IEEE128_NAME (verr) (int status, const char *format, __gnuc_va_list ap) { - IEEE128_CALL (vwarn) (format, ap); + IEEE128_NAME (vwarn) (format, ap); exit (status); } IEEE128_ALIAS (verr) void -IEEE128_DECL (verrx) (int status, const char *format, __gnuc_va_list ap) +IEEE128_NAME (verrx) (int status, const char *format, __gnuc_va_list ap) { - IEEE128_CALL (vwarnx) (format, ap); + IEEE128_NAME (vwarnx) (format, ap); exit (status); } IEEE128_ALIAS (verrx) void -IEEE128_DECL (err) (int status, const char *format, ...) +IEEE128_NAME (err) (int status, const char *format, ...) { - VA (verr (status, format, ap)) + VA (verr, status, format, ap) } -IEEE128_ALIAS (err) void -IEEE128_DECL (errx) (int status, const char *format, ...) +IEEE128_NAME (errx) (int status, const char *format, ...) { - VA (verrx (status, format, ap)) + VA (verrx, status, format, ap) } -IEEE128_ALIAS (errx) - -hidden_def (___ieee128_warn) -hidden_def (___ieee128_warnx) -hidden_def (___ieee128_vwarn) -hidden_def (___ieee128_vwarnx) -hidden_def (___ieee128_verr) -hidden_def (___ieee128_verrx)