public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/azanella/clang] Remove err-ldbl.h
@ 2022-04-04 12:51 Adhemerval Zanella
0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-04-04 12:51 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=547a601cf3cd364433d9434bde3f3514cfe5e52a
commit 547a601cf3cd364433d9434bde3f3514cfe5e52a
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
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 <misc/bits/err-ldbl.h>
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
- <https://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.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 <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/err-ldbl.h>
-#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 <stdarg.h>
#include <libio/libioP.h>
-#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)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [glibc/azanella/clang] Remove err-ldbl.h
@ 2022-06-09 21:16 Adhemerval Zanella
0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-06-09 21:16 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=63317c25c2f3d1146c4a0d20de91500bd510113d
commit 63317c25c2f3d1146c4a0d20de91500bd510113d
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
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 <misc/bits/err-ldbl.h>
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 75e2a06552..e3fc513de1 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_time64(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 ba8232a0e9..d6f39a1802 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
- <https://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.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 <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/err-ldbl.h>
-#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 <stdarg.h>
#include <libio/libioP.h>
-#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)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [glibc/azanella/clang] Remove err-ldbl.h
@ 2022-06-09 13:13 Adhemerval Zanella
0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-06-09 13:13 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=63317c25c2f3d1146c4a0d20de91500bd510113d
commit 63317c25c2f3d1146c4a0d20de91500bd510113d
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
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 <misc/bits/err-ldbl.h>
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 75e2a06552..e3fc513de1 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_time64(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 ba8232a0e9..d6f39a1802 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
- <https://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.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 <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/err-ldbl.h>
-#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 <stdarg.h>
#include <libio/libioP.h>
-#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)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [glibc/azanella/clang] Remove err-ldbl.h
@ 2022-06-03 14:02 Adhemerval Zanella
0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-06-03 14:02 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5d27301ad9dd34b6c84f956ffa0f93b710657488
commit 5d27301ad9dd34b6c84f956ffa0f93b710657488
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
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 <misc/bits/err-ldbl.h>
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 75e2a06552..e3fc513de1 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_time64(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 ba8232a0e9..d6f39a1802 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
- <https://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.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 <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/err-ldbl.h>
-#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 <stdarg.h>
#include <libio/libioP.h>
-#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)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [glibc/azanella/clang] Remove err-ldbl.h
@ 2022-05-13 14:16 Adhemerval Zanella
0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-05-13 14:16 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d4c66b811bca822bf6e6e31c03cc523b52410e9a
commit d4c66b811bca822bf6e6e31c03cc523b52410e9a
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
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 <misc/bits/err-ldbl.h>
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 ba8232a0e9..d6f39a1802 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
- <https://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.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 <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/err-ldbl.h>
-#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 <stdarg.h>
#include <libio/libioP.h>
-#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)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [glibc/azanella/clang] Remove err-ldbl.h
@ 2022-05-12 19:30 Adhemerval Zanella
0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-05-12 19:30 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ae819cb7b42c62632857ffba236c9ad4b6cb4900
commit ae819cb7b42c62632857ffba236c9ad4b6cb4900
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
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 <misc/bits/err-ldbl.h>
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 ba8232a0e9..d6f39a1802 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
- <https://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.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 <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/err-ldbl.h>
-#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 <stdarg.h>
#include <libio/libioP.h>
-#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)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [glibc/azanella/clang] Remove err-ldbl.h
@ 2022-05-10 18:20 Adhemerval Zanella
0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-05-10 18:20 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=95e3fbd306746e7d040ae8fb4201f488cc85819e
commit 95e3fbd306746e7d040ae8fb4201f488cc85819e
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
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 <misc/bits/err-ldbl.h>
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 ba8232a0e9..d6f39a1802 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
- <https://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.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 <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/err-ldbl.h>
-#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 <stdarg.h>
#include <libio/libioP.h>
-#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)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [glibc/azanella/clang] Remove err-ldbl.h
@ 2022-04-29 14:00 Adhemerval Zanella
0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-04-29 14:00 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f55e6c19901cca2485ca41f6def97c6ef152ebb7
commit f55e6c19901cca2485ca41f6def97c6ef152ebb7
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
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 <misc/bits/err-ldbl.h>
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 ba8232a0e9..d6f39a1802 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
- <https://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.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 <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/err-ldbl.h>
-#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 <stdarg.h>
#include <libio/libioP.h>
-#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)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [glibc/azanella/clang] Remove err-ldbl.h
@ 2022-03-31 19:03 Adhemerval Zanella
0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-03-31 19:03 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=99f78ebdaa76942aa668e984864224a458dbcdd1
commit 99f78ebdaa76942aa668e984864224a458dbcdd1
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
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 <misc/bits/err-ldbl.h>
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
- <https://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.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 <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/err-ldbl.h>
-#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 <stdarg.h>
#include <libio/libioP.h>
-#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)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [glibc/azanella/clang] Remove err-ldbl.h
@ 2022-03-29 20:26 Adhemerval Zanella
0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-03-29 20:26 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c48bac4d0e5525fa8c8034c8d5839d5e99cee888
commit c48bac4d0e5525fa8c8034c8d5839d5e99cee888
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
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 <misc/bits/err-ldbl.h>
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
- <https://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.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 <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/err-ldbl.h>
-#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 <stdarg.h>
#include <libio/libioP.h>
-#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)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [glibc/azanella/clang] Remove err-ldbl.h
@ 2022-03-16 17:58 Adhemerval Zanella
0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-03-16 17:58 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=12ca143f4f19e09d48f37ab4c341f7c0d3e29d25
commit 12ca143f4f19e09d48f37ab4c341f7c0d3e29d25
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
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 <misc/bits/err-ldbl.h>
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
- <https://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.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 <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/err-ldbl.h>
-#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 <stdarg.h>
#include <libio/libioP.h>
-#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)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [glibc/azanella/clang] Remove err-ldbl.h
@ 2022-03-15 18:36 Adhemerval Zanella
0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-03-15 18:36 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=12ca143f4f19e09d48f37ab4c341f7c0d3e29d25
commit 12ca143f4f19e09d48f37ab4c341f7c0d3e29d25
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
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 <misc/bits/err-ldbl.h>
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
- <https://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.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 <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/err-ldbl.h>
-#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 <stdarg.h>
#include <libio/libioP.h>
-#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)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [glibc/azanella/clang] Remove err-ldbl.h
@ 2022-03-11 17:20 Adhemerval Zanella
0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-03-11 17:20 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=687ac12d757214494f9a97c3d5c7ea7c2e7f60ae
commit 687ac12d757214494f9a97c3d5c7ea7c2e7f60ae
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
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 <misc/bits/err-ldbl.h>
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
- <https://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.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 <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/err-ldbl.h>
-#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 <stdarg.h>
#include <libio/libioP.h>
-#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)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [glibc/azanella/clang] Remove err-ldbl.h
@ 2022-03-08 18:56 Adhemerval Zanella
0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-03-08 18:56 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=bff6b10288d2a9085473ba364f033bc5aa791992
commit bff6b10288d2a9085473ba364f033bc5aa791992
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
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 <misc/bits/err-ldbl.h>
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
- <https://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.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 <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/err-ldbl.h>
-#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 <stdarg.h>
#include <libio/libioP.h>
-#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)
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2022-06-09 21:16 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-04 12:51 [glibc/azanella/clang] Remove err-ldbl.h Adhemerval Zanella
-- strict thread matches above, loose matches on Subject: below --
2022-06-09 21:16 Adhemerval Zanella
2022-06-09 13:13 Adhemerval Zanella
2022-06-03 14:02 Adhemerval Zanella
2022-05-13 14:16 Adhemerval Zanella
2022-05-12 19:30 Adhemerval Zanella
2022-05-10 18:20 Adhemerval Zanella
2022-04-29 14:00 Adhemerval Zanella
2022-03-31 19:03 Adhemerval Zanella
2022-03-29 20:26 Adhemerval Zanella
2022-03-16 17:58 Adhemerval Zanella
2022-03-15 18:36 Adhemerval Zanella
2022-03-11 17:20 Adhemerval Zanella
2022-03-08 18:56 Adhemerval Zanella
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).