public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/azanella/clang] Remove wchar-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=b9e5027c0776dc90bc7f5da2d3e2e6a6309da9e8

commit b9e5027c0776dc90bc7f5da2d3e2e6a6309da9e8
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Feb 25 11:02:21 2022 -0300

    Remove wchar-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.
    
    A new macro, __REDIRECT_LDBL128, is used for function where only
    the binary128 alias is required.
    
    Checked on x86_64-linux-gnu and powerpc64le-linux-gnu.

Diff:
---
 include/bits/wchar-ldbl.h |   1 -
 misc/sys/cdefs.h          |  13 +++
 wcsmbs/Makefile           |   2 +-
 wcsmbs/bits/wchar-ldbl.h  |  91 ------------------
 wcsmbs/bits/wchar2.h      |  70 +++++++-------
 wcsmbs/wchar.h            | 229 +++++++++++++++++++++++++++-------------------
 6 files changed, 183 insertions(+), 223 deletions(-)

diff --git a/include/bits/wchar-ldbl.h b/include/bits/wchar-ldbl.h
deleted file mode 100644
index 29baa2f4d5..0000000000
--- a/include/bits/wchar-ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <wcsmbs/bits/wchar-ldbl.h>
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index e7f8952caa..79a0ae39c7 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -567,16 +567,26 @@
 #  ifdef __REDIRECT
 #   define __REDIRECT_LDBL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , , proto, ieee128)
+#   define __REDIRECT_LDBL128(name, proto) \
+      __REDIRECT_LDBL1 (name, , , proto, __##name##ieee128)
 #   ifdef __cplusplus
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROW, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROW, , proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROWNL, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROWNL, , proto, __##name##ieee128)
 #   else
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROW, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROW, proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROWNL, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROWNL, proto, __##name##ieee128)
 #   endif /* __cplusplus */
 #  else
 _Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
@@ -606,6 +616,9 @@ _Static_assert (0, "Compat long double requires redirection on this platform");
 # define __REDIRECT_LDBL(name, proto, ieee128, compat) name proto
 # define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) name proto __THROW
 # define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) name proto __THROWNL
+# define __REDIRECT_LDBL128(name, proto) name proto
+# define __REDIRECT_LDBL128_NTH(name, proto) name proto __THROW
+# define __REDIRECT_LDBL128_NTHNL(name, proto) name proto __THROWNL
 #endif
 
 #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index df9a85f4a9..b67202526d 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -22,7 +22,7 @@ subdir	:= wcsmbs
 
 include ../Makeconfig
 
-headers	:= wchar.h bits/wchar.h bits/wchar2.h bits/wchar-ldbl.h uchar.h \
+headers	:= wchar.h bits/wchar.h bits/wchar2.h uchar.h \
 	   bits/types/__mbstate_t.h bits/types/mbstate_t.h bits/types/wint_t.h
 
 routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
diff --git a/wcsmbs/bits/wchar-ldbl.h b/wcsmbs/bits/wchar-ldbl.h
deleted file mode 100644
index f0d8506f83..0000000000
--- a/wcsmbs/bits/wchar-ldbl.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -mlong-double-64 compatibility mode for <wchar.h> functions.
-   Copyright (C) 2006-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 _WCHAR_H
-# error "Never include <bits/wchar-ldbl.h> directly; use <wchar.h> instead."
-#endif
-
-#if defined __USE_ISOC95 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (fwprintf);
-__LDBL_REDIR_DECL (wprintf);
-__LDBL_REDIR_DECL (swprintf);
-__LDBL_REDIR_DECL (vfwprintf);
-__LDBL_REDIR_DECL (vwprintf);
-__LDBL_REDIR_DECL (vswprintf);
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (fwscanf, __nldbl___isoc99_fwscanf)
-__LDBL_REDIR1_DECL (wscanf, __nldbl___isoc99_wscanf)
-__LDBL_REDIR1_DECL (swscanf, __nldbl___isoc99_swscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (fwscanf, __isoc99_fwscanfieee128)
-__LDBL_REDIR1_DECL (wscanf, __isoc99_wscanfieee128)
-__LDBL_REDIR1_DECL (swscanf, __isoc99_swscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (fwscanf);
-__LDBL_REDIR_DECL (wscanf);
-__LDBL_REDIR_DECL (swscanf);
-# endif
-#endif
-
-#ifdef __USE_ISOC99
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold, wcstod);
-# else
-__LDBL_REDIR1_DECL (wcstold, __wcstoieee128)
-# endif
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (vfwscanf, __nldbl___isoc99_vfwscanf)
-__LDBL_REDIR1_DECL (vwscanf, __nldbl___isoc99_vwscanf)
-__LDBL_REDIR1_DECL (vswscanf, __nldbl___isoc99_vswscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (vfwscanf, __isoc99_vfwscanfieee128)
-__LDBL_REDIR1_DECL (vwscanf, __isoc99_vwscanfieee128)
-__LDBL_REDIR1_DECL (vswscanf, __isoc99_vswscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (vfwscanf);
-__LDBL_REDIR_DECL (vwscanf);
-__LDBL_REDIR_DECL (vswscanf);
-# endif
-#endif
-
-#ifdef __USE_GNU
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold_l, wcstod_l);
-# else
-__LDBL_REDIR1_DECL (wcstold_l, __wcstoieee128_l)
-# endif
-#endif
-
-#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR2_DECL (swprintf_chk)
-__LDBL_REDIR2_DECL (vswprintf_chk)
-# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR2_DECL (fwprintf_chk)
-__LDBL_REDIR2_DECL (wprintf_chk)
-__LDBL_REDIR2_DECL (vfwprintf_chk)
-__LDBL_REDIR2_DECL (vwprintf_chk)
-# endif
-#endif
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index f2dca7711a..548deeedbf 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -227,19 +227,18 @@ __NTH (wcsncat (wchar_t *__restrict __dest, const wchar_t *__restrict __src,
   return __wcsncat_alias (__dest, __src, __n);
 }
 
-
-extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
-			   int __flag, size_t __s_len,
-			   const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
-
-extern int __swprintf_alias (wchar_t *__restrict __s, size_t __n,
-			     const wchar_t *__restrict __fmt, ...)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("swprintf"))
-#endif
-     ;
-
+extern int __REDIRECT_LDBL_NTH (__swprintf_chk, (wchar_t *__restrict __s,
+						 size_t __n,
+						 int __flag, size_t __s_len,
+						 const wchar_t *__restrict __format,
+						 ...),
+				__swprintf_chkieee128, __nldbl___swprintf_chk);
+extern int __REDIRECT_LDBL_NTH (__vswprintf_chk, (wchar_t *__restrict __s,
+						  size_t __n,
+						  int __flag, size_t __s_len,
+						  const wchar_t *__restrict __format,
+						  __gnuc_va_list __arg),
+				__vswprintf_chkieee128, __nldbl___vswprintf_chk);
 
 #ifdef __va_arg_pack
 __fortify_function int
@@ -250,7 +249,7 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __swprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
 			   sz / sizeof (wchar_t), __fmt, __va_arg_pack ());
-  return __swprintf_alias (__s, __n, __fmt, __va_arg_pack ());
+  return swprintf (__s, __n, __fmt, __va_arg_pack ());
 }
 #elif !defined __cplusplus
 /* XXX We might want to have support in gcc for swprintf.  */
@@ -261,20 +260,6 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
    : swprintf (s, n, __VA_ARGS__))
 #endif
 
-extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
-			    int __flag, size_t __s_len,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-
-extern int __vswprintf_alias (wchar_t *__restrict __s, size_t __n,
-			      const wchar_t *__restrict __fmt,
-			      __gnuc_va_list __ap)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("vswprintf"))
-#endif
-     ;
-
 __fortify_function int
 __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
 		  const wchar_t *__restrict __fmt, __gnuc_va_list __ap))
@@ -283,21 +268,30 @@ __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __vswprintf_chk (__s, __n,  __USE_FORTIFY_LEVEL - 1,
 			    sz / sizeof (wchar_t), __fmt, __ap);
-  return __vswprintf_alias (__s, __n, __fmt, __ap);
+  return vswprintf (__s, __n, __fmt, __ap);
 }
 
 
 #if __USE_FORTIFY_LEVEL > 1
 
-extern int __fwprintf_chk (__FILE *__restrict __stream, int __flag,
-			   const wchar_t *__restrict __format, ...);
-extern int __wprintf_chk (int __flag, const wchar_t *__restrict __format,
-			  ...);
-extern int __vfwprintf_chk (__FILE *__restrict __stream, int __flag,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __ap);
-extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format,
-			   __gnuc_va_list __ap);
+extern int __REDIRECT_LDBL (__fwprintf_chk, (__FILE *__restrict __stream,
+					     int __flag,
+					     const wchar_t *__restrict __format,
+					     ...),
+			    __fwprintf_chkieee128, __nldbl___fwprintf_chk);
+extern int __REDIRECT_LDBL (__wprintf_chk, (int __flag,
+					    const wchar_t *__restrict __format,
+					    ...),
+			    __wprintf_chkieee128, __nldbl___wprintf_chk);
+extern int __REDIRECT_LDBL (__vfwprintf_chk, (__FILE *__restrict __stream,
+					      int __flag,
+					      const wchar_t *__restrict __format,
+					      __gnuc_va_list __ap),
+			   __vfwprintf_chkieee128, __nldbl___vfwprintf_chk);
+extern int __REDIRECT_LDBL (__vwprintf_chk, (int __flag,
+					     const wchar_t *__restrict __format,
+					     __gnuc_va_list __ap),
+			    __vwprintf_chkieee128, __nldbl___vwprintf_chk);
 
 # ifdef __va_arg_pack
 __fortify_function int
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 5d6a40853d..27406d0edb 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -382,8 +382,10 @@ extern double wcstod (const wchar_t *__restrict __nptr,
 /* Likewise for `float' and `long double' sizes of floating-point numbers.  */
 extern float wcstof (const wchar_t *__restrict __nptr,
 		     wchar_t **__restrict __endptr) __THROW;
-extern long double wcstold (const wchar_t *__restrict __nptr,
-			    wchar_t **__restrict __endptr) __THROW;
+extern long double __REDIRECT_LDBL_NTH (wcstold,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr),
+					__wcstoieee128, wcstod);
 #endif /* C99 */
 
 /* Likewise for `_FloatN' and `_FloatNx' when support is enabled.  */
@@ -498,9 +500,12 @@ extern float wcstof_l (const wchar_t *__restrict __nptr,
 		       wchar_t **__restrict __endptr, locale_t __loc)
      __THROW;
 
-extern long double wcstold_l (const wchar_t *__restrict __nptr,
-			      wchar_t **__restrict __endptr,
-			      locale_t __loc) __THROW;
+
+extern long double __REDIRECT_LDBL_NTH (wcstold_l,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr,
+					 locale_t __loc),
+					__wcstoieee128_l, wcstod_l);
 
 # if __HAVE_FLOAT16
 extern _Float16 wcstof16_l (const wchar_t *__restrict __nptr,
@@ -587,73 +592,61 @@ extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW
 /* Select orientation for stream.  */
 extern int fwide (__FILE *__fp, int __mode) __THROW;
 
-
 /* Write formatted output to STREAM.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int fwprintf (__FILE *__restrict __stream,
-		     const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (fwprintf, (__FILE *__restrict __stream,
+					  const wchar_t *__restrict __format,
+					  ...))
      /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
 /* Write formatted output to stdout.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int wprintf (const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (wprintf, (const wchar_t *__restrict __format, ...))
      /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
 /* Write formatted output of at most N characters to S.  */
-extern int swprintf (wchar_t *__restrict __s, size_t __n,
-		     const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
+extern int __REDIRECT_LDBL128_NTH (swprintf, (wchar_t *__restrict __s, size_t __n,
+					      const wchar_t *__restrict __format,
+					      ...))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
 
 /* Write formatted output to S from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vfwprintf (__FILE *__restrict __s,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vfwprintf, (__FILE *__restrict __s,
+					const wchar_t *__restrict __format,
+					__gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
 /* Write formatted output to stdout from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vwprintf (const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vwprintf, (const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
 /* Write formatted output of at most N character to S from argument
    list ARG.  */
-extern int vswprintf (wchar_t *__restrict __s, size_t __n,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
-
-
-/* Read formatted input from STREAM.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int fwscanf (__FILE *__restrict __stream,
-		    const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-/* Read formatted input from stdin.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int wscanf (const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
-/* Read formatted input from S.  */
-extern int swscanf (const wchar_t *__restrict __s,
-		    const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-
-/* For historical reasons, the C99-compliant versions of the scanf
-   functions are at alternative names.  When __LDBL_COMPAT or
-   __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
-   bits/wchar-ldbl.h.  */
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
+extern int __REDIRECT_LDBL128_NTH (vswprintf, (wchar_t *__restrict __s, size_t __n,
+				      const wchar_t *__restrict __format,
+					      __gnuc_va_list __arg))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
+
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __isoc99_fwscanfieee128, __nldbl___isoc99_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __isoc99_wscanfieee128,__nldbl___isoc99_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__isoc99_swscanfieee128, __nldbl___isoc99_swscanf);
+#  else
+#   ifdef __REDIRECT
 extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
 				 const wchar_t *__restrict __format, ...),
 		       __isoc99_fwscanf)
@@ -665,72 +658,129 @@ extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s,
 				     const wchar_t *__restrict __format,
 				     ...), __isoc99_swscanf)
      /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-#  else
+#   else
 extern int __isoc99_fwscanf (__FILE *__restrict __stream,
 			     const wchar_t *__restrict __format, ...);
 extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...);
 extern int __isoc99_swscanf (const wchar_t *__restrict __s,
 			     const wchar_t *__restrict __format, ...)
      __THROW;
-#   define fwscanf __isoc99_fwscanf
-#   define wscanf __isoc99_wscanf
-#   define swscanf __isoc99_swscanf
+#    define fwscanf __isoc99_fwscanf
+#    define wscanf __isoc99_wscanf
+#    define swscanf __isoc99_swscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __fwscanfieee128, __nldbl_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __wscanfieee128,__nldbl_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__swscanfieee128, __nldbl_swscanf);
+#  else
+/* Read formatted input from STREAM.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int fwscanf (__FILE *__restrict __stream,
+                    const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
+/* Read formatted input from stdin.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int wscanf (const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
+/* Read formatted input from S.  */
+extern int swscanf (const wchar_t *__restrict __s,
+                    const wchar_t *__restrict __format, ...)
+     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
 #  endif
 # endif
 
 #endif /* Use ISO C95, C99 and Unix98. */
 
 #ifdef __USE_ISOC99
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __isoc99_vfwscanfieee128, __nldbl___isoc99_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __isoc99_vwscanfieee128, __nldbl___isoc99_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__isoc99_vswscanfieee128,
+				__nldbl___isoc99_vswscanf);
+#  else
+#   ifdef __REDIRECT
+extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
+                                  const wchar_t *__restrict __format,
+                                  __gnuc_va_list __arg), __isoc99_vfwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
+                                 __gnuc_va_list __arg), __isoc99_vwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
+extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
+                                      const wchar_t *__restrict __format,
+                                      __gnuc_va_list __arg), __isoc99_vswscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+#   else
+extern int __isoc99_vfwscanf (__FILE *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg);
+extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
+                             __gnuc_va_list __arg);
+extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg) __THROW;
+#    define vfwscanf __isoc99_vfwscanf
+#    define vwscanf __isoc99_vwscanf
+#    define vswscanf __isoc99_vswscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __vfwscanfieee128, __nldbl_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __vwscanfieee128, __nldbl_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__vswscanfieee128,
+				__nldbl_vswscanf);
+#  else
 /* Read formatted input from S into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vfwscanf (__FILE *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
 /* Read formatted input from stdin into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vwscanf (const wchar_t *__restrict __format,
-		    __gnuc_va_list __arg)
+                    __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
 /* Read formatted input from S into argument list ARG.  */
 extern int vswscanf (const wchar_t *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-
-/* Same redirection as above for the v*wscanf family.  */
-# if !__GLIBC_USE (DEPRECATED_SCANF) \
-     && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
-     && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
-extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
-				  const wchar_t *__restrict __format,
-				  __gnuc_va_list __arg), __isoc99_vfwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
-				 __gnuc_va_list __arg), __isoc99_vwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
-extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
-				      const wchar_t *__restrict __format,
-				      __gnuc_va_list __arg), __isoc99_vswscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-#  else
-extern int __isoc99_vfwscanf (__FILE *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg);
-extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
-			     __gnuc_va_list __arg);
-extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg) __THROW;
-#   define vfwscanf __isoc99_vfwscanf
-#   define vwscanf __isoc99_vwscanf
-#   define vswscanf __isoc99_vswscanf
 #  endif
 # endif
 
@@ -867,11 +917,6 @@ extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
 # include <bits/wchar2.h>
 #endif
 
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/wchar-ldbl.h>
-#endif
-
 __END_DECLS
 
 #endif /* wchar.h  */


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

* [glibc/azanella/clang] Remove wchar-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=b9e5027c0776dc90bc7f5da2d3e2e6a6309da9e8

commit b9e5027c0776dc90bc7f5da2d3e2e6a6309da9e8
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Feb 25 11:02:21 2022 -0300

    Remove wchar-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.
    
    A new macro, __REDIRECT_LDBL128, is used for function where only
    the binary128 alias is required.
    
    Checked on x86_64-linux-gnu and powerpc64le-linux-gnu.

Diff:
---
 include/bits/wchar-ldbl.h |   1 -
 misc/sys/cdefs.h          |  13 +++
 wcsmbs/Makefile           |   2 +-
 wcsmbs/bits/wchar-ldbl.h  |  91 ------------------
 wcsmbs/bits/wchar2.h      |  70 +++++++-------
 wcsmbs/wchar.h            | 229 +++++++++++++++++++++++++++-------------------
 6 files changed, 183 insertions(+), 223 deletions(-)

diff --git a/include/bits/wchar-ldbl.h b/include/bits/wchar-ldbl.h
deleted file mode 100644
index 29baa2f4d5..0000000000
--- a/include/bits/wchar-ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <wcsmbs/bits/wchar-ldbl.h>
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index e7f8952caa..79a0ae39c7 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -567,16 +567,26 @@
 #  ifdef __REDIRECT
 #   define __REDIRECT_LDBL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , , proto, ieee128)
+#   define __REDIRECT_LDBL128(name, proto) \
+      __REDIRECT_LDBL1 (name, , , proto, __##name##ieee128)
 #   ifdef __cplusplus
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROW, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROW, , proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROWNL, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROWNL, , proto, __##name##ieee128)
 #   else
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROW, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROW, proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROWNL, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROWNL, proto, __##name##ieee128)
 #   endif /* __cplusplus */
 #  else
 _Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
@@ -606,6 +616,9 @@ _Static_assert (0, "Compat long double requires redirection on this platform");
 # define __REDIRECT_LDBL(name, proto, ieee128, compat) name proto
 # define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) name proto __THROW
 # define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) name proto __THROWNL
+# define __REDIRECT_LDBL128(name, proto) name proto
+# define __REDIRECT_LDBL128_NTH(name, proto) name proto __THROW
+# define __REDIRECT_LDBL128_NTHNL(name, proto) name proto __THROWNL
 #endif
 
 #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index df9a85f4a9..b67202526d 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -22,7 +22,7 @@ subdir	:= wcsmbs
 
 include ../Makeconfig
 
-headers	:= wchar.h bits/wchar.h bits/wchar2.h bits/wchar-ldbl.h uchar.h \
+headers	:= wchar.h bits/wchar.h bits/wchar2.h uchar.h \
 	   bits/types/__mbstate_t.h bits/types/mbstate_t.h bits/types/wint_t.h
 
 routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
diff --git a/wcsmbs/bits/wchar-ldbl.h b/wcsmbs/bits/wchar-ldbl.h
deleted file mode 100644
index f0d8506f83..0000000000
--- a/wcsmbs/bits/wchar-ldbl.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -mlong-double-64 compatibility mode for <wchar.h> functions.
-   Copyright (C) 2006-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 _WCHAR_H
-# error "Never include <bits/wchar-ldbl.h> directly; use <wchar.h> instead."
-#endif
-
-#if defined __USE_ISOC95 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (fwprintf);
-__LDBL_REDIR_DECL (wprintf);
-__LDBL_REDIR_DECL (swprintf);
-__LDBL_REDIR_DECL (vfwprintf);
-__LDBL_REDIR_DECL (vwprintf);
-__LDBL_REDIR_DECL (vswprintf);
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (fwscanf, __nldbl___isoc99_fwscanf)
-__LDBL_REDIR1_DECL (wscanf, __nldbl___isoc99_wscanf)
-__LDBL_REDIR1_DECL (swscanf, __nldbl___isoc99_swscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (fwscanf, __isoc99_fwscanfieee128)
-__LDBL_REDIR1_DECL (wscanf, __isoc99_wscanfieee128)
-__LDBL_REDIR1_DECL (swscanf, __isoc99_swscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (fwscanf);
-__LDBL_REDIR_DECL (wscanf);
-__LDBL_REDIR_DECL (swscanf);
-# endif
-#endif
-
-#ifdef __USE_ISOC99
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold, wcstod);
-# else
-__LDBL_REDIR1_DECL (wcstold, __wcstoieee128)
-# endif
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (vfwscanf, __nldbl___isoc99_vfwscanf)
-__LDBL_REDIR1_DECL (vwscanf, __nldbl___isoc99_vwscanf)
-__LDBL_REDIR1_DECL (vswscanf, __nldbl___isoc99_vswscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (vfwscanf, __isoc99_vfwscanfieee128)
-__LDBL_REDIR1_DECL (vwscanf, __isoc99_vwscanfieee128)
-__LDBL_REDIR1_DECL (vswscanf, __isoc99_vswscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (vfwscanf);
-__LDBL_REDIR_DECL (vwscanf);
-__LDBL_REDIR_DECL (vswscanf);
-# endif
-#endif
-
-#ifdef __USE_GNU
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold_l, wcstod_l);
-# else
-__LDBL_REDIR1_DECL (wcstold_l, __wcstoieee128_l)
-# endif
-#endif
-
-#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR2_DECL (swprintf_chk)
-__LDBL_REDIR2_DECL (vswprintf_chk)
-# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR2_DECL (fwprintf_chk)
-__LDBL_REDIR2_DECL (wprintf_chk)
-__LDBL_REDIR2_DECL (vfwprintf_chk)
-__LDBL_REDIR2_DECL (vwprintf_chk)
-# endif
-#endif
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index f2dca7711a..548deeedbf 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -227,19 +227,18 @@ __NTH (wcsncat (wchar_t *__restrict __dest, const wchar_t *__restrict __src,
   return __wcsncat_alias (__dest, __src, __n);
 }
 
-
-extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
-			   int __flag, size_t __s_len,
-			   const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
-
-extern int __swprintf_alias (wchar_t *__restrict __s, size_t __n,
-			     const wchar_t *__restrict __fmt, ...)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("swprintf"))
-#endif
-     ;
-
+extern int __REDIRECT_LDBL_NTH (__swprintf_chk, (wchar_t *__restrict __s,
+						 size_t __n,
+						 int __flag, size_t __s_len,
+						 const wchar_t *__restrict __format,
+						 ...),
+				__swprintf_chkieee128, __nldbl___swprintf_chk);
+extern int __REDIRECT_LDBL_NTH (__vswprintf_chk, (wchar_t *__restrict __s,
+						  size_t __n,
+						  int __flag, size_t __s_len,
+						  const wchar_t *__restrict __format,
+						  __gnuc_va_list __arg),
+				__vswprintf_chkieee128, __nldbl___vswprintf_chk);
 
 #ifdef __va_arg_pack
 __fortify_function int
@@ -250,7 +249,7 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __swprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
 			   sz / sizeof (wchar_t), __fmt, __va_arg_pack ());
-  return __swprintf_alias (__s, __n, __fmt, __va_arg_pack ());
+  return swprintf (__s, __n, __fmt, __va_arg_pack ());
 }
 #elif !defined __cplusplus
 /* XXX We might want to have support in gcc for swprintf.  */
@@ -261,20 +260,6 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
    : swprintf (s, n, __VA_ARGS__))
 #endif
 
-extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
-			    int __flag, size_t __s_len,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-
-extern int __vswprintf_alias (wchar_t *__restrict __s, size_t __n,
-			      const wchar_t *__restrict __fmt,
-			      __gnuc_va_list __ap)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("vswprintf"))
-#endif
-     ;
-
 __fortify_function int
 __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
 		  const wchar_t *__restrict __fmt, __gnuc_va_list __ap))
@@ -283,21 +268,30 @@ __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __vswprintf_chk (__s, __n,  __USE_FORTIFY_LEVEL - 1,
 			    sz / sizeof (wchar_t), __fmt, __ap);
-  return __vswprintf_alias (__s, __n, __fmt, __ap);
+  return vswprintf (__s, __n, __fmt, __ap);
 }
 
 
 #if __USE_FORTIFY_LEVEL > 1
 
-extern int __fwprintf_chk (__FILE *__restrict __stream, int __flag,
-			   const wchar_t *__restrict __format, ...);
-extern int __wprintf_chk (int __flag, const wchar_t *__restrict __format,
-			  ...);
-extern int __vfwprintf_chk (__FILE *__restrict __stream, int __flag,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __ap);
-extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format,
-			   __gnuc_va_list __ap);
+extern int __REDIRECT_LDBL (__fwprintf_chk, (__FILE *__restrict __stream,
+					     int __flag,
+					     const wchar_t *__restrict __format,
+					     ...),
+			    __fwprintf_chkieee128, __nldbl___fwprintf_chk);
+extern int __REDIRECT_LDBL (__wprintf_chk, (int __flag,
+					    const wchar_t *__restrict __format,
+					    ...),
+			    __wprintf_chkieee128, __nldbl___wprintf_chk);
+extern int __REDIRECT_LDBL (__vfwprintf_chk, (__FILE *__restrict __stream,
+					      int __flag,
+					      const wchar_t *__restrict __format,
+					      __gnuc_va_list __ap),
+			   __vfwprintf_chkieee128, __nldbl___vfwprintf_chk);
+extern int __REDIRECT_LDBL (__vwprintf_chk, (int __flag,
+					     const wchar_t *__restrict __format,
+					     __gnuc_va_list __ap),
+			    __vwprintf_chkieee128, __nldbl___vwprintf_chk);
 
 # ifdef __va_arg_pack
 __fortify_function int
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 5d6a40853d..27406d0edb 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -382,8 +382,10 @@ extern double wcstod (const wchar_t *__restrict __nptr,
 /* Likewise for `float' and `long double' sizes of floating-point numbers.  */
 extern float wcstof (const wchar_t *__restrict __nptr,
 		     wchar_t **__restrict __endptr) __THROW;
-extern long double wcstold (const wchar_t *__restrict __nptr,
-			    wchar_t **__restrict __endptr) __THROW;
+extern long double __REDIRECT_LDBL_NTH (wcstold,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr),
+					__wcstoieee128, wcstod);
 #endif /* C99 */
 
 /* Likewise for `_FloatN' and `_FloatNx' when support is enabled.  */
@@ -498,9 +500,12 @@ extern float wcstof_l (const wchar_t *__restrict __nptr,
 		       wchar_t **__restrict __endptr, locale_t __loc)
      __THROW;
 
-extern long double wcstold_l (const wchar_t *__restrict __nptr,
-			      wchar_t **__restrict __endptr,
-			      locale_t __loc) __THROW;
+
+extern long double __REDIRECT_LDBL_NTH (wcstold_l,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr,
+					 locale_t __loc),
+					__wcstoieee128_l, wcstod_l);
 
 # if __HAVE_FLOAT16
 extern _Float16 wcstof16_l (const wchar_t *__restrict __nptr,
@@ -587,73 +592,61 @@ extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW
 /* Select orientation for stream.  */
 extern int fwide (__FILE *__fp, int __mode) __THROW;
 
-
 /* Write formatted output to STREAM.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int fwprintf (__FILE *__restrict __stream,
-		     const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (fwprintf, (__FILE *__restrict __stream,
+					  const wchar_t *__restrict __format,
+					  ...))
      /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
 /* Write formatted output to stdout.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int wprintf (const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (wprintf, (const wchar_t *__restrict __format, ...))
      /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
 /* Write formatted output of at most N characters to S.  */
-extern int swprintf (wchar_t *__restrict __s, size_t __n,
-		     const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
+extern int __REDIRECT_LDBL128_NTH (swprintf, (wchar_t *__restrict __s, size_t __n,
+					      const wchar_t *__restrict __format,
+					      ...))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
 
 /* Write formatted output to S from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vfwprintf (__FILE *__restrict __s,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vfwprintf, (__FILE *__restrict __s,
+					const wchar_t *__restrict __format,
+					__gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
 /* Write formatted output to stdout from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vwprintf (const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vwprintf, (const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
 /* Write formatted output of at most N character to S from argument
    list ARG.  */
-extern int vswprintf (wchar_t *__restrict __s, size_t __n,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
-
-
-/* Read formatted input from STREAM.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int fwscanf (__FILE *__restrict __stream,
-		    const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-/* Read formatted input from stdin.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int wscanf (const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
-/* Read formatted input from S.  */
-extern int swscanf (const wchar_t *__restrict __s,
-		    const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-
-/* For historical reasons, the C99-compliant versions of the scanf
-   functions are at alternative names.  When __LDBL_COMPAT or
-   __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
-   bits/wchar-ldbl.h.  */
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
+extern int __REDIRECT_LDBL128_NTH (vswprintf, (wchar_t *__restrict __s, size_t __n,
+				      const wchar_t *__restrict __format,
+					      __gnuc_va_list __arg))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
+
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __isoc99_fwscanfieee128, __nldbl___isoc99_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __isoc99_wscanfieee128,__nldbl___isoc99_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__isoc99_swscanfieee128, __nldbl___isoc99_swscanf);
+#  else
+#   ifdef __REDIRECT
 extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
 				 const wchar_t *__restrict __format, ...),
 		       __isoc99_fwscanf)
@@ -665,72 +658,129 @@ extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s,
 				     const wchar_t *__restrict __format,
 				     ...), __isoc99_swscanf)
      /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-#  else
+#   else
 extern int __isoc99_fwscanf (__FILE *__restrict __stream,
 			     const wchar_t *__restrict __format, ...);
 extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...);
 extern int __isoc99_swscanf (const wchar_t *__restrict __s,
 			     const wchar_t *__restrict __format, ...)
      __THROW;
-#   define fwscanf __isoc99_fwscanf
-#   define wscanf __isoc99_wscanf
-#   define swscanf __isoc99_swscanf
+#    define fwscanf __isoc99_fwscanf
+#    define wscanf __isoc99_wscanf
+#    define swscanf __isoc99_swscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __fwscanfieee128, __nldbl_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __wscanfieee128,__nldbl_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__swscanfieee128, __nldbl_swscanf);
+#  else
+/* Read formatted input from STREAM.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int fwscanf (__FILE *__restrict __stream,
+                    const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
+/* Read formatted input from stdin.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int wscanf (const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
+/* Read formatted input from S.  */
+extern int swscanf (const wchar_t *__restrict __s,
+                    const wchar_t *__restrict __format, ...)
+     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
 #  endif
 # endif
 
 #endif /* Use ISO C95, C99 and Unix98. */
 
 #ifdef __USE_ISOC99
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __isoc99_vfwscanfieee128, __nldbl___isoc99_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __isoc99_vwscanfieee128, __nldbl___isoc99_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__isoc99_vswscanfieee128,
+				__nldbl___isoc99_vswscanf);
+#  else
+#   ifdef __REDIRECT
+extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
+                                  const wchar_t *__restrict __format,
+                                  __gnuc_va_list __arg), __isoc99_vfwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
+                                 __gnuc_va_list __arg), __isoc99_vwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
+extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
+                                      const wchar_t *__restrict __format,
+                                      __gnuc_va_list __arg), __isoc99_vswscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+#   else
+extern int __isoc99_vfwscanf (__FILE *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg);
+extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
+                             __gnuc_va_list __arg);
+extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg) __THROW;
+#    define vfwscanf __isoc99_vfwscanf
+#    define vwscanf __isoc99_vwscanf
+#    define vswscanf __isoc99_vswscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __vfwscanfieee128, __nldbl_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __vwscanfieee128, __nldbl_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__vswscanfieee128,
+				__nldbl_vswscanf);
+#  else
 /* Read formatted input from S into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vfwscanf (__FILE *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
 /* Read formatted input from stdin into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vwscanf (const wchar_t *__restrict __format,
-		    __gnuc_va_list __arg)
+                    __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
 /* Read formatted input from S into argument list ARG.  */
 extern int vswscanf (const wchar_t *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-
-/* Same redirection as above for the v*wscanf family.  */
-# if !__GLIBC_USE (DEPRECATED_SCANF) \
-     && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
-     && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
-extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
-				  const wchar_t *__restrict __format,
-				  __gnuc_va_list __arg), __isoc99_vfwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
-				 __gnuc_va_list __arg), __isoc99_vwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
-extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
-				      const wchar_t *__restrict __format,
-				      __gnuc_va_list __arg), __isoc99_vswscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-#  else
-extern int __isoc99_vfwscanf (__FILE *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg);
-extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
-			     __gnuc_va_list __arg);
-extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg) __THROW;
-#   define vfwscanf __isoc99_vfwscanf
-#   define vwscanf __isoc99_vwscanf
-#   define vswscanf __isoc99_vswscanf
 #  endif
 # endif
 
@@ -867,11 +917,6 @@ extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
 # include <bits/wchar2.h>
 #endif
 
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/wchar-ldbl.h>
-#endif
-
 __END_DECLS
 
 #endif /* wchar.h  */


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

* [glibc/azanella/clang] Remove wchar-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=78eb9cc98189b63788392ea5625d85328f60b7ea

commit 78eb9cc98189b63788392ea5625d85328f60b7ea
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Feb 25 11:02:21 2022 -0300

    Remove wchar-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.
    
    A new macro, __REDIRECT_LDBL128, is used for function where only
    the binary128 alias is required.
    
    Checked on x86_64-linux-gnu and powerpc64le-linux-gnu.

Diff:
---
 include/bits/wchar-ldbl.h |   1 -
 misc/sys/cdefs.h          |  13 +++
 wcsmbs/Makefile           |   2 +-
 wcsmbs/bits/wchar-ldbl.h  |  91 ------------------
 wcsmbs/bits/wchar2.h      |  70 +++++++-------
 wcsmbs/wchar.h            | 229 +++++++++++++++++++++++++++-------------------
 6 files changed, 183 insertions(+), 223 deletions(-)

diff --git a/include/bits/wchar-ldbl.h b/include/bits/wchar-ldbl.h
deleted file mode 100644
index 29baa2f4d5..0000000000
--- a/include/bits/wchar-ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <wcsmbs/bits/wchar-ldbl.h>
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index e7f8952caa..79a0ae39c7 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -567,16 +567,26 @@
 #  ifdef __REDIRECT
 #   define __REDIRECT_LDBL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , , proto, ieee128)
+#   define __REDIRECT_LDBL128(name, proto) \
+      __REDIRECT_LDBL1 (name, , , proto, __##name##ieee128)
 #   ifdef __cplusplus
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROW, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROW, , proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROWNL, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROWNL, , proto, __##name##ieee128)
 #   else
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROW, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROW, proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROWNL, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROWNL, proto, __##name##ieee128)
 #   endif /* __cplusplus */
 #  else
 _Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
@@ -606,6 +616,9 @@ _Static_assert (0, "Compat long double requires redirection on this platform");
 # define __REDIRECT_LDBL(name, proto, ieee128, compat) name proto
 # define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) name proto __THROW
 # define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) name proto __THROWNL
+# define __REDIRECT_LDBL128(name, proto) name proto
+# define __REDIRECT_LDBL128_NTH(name, proto) name proto __THROW
+# define __REDIRECT_LDBL128_NTHNL(name, proto) name proto __THROWNL
 #endif
 
 #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index df9a85f4a9..b67202526d 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -22,7 +22,7 @@ subdir	:= wcsmbs
 
 include ../Makeconfig
 
-headers	:= wchar.h bits/wchar.h bits/wchar2.h bits/wchar-ldbl.h uchar.h \
+headers	:= wchar.h bits/wchar.h bits/wchar2.h uchar.h \
 	   bits/types/__mbstate_t.h bits/types/mbstate_t.h bits/types/wint_t.h
 
 routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
diff --git a/wcsmbs/bits/wchar-ldbl.h b/wcsmbs/bits/wchar-ldbl.h
deleted file mode 100644
index f0d8506f83..0000000000
--- a/wcsmbs/bits/wchar-ldbl.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -mlong-double-64 compatibility mode for <wchar.h> functions.
-   Copyright (C) 2006-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 _WCHAR_H
-# error "Never include <bits/wchar-ldbl.h> directly; use <wchar.h> instead."
-#endif
-
-#if defined __USE_ISOC95 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (fwprintf);
-__LDBL_REDIR_DECL (wprintf);
-__LDBL_REDIR_DECL (swprintf);
-__LDBL_REDIR_DECL (vfwprintf);
-__LDBL_REDIR_DECL (vwprintf);
-__LDBL_REDIR_DECL (vswprintf);
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (fwscanf, __nldbl___isoc99_fwscanf)
-__LDBL_REDIR1_DECL (wscanf, __nldbl___isoc99_wscanf)
-__LDBL_REDIR1_DECL (swscanf, __nldbl___isoc99_swscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (fwscanf, __isoc99_fwscanfieee128)
-__LDBL_REDIR1_DECL (wscanf, __isoc99_wscanfieee128)
-__LDBL_REDIR1_DECL (swscanf, __isoc99_swscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (fwscanf);
-__LDBL_REDIR_DECL (wscanf);
-__LDBL_REDIR_DECL (swscanf);
-# endif
-#endif
-
-#ifdef __USE_ISOC99
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold, wcstod);
-# else
-__LDBL_REDIR1_DECL (wcstold, __wcstoieee128)
-# endif
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (vfwscanf, __nldbl___isoc99_vfwscanf)
-__LDBL_REDIR1_DECL (vwscanf, __nldbl___isoc99_vwscanf)
-__LDBL_REDIR1_DECL (vswscanf, __nldbl___isoc99_vswscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (vfwscanf, __isoc99_vfwscanfieee128)
-__LDBL_REDIR1_DECL (vwscanf, __isoc99_vwscanfieee128)
-__LDBL_REDIR1_DECL (vswscanf, __isoc99_vswscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (vfwscanf);
-__LDBL_REDIR_DECL (vwscanf);
-__LDBL_REDIR_DECL (vswscanf);
-# endif
-#endif
-
-#ifdef __USE_GNU
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold_l, wcstod_l);
-# else
-__LDBL_REDIR1_DECL (wcstold_l, __wcstoieee128_l)
-# endif
-#endif
-
-#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR2_DECL (swprintf_chk)
-__LDBL_REDIR2_DECL (vswprintf_chk)
-# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR2_DECL (fwprintf_chk)
-__LDBL_REDIR2_DECL (wprintf_chk)
-__LDBL_REDIR2_DECL (vfwprintf_chk)
-__LDBL_REDIR2_DECL (vwprintf_chk)
-# endif
-#endif
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index f2dca7711a..548deeedbf 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -227,19 +227,18 @@ __NTH (wcsncat (wchar_t *__restrict __dest, const wchar_t *__restrict __src,
   return __wcsncat_alias (__dest, __src, __n);
 }
 
-
-extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
-			   int __flag, size_t __s_len,
-			   const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
-
-extern int __swprintf_alias (wchar_t *__restrict __s, size_t __n,
-			     const wchar_t *__restrict __fmt, ...)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("swprintf"))
-#endif
-     ;
-
+extern int __REDIRECT_LDBL_NTH (__swprintf_chk, (wchar_t *__restrict __s,
+						 size_t __n,
+						 int __flag, size_t __s_len,
+						 const wchar_t *__restrict __format,
+						 ...),
+				__swprintf_chkieee128, __nldbl___swprintf_chk);
+extern int __REDIRECT_LDBL_NTH (__vswprintf_chk, (wchar_t *__restrict __s,
+						  size_t __n,
+						  int __flag, size_t __s_len,
+						  const wchar_t *__restrict __format,
+						  __gnuc_va_list __arg),
+				__vswprintf_chkieee128, __nldbl___vswprintf_chk);
 
 #ifdef __va_arg_pack
 __fortify_function int
@@ -250,7 +249,7 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __swprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
 			   sz / sizeof (wchar_t), __fmt, __va_arg_pack ());
-  return __swprintf_alias (__s, __n, __fmt, __va_arg_pack ());
+  return swprintf (__s, __n, __fmt, __va_arg_pack ());
 }
 #elif !defined __cplusplus
 /* XXX We might want to have support in gcc for swprintf.  */
@@ -261,20 +260,6 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
    : swprintf (s, n, __VA_ARGS__))
 #endif
 
-extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
-			    int __flag, size_t __s_len,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-
-extern int __vswprintf_alias (wchar_t *__restrict __s, size_t __n,
-			      const wchar_t *__restrict __fmt,
-			      __gnuc_va_list __ap)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("vswprintf"))
-#endif
-     ;
-
 __fortify_function int
 __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
 		  const wchar_t *__restrict __fmt, __gnuc_va_list __ap))
@@ -283,21 +268,30 @@ __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __vswprintf_chk (__s, __n,  __USE_FORTIFY_LEVEL - 1,
 			    sz / sizeof (wchar_t), __fmt, __ap);
-  return __vswprintf_alias (__s, __n, __fmt, __ap);
+  return vswprintf (__s, __n, __fmt, __ap);
 }
 
 
 #if __USE_FORTIFY_LEVEL > 1
 
-extern int __fwprintf_chk (__FILE *__restrict __stream, int __flag,
-			   const wchar_t *__restrict __format, ...);
-extern int __wprintf_chk (int __flag, const wchar_t *__restrict __format,
-			  ...);
-extern int __vfwprintf_chk (__FILE *__restrict __stream, int __flag,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __ap);
-extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format,
-			   __gnuc_va_list __ap);
+extern int __REDIRECT_LDBL (__fwprintf_chk, (__FILE *__restrict __stream,
+					     int __flag,
+					     const wchar_t *__restrict __format,
+					     ...),
+			    __fwprintf_chkieee128, __nldbl___fwprintf_chk);
+extern int __REDIRECT_LDBL (__wprintf_chk, (int __flag,
+					    const wchar_t *__restrict __format,
+					    ...),
+			    __wprintf_chkieee128, __nldbl___wprintf_chk);
+extern int __REDIRECT_LDBL (__vfwprintf_chk, (__FILE *__restrict __stream,
+					      int __flag,
+					      const wchar_t *__restrict __format,
+					      __gnuc_va_list __ap),
+			   __vfwprintf_chkieee128, __nldbl___vfwprintf_chk);
+extern int __REDIRECT_LDBL (__vwprintf_chk, (int __flag,
+					     const wchar_t *__restrict __format,
+					     __gnuc_va_list __ap),
+			    __vwprintf_chkieee128, __nldbl___vwprintf_chk);
 
 # ifdef __va_arg_pack
 __fortify_function int
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 5d6a40853d..27406d0edb 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -382,8 +382,10 @@ extern double wcstod (const wchar_t *__restrict __nptr,
 /* Likewise for `float' and `long double' sizes of floating-point numbers.  */
 extern float wcstof (const wchar_t *__restrict __nptr,
 		     wchar_t **__restrict __endptr) __THROW;
-extern long double wcstold (const wchar_t *__restrict __nptr,
-			    wchar_t **__restrict __endptr) __THROW;
+extern long double __REDIRECT_LDBL_NTH (wcstold,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr),
+					__wcstoieee128, wcstod);
 #endif /* C99 */
 
 /* Likewise for `_FloatN' and `_FloatNx' when support is enabled.  */
@@ -498,9 +500,12 @@ extern float wcstof_l (const wchar_t *__restrict __nptr,
 		       wchar_t **__restrict __endptr, locale_t __loc)
      __THROW;
 
-extern long double wcstold_l (const wchar_t *__restrict __nptr,
-			      wchar_t **__restrict __endptr,
-			      locale_t __loc) __THROW;
+
+extern long double __REDIRECT_LDBL_NTH (wcstold_l,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr,
+					 locale_t __loc),
+					__wcstoieee128_l, wcstod_l);
 
 # if __HAVE_FLOAT16
 extern _Float16 wcstof16_l (const wchar_t *__restrict __nptr,
@@ -587,73 +592,61 @@ extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW
 /* Select orientation for stream.  */
 extern int fwide (__FILE *__fp, int __mode) __THROW;
 
-
 /* Write formatted output to STREAM.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int fwprintf (__FILE *__restrict __stream,
-		     const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (fwprintf, (__FILE *__restrict __stream,
+					  const wchar_t *__restrict __format,
+					  ...))
      /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
 /* Write formatted output to stdout.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int wprintf (const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (wprintf, (const wchar_t *__restrict __format, ...))
      /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
 /* Write formatted output of at most N characters to S.  */
-extern int swprintf (wchar_t *__restrict __s, size_t __n,
-		     const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
+extern int __REDIRECT_LDBL128_NTH (swprintf, (wchar_t *__restrict __s, size_t __n,
+					      const wchar_t *__restrict __format,
+					      ...))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
 
 /* Write formatted output to S from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vfwprintf (__FILE *__restrict __s,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vfwprintf, (__FILE *__restrict __s,
+					const wchar_t *__restrict __format,
+					__gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
 /* Write formatted output to stdout from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vwprintf (const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vwprintf, (const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
 /* Write formatted output of at most N character to S from argument
    list ARG.  */
-extern int vswprintf (wchar_t *__restrict __s, size_t __n,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
-
-
-/* Read formatted input from STREAM.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int fwscanf (__FILE *__restrict __stream,
-		    const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-/* Read formatted input from stdin.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int wscanf (const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
-/* Read formatted input from S.  */
-extern int swscanf (const wchar_t *__restrict __s,
-		    const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-
-/* For historical reasons, the C99-compliant versions of the scanf
-   functions are at alternative names.  When __LDBL_COMPAT or
-   __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
-   bits/wchar-ldbl.h.  */
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
+extern int __REDIRECT_LDBL128_NTH (vswprintf, (wchar_t *__restrict __s, size_t __n,
+				      const wchar_t *__restrict __format,
+					      __gnuc_va_list __arg))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
+
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __isoc99_fwscanfieee128, __nldbl___isoc99_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __isoc99_wscanfieee128,__nldbl___isoc99_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__isoc99_swscanfieee128, __nldbl___isoc99_swscanf);
+#  else
+#   ifdef __REDIRECT
 extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
 				 const wchar_t *__restrict __format, ...),
 		       __isoc99_fwscanf)
@@ -665,72 +658,129 @@ extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s,
 				     const wchar_t *__restrict __format,
 				     ...), __isoc99_swscanf)
      /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-#  else
+#   else
 extern int __isoc99_fwscanf (__FILE *__restrict __stream,
 			     const wchar_t *__restrict __format, ...);
 extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...);
 extern int __isoc99_swscanf (const wchar_t *__restrict __s,
 			     const wchar_t *__restrict __format, ...)
      __THROW;
-#   define fwscanf __isoc99_fwscanf
-#   define wscanf __isoc99_wscanf
-#   define swscanf __isoc99_swscanf
+#    define fwscanf __isoc99_fwscanf
+#    define wscanf __isoc99_wscanf
+#    define swscanf __isoc99_swscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __fwscanfieee128, __nldbl_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __wscanfieee128,__nldbl_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__swscanfieee128, __nldbl_swscanf);
+#  else
+/* Read formatted input from STREAM.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int fwscanf (__FILE *__restrict __stream,
+                    const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
+/* Read formatted input from stdin.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int wscanf (const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
+/* Read formatted input from S.  */
+extern int swscanf (const wchar_t *__restrict __s,
+                    const wchar_t *__restrict __format, ...)
+     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
 #  endif
 # endif
 
 #endif /* Use ISO C95, C99 and Unix98. */
 
 #ifdef __USE_ISOC99
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __isoc99_vfwscanfieee128, __nldbl___isoc99_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __isoc99_vwscanfieee128, __nldbl___isoc99_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__isoc99_vswscanfieee128,
+				__nldbl___isoc99_vswscanf);
+#  else
+#   ifdef __REDIRECT
+extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
+                                  const wchar_t *__restrict __format,
+                                  __gnuc_va_list __arg), __isoc99_vfwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
+                                 __gnuc_va_list __arg), __isoc99_vwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
+extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
+                                      const wchar_t *__restrict __format,
+                                      __gnuc_va_list __arg), __isoc99_vswscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+#   else
+extern int __isoc99_vfwscanf (__FILE *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg);
+extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
+                             __gnuc_va_list __arg);
+extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg) __THROW;
+#    define vfwscanf __isoc99_vfwscanf
+#    define vwscanf __isoc99_vwscanf
+#    define vswscanf __isoc99_vswscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __vfwscanfieee128, __nldbl_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __vwscanfieee128, __nldbl_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__vswscanfieee128,
+				__nldbl_vswscanf);
+#  else
 /* Read formatted input from S into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vfwscanf (__FILE *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
 /* Read formatted input from stdin into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vwscanf (const wchar_t *__restrict __format,
-		    __gnuc_va_list __arg)
+                    __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
 /* Read formatted input from S into argument list ARG.  */
 extern int vswscanf (const wchar_t *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-
-/* Same redirection as above for the v*wscanf family.  */
-# if !__GLIBC_USE (DEPRECATED_SCANF) \
-     && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
-     && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
-extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
-				  const wchar_t *__restrict __format,
-				  __gnuc_va_list __arg), __isoc99_vfwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
-				 __gnuc_va_list __arg), __isoc99_vwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
-extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
-				      const wchar_t *__restrict __format,
-				      __gnuc_va_list __arg), __isoc99_vswscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-#  else
-extern int __isoc99_vfwscanf (__FILE *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg);
-extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
-			     __gnuc_va_list __arg);
-extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg) __THROW;
-#   define vfwscanf __isoc99_vfwscanf
-#   define vwscanf __isoc99_vwscanf
-#   define vswscanf __isoc99_vswscanf
 #  endif
 # endif
 
@@ -867,11 +917,6 @@ extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
 # include <bits/wchar2.h>
 #endif
 
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/wchar-ldbl.h>
-#endif
-
 __END_DECLS
 
 #endif /* wchar.h  */


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

* [glibc/azanella/clang] Remove wchar-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=e3d1a3b86f578575332651cebfb1b10a3eeb0db3

commit e3d1a3b86f578575332651cebfb1b10a3eeb0db3
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Feb 25 11:02:21 2022 -0300

    Remove wchar-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.
    
    A new macro, __REDIRECT_LDBL128, is used for function where only
    the binary128 alias is required.
    
    Checked on x86_64-linux-gnu and powerpc64le-linux-gnu.

Diff:
---
 include/bits/wchar-ldbl.h |   1 -
 misc/sys/cdefs.h          |  13 +++
 wcsmbs/Makefile           |   2 +-
 wcsmbs/bits/wchar-ldbl.h  |  91 ------------------
 wcsmbs/bits/wchar2.h      |  70 +++++++-------
 wcsmbs/wchar.h            | 229 +++++++++++++++++++++++++++-------------------
 6 files changed, 183 insertions(+), 223 deletions(-)

diff --git a/include/bits/wchar-ldbl.h b/include/bits/wchar-ldbl.h
deleted file mode 100644
index 29baa2f4d5..0000000000
--- a/include/bits/wchar-ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <wcsmbs/bits/wchar-ldbl.h>
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 422ca351f2..419a09a3a7 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -567,16 +567,26 @@
 #  ifdef __REDIRECT
 #   define __REDIRECT_LDBL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , , proto, ieee128)
+#   define __REDIRECT_LDBL128(name, proto) \
+      __REDIRECT_LDBL1 (name, , , proto, __##name##ieee128)
 #   ifdef __cplusplus
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROW, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROW, , proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROWNL, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROWNL, , proto, __##name##ieee128)
 #   else
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROW, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROW, proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROWNL, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROWNL, proto, __##name##ieee128)
 #   endif /* __cplusplus */
 #  else
 _Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
@@ -606,6 +616,9 @@ _Static_assert (0, "Compat long double requires redirection on this platform");
 # define __REDIRECT_LDBL(name, proto, ieee128, compat) name proto
 # define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) name proto __THROW
 # define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) name proto __THROWNL
+# define __REDIRECT_LDBL128(name, proto) name proto
+# define __REDIRECT_LDBL128_NTH(name, proto) name proto __THROW
+# define __REDIRECT_LDBL128_NTHNL(name, proto) name proto __THROWNL
 #endif
 
 #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index df9a85f4a9..b67202526d 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -22,7 +22,7 @@ subdir	:= wcsmbs
 
 include ../Makeconfig
 
-headers	:= wchar.h bits/wchar.h bits/wchar2.h bits/wchar-ldbl.h uchar.h \
+headers	:= wchar.h bits/wchar.h bits/wchar2.h uchar.h \
 	   bits/types/__mbstate_t.h bits/types/mbstate_t.h bits/types/wint_t.h
 
 routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
diff --git a/wcsmbs/bits/wchar-ldbl.h b/wcsmbs/bits/wchar-ldbl.h
deleted file mode 100644
index f0d8506f83..0000000000
--- a/wcsmbs/bits/wchar-ldbl.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -mlong-double-64 compatibility mode for <wchar.h> functions.
-   Copyright (C) 2006-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 _WCHAR_H
-# error "Never include <bits/wchar-ldbl.h> directly; use <wchar.h> instead."
-#endif
-
-#if defined __USE_ISOC95 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (fwprintf);
-__LDBL_REDIR_DECL (wprintf);
-__LDBL_REDIR_DECL (swprintf);
-__LDBL_REDIR_DECL (vfwprintf);
-__LDBL_REDIR_DECL (vwprintf);
-__LDBL_REDIR_DECL (vswprintf);
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (fwscanf, __nldbl___isoc99_fwscanf)
-__LDBL_REDIR1_DECL (wscanf, __nldbl___isoc99_wscanf)
-__LDBL_REDIR1_DECL (swscanf, __nldbl___isoc99_swscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (fwscanf, __isoc99_fwscanfieee128)
-__LDBL_REDIR1_DECL (wscanf, __isoc99_wscanfieee128)
-__LDBL_REDIR1_DECL (swscanf, __isoc99_swscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (fwscanf);
-__LDBL_REDIR_DECL (wscanf);
-__LDBL_REDIR_DECL (swscanf);
-# endif
-#endif
-
-#ifdef __USE_ISOC99
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold, wcstod);
-# else
-__LDBL_REDIR1_DECL (wcstold, __wcstoieee128)
-# endif
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (vfwscanf, __nldbl___isoc99_vfwscanf)
-__LDBL_REDIR1_DECL (vwscanf, __nldbl___isoc99_vwscanf)
-__LDBL_REDIR1_DECL (vswscanf, __nldbl___isoc99_vswscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (vfwscanf, __isoc99_vfwscanfieee128)
-__LDBL_REDIR1_DECL (vwscanf, __isoc99_vwscanfieee128)
-__LDBL_REDIR1_DECL (vswscanf, __isoc99_vswscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (vfwscanf);
-__LDBL_REDIR_DECL (vwscanf);
-__LDBL_REDIR_DECL (vswscanf);
-# endif
-#endif
-
-#ifdef __USE_GNU
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold_l, wcstod_l);
-# else
-__LDBL_REDIR1_DECL (wcstold_l, __wcstoieee128_l)
-# endif
-#endif
-
-#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR2_DECL (swprintf_chk)
-__LDBL_REDIR2_DECL (vswprintf_chk)
-# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR2_DECL (fwprintf_chk)
-__LDBL_REDIR2_DECL (wprintf_chk)
-__LDBL_REDIR2_DECL (vfwprintf_chk)
-__LDBL_REDIR2_DECL (vwprintf_chk)
-# endif
-#endif
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index f2dca7711a..548deeedbf 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -227,19 +227,18 @@ __NTH (wcsncat (wchar_t *__restrict __dest, const wchar_t *__restrict __src,
   return __wcsncat_alias (__dest, __src, __n);
 }
 
-
-extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
-			   int __flag, size_t __s_len,
-			   const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
-
-extern int __swprintf_alias (wchar_t *__restrict __s, size_t __n,
-			     const wchar_t *__restrict __fmt, ...)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("swprintf"))
-#endif
-     ;
-
+extern int __REDIRECT_LDBL_NTH (__swprintf_chk, (wchar_t *__restrict __s,
+						 size_t __n,
+						 int __flag, size_t __s_len,
+						 const wchar_t *__restrict __format,
+						 ...),
+				__swprintf_chkieee128, __nldbl___swprintf_chk);
+extern int __REDIRECT_LDBL_NTH (__vswprintf_chk, (wchar_t *__restrict __s,
+						  size_t __n,
+						  int __flag, size_t __s_len,
+						  const wchar_t *__restrict __format,
+						  __gnuc_va_list __arg),
+				__vswprintf_chkieee128, __nldbl___vswprintf_chk);
 
 #ifdef __va_arg_pack
 __fortify_function int
@@ -250,7 +249,7 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __swprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
 			   sz / sizeof (wchar_t), __fmt, __va_arg_pack ());
-  return __swprintf_alias (__s, __n, __fmt, __va_arg_pack ());
+  return swprintf (__s, __n, __fmt, __va_arg_pack ());
 }
 #elif !defined __cplusplus
 /* XXX We might want to have support in gcc for swprintf.  */
@@ -261,20 +260,6 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
    : swprintf (s, n, __VA_ARGS__))
 #endif
 
-extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
-			    int __flag, size_t __s_len,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-
-extern int __vswprintf_alias (wchar_t *__restrict __s, size_t __n,
-			      const wchar_t *__restrict __fmt,
-			      __gnuc_va_list __ap)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("vswprintf"))
-#endif
-     ;
-
 __fortify_function int
 __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
 		  const wchar_t *__restrict __fmt, __gnuc_va_list __ap))
@@ -283,21 +268,30 @@ __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __vswprintf_chk (__s, __n,  __USE_FORTIFY_LEVEL - 1,
 			    sz / sizeof (wchar_t), __fmt, __ap);
-  return __vswprintf_alias (__s, __n, __fmt, __ap);
+  return vswprintf (__s, __n, __fmt, __ap);
 }
 
 
 #if __USE_FORTIFY_LEVEL > 1
 
-extern int __fwprintf_chk (__FILE *__restrict __stream, int __flag,
-			   const wchar_t *__restrict __format, ...);
-extern int __wprintf_chk (int __flag, const wchar_t *__restrict __format,
-			  ...);
-extern int __vfwprintf_chk (__FILE *__restrict __stream, int __flag,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __ap);
-extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format,
-			   __gnuc_va_list __ap);
+extern int __REDIRECT_LDBL (__fwprintf_chk, (__FILE *__restrict __stream,
+					     int __flag,
+					     const wchar_t *__restrict __format,
+					     ...),
+			    __fwprintf_chkieee128, __nldbl___fwprintf_chk);
+extern int __REDIRECT_LDBL (__wprintf_chk, (int __flag,
+					    const wchar_t *__restrict __format,
+					    ...),
+			    __wprintf_chkieee128, __nldbl___wprintf_chk);
+extern int __REDIRECT_LDBL (__vfwprintf_chk, (__FILE *__restrict __stream,
+					      int __flag,
+					      const wchar_t *__restrict __format,
+					      __gnuc_va_list __ap),
+			   __vfwprintf_chkieee128, __nldbl___vfwprintf_chk);
+extern int __REDIRECT_LDBL (__vwprintf_chk, (int __flag,
+					     const wchar_t *__restrict __format,
+					     __gnuc_va_list __ap),
+			    __vwprintf_chkieee128, __nldbl___vwprintf_chk);
 
 # ifdef __va_arg_pack
 __fortify_function int
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 5d6a40853d..27406d0edb 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -382,8 +382,10 @@ extern double wcstod (const wchar_t *__restrict __nptr,
 /* Likewise for `float' and `long double' sizes of floating-point numbers.  */
 extern float wcstof (const wchar_t *__restrict __nptr,
 		     wchar_t **__restrict __endptr) __THROW;
-extern long double wcstold (const wchar_t *__restrict __nptr,
-			    wchar_t **__restrict __endptr) __THROW;
+extern long double __REDIRECT_LDBL_NTH (wcstold,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr),
+					__wcstoieee128, wcstod);
 #endif /* C99 */
 
 /* Likewise for `_FloatN' and `_FloatNx' when support is enabled.  */
@@ -498,9 +500,12 @@ extern float wcstof_l (const wchar_t *__restrict __nptr,
 		       wchar_t **__restrict __endptr, locale_t __loc)
      __THROW;
 
-extern long double wcstold_l (const wchar_t *__restrict __nptr,
-			      wchar_t **__restrict __endptr,
-			      locale_t __loc) __THROW;
+
+extern long double __REDIRECT_LDBL_NTH (wcstold_l,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr,
+					 locale_t __loc),
+					__wcstoieee128_l, wcstod_l);
 
 # if __HAVE_FLOAT16
 extern _Float16 wcstof16_l (const wchar_t *__restrict __nptr,
@@ -587,73 +592,61 @@ extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW
 /* Select orientation for stream.  */
 extern int fwide (__FILE *__fp, int __mode) __THROW;
 
-
 /* Write formatted output to STREAM.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int fwprintf (__FILE *__restrict __stream,
-		     const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (fwprintf, (__FILE *__restrict __stream,
+					  const wchar_t *__restrict __format,
+					  ...))
      /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
 /* Write formatted output to stdout.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int wprintf (const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (wprintf, (const wchar_t *__restrict __format, ...))
      /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
 /* Write formatted output of at most N characters to S.  */
-extern int swprintf (wchar_t *__restrict __s, size_t __n,
-		     const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
+extern int __REDIRECT_LDBL128_NTH (swprintf, (wchar_t *__restrict __s, size_t __n,
+					      const wchar_t *__restrict __format,
+					      ...))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
 
 /* Write formatted output to S from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vfwprintf (__FILE *__restrict __s,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vfwprintf, (__FILE *__restrict __s,
+					const wchar_t *__restrict __format,
+					__gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
 /* Write formatted output to stdout from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vwprintf (const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vwprintf, (const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
 /* Write formatted output of at most N character to S from argument
    list ARG.  */
-extern int vswprintf (wchar_t *__restrict __s, size_t __n,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
-
-
-/* Read formatted input from STREAM.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int fwscanf (__FILE *__restrict __stream,
-		    const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-/* Read formatted input from stdin.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int wscanf (const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
-/* Read formatted input from S.  */
-extern int swscanf (const wchar_t *__restrict __s,
-		    const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-
-/* For historical reasons, the C99-compliant versions of the scanf
-   functions are at alternative names.  When __LDBL_COMPAT or
-   __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
-   bits/wchar-ldbl.h.  */
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
+extern int __REDIRECT_LDBL128_NTH (vswprintf, (wchar_t *__restrict __s, size_t __n,
+				      const wchar_t *__restrict __format,
+					      __gnuc_va_list __arg))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
+
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __isoc99_fwscanfieee128, __nldbl___isoc99_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __isoc99_wscanfieee128,__nldbl___isoc99_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__isoc99_swscanfieee128, __nldbl___isoc99_swscanf);
+#  else
+#   ifdef __REDIRECT
 extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
 				 const wchar_t *__restrict __format, ...),
 		       __isoc99_fwscanf)
@@ -665,72 +658,129 @@ extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s,
 				     const wchar_t *__restrict __format,
 				     ...), __isoc99_swscanf)
      /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-#  else
+#   else
 extern int __isoc99_fwscanf (__FILE *__restrict __stream,
 			     const wchar_t *__restrict __format, ...);
 extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...);
 extern int __isoc99_swscanf (const wchar_t *__restrict __s,
 			     const wchar_t *__restrict __format, ...)
      __THROW;
-#   define fwscanf __isoc99_fwscanf
-#   define wscanf __isoc99_wscanf
-#   define swscanf __isoc99_swscanf
+#    define fwscanf __isoc99_fwscanf
+#    define wscanf __isoc99_wscanf
+#    define swscanf __isoc99_swscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __fwscanfieee128, __nldbl_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __wscanfieee128,__nldbl_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__swscanfieee128, __nldbl_swscanf);
+#  else
+/* Read formatted input from STREAM.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int fwscanf (__FILE *__restrict __stream,
+                    const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
+/* Read formatted input from stdin.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int wscanf (const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
+/* Read formatted input from S.  */
+extern int swscanf (const wchar_t *__restrict __s,
+                    const wchar_t *__restrict __format, ...)
+     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
 #  endif
 # endif
 
 #endif /* Use ISO C95, C99 and Unix98. */
 
 #ifdef __USE_ISOC99
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __isoc99_vfwscanfieee128, __nldbl___isoc99_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __isoc99_vwscanfieee128, __nldbl___isoc99_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__isoc99_vswscanfieee128,
+				__nldbl___isoc99_vswscanf);
+#  else
+#   ifdef __REDIRECT
+extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
+                                  const wchar_t *__restrict __format,
+                                  __gnuc_va_list __arg), __isoc99_vfwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
+                                 __gnuc_va_list __arg), __isoc99_vwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
+extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
+                                      const wchar_t *__restrict __format,
+                                      __gnuc_va_list __arg), __isoc99_vswscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+#   else
+extern int __isoc99_vfwscanf (__FILE *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg);
+extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
+                             __gnuc_va_list __arg);
+extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg) __THROW;
+#    define vfwscanf __isoc99_vfwscanf
+#    define vwscanf __isoc99_vwscanf
+#    define vswscanf __isoc99_vswscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __vfwscanfieee128, __nldbl_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __vwscanfieee128, __nldbl_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__vswscanfieee128,
+				__nldbl_vswscanf);
+#  else
 /* Read formatted input from S into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vfwscanf (__FILE *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
 /* Read formatted input from stdin into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vwscanf (const wchar_t *__restrict __format,
-		    __gnuc_va_list __arg)
+                    __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
 /* Read formatted input from S into argument list ARG.  */
 extern int vswscanf (const wchar_t *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-
-/* Same redirection as above for the v*wscanf family.  */
-# if !__GLIBC_USE (DEPRECATED_SCANF) \
-     && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
-     && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
-extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
-				  const wchar_t *__restrict __format,
-				  __gnuc_va_list __arg), __isoc99_vfwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
-				 __gnuc_va_list __arg), __isoc99_vwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
-extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
-				      const wchar_t *__restrict __format,
-				      __gnuc_va_list __arg), __isoc99_vswscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-#  else
-extern int __isoc99_vfwscanf (__FILE *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg);
-extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
-			     __gnuc_va_list __arg);
-extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg) __THROW;
-#   define vfwscanf __isoc99_vfwscanf
-#   define vwscanf __isoc99_vwscanf
-#   define vswscanf __isoc99_vswscanf
 #  endif
 # endif
 
@@ -867,11 +917,6 @@ extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
 # include <bits/wchar2.h>
 #endif
 
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/wchar-ldbl.h>
-#endif
-
 __END_DECLS
 
 #endif /* wchar.h  */


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

* [glibc/azanella/clang] Remove wchar-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=cdcfe84eaacec0e800dc724501174a4a67302606

commit cdcfe84eaacec0e800dc724501174a4a67302606
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Feb 25 11:02:21 2022 -0300

    Remove wchar-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.
    
    A new macro, __REDIRECT_LDBL128, is used for function where only
    the binary128 alias is required.
    
    Checked on x86_64-linux-gnu and powerpc64le-linux-gnu.

Diff:
---
 include/bits/wchar-ldbl.h |   1 -
 misc/sys/cdefs.h          |  13 +++
 wcsmbs/Makefile           |   2 +-
 wcsmbs/bits/wchar-ldbl.h  |  91 ------------------
 wcsmbs/bits/wchar2.h      |  70 +++++++-------
 wcsmbs/wchar.h            | 229 +++++++++++++++++++++++++++-------------------
 6 files changed, 183 insertions(+), 223 deletions(-)

diff --git a/include/bits/wchar-ldbl.h b/include/bits/wchar-ldbl.h
deleted file mode 100644
index 29baa2f4d5..0000000000
--- a/include/bits/wchar-ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <wcsmbs/bits/wchar-ldbl.h>
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 422ca351f2..419a09a3a7 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -567,16 +567,26 @@
 #  ifdef __REDIRECT
 #   define __REDIRECT_LDBL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , , proto, ieee128)
+#   define __REDIRECT_LDBL128(name, proto) \
+      __REDIRECT_LDBL1 (name, , , proto, __##name##ieee128)
 #   ifdef __cplusplus
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROW, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROW, , proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROWNL, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROWNL, , proto, __##name##ieee128)
 #   else
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROW, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROW, proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROWNL, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROWNL, proto, __##name##ieee128)
 #   endif /* __cplusplus */
 #  else
 _Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
@@ -606,6 +616,9 @@ _Static_assert (0, "Compat long double requires redirection on this platform");
 # define __REDIRECT_LDBL(name, proto, ieee128, compat) name proto
 # define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) name proto __THROW
 # define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) name proto __THROWNL
+# define __REDIRECT_LDBL128(name, proto) name proto
+# define __REDIRECT_LDBL128_NTH(name, proto) name proto __THROW
+# define __REDIRECT_LDBL128_NTHNL(name, proto) name proto __THROWNL
 #endif
 
 #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index df9a85f4a9..b67202526d 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -22,7 +22,7 @@ subdir	:= wcsmbs
 
 include ../Makeconfig
 
-headers	:= wchar.h bits/wchar.h bits/wchar2.h bits/wchar-ldbl.h uchar.h \
+headers	:= wchar.h bits/wchar.h bits/wchar2.h uchar.h \
 	   bits/types/__mbstate_t.h bits/types/mbstate_t.h bits/types/wint_t.h
 
 routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
diff --git a/wcsmbs/bits/wchar-ldbl.h b/wcsmbs/bits/wchar-ldbl.h
deleted file mode 100644
index f0d8506f83..0000000000
--- a/wcsmbs/bits/wchar-ldbl.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -mlong-double-64 compatibility mode for <wchar.h> functions.
-   Copyright (C) 2006-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 _WCHAR_H
-# error "Never include <bits/wchar-ldbl.h> directly; use <wchar.h> instead."
-#endif
-
-#if defined __USE_ISOC95 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (fwprintf);
-__LDBL_REDIR_DECL (wprintf);
-__LDBL_REDIR_DECL (swprintf);
-__LDBL_REDIR_DECL (vfwprintf);
-__LDBL_REDIR_DECL (vwprintf);
-__LDBL_REDIR_DECL (vswprintf);
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (fwscanf, __nldbl___isoc99_fwscanf)
-__LDBL_REDIR1_DECL (wscanf, __nldbl___isoc99_wscanf)
-__LDBL_REDIR1_DECL (swscanf, __nldbl___isoc99_swscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (fwscanf, __isoc99_fwscanfieee128)
-__LDBL_REDIR1_DECL (wscanf, __isoc99_wscanfieee128)
-__LDBL_REDIR1_DECL (swscanf, __isoc99_swscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (fwscanf);
-__LDBL_REDIR_DECL (wscanf);
-__LDBL_REDIR_DECL (swscanf);
-# endif
-#endif
-
-#ifdef __USE_ISOC99
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold, wcstod);
-# else
-__LDBL_REDIR1_DECL (wcstold, __wcstoieee128)
-# endif
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (vfwscanf, __nldbl___isoc99_vfwscanf)
-__LDBL_REDIR1_DECL (vwscanf, __nldbl___isoc99_vwscanf)
-__LDBL_REDIR1_DECL (vswscanf, __nldbl___isoc99_vswscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (vfwscanf, __isoc99_vfwscanfieee128)
-__LDBL_REDIR1_DECL (vwscanf, __isoc99_vwscanfieee128)
-__LDBL_REDIR1_DECL (vswscanf, __isoc99_vswscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (vfwscanf);
-__LDBL_REDIR_DECL (vwscanf);
-__LDBL_REDIR_DECL (vswscanf);
-# endif
-#endif
-
-#ifdef __USE_GNU
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold_l, wcstod_l);
-# else
-__LDBL_REDIR1_DECL (wcstold_l, __wcstoieee128_l)
-# endif
-#endif
-
-#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR2_DECL (swprintf_chk)
-__LDBL_REDIR2_DECL (vswprintf_chk)
-# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR2_DECL (fwprintf_chk)
-__LDBL_REDIR2_DECL (wprintf_chk)
-__LDBL_REDIR2_DECL (vfwprintf_chk)
-__LDBL_REDIR2_DECL (vwprintf_chk)
-# endif
-#endif
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index f2dca7711a..548deeedbf 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -227,19 +227,18 @@ __NTH (wcsncat (wchar_t *__restrict __dest, const wchar_t *__restrict __src,
   return __wcsncat_alias (__dest, __src, __n);
 }
 
-
-extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
-			   int __flag, size_t __s_len,
-			   const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
-
-extern int __swprintf_alias (wchar_t *__restrict __s, size_t __n,
-			     const wchar_t *__restrict __fmt, ...)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("swprintf"))
-#endif
-     ;
-
+extern int __REDIRECT_LDBL_NTH (__swprintf_chk, (wchar_t *__restrict __s,
+						 size_t __n,
+						 int __flag, size_t __s_len,
+						 const wchar_t *__restrict __format,
+						 ...),
+				__swprintf_chkieee128, __nldbl___swprintf_chk);
+extern int __REDIRECT_LDBL_NTH (__vswprintf_chk, (wchar_t *__restrict __s,
+						  size_t __n,
+						  int __flag, size_t __s_len,
+						  const wchar_t *__restrict __format,
+						  __gnuc_va_list __arg),
+				__vswprintf_chkieee128, __nldbl___vswprintf_chk);
 
 #ifdef __va_arg_pack
 __fortify_function int
@@ -250,7 +249,7 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __swprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
 			   sz / sizeof (wchar_t), __fmt, __va_arg_pack ());
-  return __swprintf_alias (__s, __n, __fmt, __va_arg_pack ());
+  return swprintf (__s, __n, __fmt, __va_arg_pack ());
 }
 #elif !defined __cplusplus
 /* XXX We might want to have support in gcc for swprintf.  */
@@ -261,20 +260,6 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
    : swprintf (s, n, __VA_ARGS__))
 #endif
 
-extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
-			    int __flag, size_t __s_len,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-
-extern int __vswprintf_alias (wchar_t *__restrict __s, size_t __n,
-			      const wchar_t *__restrict __fmt,
-			      __gnuc_va_list __ap)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("vswprintf"))
-#endif
-     ;
-
 __fortify_function int
 __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
 		  const wchar_t *__restrict __fmt, __gnuc_va_list __ap))
@@ -283,21 +268,30 @@ __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __vswprintf_chk (__s, __n,  __USE_FORTIFY_LEVEL - 1,
 			    sz / sizeof (wchar_t), __fmt, __ap);
-  return __vswprintf_alias (__s, __n, __fmt, __ap);
+  return vswprintf (__s, __n, __fmt, __ap);
 }
 
 
 #if __USE_FORTIFY_LEVEL > 1
 
-extern int __fwprintf_chk (__FILE *__restrict __stream, int __flag,
-			   const wchar_t *__restrict __format, ...);
-extern int __wprintf_chk (int __flag, const wchar_t *__restrict __format,
-			  ...);
-extern int __vfwprintf_chk (__FILE *__restrict __stream, int __flag,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __ap);
-extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format,
-			   __gnuc_va_list __ap);
+extern int __REDIRECT_LDBL (__fwprintf_chk, (__FILE *__restrict __stream,
+					     int __flag,
+					     const wchar_t *__restrict __format,
+					     ...),
+			    __fwprintf_chkieee128, __nldbl___fwprintf_chk);
+extern int __REDIRECT_LDBL (__wprintf_chk, (int __flag,
+					    const wchar_t *__restrict __format,
+					    ...),
+			    __wprintf_chkieee128, __nldbl___wprintf_chk);
+extern int __REDIRECT_LDBL (__vfwprintf_chk, (__FILE *__restrict __stream,
+					      int __flag,
+					      const wchar_t *__restrict __format,
+					      __gnuc_va_list __ap),
+			   __vfwprintf_chkieee128, __nldbl___vfwprintf_chk);
+extern int __REDIRECT_LDBL (__vwprintf_chk, (int __flag,
+					     const wchar_t *__restrict __format,
+					     __gnuc_va_list __ap),
+			    __vwprintf_chkieee128, __nldbl___vwprintf_chk);
 
 # ifdef __va_arg_pack
 __fortify_function int
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 5d6a40853d..27406d0edb 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -382,8 +382,10 @@ extern double wcstod (const wchar_t *__restrict __nptr,
 /* Likewise for `float' and `long double' sizes of floating-point numbers.  */
 extern float wcstof (const wchar_t *__restrict __nptr,
 		     wchar_t **__restrict __endptr) __THROW;
-extern long double wcstold (const wchar_t *__restrict __nptr,
-			    wchar_t **__restrict __endptr) __THROW;
+extern long double __REDIRECT_LDBL_NTH (wcstold,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr),
+					__wcstoieee128, wcstod);
 #endif /* C99 */
 
 /* Likewise for `_FloatN' and `_FloatNx' when support is enabled.  */
@@ -498,9 +500,12 @@ extern float wcstof_l (const wchar_t *__restrict __nptr,
 		       wchar_t **__restrict __endptr, locale_t __loc)
      __THROW;
 
-extern long double wcstold_l (const wchar_t *__restrict __nptr,
-			      wchar_t **__restrict __endptr,
-			      locale_t __loc) __THROW;
+
+extern long double __REDIRECT_LDBL_NTH (wcstold_l,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr,
+					 locale_t __loc),
+					__wcstoieee128_l, wcstod_l);
 
 # if __HAVE_FLOAT16
 extern _Float16 wcstof16_l (const wchar_t *__restrict __nptr,
@@ -587,73 +592,61 @@ extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW
 /* Select orientation for stream.  */
 extern int fwide (__FILE *__fp, int __mode) __THROW;
 
-
 /* Write formatted output to STREAM.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int fwprintf (__FILE *__restrict __stream,
-		     const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (fwprintf, (__FILE *__restrict __stream,
+					  const wchar_t *__restrict __format,
+					  ...))
      /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
 /* Write formatted output to stdout.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int wprintf (const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (wprintf, (const wchar_t *__restrict __format, ...))
      /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
 /* Write formatted output of at most N characters to S.  */
-extern int swprintf (wchar_t *__restrict __s, size_t __n,
-		     const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
+extern int __REDIRECT_LDBL128_NTH (swprintf, (wchar_t *__restrict __s, size_t __n,
+					      const wchar_t *__restrict __format,
+					      ...))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
 
 /* Write formatted output to S from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vfwprintf (__FILE *__restrict __s,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vfwprintf, (__FILE *__restrict __s,
+					const wchar_t *__restrict __format,
+					__gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
 /* Write formatted output to stdout from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vwprintf (const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vwprintf, (const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
 /* Write formatted output of at most N character to S from argument
    list ARG.  */
-extern int vswprintf (wchar_t *__restrict __s, size_t __n,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
-
-
-/* Read formatted input from STREAM.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int fwscanf (__FILE *__restrict __stream,
-		    const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-/* Read formatted input from stdin.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int wscanf (const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
-/* Read formatted input from S.  */
-extern int swscanf (const wchar_t *__restrict __s,
-		    const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-
-/* For historical reasons, the C99-compliant versions of the scanf
-   functions are at alternative names.  When __LDBL_COMPAT or
-   __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
-   bits/wchar-ldbl.h.  */
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
+extern int __REDIRECT_LDBL128_NTH (vswprintf, (wchar_t *__restrict __s, size_t __n,
+				      const wchar_t *__restrict __format,
+					      __gnuc_va_list __arg))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
+
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __isoc99_fwscanfieee128, __nldbl___isoc99_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __isoc99_wscanfieee128,__nldbl___isoc99_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__isoc99_swscanfieee128, __nldbl___isoc99_swscanf);
+#  else
+#   ifdef __REDIRECT
 extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
 				 const wchar_t *__restrict __format, ...),
 		       __isoc99_fwscanf)
@@ -665,72 +658,129 @@ extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s,
 				     const wchar_t *__restrict __format,
 				     ...), __isoc99_swscanf)
      /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-#  else
+#   else
 extern int __isoc99_fwscanf (__FILE *__restrict __stream,
 			     const wchar_t *__restrict __format, ...);
 extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...);
 extern int __isoc99_swscanf (const wchar_t *__restrict __s,
 			     const wchar_t *__restrict __format, ...)
      __THROW;
-#   define fwscanf __isoc99_fwscanf
-#   define wscanf __isoc99_wscanf
-#   define swscanf __isoc99_swscanf
+#    define fwscanf __isoc99_fwscanf
+#    define wscanf __isoc99_wscanf
+#    define swscanf __isoc99_swscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __fwscanfieee128, __nldbl_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __wscanfieee128,__nldbl_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__swscanfieee128, __nldbl_swscanf);
+#  else
+/* Read formatted input from STREAM.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int fwscanf (__FILE *__restrict __stream,
+                    const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
+/* Read formatted input from stdin.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int wscanf (const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
+/* Read formatted input from S.  */
+extern int swscanf (const wchar_t *__restrict __s,
+                    const wchar_t *__restrict __format, ...)
+     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
 #  endif
 # endif
 
 #endif /* Use ISO C95, C99 and Unix98. */
 
 #ifdef __USE_ISOC99
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __isoc99_vfwscanfieee128, __nldbl___isoc99_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __isoc99_vwscanfieee128, __nldbl___isoc99_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__isoc99_vswscanfieee128,
+				__nldbl___isoc99_vswscanf);
+#  else
+#   ifdef __REDIRECT
+extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
+                                  const wchar_t *__restrict __format,
+                                  __gnuc_va_list __arg), __isoc99_vfwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
+                                 __gnuc_va_list __arg), __isoc99_vwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
+extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
+                                      const wchar_t *__restrict __format,
+                                      __gnuc_va_list __arg), __isoc99_vswscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+#   else
+extern int __isoc99_vfwscanf (__FILE *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg);
+extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
+                             __gnuc_va_list __arg);
+extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg) __THROW;
+#    define vfwscanf __isoc99_vfwscanf
+#    define vwscanf __isoc99_vwscanf
+#    define vswscanf __isoc99_vswscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __vfwscanfieee128, __nldbl_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __vwscanfieee128, __nldbl_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__vswscanfieee128,
+				__nldbl_vswscanf);
+#  else
 /* Read formatted input from S into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vfwscanf (__FILE *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
 /* Read formatted input from stdin into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vwscanf (const wchar_t *__restrict __format,
-		    __gnuc_va_list __arg)
+                    __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
 /* Read formatted input from S into argument list ARG.  */
 extern int vswscanf (const wchar_t *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-
-/* Same redirection as above for the v*wscanf family.  */
-# if !__GLIBC_USE (DEPRECATED_SCANF) \
-     && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
-     && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
-extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
-				  const wchar_t *__restrict __format,
-				  __gnuc_va_list __arg), __isoc99_vfwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
-				 __gnuc_va_list __arg), __isoc99_vwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
-extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
-				      const wchar_t *__restrict __format,
-				      __gnuc_va_list __arg), __isoc99_vswscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-#  else
-extern int __isoc99_vfwscanf (__FILE *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg);
-extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
-			     __gnuc_va_list __arg);
-extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg) __THROW;
-#   define vfwscanf __isoc99_vfwscanf
-#   define vwscanf __isoc99_vwscanf
-#   define vswscanf __isoc99_vswscanf
 #  endif
 # endif
 
@@ -867,11 +917,6 @@ extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
 # include <bits/wchar2.h>
 #endif
 
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/wchar-ldbl.h>
-#endif
-
 __END_DECLS
 
 #endif /* wchar.h  */


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

* [glibc/azanella/clang] Remove wchar-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=c38e132ebcf6be8cb5650a8717847ae9d55c5413

commit c38e132ebcf6be8cb5650a8717847ae9d55c5413
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Feb 25 11:02:21 2022 -0300

    Remove wchar-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.
    
    A new macro, __REDIRECT_LDBL128, is used for function where only
    the binary128 alias is required.
    
    Checked on x86_64-linux-gnu and powerpc64le-linux-gnu.

Diff:
---
 include/bits/wchar-ldbl.h |   1 -
 misc/sys/cdefs.h          |  13 +++
 wcsmbs/Makefile           |   2 +-
 wcsmbs/bits/wchar-ldbl.h  |  91 ------------------
 wcsmbs/bits/wchar2.h      |  70 +++++++-------
 wcsmbs/wchar.h            | 229 +++++++++++++++++++++++++++-------------------
 6 files changed, 183 insertions(+), 223 deletions(-)

diff --git a/include/bits/wchar-ldbl.h b/include/bits/wchar-ldbl.h
deleted file mode 100644
index 29baa2f4d5..0000000000
--- a/include/bits/wchar-ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <wcsmbs/bits/wchar-ldbl.h>
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 422ca351f2..419a09a3a7 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -567,16 +567,26 @@
 #  ifdef __REDIRECT
 #   define __REDIRECT_LDBL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , , proto, ieee128)
+#   define __REDIRECT_LDBL128(name, proto) \
+      __REDIRECT_LDBL1 (name, , , proto, __##name##ieee128)
 #   ifdef __cplusplus
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROW, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROW, , proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROWNL, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROWNL, , proto, __##name##ieee128)
 #   else
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROW, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROW, proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROWNL, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROWNL, proto, __##name##ieee128)
 #   endif /* __cplusplus */
 #  else
 _Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
@@ -606,6 +616,9 @@ _Static_assert (0, "Compat long double requires redirection on this platform");
 # define __REDIRECT_LDBL(name, proto, ieee128, compat) name proto
 # define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) name proto __THROW
 # define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) name proto __THROWNL
+# define __REDIRECT_LDBL128(name, proto) name proto
+# define __REDIRECT_LDBL128_NTH(name, proto) name proto __THROW
+# define __REDIRECT_LDBL128_NTHNL(name, proto) name proto __THROWNL
 #endif
 
 #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index df9a85f4a9..b67202526d 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -22,7 +22,7 @@ subdir	:= wcsmbs
 
 include ../Makeconfig
 
-headers	:= wchar.h bits/wchar.h bits/wchar2.h bits/wchar-ldbl.h uchar.h \
+headers	:= wchar.h bits/wchar.h bits/wchar2.h uchar.h \
 	   bits/types/__mbstate_t.h bits/types/mbstate_t.h bits/types/wint_t.h
 
 routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
diff --git a/wcsmbs/bits/wchar-ldbl.h b/wcsmbs/bits/wchar-ldbl.h
deleted file mode 100644
index f0d8506f83..0000000000
--- a/wcsmbs/bits/wchar-ldbl.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -mlong-double-64 compatibility mode for <wchar.h> functions.
-   Copyright (C) 2006-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 _WCHAR_H
-# error "Never include <bits/wchar-ldbl.h> directly; use <wchar.h> instead."
-#endif
-
-#if defined __USE_ISOC95 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (fwprintf);
-__LDBL_REDIR_DECL (wprintf);
-__LDBL_REDIR_DECL (swprintf);
-__LDBL_REDIR_DECL (vfwprintf);
-__LDBL_REDIR_DECL (vwprintf);
-__LDBL_REDIR_DECL (vswprintf);
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (fwscanf, __nldbl___isoc99_fwscanf)
-__LDBL_REDIR1_DECL (wscanf, __nldbl___isoc99_wscanf)
-__LDBL_REDIR1_DECL (swscanf, __nldbl___isoc99_swscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (fwscanf, __isoc99_fwscanfieee128)
-__LDBL_REDIR1_DECL (wscanf, __isoc99_wscanfieee128)
-__LDBL_REDIR1_DECL (swscanf, __isoc99_swscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (fwscanf);
-__LDBL_REDIR_DECL (wscanf);
-__LDBL_REDIR_DECL (swscanf);
-# endif
-#endif
-
-#ifdef __USE_ISOC99
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold, wcstod);
-# else
-__LDBL_REDIR1_DECL (wcstold, __wcstoieee128)
-# endif
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (vfwscanf, __nldbl___isoc99_vfwscanf)
-__LDBL_REDIR1_DECL (vwscanf, __nldbl___isoc99_vwscanf)
-__LDBL_REDIR1_DECL (vswscanf, __nldbl___isoc99_vswscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (vfwscanf, __isoc99_vfwscanfieee128)
-__LDBL_REDIR1_DECL (vwscanf, __isoc99_vwscanfieee128)
-__LDBL_REDIR1_DECL (vswscanf, __isoc99_vswscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (vfwscanf);
-__LDBL_REDIR_DECL (vwscanf);
-__LDBL_REDIR_DECL (vswscanf);
-# endif
-#endif
-
-#ifdef __USE_GNU
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold_l, wcstod_l);
-# else
-__LDBL_REDIR1_DECL (wcstold_l, __wcstoieee128_l)
-# endif
-#endif
-
-#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR2_DECL (swprintf_chk)
-__LDBL_REDIR2_DECL (vswprintf_chk)
-# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR2_DECL (fwprintf_chk)
-__LDBL_REDIR2_DECL (wprintf_chk)
-__LDBL_REDIR2_DECL (vfwprintf_chk)
-__LDBL_REDIR2_DECL (vwprintf_chk)
-# endif
-#endif
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index f2dca7711a..548deeedbf 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -227,19 +227,18 @@ __NTH (wcsncat (wchar_t *__restrict __dest, const wchar_t *__restrict __src,
   return __wcsncat_alias (__dest, __src, __n);
 }
 
-
-extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
-			   int __flag, size_t __s_len,
-			   const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
-
-extern int __swprintf_alias (wchar_t *__restrict __s, size_t __n,
-			     const wchar_t *__restrict __fmt, ...)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("swprintf"))
-#endif
-     ;
-
+extern int __REDIRECT_LDBL_NTH (__swprintf_chk, (wchar_t *__restrict __s,
+						 size_t __n,
+						 int __flag, size_t __s_len,
+						 const wchar_t *__restrict __format,
+						 ...),
+				__swprintf_chkieee128, __nldbl___swprintf_chk);
+extern int __REDIRECT_LDBL_NTH (__vswprintf_chk, (wchar_t *__restrict __s,
+						  size_t __n,
+						  int __flag, size_t __s_len,
+						  const wchar_t *__restrict __format,
+						  __gnuc_va_list __arg),
+				__vswprintf_chkieee128, __nldbl___vswprintf_chk);
 
 #ifdef __va_arg_pack
 __fortify_function int
@@ -250,7 +249,7 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __swprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
 			   sz / sizeof (wchar_t), __fmt, __va_arg_pack ());
-  return __swprintf_alias (__s, __n, __fmt, __va_arg_pack ());
+  return swprintf (__s, __n, __fmt, __va_arg_pack ());
 }
 #elif !defined __cplusplus
 /* XXX We might want to have support in gcc for swprintf.  */
@@ -261,20 +260,6 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
    : swprintf (s, n, __VA_ARGS__))
 #endif
 
-extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
-			    int __flag, size_t __s_len,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-
-extern int __vswprintf_alias (wchar_t *__restrict __s, size_t __n,
-			      const wchar_t *__restrict __fmt,
-			      __gnuc_va_list __ap)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("vswprintf"))
-#endif
-     ;
-
 __fortify_function int
 __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
 		  const wchar_t *__restrict __fmt, __gnuc_va_list __ap))
@@ -283,21 +268,30 @@ __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __vswprintf_chk (__s, __n,  __USE_FORTIFY_LEVEL - 1,
 			    sz / sizeof (wchar_t), __fmt, __ap);
-  return __vswprintf_alias (__s, __n, __fmt, __ap);
+  return vswprintf (__s, __n, __fmt, __ap);
 }
 
 
 #if __USE_FORTIFY_LEVEL > 1
 
-extern int __fwprintf_chk (__FILE *__restrict __stream, int __flag,
-			   const wchar_t *__restrict __format, ...);
-extern int __wprintf_chk (int __flag, const wchar_t *__restrict __format,
-			  ...);
-extern int __vfwprintf_chk (__FILE *__restrict __stream, int __flag,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __ap);
-extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format,
-			   __gnuc_va_list __ap);
+extern int __REDIRECT_LDBL (__fwprintf_chk, (__FILE *__restrict __stream,
+					     int __flag,
+					     const wchar_t *__restrict __format,
+					     ...),
+			    __fwprintf_chkieee128, __nldbl___fwprintf_chk);
+extern int __REDIRECT_LDBL (__wprintf_chk, (int __flag,
+					    const wchar_t *__restrict __format,
+					    ...),
+			    __wprintf_chkieee128, __nldbl___wprintf_chk);
+extern int __REDIRECT_LDBL (__vfwprintf_chk, (__FILE *__restrict __stream,
+					      int __flag,
+					      const wchar_t *__restrict __format,
+					      __gnuc_va_list __ap),
+			   __vfwprintf_chkieee128, __nldbl___vfwprintf_chk);
+extern int __REDIRECT_LDBL (__vwprintf_chk, (int __flag,
+					     const wchar_t *__restrict __format,
+					     __gnuc_va_list __ap),
+			    __vwprintf_chkieee128, __nldbl___vwprintf_chk);
 
 # ifdef __va_arg_pack
 __fortify_function int
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 5d6a40853d..27406d0edb 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -382,8 +382,10 @@ extern double wcstod (const wchar_t *__restrict __nptr,
 /* Likewise for `float' and `long double' sizes of floating-point numbers.  */
 extern float wcstof (const wchar_t *__restrict __nptr,
 		     wchar_t **__restrict __endptr) __THROW;
-extern long double wcstold (const wchar_t *__restrict __nptr,
-			    wchar_t **__restrict __endptr) __THROW;
+extern long double __REDIRECT_LDBL_NTH (wcstold,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr),
+					__wcstoieee128, wcstod);
 #endif /* C99 */
 
 /* Likewise for `_FloatN' and `_FloatNx' when support is enabled.  */
@@ -498,9 +500,12 @@ extern float wcstof_l (const wchar_t *__restrict __nptr,
 		       wchar_t **__restrict __endptr, locale_t __loc)
      __THROW;
 
-extern long double wcstold_l (const wchar_t *__restrict __nptr,
-			      wchar_t **__restrict __endptr,
-			      locale_t __loc) __THROW;
+
+extern long double __REDIRECT_LDBL_NTH (wcstold_l,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr,
+					 locale_t __loc),
+					__wcstoieee128_l, wcstod_l);
 
 # if __HAVE_FLOAT16
 extern _Float16 wcstof16_l (const wchar_t *__restrict __nptr,
@@ -587,73 +592,61 @@ extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW
 /* Select orientation for stream.  */
 extern int fwide (__FILE *__fp, int __mode) __THROW;
 
-
 /* Write formatted output to STREAM.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int fwprintf (__FILE *__restrict __stream,
-		     const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (fwprintf, (__FILE *__restrict __stream,
+					  const wchar_t *__restrict __format,
+					  ...))
      /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
 /* Write formatted output to stdout.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int wprintf (const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (wprintf, (const wchar_t *__restrict __format, ...))
      /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
 /* Write formatted output of at most N characters to S.  */
-extern int swprintf (wchar_t *__restrict __s, size_t __n,
-		     const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
+extern int __REDIRECT_LDBL128_NTH (swprintf, (wchar_t *__restrict __s, size_t __n,
+					      const wchar_t *__restrict __format,
+					      ...))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
 
 /* Write formatted output to S from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vfwprintf (__FILE *__restrict __s,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vfwprintf, (__FILE *__restrict __s,
+					const wchar_t *__restrict __format,
+					__gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
 /* Write formatted output to stdout from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vwprintf (const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vwprintf, (const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
 /* Write formatted output of at most N character to S from argument
    list ARG.  */
-extern int vswprintf (wchar_t *__restrict __s, size_t __n,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
-
-
-/* Read formatted input from STREAM.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int fwscanf (__FILE *__restrict __stream,
-		    const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-/* Read formatted input from stdin.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int wscanf (const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
-/* Read formatted input from S.  */
-extern int swscanf (const wchar_t *__restrict __s,
-		    const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-
-/* For historical reasons, the C99-compliant versions of the scanf
-   functions are at alternative names.  When __LDBL_COMPAT or
-   __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
-   bits/wchar-ldbl.h.  */
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
+extern int __REDIRECT_LDBL128_NTH (vswprintf, (wchar_t *__restrict __s, size_t __n,
+				      const wchar_t *__restrict __format,
+					      __gnuc_va_list __arg))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
+
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __isoc99_fwscanfieee128, __nldbl___isoc99_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __isoc99_wscanfieee128,__nldbl___isoc99_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__isoc99_swscanfieee128, __nldbl___isoc99_swscanf);
+#  else
+#   ifdef __REDIRECT
 extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
 				 const wchar_t *__restrict __format, ...),
 		       __isoc99_fwscanf)
@@ -665,72 +658,129 @@ extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s,
 				     const wchar_t *__restrict __format,
 				     ...), __isoc99_swscanf)
      /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-#  else
+#   else
 extern int __isoc99_fwscanf (__FILE *__restrict __stream,
 			     const wchar_t *__restrict __format, ...);
 extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...);
 extern int __isoc99_swscanf (const wchar_t *__restrict __s,
 			     const wchar_t *__restrict __format, ...)
      __THROW;
-#   define fwscanf __isoc99_fwscanf
-#   define wscanf __isoc99_wscanf
-#   define swscanf __isoc99_swscanf
+#    define fwscanf __isoc99_fwscanf
+#    define wscanf __isoc99_wscanf
+#    define swscanf __isoc99_swscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __fwscanfieee128, __nldbl_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __wscanfieee128,__nldbl_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__swscanfieee128, __nldbl_swscanf);
+#  else
+/* Read formatted input from STREAM.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int fwscanf (__FILE *__restrict __stream,
+                    const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
+/* Read formatted input from stdin.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int wscanf (const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
+/* Read formatted input from S.  */
+extern int swscanf (const wchar_t *__restrict __s,
+                    const wchar_t *__restrict __format, ...)
+     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
 #  endif
 # endif
 
 #endif /* Use ISO C95, C99 and Unix98. */
 
 #ifdef __USE_ISOC99
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __isoc99_vfwscanfieee128, __nldbl___isoc99_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __isoc99_vwscanfieee128, __nldbl___isoc99_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__isoc99_vswscanfieee128,
+				__nldbl___isoc99_vswscanf);
+#  else
+#   ifdef __REDIRECT
+extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
+                                  const wchar_t *__restrict __format,
+                                  __gnuc_va_list __arg), __isoc99_vfwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
+                                 __gnuc_va_list __arg), __isoc99_vwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
+extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
+                                      const wchar_t *__restrict __format,
+                                      __gnuc_va_list __arg), __isoc99_vswscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+#   else
+extern int __isoc99_vfwscanf (__FILE *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg);
+extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
+                             __gnuc_va_list __arg);
+extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg) __THROW;
+#    define vfwscanf __isoc99_vfwscanf
+#    define vwscanf __isoc99_vwscanf
+#    define vswscanf __isoc99_vswscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __vfwscanfieee128, __nldbl_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __vwscanfieee128, __nldbl_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__vswscanfieee128,
+				__nldbl_vswscanf);
+#  else
 /* Read formatted input from S into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vfwscanf (__FILE *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
 /* Read formatted input from stdin into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vwscanf (const wchar_t *__restrict __format,
-		    __gnuc_va_list __arg)
+                    __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
 /* Read formatted input from S into argument list ARG.  */
 extern int vswscanf (const wchar_t *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-
-/* Same redirection as above for the v*wscanf family.  */
-# if !__GLIBC_USE (DEPRECATED_SCANF) \
-     && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
-     && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
-extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
-				  const wchar_t *__restrict __format,
-				  __gnuc_va_list __arg), __isoc99_vfwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
-				 __gnuc_va_list __arg), __isoc99_vwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
-extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
-				      const wchar_t *__restrict __format,
-				      __gnuc_va_list __arg), __isoc99_vswscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-#  else
-extern int __isoc99_vfwscanf (__FILE *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg);
-extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
-			     __gnuc_va_list __arg);
-extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg) __THROW;
-#   define vfwscanf __isoc99_vfwscanf
-#   define vwscanf __isoc99_vwscanf
-#   define vswscanf __isoc99_vswscanf
 #  endif
 # endif
 
@@ -867,11 +917,6 @@ extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
 # include <bits/wchar2.h>
 #endif
 
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/wchar-ldbl.h>
-#endif
-
 __END_DECLS
 
 #endif /* wchar.h  */


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

* [glibc/azanella/clang] Remove wchar-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=24106f786c1c5c388b2754f44a6069ba7a4e55c8

commit 24106f786c1c5c388b2754f44a6069ba7a4e55c8
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Feb 25 11:02:21 2022 -0300

    Remove wchar-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.
    
    A new macro, __REDIRECT_LDBL128, is used for function where only
    the binary128 alias is required.
    
    Checked on x86_64-linux-gnu and powerpc64le-linux-gnu.

Diff:
---
 include/bits/wchar-ldbl.h |   1 -
 misc/sys/cdefs.h          |  13 +++
 wcsmbs/Makefile           |   2 +-
 wcsmbs/bits/wchar-ldbl.h  |  91 ------------------
 wcsmbs/bits/wchar2.h      |  70 +++++++-------
 wcsmbs/wchar.h            | 229 +++++++++++++++++++++++++++-------------------
 6 files changed, 183 insertions(+), 223 deletions(-)

diff --git a/include/bits/wchar-ldbl.h b/include/bits/wchar-ldbl.h
deleted file mode 100644
index 29baa2f4d5..0000000000
--- a/include/bits/wchar-ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <wcsmbs/bits/wchar-ldbl.h>
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 422ca351f2..419a09a3a7 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -567,16 +567,26 @@
 #  ifdef __REDIRECT
 #   define __REDIRECT_LDBL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , , proto, ieee128)
+#   define __REDIRECT_LDBL128(name, proto) \
+      __REDIRECT_LDBL1 (name, , , proto, __##name##ieee128)
 #   ifdef __cplusplus
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROW, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROW, , proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROWNL, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROWNL, , proto, __##name##ieee128)
 #   else
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROW, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROW, proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROWNL, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROWNL, proto, __##name##ieee128)
 #   endif /* __cplusplus */
 #  else
 _Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
@@ -606,6 +616,9 @@ _Static_assert (0, "Compat long double requires redirection on this platform");
 # define __REDIRECT_LDBL(name, proto, ieee128, compat) name proto
 # define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) name proto __THROW
 # define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) name proto __THROWNL
+# define __REDIRECT_LDBL128(name, proto) name proto
+# define __REDIRECT_LDBL128_NTH(name, proto) name proto __THROW
+# define __REDIRECT_LDBL128_NTHNL(name, proto) name proto __THROWNL
 #endif
 
 #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index df9a85f4a9..b67202526d 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -22,7 +22,7 @@ subdir	:= wcsmbs
 
 include ../Makeconfig
 
-headers	:= wchar.h bits/wchar.h bits/wchar2.h bits/wchar-ldbl.h uchar.h \
+headers	:= wchar.h bits/wchar.h bits/wchar2.h uchar.h \
 	   bits/types/__mbstate_t.h bits/types/mbstate_t.h bits/types/wint_t.h
 
 routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
diff --git a/wcsmbs/bits/wchar-ldbl.h b/wcsmbs/bits/wchar-ldbl.h
deleted file mode 100644
index f0d8506f83..0000000000
--- a/wcsmbs/bits/wchar-ldbl.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -mlong-double-64 compatibility mode for <wchar.h> functions.
-   Copyright (C) 2006-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 _WCHAR_H
-# error "Never include <bits/wchar-ldbl.h> directly; use <wchar.h> instead."
-#endif
-
-#if defined __USE_ISOC95 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (fwprintf);
-__LDBL_REDIR_DECL (wprintf);
-__LDBL_REDIR_DECL (swprintf);
-__LDBL_REDIR_DECL (vfwprintf);
-__LDBL_REDIR_DECL (vwprintf);
-__LDBL_REDIR_DECL (vswprintf);
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (fwscanf, __nldbl___isoc99_fwscanf)
-__LDBL_REDIR1_DECL (wscanf, __nldbl___isoc99_wscanf)
-__LDBL_REDIR1_DECL (swscanf, __nldbl___isoc99_swscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (fwscanf, __isoc99_fwscanfieee128)
-__LDBL_REDIR1_DECL (wscanf, __isoc99_wscanfieee128)
-__LDBL_REDIR1_DECL (swscanf, __isoc99_swscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (fwscanf);
-__LDBL_REDIR_DECL (wscanf);
-__LDBL_REDIR_DECL (swscanf);
-# endif
-#endif
-
-#ifdef __USE_ISOC99
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold, wcstod);
-# else
-__LDBL_REDIR1_DECL (wcstold, __wcstoieee128)
-# endif
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (vfwscanf, __nldbl___isoc99_vfwscanf)
-__LDBL_REDIR1_DECL (vwscanf, __nldbl___isoc99_vwscanf)
-__LDBL_REDIR1_DECL (vswscanf, __nldbl___isoc99_vswscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (vfwscanf, __isoc99_vfwscanfieee128)
-__LDBL_REDIR1_DECL (vwscanf, __isoc99_vwscanfieee128)
-__LDBL_REDIR1_DECL (vswscanf, __isoc99_vswscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (vfwscanf);
-__LDBL_REDIR_DECL (vwscanf);
-__LDBL_REDIR_DECL (vswscanf);
-# endif
-#endif
-
-#ifdef __USE_GNU
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold_l, wcstod_l);
-# else
-__LDBL_REDIR1_DECL (wcstold_l, __wcstoieee128_l)
-# endif
-#endif
-
-#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR2_DECL (swprintf_chk)
-__LDBL_REDIR2_DECL (vswprintf_chk)
-# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR2_DECL (fwprintf_chk)
-__LDBL_REDIR2_DECL (wprintf_chk)
-__LDBL_REDIR2_DECL (vfwprintf_chk)
-__LDBL_REDIR2_DECL (vwprintf_chk)
-# endif
-#endif
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index f2dca7711a..548deeedbf 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -227,19 +227,18 @@ __NTH (wcsncat (wchar_t *__restrict __dest, const wchar_t *__restrict __src,
   return __wcsncat_alias (__dest, __src, __n);
 }
 
-
-extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
-			   int __flag, size_t __s_len,
-			   const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
-
-extern int __swprintf_alias (wchar_t *__restrict __s, size_t __n,
-			     const wchar_t *__restrict __fmt, ...)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("swprintf"))
-#endif
-     ;
-
+extern int __REDIRECT_LDBL_NTH (__swprintf_chk, (wchar_t *__restrict __s,
+						 size_t __n,
+						 int __flag, size_t __s_len,
+						 const wchar_t *__restrict __format,
+						 ...),
+				__swprintf_chkieee128, __nldbl___swprintf_chk);
+extern int __REDIRECT_LDBL_NTH (__vswprintf_chk, (wchar_t *__restrict __s,
+						  size_t __n,
+						  int __flag, size_t __s_len,
+						  const wchar_t *__restrict __format,
+						  __gnuc_va_list __arg),
+				__vswprintf_chkieee128, __nldbl___vswprintf_chk);
 
 #ifdef __va_arg_pack
 __fortify_function int
@@ -250,7 +249,7 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __swprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
 			   sz / sizeof (wchar_t), __fmt, __va_arg_pack ());
-  return __swprintf_alias (__s, __n, __fmt, __va_arg_pack ());
+  return swprintf (__s, __n, __fmt, __va_arg_pack ());
 }
 #elif !defined __cplusplus
 /* XXX We might want to have support in gcc for swprintf.  */
@@ -261,20 +260,6 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
    : swprintf (s, n, __VA_ARGS__))
 #endif
 
-extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
-			    int __flag, size_t __s_len,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-
-extern int __vswprintf_alias (wchar_t *__restrict __s, size_t __n,
-			      const wchar_t *__restrict __fmt,
-			      __gnuc_va_list __ap)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("vswprintf"))
-#endif
-     ;
-
 __fortify_function int
 __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
 		  const wchar_t *__restrict __fmt, __gnuc_va_list __ap))
@@ -283,21 +268,30 @@ __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __vswprintf_chk (__s, __n,  __USE_FORTIFY_LEVEL - 1,
 			    sz / sizeof (wchar_t), __fmt, __ap);
-  return __vswprintf_alias (__s, __n, __fmt, __ap);
+  return vswprintf (__s, __n, __fmt, __ap);
 }
 
 
 #if __USE_FORTIFY_LEVEL > 1
 
-extern int __fwprintf_chk (__FILE *__restrict __stream, int __flag,
-			   const wchar_t *__restrict __format, ...);
-extern int __wprintf_chk (int __flag, const wchar_t *__restrict __format,
-			  ...);
-extern int __vfwprintf_chk (__FILE *__restrict __stream, int __flag,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __ap);
-extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format,
-			   __gnuc_va_list __ap);
+extern int __REDIRECT_LDBL (__fwprintf_chk, (__FILE *__restrict __stream,
+					     int __flag,
+					     const wchar_t *__restrict __format,
+					     ...),
+			    __fwprintf_chkieee128, __nldbl___fwprintf_chk);
+extern int __REDIRECT_LDBL (__wprintf_chk, (int __flag,
+					    const wchar_t *__restrict __format,
+					    ...),
+			    __wprintf_chkieee128, __nldbl___wprintf_chk);
+extern int __REDIRECT_LDBL (__vfwprintf_chk, (__FILE *__restrict __stream,
+					      int __flag,
+					      const wchar_t *__restrict __format,
+					      __gnuc_va_list __ap),
+			   __vfwprintf_chkieee128, __nldbl___vfwprintf_chk);
+extern int __REDIRECT_LDBL (__vwprintf_chk, (int __flag,
+					     const wchar_t *__restrict __format,
+					     __gnuc_va_list __ap),
+			    __vwprintf_chkieee128, __nldbl___vwprintf_chk);
 
 # ifdef __va_arg_pack
 __fortify_function int
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 5d6a40853d..27406d0edb 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -382,8 +382,10 @@ extern double wcstod (const wchar_t *__restrict __nptr,
 /* Likewise for `float' and `long double' sizes of floating-point numbers.  */
 extern float wcstof (const wchar_t *__restrict __nptr,
 		     wchar_t **__restrict __endptr) __THROW;
-extern long double wcstold (const wchar_t *__restrict __nptr,
-			    wchar_t **__restrict __endptr) __THROW;
+extern long double __REDIRECT_LDBL_NTH (wcstold,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr),
+					__wcstoieee128, wcstod);
 #endif /* C99 */
 
 /* Likewise for `_FloatN' and `_FloatNx' when support is enabled.  */
@@ -498,9 +500,12 @@ extern float wcstof_l (const wchar_t *__restrict __nptr,
 		       wchar_t **__restrict __endptr, locale_t __loc)
      __THROW;
 
-extern long double wcstold_l (const wchar_t *__restrict __nptr,
-			      wchar_t **__restrict __endptr,
-			      locale_t __loc) __THROW;
+
+extern long double __REDIRECT_LDBL_NTH (wcstold_l,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr,
+					 locale_t __loc),
+					__wcstoieee128_l, wcstod_l);
 
 # if __HAVE_FLOAT16
 extern _Float16 wcstof16_l (const wchar_t *__restrict __nptr,
@@ -587,73 +592,61 @@ extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW
 /* Select orientation for stream.  */
 extern int fwide (__FILE *__fp, int __mode) __THROW;
 
-
 /* Write formatted output to STREAM.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int fwprintf (__FILE *__restrict __stream,
-		     const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (fwprintf, (__FILE *__restrict __stream,
+					  const wchar_t *__restrict __format,
+					  ...))
      /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
 /* Write formatted output to stdout.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int wprintf (const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (wprintf, (const wchar_t *__restrict __format, ...))
      /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
 /* Write formatted output of at most N characters to S.  */
-extern int swprintf (wchar_t *__restrict __s, size_t __n,
-		     const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
+extern int __REDIRECT_LDBL128_NTH (swprintf, (wchar_t *__restrict __s, size_t __n,
+					      const wchar_t *__restrict __format,
+					      ...))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
 
 /* Write formatted output to S from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vfwprintf (__FILE *__restrict __s,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vfwprintf, (__FILE *__restrict __s,
+					const wchar_t *__restrict __format,
+					__gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
 /* Write formatted output to stdout from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vwprintf (const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vwprintf, (const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
 /* Write formatted output of at most N character to S from argument
    list ARG.  */
-extern int vswprintf (wchar_t *__restrict __s, size_t __n,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
-
-
-/* Read formatted input from STREAM.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int fwscanf (__FILE *__restrict __stream,
-		    const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-/* Read formatted input from stdin.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int wscanf (const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
-/* Read formatted input from S.  */
-extern int swscanf (const wchar_t *__restrict __s,
-		    const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-
-/* For historical reasons, the C99-compliant versions of the scanf
-   functions are at alternative names.  When __LDBL_COMPAT or
-   __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
-   bits/wchar-ldbl.h.  */
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
+extern int __REDIRECT_LDBL128_NTH (vswprintf, (wchar_t *__restrict __s, size_t __n,
+				      const wchar_t *__restrict __format,
+					      __gnuc_va_list __arg))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
+
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __isoc99_fwscanfieee128, __nldbl___isoc99_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __isoc99_wscanfieee128,__nldbl___isoc99_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__isoc99_swscanfieee128, __nldbl___isoc99_swscanf);
+#  else
+#   ifdef __REDIRECT
 extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
 				 const wchar_t *__restrict __format, ...),
 		       __isoc99_fwscanf)
@@ -665,72 +658,129 @@ extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s,
 				     const wchar_t *__restrict __format,
 				     ...), __isoc99_swscanf)
      /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-#  else
+#   else
 extern int __isoc99_fwscanf (__FILE *__restrict __stream,
 			     const wchar_t *__restrict __format, ...);
 extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...);
 extern int __isoc99_swscanf (const wchar_t *__restrict __s,
 			     const wchar_t *__restrict __format, ...)
      __THROW;
-#   define fwscanf __isoc99_fwscanf
-#   define wscanf __isoc99_wscanf
-#   define swscanf __isoc99_swscanf
+#    define fwscanf __isoc99_fwscanf
+#    define wscanf __isoc99_wscanf
+#    define swscanf __isoc99_swscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __fwscanfieee128, __nldbl_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __wscanfieee128,__nldbl_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__swscanfieee128, __nldbl_swscanf);
+#  else
+/* Read formatted input from STREAM.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int fwscanf (__FILE *__restrict __stream,
+                    const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
+/* Read formatted input from stdin.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int wscanf (const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
+/* Read formatted input from S.  */
+extern int swscanf (const wchar_t *__restrict __s,
+                    const wchar_t *__restrict __format, ...)
+     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
 #  endif
 # endif
 
 #endif /* Use ISO C95, C99 and Unix98. */
 
 #ifdef __USE_ISOC99
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __isoc99_vfwscanfieee128, __nldbl___isoc99_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __isoc99_vwscanfieee128, __nldbl___isoc99_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__isoc99_vswscanfieee128,
+				__nldbl___isoc99_vswscanf);
+#  else
+#   ifdef __REDIRECT
+extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
+                                  const wchar_t *__restrict __format,
+                                  __gnuc_va_list __arg), __isoc99_vfwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
+                                 __gnuc_va_list __arg), __isoc99_vwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
+extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
+                                      const wchar_t *__restrict __format,
+                                      __gnuc_va_list __arg), __isoc99_vswscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+#   else
+extern int __isoc99_vfwscanf (__FILE *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg);
+extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
+                             __gnuc_va_list __arg);
+extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg) __THROW;
+#    define vfwscanf __isoc99_vfwscanf
+#    define vwscanf __isoc99_vwscanf
+#    define vswscanf __isoc99_vswscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __vfwscanfieee128, __nldbl_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __vwscanfieee128, __nldbl_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__vswscanfieee128,
+				__nldbl_vswscanf);
+#  else
 /* Read formatted input from S into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vfwscanf (__FILE *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
 /* Read formatted input from stdin into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vwscanf (const wchar_t *__restrict __format,
-		    __gnuc_va_list __arg)
+                    __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
 /* Read formatted input from S into argument list ARG.  */
 extern int vswscanf (const wchar_t *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-
-/* Same redirection as above for the v*wscanf family.  */
-# if !__GLIBC_USE (DEPRECATED_SCANF) \
-     && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
-     && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
-extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
-				  const wchar_t *__restrict __format,
-				  __gnuc_va_list __arg), __isoc99_vfwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
-				 __gnuc_va_list __arg), __isoc99_vwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
-extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
-				      const wchar_t *__restrict __format,
-				      __gnuc_va_list __arg), __isoc99_vswscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-#  else
-extern int __isoc99_vfwscanf (__FILE *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg);
-extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
-			     __gnuc_va_list __arg);
-extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg) __THROW;
-#   define vfwscanf __isoc99_vfwscanf
-#   define vwscanf __isoc99_vwscanf
-#   define vswscanf __isoc99_vswscanf
 #  endif
 # endif
 
@@ -867,11 +917,6 @@ extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
 # include <bits/wchar2.h>
 #endif
 
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/wchar-ldbl.h>
-#endif
-
 __END_DECLS
 
 #endif /* wchar.h  */


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

* [glibc/azanella/clang] Remove wchar-ldbl.h
@ 2022-04-04 12:50 Adhemerval Zanella
  0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-04-04 12:50 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b07fe616b2aa79ba44aa9cc6822d444e50782d29

commit b07fe616b2aa79ba44aa9cc6822d444e50782d29
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Feb 25 11:02:21 2022 -0300

    Remove wchar-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.
    
    A new macro, __REDIRECT_LDBL128, is used for function where only
    the binary128 alias is required.
    
    Checked on x86_64-linux-gnu and powerpc64le-linux-gnu.

Diff:
---
 include/bits/wchar-ldbl.h |   1 -
 misc/sys/cdefs.h          |  13 +++
 wcsmbs/Makefile           |   2 +-
 wcsmbs/bits/wchar-ldbl.h  |  91 ------------------
 wcsmbs/bits/wchar2.h      |  70 +++++++-------
 wcsmbs/wchar.h            | 229 +++++++++++++++++++++++++++-------------------
 6 files changed, 183 insertions(+), 223 deletions(-)

diff --git a/include/bits/wchar-ldbl.h b/include/bits/wchar-ldbl.h
deleted file mode 100644
index 29baa2f4d5..0000000000
--- a/include/bits/wchar-ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <wcsmbs/bits/wchar-ldbl.h>
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index e43b5d4b36..d8069a7590 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -567,16 +567,26 @@
 #  ifdef __REDIRECT
 #   define __REDIRECT_LDBL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , , proto, ieee128)
+#   define __REDIRECT_LDBL128(name, proto) \
+      __REDIRECT_LDBL1 (name, , , proto, __##name##ieee128)
 #   ifdef __cplusplus
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROW, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROW, , proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROWNL, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROWNL, , proto, __##name##ieee128)
 #   else
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROW, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROW, proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROWNL, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROWNL, proto, __##name##ieee128)
 #   endif /* __cplusplus */
 #  else
 _Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
@@ -606,6 +616,9 @@ _Static_assert (0, "Compat long double requires redirection on this platform");
 # define __REDIRECT_LDBL(name, proto, ieee128, compat) name proto
 # define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) name proto __THROW
 # define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) name proto __THROWNL
+# define __REDIRECT_LDBL128(name, proto) name proto
+# define __REDIRECT_LDBL128_NTH(name, proto) name proto __THROW
+# define __REDIRECT_LDBL128_NTHNL(name, proto) name proto __THROWNL
 #endif
 
 #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index df9a85f4a9..b67202526d 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -22,7 +22,7 @@ subdir	:= wcsmbs
 
 include ../Makeconfig
 
-headers	:= wchar.h bits/wchar.h bits/wchar2.h bits/wchar-ldbl.h uchar.h \
+headers	:= wchar.h bits/wchar.h bits/wchar2.h uchar.h \
 	   bits/types/__mbstate_t.h bits/types/mbstate_t.h bits/types/wint_t.h
 
 routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
diff --git a/wcsmbs/bits/wchar-ldbl.h b/wcsmbs/bits/wchar-ldbl.h
deleted file mode 100644
index f0d8506f83..0000000000
--- a/wcsmbs/bits/wchar-ldbl.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -mlong-double-64 compatibility mode for <wchar.h> functions.
-   Copyright (C) 2006-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 _WCHAR_H
-# error "Never include <bits/wchar-ldbl.h> directly; use <wchar.h> instead."
-#endif
-
-#if defined __USE_ISOC95 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (fwprintf);
-__LDBL_REDIR_DECL (wprintf);
-__LDBL_REDIR_DECL (swprintf);
-__LDBL_REDIR_DECL (vfwprintf);
-__LDBL_REDIR_DECL (vwprintf);
-__LDBL_REDIR_DECL (vswprintf);
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (fwscanf, __nldbl___isoc99_fwscanf)
-__LDBL_REDIR1_DECL (wscanf, __nldbl___isoc99_wscanf)
-__LDBL_REDIR1_DECL (swscanf, __nldbl___isoc99_swscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (fwscanf, __isoc99_fwscanfieee128)
-__LDBL_REDIR1_DECL (wscanf, __isoc99_wscanfieee128)
-__LDBL_REDIR1_DECL (swscanf, __isoc99_swscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (fwscanf);
-__LDBL_REDIR_DECL (wscanf);
-__LDBL_REDIR_DECL (swscanf);
-# endif
-#endif
-
-#ifdef __USE_ISOC99
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold, wcstod);
-# else
-__LDBL_REDIR1_DECL (wcstold, __wcstoieee128)
-# endif
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (vfwscanf, __nldbl___isoc99_vfwscanf)
-__LDBL_REDIR1_DECL (vwscanf, __nldbl___isoc99_vwscanf)
-__LDBL_REDIR1_DECL (vswscanf, __nldbl___isoc99_vswscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (vfwscanf, __isoc99_vfwscanfieee128)
-__LDBL_REDIR1_DECL (vwscanf, __isoc99_vwscanfieee128)
-__LDBL_REDIR1_DECL (vswscanf, __isoc99_vswscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (vfwscanf);
-__LDBL_REDIR_DECL (vwscanf);
-__LDBL_REDIR_DECL (vswscanf);
-# endif
-#endif
-
-#ifdef __USE_GNU
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold_l, wcstod_l);
-# else
-__LDBL_REDIR1_DECL (wcstold_l, __wcstoieee128_l)
-# endif
-#endif
-
-#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR2_DECL (swprintf_chk)
-__LDBL_REDIR2_DECL (vswprintf_chk)
-# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR2_DECL (fwprintf_chk)
-__LDBL_REDIR2_DECL (wprintf_chk)
-__LDBL_REDIR2_DECL (vfwprintf_chk)
-__LDBL_REDIR2_DECL (vwprintf_chk)
-# endif
-#endif
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index f2dca7711a..548deeedbf 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -227,19 +227,18 @@ __NTH (wcsncat (wchar_t *__restrict __dest, const wchar_t *__restrict __src,
   return __wcsncat_alias (__dest, __src, __n);
 }
 
-
-extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
-			   int __flag, size_t __s_len,
-			   const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
-
-extern int __swprintf_alias (wchar_t *__restrict __s, size_t __n,
-			     const wchar_t *__restrict __fmt, ...)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("swprintf"))
-#endif
-     ;
-
+extern int __REDIRECT_LDBL_NTH (__swprintf_chk, (wchar_t *__restrict __s,
+						 size_t __n,
+						 int __flag, size_t __s_len,
+						 const wchar_t *__restrict __format,
+						 ...),
+				__swprintf_chkieee128, __nldbl___swprintf_chk);
+extern int __REDIRECT_LDBL_NTH (__vswprintf_chk, (wchar_t *__restrict __s,
+						  size_t __n,
+						  int __flag, size_t __s_len,
+						  const wchar_t *__restrict __format,
+						  __gnuc_va_list __arg),
+				__vswprintf_chkieee128, __nldbl___vswprintf_chk);
 
 #ifdef __va_arg_pack
 __fortify_function int
@@ -250,7 +249,7 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __swprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
 			   sz / sizeof (wchar_t), __fmt, __va_arg_pack ());
-  return __swprintf_alias (__s, __n, __fmt, __va_arg_pack ());
+  return swprintf (__s, __n, __fmt, __va_arg_pack ());
 }
 #elif !defined __cplusplus
 /* XXX We might want to have support in gcc for swprintf.  */
@@ -261,20 +260,6 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
    : swprintf (s, n, __VA_ARGS__))
 #endif
 
-extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
-			    int __flag, size_t __s_len,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-
-extern int __vswprintf_alias (wchar_t *__restrict __s, size_t __n,
-			      const wchar_t *__restrict __fmt,
-			      __gnuc_va_list __ap)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("vswprintf"))
-#endif
-     ;
-
 __fortify_function int
 __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
 		  const wchar_t *__restrict __fmt, __gnuc_va_list __ap))
@@ -283,21 +268,30 @@ __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __vswprintf_chk (__s, __n,  __USE_FORTIFY_LEVEL - 1,
 			    sz / sizeof (wchar_t), __fmt, __ap);
-  return __vswprintf_alias (__s, __n, __fmt, __ap);
+  return vswprintf (__s, __n, __fmt, __ap);
 }
 
 
 #if __USE_FORTIFY_LEVEL > 1
 
-extern int __fwprintf_chk (__FILE *__restrict __stream, int __flag,
-			   const wchar_t *__restrict __format, ...);
-extern int __wprintf_chk (int __flag, const wchar_t *__restrict __format,
-			  ...);
-extern int __vfwprintf_chk (__FILE *__restrict __stream, int __flag,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __ap);
-extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format,
-			   __gnuc_va_list __ap);
+extern int __REDIRECT_LDBL (__fwprintf_chk, (__FILE *__restrict __stream,
+					     int __flag,
+					     const wchar_t *__restrict __format,
+					     ...),
+			    __fwprintf_chkieee128, __nldbl___fwprintf_chk);
+extern int __REDIRECT_LDBL (__wprintf_chk, (int __flag,
+					    const wchar_t *__restrict __format,
+					    ...),
+			    __wprintf_chkieee128, __nldbl___wprintf_chk);
+extern int __REDIRECT_LDBL (__vfwprintf_chk, (__FILE *__restrict __stream,
+					      int __flag,
+					      const wchar_t *__restrict __format,
+					      __gnuc_va_list __ap),
+			   __vfwprintf_chkieee128, __nldbl___vfwprintf_chk);
+extern int __REDIRECT_LDBL (__vwprintf_chk, (int __flag,
+					     const wchar_t *__restrict __format,
+					     __gnuc_va_list __ap),
+			    __vwprintf_chkieee128, __nldbl___vwprintf_chk);
 
 # ifdef __va_arg_pack
 __fortify_function int
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 5d6a40853d..27406d0edb 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -382,8 +382,10 @@ extern double wcstod (const wchar_t *__restrict __nptr,
 /* Likewise for `float' and `long double' sizes of floating-point numbers.  */
 extern float wcstof (const wchar_t *__restrict __nptr,
 		     wchar_t **__restrict __endptr) __THROW;
-extern long double wcstold (const wchar_t *__restrict __nptr,
-			    wchar_t **__restrict __endptr) __THROW;
+extern long double __REDIRECT_LDBL_NTH (wcstold,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr),
+					__wcstoieee128, wcstod);
 #endif /* C99 */
 
 /* Likewise for `_FloatN' and `_FloatNx' when support is enabled.  */
@@ -498,9 +500,12 @@ extern float wcstof_l (const wchar_t *__restrict __nptr,
 		       wchar_t **__restrict __endptr, locale_t __loc)
      __THROW;
 
-extern long double wcstold_l (const wchar_t *__restrict __nptr,
-			      wchar_t **__restrict __endptr,
-			      locale_t __loc) __THROW;
+
+extern long double __REDIRECT_LDBL_NTH (wcstold_l,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr,
+					 locale_t __loc),
+					__wcstoieee128_l, wcstod_l);
 
 # if __HAVE_FLOAT16
 extern _Float16 wcstof16_l (const wchar_t *__restrict __nptr,
@@ -587,73 +592,61 @@ extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW
 /* Select orientation for stream.  */
 extern int fwide (__FILE *__fp, int __mode) __THROW;
 
-
 /* Write formatted output to STREAM.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int fwprintf (__FILE *__restrict __stream,
-		     const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (fwprintf, (__FILE *__restrict __stream,
+					  const wchar_t *__restrict __format,
+					  ...))
      /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
 /* Write formatted output to stdout.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int wprintf (const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (wprintf, (const wchar_t *__restrict __format, ...))
      /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
 /* Write formatted output of at most N characters to S.  */
-extern int swprintf (wchar_t *__restrict __s, size_t __n,
-		     const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
+extern int __REDIRECT_LDBL128_NTH (swprintf, (wchar_t *__restrict __s, size_t __n,
+					      const wchar_t *__restrict __format,
+					      ...))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
 
 /* Write formatted output to S from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vfwprintf (__FILE *__restrict __s,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vfwprintf, (__FILE *__restrict __s,
+					const wchar_t *__restrict __format,
+					__gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
 /* Write formatted output to stdout from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vwprintf (const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vwprintf, (const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
 /* Write formatted output of at most N character to S from argument
    list ARG.  */
-extern int vswprintf (wchar_t *__restrict __s, size_t __n,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
-
-
-/* Read formatted input from STREAM.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int fwscanf (__FILE *__restrict __stream,
-		    const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-/* Read formatted input from stdin.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int wscanf (const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
-/* Read formatted input from S.  */
-extern int swscanf (const wchar_t *__restrict __s,
-		    const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-
-/* For historical reasons, the C99-compliant versions of the scanf
-   functions are at alternative names.  When __LDBL_COMPAT or
-   __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
-   bits/wchar-ldbl.h.  */
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
+extern int __REDIRECT_LDBL128_NTH (vswprintf, (wchar_t *__restrict __s, size_t __n,
+				      const wchar_t *__restrict __format,
+					      __gnuc_va_list __arg))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
+
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __isoc99_fwscanfieee128, __nldbl___isoc99_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __isoc99_wscanfieee128,__nldbl___isoc99_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__isoc99_swscanfieee128, __nldbl___isoc99_swscanf);
+#  else
+#   ifdef __REDIRECT
 extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
 				 const wchar_t *__restrict __format, ...),
 		       __isoc99_fwscanf)
@@ -665,72 +658,129 @@ extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s,
 				     const wchar_t *__restrict __format,
 				     ...), __isoc99_swscanf)
      /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-#  else
+#   else
 extern int __isoc99_fwscanf (__FILE *__restrict __stream,
 			     const wchar_t *__restrict __format, ...);
 extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...);
 extern int __isoc99_swscanf (const wchar_t *__restrict __s,
 			     const wchar_t *__restrict __format, ...)
      __THROW;
-#   define fwscanf __isoc99_fwscanf
-#   define wscanf __isoc99_wscanf
-#   define swscanf __isoc99_swscanf
+#    define fwscanf __isoc99_fwscanf
+#    define wscanf __isoc99_wscanf
+#    define swscanf __isoc99_swscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __fwscanfieee128, __nldbl_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __wscanfieee128,__nldbl_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__swscanfieee128, __nldbl_swscanf);
+#  else
+/* Read formatted input from STREAM.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int fwscanf (__FILE *__restrict __stream,
+                    const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
+/* Read formatted input from stdin.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int wscanf (const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
+/* Read formatted input from S.  */
+extern int swscanf (const wchar_t *__restrict __s,
+                    const wchar_t *__restrict __format, ...)
+     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
 #  endif
 # endif
 
 #endif /* Use ISO C95, C99 and Unix98. */
 
 #ifdef __USE_ISOC99
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __isoc99_vfwscanfieee128, __nldbl___isoc99_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __isoc99_vwscanfieee128, __nldbl___isoc99_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__isoc99_vswscanfieee128,
+				__nldbl___isoc99_vswscanf);
+#  else
+#   ifdef __REDIRECT
+extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
+                                  const wchar_t *__restrict __format,
+                                  __gnuc_va_list __arg), __isoc99_vfwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
+                                 __gnuc_va_list __arg), __isoc99_vwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
+extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
+                                      const wchar_t *__restrict __format,
+                                      __gnuc_va_list __arg), __isoc99_vswscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+#   else
+extern int __isoc99_vfwscanf (__FILE *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg);
+extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
+                             __gnuc_va_list __arg);
+extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg) __THROW;
+#    define vfwscanf __isoc99_vfwscanf
+#    define vwscanf __isoc99_vwscanf
+#    define vswscanf __isoc99_vswscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __vfwscanfieee128, __nldbl_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __vwscanfieee128, __nldbl_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__vswscanfieee128,
+				__nldbl_vswscanf);
+#  else
 /* Read formatted input from S into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vfwscanf (__FILE *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
 /* Read formatted input from stdin into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vwscanf (const wchar_t *__restrict __format,
-		    __gnuc_va_list __arg)
+                    __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
 /* Read formatted input from S into argument list ARG.  */
 extern int vswscanf (const wchar_t *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-
-/* Same redirection as above for the v*wscanf family.  */
-# if !__GLIBC_USE (DEPRECATED_SCANF) \
-     && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
-     && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
-extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
-				  const wchar_t *__restrict __format,
-				  __gnuc_va_list __arg), __isoc99_vfwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
-				 __gnuc_va_list __arg), __isoc99_vwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
-extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
-				      const wchar_t *__restrict __format,
-				      __gnuc_va_list __arg), __isoc99_vswscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-#  else
-extern int __isoc99_vfwscanf (__FILE *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg);
-extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
-			     __gnuc_va_list __arg);
-extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg) __THROW;
-#   define vfwscanf __isoc99_vfwscanf
-#   define vwscanf __isoc99_vwscanf
-#   define vswscanf __isoc99_vswscanf
 #  endif
 # endif
 
@@ -867,11 +917,6 @@ extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
 # include <bits/wchar2.h>
 #endif
 
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/wchar-ldbl.h>
-#endif
-
 __END_DECLS
 
 #endif /* wchar.h  */


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

* [glibc/azanella/clang] Remove wchar-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=9f87b4e3f21ce65cd4572dd3cb79e955ab3b8697

commit 9f87b4e3f21ce65cd4572dd3cb79e955ab3b8697
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Feb 25 11:02:21 2022 -0300

    Remove wchar-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.
    
    A new macro, __REDIRECT_LDBL128, is used for function where only
    the binary128 alias is required.
    
    Checked on x86_64-linux-gnu and powerpc64le-linux-gnu.

Diff:
---
 include/bits/wchar-ldbl.h |   1 -
 misc/sys/cdefs.h          |  13 +++
 wcsmbs/Makefile           |   2 +-
 wcsmbs/bits/wchar-ldbl.h  |  91 ------------------
 wcsmbs/bits/wchar2.h      |  70 +++++++-------
 wcsmbs/wchar.h            | 229 +++++++++++++++++++++++++++-------------------
 6 files changed, 183 insertions(+), 223 deletions(-)

diff --git a/include/bits/wchar-ldbl.h b/include/bits/wchar-ldbl.h
deleted file mode 100644
index 29baa2f4d5..0000000000
--- a/include/bits/wchar-ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <wcsmbs/bits/wchar-ldbl.h>
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index e43b5d4b36..d8069a7590 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -567,16 +567,26 @@
 #  ifdef __REDIRECT
 #   define __REDIRECT_LDBL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , , proto, ieee128)
+#   define __REDIRECT_LDBL128(name, proto) \
+      __REDIRECT_LDBL1 (name, , , proto, __##name##ieee128)
 #   ifdef __cplusplus
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROW, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROW, , proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROWNL, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROWNL, , proto, __##name##ieee128)
 #   else
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROW, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROW, proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROWNL, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROWNL, proto, __##name##ieee128)
 #   endif /* __cplusplus */
 #  else
 _Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
@@ -606,6 +616,9 @@ _Static_assert (0, "Compat long double requires redirection on this platform");
 # define __REDIRECT_LDBL(name, proto, ieee128, compat) name proto
 # define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) name proto __THROW
 # define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) name proto __THROWNL
+# define __REDIRECT_LDBL128(name, proto) name proto
+# define __REDIRECT_LDBL128_NTH(name, proto) name proto __THROW
+# define __REDIRECT_LDBL128_NTHNL(name, proto) name proto __THROWNL
 #endif
 
 #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index df9a85f4a9..b67202526d 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -22,7 +22,7 @@ subdir	:= wcsmbs
 
 include ../Makeconfig
 
-headers	:= wchar.h bits/wchar.h bits/wchar2.h bits/wchar-ldbl.h uchar.h \
+headers	:= wchar.h bits/wchar.h bits/wchar2.h uchar.h \
 	   bits/types/__mbstate_t.h bits/types/mbstate_t.h bits/types/wint_t.h
 
 routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
diff --git a/wcsmbs/bits/wchar-ldbl.h b/wcsmbs/bits/wchar-ldbl.h
deleted file mode 100644
index f0d8506f83..0000000000
--- a/wcsmbs/bits/wchar-ldbl.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -mlong-double-64 compatibility mode for <wchar.h> functions.
-   Copyright (C) 2006-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 _WCHAR_H
-# error "Never include <bits/wchar-ldbl.h> directly; use <wchar.h> instead."
-#endif
-
-#if defined __USE_ISOC95 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (fwprintf);
-__LDBL_REDIR_DECL (wprintf);
-__LDBL_REDIR_DECL (swprintf);
-__LDBL_REDIR_DECL (vfwprintf);
-__LDBL_REDIR_DECL (vwprintf);
-__LDBL_REDIR_DECL (vswprintf);
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (fwscanf, __nldbl___isoc99_fwscanf)
-__LDBL_REDIR1_DECL (wscanf, __nldbl___isoc99_wscanf)
-__LDBL_REDIR1_DECL (swscanf, __nldbl___isoc99_swscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (fwscanf, __isoc99_fwscanfieee128)
-__LDBL_REDIR1_DECL (wscanf, __isoc99_wscanfieee128)
-__LDBL_REDIR1_DECL (swscanf, __isoc99_swscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (fwscanf);
-__LDBL_REDIR_DECL (wscanf);
-__LDBL_REDIR_DECL (swscanf);
-# endif
-#endif
-
-#ifdef __USE_ISOC99
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold, wcstod);
-# else
-__LDBL_REDIR1_DECL (wcstold, __wcstoieee128)
-# endif
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (vfwscanf, __nldbl___isoc99_vfwscanf)
-__LDBL_REDIR1_DECL (vwscanf, __nldbl___isoc99_vwscanf)
-__LDBL_REDIR1_DECL (vswscanf, __nldbl___isoc99_vswscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (vfwscanf, __isoc99_vfwscanfieee128)
-__LDBL_REDIR1_DECL (vwscanf, __isoc99_vwscanfieee128)
-__LDBL_REDIR1_DECL (vswscanf, __isoc99_vswscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (vfwscanf);
-__LDBL_REDIR_DECL (vwscanf);
-__LDBL_REDIR_DECL (vswscanf);
-# endif
-#endif
-
-#ifdef __USE_GNU
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold_l, wcstod_l);
-# else
-__LDBL_REDIR1_DECL (wcstold_l, __wcstoieee128_l)
-# endif
-#endif
-
-#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR2_DECL (swprintf_chk)
-__LDBL_REDIR2_DECL (vswprintf_chk)
-# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR2_DECL (fwprintf_chk)
-__LDBL_REDIR2_DECL (wprintf_chk)
-__LDBL_REDIR2_DECL (vfwprintf_chk)
-__LDBL_REDIR2_DECL (vwprintf_chk)
-# endif
-#endif
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index f2dca7711a..548deeedbf 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -227,19 +227,18 @@ __NTH (wcsncat (wchar_t *__restrict __dest, const wchar_t *__restrict __src,
   return __wcsncat_alias (__dest, __src, __n);
 }
 
-
-extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
-			   int __flag, size_t __s_len,
-			   const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
-
-extern int __swprintf_alias (wchar_t *__restrict __s, size_t __n,
-			     const wchar_t *__restrict __fmt, ...)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("swprintf"))
-#endif
-     ;
-
+extern int __REDIRECT_LDBL_NTH (__swprintf_chk, (wchar_t *__restrict __s,
+						 size_t __n,
+						 int __flag, size_t __s_len,
+						 const wchar_t *__restrict __format,
+						 ...),
+				__swprintf_chkieee128, __nldbl___swprintf_chk);
+extern int __REDIRECT_LDBL_NTH (__vswprintf_chk, (wchar_t *__restrict __s,
+						  size_t __n,
+						  int __flag, size_t __s_len,
+						  const wchar_t *__restrict __format,
+						  __gnuc_va_list __arg),
+				__vswprintf_chkieee128, __nldbl___vswprintf_chk);
 
 #ifdef __va_arg_pack
 __fortify_function int
@@ -250,7 +249,7 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __swprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
 			   sz / sizeof (wchar_t), __fmt, __va_arg_pack ());
-  return __swprintf_alias (__s, __n, __fmt, __va_arg_pack ());
+  return swprintf (__s, __n, __fmt, __va_arg_pack ());
 }
 #elif !defined __cplusplus
 /* XXX We might want to have support in gcc for swprintf.  */
@@ -261,20 +260,6 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
    : swprintf (s, n, __VA_ARGS__))
 #endif
 
-extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
-			    int __flag, size_t __s_len,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-
-extern int __vswprintf_alias (wchar_t *__restrict __s, size_t __n,
-			      const wchar_t *__restrict __fmt,
-			      __gnuc_va_list __ap)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("vswprintf"))
-#endif
-     ;
-
 __fortify_function int
 __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
 		  const wchar_t *__restrict __fmt, __gnuc_va_list __ap))
@@ -283,21 +268,30 @@ __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __vswprintf_chk (__s, __n,  __USE_FORTIFY_LEVEL - 1,
 			    sz / sizeof (wchar_t), __fmt, __ap);
-  return __vswprintf_alias (__s, __n, __fmt, __ap);
+  return vswprintf (__s, __n, __fmt, __ap);
 }
 
 
 #if __USE_FORTIFY_LEVEL > 1
 
-extern int __fwprintf_chk (__FILE *__restrict __stream, int __flag,
-			   const wchar_t *__restrict __format, ...);
-extern int __wprintf_chk (int __flag, const wchar_t *__restrict __format,
-			  ...);
-extern int __vfwprintf_chk (__FILE *__restrict __stream, int __flag,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __ap);
-extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format,
-			   __gnuc_va_list __ap);
+extern int __REDIRECT_LDBL (__fwprintf_chk, (__FILE *__restrict __stream,
+					     int __flag,
+					     const wchar_t *__restrict __format,
+					     ...),
+			    __fwprintf_chkieee128, __nldbl___fwprintf_chk);
+extern int __REDIRECT_LDBL (__wprintf_chk, (int __flag,
+					    const wchar_t *__restrict __format,
+					    ...),
+			    __wprintf_chkieee128, __nldbl___wprintf_chk);
+extern int __REDIRECT_LDBL (__vfwprintf_chk, (__FILE *__restrict __stream,
+					      int __flag,
+					      const wchar_t *__restrict __format,
+					      __gnuc_va_list __ap),
+			   __vfwprintf_chkieee128, __nldbl___vfwprintf_chk);
+extern int __REDIRECT_LDBL (__vwprintf_chk, (int __flag,
+					     const wchar_t *__restrict __format,
+					     __gnuc_va_list __ap),
+			    __vwprintf_chkieee128, __nldbl___vwprintf_chk);
 
 # ifdef __va_arg_pack
 __fortify_function int
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 5d6a40853d..27406d0edb 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -382,8 +382,10 @@ extern double wcstod (const wchar_t *__restrict __nptr,
 /* Likewise for `float' and `long double' sizes of floating-point numbers.  */
 extern float wcstof (const wchar_t *__restrict __nptr,
 		     wchar_t **__restrict __endptr) __THROW;
-extern long double wcstold (const wchar_t *__restrict __nptr,
-			    wchar_t **__restrict __endptr) __THROW;
+extern long double __REDIRECT_LDBL_NTH (wcstold,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr),
+					__wcstoieee128, wcstod);
 #endif /* C99 */
 
 /* Likewise for `_FloatN' and `_FloatNx' when support is enabled.  */
@@ -498,9 +500,12 @@ extern float wcstof_l (const wchar_t *__restrict __nptr,
 		       wchar_t **__restrict __endptr, locale_t __loc)
      __THROW;
 
-extern long double wcstold_l (const wchar_t *__restrict __nptr,
-			      wchar_t **__restrict __endptr,
-			      locale_t __loc) __THROW;
+
+extern long double __REDIRECT_LDBL_NTH (wcstold_l,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr,
+					 locale_t __loc),
+					__wcstoieee128_l, wcstod_l);
 
 # if __HAVE_FLOAT16
 extern _Float16 wcstof16_l (const wchar_t *__restrict __nptr,
@@ -587,73 +592,61 @@ extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW
 /* Select orientation for stream.  */
 extern int fwide (__FILE *__fp, int __mode) __THROW;
 
-
 /* Write formatted output to STREAM.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int fwprintf (__FILE *__restrict __stream,
-		     const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (fwprintf, (__FILE *__restrict __stream,
+					  const wchar_t *__restrict __format,
+					  ...))
      /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
 /* Write formatted output to stdout.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int wprintf (const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (wprintf, (const wchar_t *__restrict __format, ...))
      /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
 /* Write formatted output of at most N characters to S.  */
-extern int swprintf (wchar_t *__restrict __s, size_t __n,
-		     const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
+extern int __REDIRECT_LDBL128_NTH (swprintf, (wchar_t *__restrict __s, size_t __n,
+					      const wchar_t *__restrict __format,
+					      ...))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
 
 /* Write formatted output to S from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vfwprintf (__FILE *__restrict __s,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vfwprintf, (__FILE *__restrict __s,
+					const wchar_t *__restrict __format,
+					__gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
 /* Write formatted output to stdout from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vwprintf (const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vwprintf, (const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
 /* Write formatted output of at most N character to S from argument
    list ARG.  */
-extern int vswprintf (wchar_t *__restrict __s, size_t __n,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
-
-
-/* Read formatted input from STREAM.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int fwscanf (__FILE *__restrict __stream,
-		    const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-/* Read formatted input from stdin.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int wscanf (const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
-/* Read formatted input from S.  */
-extern int swscanf (const wchar_t *__restrict __s,
-		    const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-
-/* For historical reasons, the C99-compliant versions of the scanf
-   functions are at alternative names.  When __LDBL_COMPAT or
-   __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
-   bits/wchar-ldbl.h.  */
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
+extern int __REDIRECT_LDBL128_NTH (vswprintf, (wchar_t *__restrict __s, size_t __n,
+				      const wchar_t *__restrict __format,
+					      __gnuc_va_list __arg))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
+
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __isoc99_fwscanfieee128, __nldbl___isoc99_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __isoc99_wscanfieee128,__nldbl___isoc99_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__isoc99_swscanfieee128, __nldbl___isoc99_swscanf);
+#  else
+#   ifdef __REDIRECT
 extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
 				 const wchar_t *__restrict __format, ...),
 		       __isoc99_fwscanf)
@@ -665,72 +658,129 @@ extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s,
 				     const wchar_t *__restrict __format,
 				     ...), __isoc99_swscanf)
      /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-#  else
+#   else
 extern int __isoc99_fwscanf (__FILE *__restrict __stream,
 			     const wchar_t *__restrict __format, ...);
 extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...);
 extern int __isoc99_swscanf (const wchar_t *__restrict __s,
 			     const wchar_t *__restrict __format, ...)
      __THROW;
-#   define fwscanf __isoc99_fwscanf
-#   define wscanf __isoc99_wscanf
-#   define swscanf __isoc99_swscanf
+#    define fwscanf __isoc99_fwscanf
+#    define wscanf __isoc99_wscanf
+#    define swscanf __isoc99_swscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __fwscanfieee128, __nldbl_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __wscanfieee128,__nldbl_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__swscanfieee128, __nldbl_swscanf);
+#  else
+/* Read formatted input from STREAM.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int fwscanf (__FILE *__restrict __stream,
+                    const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
+/* Read formatted input from stdin.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int wscanf (const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
+/* Read formatted input from S.  */
+extern int swscanf (const wchar_t *__restrict __s,
+                    const wchar_t *__restrict __format, ...)
+     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
 #  endif
 # endif
 
 #endif /* Use ISO C95, C99 and Unix98. */
 
 #ifdef __USE_ISOC99
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __isoc99_vfwscanfieee128, __nldbl___isoc99_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __isoc99_vwscanfieee128, __nldbl___isoc99_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__isoc99_vswscanfieee128,
+				__nldbl___isoc99_vswscanf);
+#  else
+#   ifdef __REDIRECT
+extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
+                                  const wchar_t *__restrict __format,
+                                  __gnuc_va_list __arg), __isoc99_vfwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
+                                 __gnuc_va_list __arg), __isoc99_vwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
+extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
+                                      const wchar_t *__restrict __format,
+                                      __gnuc_va_list __arg), __isoc99_vswscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+#   else
+extern int __isoc99_vfwscanf (__FILE *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg);
+extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
+                             __gnuc_va_list __arg);
+extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg) __THROW;
+#    define vfwscanf __isoc99_vfwscanf
+#    define vwscanf __isoc99_vwscanf
+#    define vswscanf __isoc99_vswscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __vfwscanfieee128, __nldbl_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __vwscanfieee128, __nldbl_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__vswscanfieee128,
+				__nldbl_vswscanf);
+#  else
 /* Read formatted input from S into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vfwscanf (__FILE *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
 /* Read formatted input from stdin into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vwscanf (const wchar_t *__restrict __format,
-		    __gnuc_va_list __arg)
+                    __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
 /* Read formatted input from S into argument list ARG.  */
 extern int vswscanf (const wchar_t *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-
-/* Same redirection as above for the v*wscanf family.  */
-# if !__GLIBC_USE (DEPRECATED_SCANF) \
-     && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
-     && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
-extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
-				  const wchar_t *__restrict __format,
-				  __gnuc_va_list __arg), __isoc99_vfwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
-				 __gnuc_va_list __arg), __isoc99_vwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
-extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
-				      const wchar_t *__restrict __format,
-				      __gnuc_va_list __arg), __isoc99_vswscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-#  else
-extern int __isoc99_vfwscanf (__FILE *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg);
-extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
-			     __gnuc_va_list __arg);
-extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg) __THROW;
-#   define vfwscanf __isoc99_vfwscanf
-#   define vwscanf __isoc99_vwscanf
-#   define vswscanf __isoc99_vswscanf
 #  endif
 # endif
 
@@ -867,11 +917,6 @@ extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
 # include <bits/wchar2.h>
 #endif
 
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/wchar-ldbl.h>
-#endif
-
 __END_DECLS
 
 #endif /* wchar.h  */


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

* [glibc/azanella/clang] Remove wchar-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=b0349219158746ee778c8705cbf24e892e384943

commit b0349219158746ee778c8705cbf24e892e384943
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Feb 25 11:02:21 2022 -0300

    Remove wchar-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.
    
    A new macro, __REDIRECT_LDBL128, is used for function where only
    the binary128 alias is required.
    
    Checked on x86_64-linux-gnu and powerpc64le-linux-gnu.

Diff:
---
 include/bits/wchar-ldbl.h |   1 -
 misc/sys/cdefs.h          |  13 +++
 wcsmbs/Makefile           |   2 +-
 wcsmbs/bits/wchar-ldbl.h  |  91 ------------------
 wcsmbs/bits/wchar2.h      |  70 +++++++-------
 wcsmbs/wchar.h            | 229 +++++++++++++++++++++++++++-------------------
 6 files changed, 183 insertions(+), 223 deletions(-)

diff --git a/include/bits/wchar-ldbl.h b/include/bits/wchar-ldbl.h
deleted file mode 100644
index 29baa2f4d5..0000000000
--- a/include/bits/wchar-ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <wcsmbs/bits/wchar-ldbl.h>
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index e43b5d4b36..d8069a7590 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -567,16 +567,26 @@
 #  ifdef __REDIRECT
 #   define __REDIRECT_LDBL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , , proto, ieee128)
+#   define __REDIRECT_LDBL128(name, proto) \
+      __REDIRECT_LDBL1 (name, , , proto, __##name##ieee128)
 #   ifdef __cplusplus
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROW, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROW, , proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROWNL, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROWNL, , proto, __##name##ieee128)
 #   else
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROW, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROW, proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROWNL, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROWNL, proto, __##name##ieee128)
 #   endif /* __cplusplus */
 #  else
 _Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
@@ -606,6 +616,9 @@ _Static_assert (0, "Compat long double requires redirection on this platform");
 # define __REDIRECT_LDBL(name, proto, ieee128, compat) name proto
 # define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) name proto __THROW
 # define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) name proto __THROWNL
+# define __REDIRECT_LDBL128(name, proto) name proto
+# define __REDIRECT_LDBL128_NTH(name, proto) name proto __THROW
+# define __REDIRECT_LDBL128_NTHNL(name, proto) name proto __THROWNL
 #endif
 
 #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index df9a85f4a9..b67202526d 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -22,7 +22,7 @@ subdir	:= wcsmbs
 
 include ../Makeconfig
 
-headers	:= wchar.h bits/wchar.h bits/wchar2.h bits/wchar-ldbl.h uchar.h \
+headers	:= wchar.h bits/wchar.h bits/wchar2.h uchar.h \
 	   bits/types/__mbstate_t.h bits/types/mbstate_t.h bits/types/wint_t.h
 
 routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
diff --git a/wcsmbs/bits/wchar-ldbl.h b/wcsmbs/bits/wchar-ldbl.h
deleted file mode 100644
index f0d8506f83..0000000000
--- a/wcsmbs/bits/wchar-ldbl.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -mlong-double-64 compatibility mode for <wchar.h> functions.
-   Copyright (C) 2006-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 _WCHAR_H
-# error "Never include <bits/wchar-ldbl.h> directly; use <wchar.h> instead."
-#endif
-
-#if defined __USE_ISOC95 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (fwprintf);
-__LDBL_REDIR_DECL (wprintf);
-__LDBL_REDIR_DECL (swprintf);
-__LDBL_REDIR_DECL (vfwprintf);
-__LDBL_REDIR_DECL (vwprintf);
-__LDBL_REDIR_DECL (vswprintf);
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (fwscanf, __nldbl___isoc99_fwscanf)
-__LDBL_REDIR1_DECL (wscanf, __nldbl___isoc99_wscanf)
-__LDBL_REDIR1_DECL (swscanf, __nldbl___isoc99_swscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (fwscanf, __isoc99_fwscanfieee128)
-__LDBL_REDIR1_DECL (wscanf, __isoc99_wscanfieee128)
-__LDBL_REDIR1_DECL (swscanf, __isoc99_swscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (fwscanf);
-__LDBL_REDIR_DECL (wscanf);
-__LDBL_REDIR_DECL (swscanf);
-# endif
-#endif
-
-#ifdef __USE_ISOC99
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold, wcstod);
-# else
-__LDBL_REDIR1_DECL (wcstold, __wcstoieee128)
-# endif
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (vfwscanf, __nldbl___isoc99_vfwscanf)
-__LDBL_REDIR1_DECL (vwscanf, __nldbl___isoc99_vwscanf)
-__LDBL_REDIR1_DECL (vswscanf, __nldbl___isoc99_vswscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (vfwscanf, __isoc99_vfwscanfieee128)
-__LDBL_REDIR1_DECL (vwscanf, __isoc99_vwscanfieee128)
-__LDBL_REDIR1_DECL (vswscanf, __isoc99_vswscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (vfwscanf);
-__LDBL_REDIR_DECL (vwscanf);
-__LDBL_REDIR_DECL (vswscanf);
-# endif
-#endif
-
-#ifdef __USE_GNU
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold_l, wcstod_l);
-# else
-__LDBL_REDIR1_DECL (wcstold_l, __wcstoieee128_l)
-# endif
-#endif
-
-#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR2_DECL (swprintf_chk)
-__LDBL_REDIR2_DECL (vswprintf_chk)
-# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR2_DECL (fwprintf_chk)
-__LDBL_REDIR2_DECL (wprintf_chk)
-__LDBL_REDIR2_DECL (vfwprintf_chk)
-__LDBL_REDIR2_DECL (vwprintf_chk)
-# endif
-#endif
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index f2dca7711a..548deeedbf 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -227,19 +227,18 @@ __NTH (wcsncat (wchar_t *__restrict __dest, const wchar_t *__restrict __src,
   return __wcsncat_alias (__dest, __src, __n);
 }
 
-
-extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
-			   int __flag, size_t __s_len,
-			   const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
-
-extern int __swprintf_alias (wchar_t *__restrict __s, size_t __n,
-			     const wchar_t *__restrict __fmt, ...)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("swprintf"))
-#endif
-     ;
-
+extern int __REDIRECT_LDBL_NTH (__swprintf_chk, (wchar_t *__restrict __s,
+						 size_t __n,
+						 int __flag, size_t __s_len,
+						 const wchar_t *__restrict __format,
+						 ...),
+				__swprintf_chkieee128, __nldbl___swprintf_chk);
+extern int __REDIRECT_LDBL_NTH (__vswprintf_chk, (wchar_t *__restrict __s,
+						  size_t __n,
+						  int __flag, size_t __s_len,
+						  const wchar_t *__restrict __format,
+						  __gnuc_va_list __arg),
+				__vswprintf_chkieee128, __nldbl___vswprintf_chk);
 
 #ifdef __va_arg_pack
 __fortify_function int
@@ -250,7 +249,7 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __swprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
 			   sz / sizeof (wchar_t), __fmt, __va_arg_pack ());
-  return __swprintf_alias (__s, __n, __fmt, __va_arg_pack ());
+  return swprintf (__s, __n, __fmt, __va_arg_pack ());
 }
 #elif !defined __cplusplus
 /* XXX We might want to have support in gcc for swprintf.  */
@@ -261,20 +260,6 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
    : swprintf (s, n, __VA_ARGS__))
 #endif
 
-extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
-			    int __flag, size_t __s_len,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-
-extern int __vswprintf_alias (wchar_t *__restrict __s, size_t __n,
-			      const wchar_t *__restrict __fmt,
-			      __gnuc_va_list __ap)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("vswprintf"))
-#endif
-     ;
-
 __fortify_function int
 __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
 		  const wchar_t *__restrict __fmt, __gnuc_va_list __ap))
@@ -283,21 +268,30 @@ __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __vswprintf_chk (__s, __n,  __USE_FORTIFY_LEVEL - 1,
 			    sz / sizeof (wchar_t), __fmt, __ap);
-  return __vswprintf_alias (__s, __n, __fmt, __ap);
+  return vswprintf (__s, __n, __fmt, __ap);
 }
 
 
 #if __USE_FORTIFY_LEVEL > 1
 
-extern int __fwprintf_chk (__FILE *__restrict __stream, int __flag,
-			   const wchar_t *__restrict __format, ...);
-extern int __wprintf_chk (int __flag, const wchar_t *__restrict __format,
-			  ...);
-extern int __vfwprintf_chk (__FILE *__restrict __stream, int __flag,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __ap);
-extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format,
-			   __gnuc_va_list __ap);
+extern int __REDIRECT_LDBL (__fwprintf_chk, (__FILE *__restrict __stream,
+					     int __flag,
+					     const wchar_t *__restrict __format,
+					     ...),
+			    __fwprintf_chkieee128, __nldbl___fwprintf_chk);
+extern int __REDIRECT_LDBL (__wprintf_chk, (int __flag,
+					    const wchar_t *__restrict __format,
+					    ...),
+			    __wprintf_chkieee128, __nldbl___wprintf_chk);
+extern int __REDIRECT_LDBL (__vfwprintf_chk, (__FILE *__restrict __stream,
+					      int __flag,
+					      const wchar_t *__restrict __format,
+					      __gnuc_va_list __ap),
+			   __vfwprintf_chkieee128, __nldbl___vfwprintf_chk);
+extern int __REDIRECT_LDBL (__vwprintf_chk, (int __flag,
+					     const wchar_t *__restrict __format,
+					     __gnuc_va_list __ap),
+			    __vwprintf_chkieee128, __nldbl___vwprintf_chk);
 
 # ifdef __va_arg_pack
 __fortify_function int
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 5d6a40853d..27406d0edb 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -382,8 +382,10 @@ extern double wcstod (const wchar_t *__restrict __nptr,
 /* Likewise for `float' and `long double' sizes of floating-point numbers.  */
 extern float wcstof (const wchar_t *__restrict __nptr,
 		     wchar_t **__restrict __endptr) __THROW;
-extern long double wcstold (const wchar_t *__restrict __nptr,
-			    wchar_t **__restrict __endptr) __THROW;
+extern long double __REDIRECT_LDBL_NTH (wcstold,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr),
+					__wcstoieee128, wcstod);
 #endif /* C99 */
 
 /* Likewise for `_FloatN' and `_FloatNx' when support is enabled.  */
@@ -498,9 +500,12 @@ extern float wcstof_l (const wchar_t *__restrict __nptr,
 		       wchar_t **__restrict __endptr, locale_t __loc)
      __THROW;
 
-extern long double wcstold_l (const wchar_t *__restrict __nptr,
-			      wchar_t **__restrict __endptr,
-			      locale_t __loc) __THROW;
+
+extern long double __REDIRECT_LDBL_NTH (wcstold_l,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr,
+					 locale_t __loc),
+					__wcstoieee128_l, wcstod_l);
 
 # if __HAVE_FLOAT16
 extern _Float16 wcstof16_l (const wchar_t *__restrict __nptr,
@@ -587,73 +592,61 @@ extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW
 /* Select orientation for stream.  */
 extern int fwide (__FILE *__fp, int __mode) __THROW;
 
-
 /* Write formatted output to STREAM.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int fwprintf (__FILE *__restrict __stream,
-		     const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (fwprintf, (__FILE *__restrict __stream,
+					  const wchar_t *__restrict __format,
+					  ...))
      /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
 /* Write formatted output to stdout.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int wprintf (const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (wprintf, (const wchar_t *__restrict __format, ...))
      /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
 /* Write formatted output of at most N characters to S.  */
-extern int swprintf (wchar_t *__restrict __s, size_t __n,
-		     const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
+extern int __REDIRECT_LDBL128_NTH (swprintf, (wchar_t *__restrict __s, size_t __n,
+					      const wchar_t *__restrict __format,
+					      ...))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
 
 /* Write formatted output to S from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vfwprintf (__FILE *__restrict __s,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vfwprintf, (__FILE *__restrict __s,
+					const wchar_t *__restrict __format,
+					__gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
 /* Write formatted output to stdout from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vwprintf (const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vwprintf, (const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
 /* Write formatted output of at most N character to S from argument
    list ARG.  */
-extern int vswprintf (wchar_t *__restrict __s, size_t __n,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
-
-
-/* Read formatted input from STREAM.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int fwscanf (__FILE *__restrict __stream,
-		    const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-/* Read formatted input from stdin.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int wscanf (const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
-/* Read formatted input from S.  */
-extern int swscanf (const wchar_t *__restrict __s,
-		    const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-
-/* For historical reasons, the C99-compliant versions of the scanf
-   functions are at alternative names.  When __LDBL_COMPAT or
-   __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
-   bits/wchar-ldbl.h.  */
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
+extern int __REDIRECT_LDBL128_NTH (vswprintf, (wchar_t *__restrict __s, size_t __n,
+				      const wchar_t *__restrict __format,
+					      __gnuc_va_list __arg))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
+
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __isoc99_fwscanfieee128, __nldbl___isoc99_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __isoc99_wscanfieee128,__nldbl___isoc99_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__isoc99_swscanfieee128, __nldbl___isoc99_swscanf);
+#  else
+#   ifdef __REDIRECT
 extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
 				 const wchar_t *__restrict __format, ...),
 		       __isoc99_fwscanf)
@@ -665,72 +658,129 @@ extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s,
 				     const wchar_t *__restrict __format,
 				     ...), __isoc99_swscanf)
      /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-#  else
+#   else
 extern int __isoc99_fwscanf (__FILE *__restrict __stream,
 			     const wchar_t *__restrict __format, ...);
 extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...);
 extern int __isoc99_swscanf (const wchar_t *__restrict __s,
 			     const wchar_t *__restrict __format, ...)
      __THROW;
-#   define fwscanf __isoc99_fwscanf
-#   define wscanf __isoc99_wscanf
-#   define swscanf __isoc99_swscanf
+#    define fwscanf __isoc99_fwscanf
+#    define wscanf __isoc99_wscanf
+#    define swscanf __isoc99_swscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __fwscanfieee128, __nldbl_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __wscanfieee128,__nldbl_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__swscanfieee128, __nldbl_swscanf);
+#  else
+/* Read formatted input from STREAM.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int fwscanf (__FILE *__restrict __stream,
+                    const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
+/* Read formatted input from stdin.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int wscanf (const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
+/* Read formatted input from S.  */
+extern int swscanf (const wchar_t *__restrict __s,
+                    const wchar_t *__restrict __format, ...)
+     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
 #  endif
 # endif
 
 #endif /* Use ISO C95, C99 and Unix98. */
 
 #ifdef __USE_ISOC99
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __isoc99_vfwscanfieee128, __nldbl___isoc99_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __isoc99_vwscanfieee128, __nldbl___isoc99_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__isoc99_vswscanfieee128,
+				__nldbl___isoc99_vswscanf);
+#  else
+#   ifdef __REDIRECT
+extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
+                                  const wchar_t *__restrict __format,
+                                  __gnuc_va_list __arg), __isoc99_vfwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
+                                 __gnuc_va_list __arg), __isoc99_vwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
+extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
+                                      const wchar_t *__restrict __format,
+                                      __gnuc_va_list __arg), __isoc99_vswscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+#   else
+extern int __isoc99_vfwscanf (__FILE *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg);
+extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
+                             __gnuc_va_list __arg);
+extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg) __THROW;
+#    define vfwscanf __isoc99_vfwscanf
+#    define vwscanf __isoc99_vwscanf
+#    define vswscanf __isoc99_vswscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __vfwscanfieee128, __nldbl_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __vwscanfieee128, __nldbl_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__vswscanfieee128,
+				__nldbl_vswscanf);
+#  else
 /* Read formatted input from S into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vfwscanf (__FILE *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
 /* Read formatted input from stdin into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vwscanf (const wchar_t *__restrict __format,
-		    __gnuc_va_list __arg)
+                    __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
 /* Read formatted input from S into argument list ARG.  */
 extern int vswscanf (const wchar_t *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-
-/* Same redirection as above for the v*wscanf family.  */
-# if !__GLIBC_USE (DEPRECATED_SCANF) \
-     && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
-     && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
-extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
-				  const wchar_t *__restrict __format,
-				  __gnuc_va_list __arg), __isoc99_vfwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
-				 __gnuc_va_list __arg), __isoc99_vwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
-extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
-				      const wchar_t *__restrict __format,
-				      __gnuc_va_list __arg), __isoc99_vswscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-#  else
-extern int __isoc99_vfwscanf (__FILE *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg);
-extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
-			     __gnuc_va_list __arg);
-extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg) __THROW;
-#   define vfwscanf __isoc99_vfwscanf
-#   define vwscanf __isoc99_vwscanf
-#   define vswscanf __isoc99_vswscanf
 #  endif
 # endif
 
@@ -867,11 +917,6 @@ extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
 # include <bits/wchar2.h>
 #endif
 
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/wchar-ldbl.h>
-#endif
-
 __END_DECLS
 
 #endif /* wchar.h  */


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

* [glibc/azanella/clang] Remove wchar-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=ea6fa3c1b13feb63599de6708652660dae94750a

commit ea6fa3c1b13feb63599de6708652660dae94750a
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Feb 25 11:02:21 2022 -0300

    Remove wchar-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.
    
    A new macro, __REDIRECT_LDBL128, is used for function where only
    the binary128 alias is required.
    
    Checked on x86_64-linux-gnu and powerpc64le-linux-gnu.

Diff:
---
 include/bits/wchar-ldbl.h |   1 -
 misc/sys/cdefs.h          |  13 +++
 wcsmbs/Makefile           |   2 +-
 wcsmbs/bits/wchar-ldbl.h  |  91 ------------------
 wcsmbs/bits/wchar2.h      |  70 +++++++-------
 wcsmbs/wchar.h            | 229 +++++++++++++++++++++++++++-------------------
 6 files changed, 183 insertions(+), 223 deletions(-)

diff --git a/include/bits/wchar-ldbl.h b/include/bits/wchar-ldbl.h
deleted file mode 100644
index 29baa2f4d5..0000000000
--- a/include/bits/wchar-ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <wcsmbs/bits/wchar-ldbl.h>
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index e43b5d4b36..d8069a7590 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -567,16 +567,26 @@
 #  ifdef __REDIRECT
 #   define __REDIRECT_LDBL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , , proto, ieee128)
+#   define __REDIRECT_LDBL128(name, proto) \
+      __REDIRECT_LDBL1 (name, , , proto, __##name##ieee128)
 #   ifdef __cplusplus
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROW, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROW, , proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROWNL, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROWNL, , proto, __##name##ieee128)
 #   else
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROW, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROW, proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROWNL, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROWNL, proto, __##name##ieee128)
 #   endif /* __cplusplus */
 #  else
 _Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
@@ -606,6 +616,9 @@ _Static_assert (0, "Compat long double requires redirection on this platform");
 # define __REDIRECT_LDBL(name, proto, ieee128, compat) name proto
 # define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) name proto __THROW
 # define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) name proto __THROWNL
+# define __REDIRECT_LDBL128(name, proto) name proto
+# define __REDIRECT_LDBL128_NTH(name, proto) name proto __THROW
+# define __REDIRECT_LDBL128_NTHNL(name, proto) name proto __THROWNL
 #endif
 
 #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index df9a85f4a9..b67202526d 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -22,7 +22,7 @@ subdir	:= wcsmbs
 
 include ../Makeconfig
 
-headers	:= wchar.h bits/wchar.h bits/wchar2.h bits/wchar-ldbl.h uchar.h \
+headers	:= wchar.h bits/wchar.h bits/wchar2.h uchar.h \
 	   bits/types/__mbstate_t.h bits/types/mbstate_t.h bits/types/wint_t.h
 
 routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
diff --git a/wcsmbs/bits/wchar-ldbl.h b/wcsmbs/bits/wchar-ldbl.h
deleted file mode 100644
index f0d8506f83..0000000000
--- a/wcsmbs/bits/wchar-ldbl.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -mlong-double-64 compatibility mode for <wchar.h> functions.
-   Copyright (C) 2006-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 _WCHAR_H
-# error "Never include <bits/wchar-ldbl.h> directly; use <wchar.h> instead."
-#endif
-
-#if defined __USE_ISOC95 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (fwprintf);
-__LDBL_REDIR_DECL (wprintf);
-__LDBL_REDIR_DECL (swprintf);
-__LDBL_REDIR_DECL (vfwprintf);
-__LDBL_REDIR_DECL (vwprintf);
-__LDBL_REDIR_DECL (vswprintf);
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (fwscanf, __nldbl___isoc99_fwscanf)
-__LDBL_REDIR1_DECL (wscanf, __nldbl___isoc99_wscanf)
-__LDBL_REDIR1_DECL (swscanf, __nldbl___isoc99_swscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (fwscanf, __isoc99_fwscanfieee128)
-__LDBL_REDIR1_DECL (wscanf, __isoc99_wscanfieee128)
-__LDBL_REDIR1_DECL (swscanf, __isoc99_swscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (fwscanf);
-__LDBL_REDIR_DECL (wscanf);
-__LDBL_REDIR_DECL (swscanf);
-# endif
-#endif
-
-#ifdef __USE_ISOC99
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold, wcstod);
-# else
-__LDBL_REDIR1_DECL (wcstold, __wcstoieee128)
-# endif
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (vfwscanf, __nldbl___isoc99_vfwscanf)
-__LDBL_REDIR1_DECL (vwscanf, __nldbl___isoc99_vwscanf)
-__LDBL_REDIR1_DECL (vswscanf, __nldbl___isoc99_vswscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (vfwscanf, __isoc99_vfwscanfieee128)
-__LDBL_REDIR1_DECL (vwscanf, __isoc99_vwscanfieee128)
-__LDBL_REDIR1_DECL (vswscanf, __isoc99_vswscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (vfwscanf);
-__LDBL_REDIR_DECL (vwscanf);
-__LDBL_REDIR_DECL (vswscanf);
-# endif
-#endif
-
-#ifdef __USE_GNU
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold_l, wcstod_l);
-# else
-__LDBL_REDIR1_DECL (wcstold_l, __wcstoieee128_l)
-# endif
-#endif
-
-#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR2_DECL (swprintf_chk)
-__LDBL_REDIR2_DECL (vswprintf_chk)
-# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR2_DECL (fwprintf_chk)
-__LDBL_REDIR2_DECL (wprintf_chk)
-__LDBL_REDIR2_DECL (vfwprintf_chk)
-__LDBL_REDIR2_DECL (vwprintf_chk)
-# endif
-#endif
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index f2dca7711a..548deeedbf 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -227,19 +227,18 @@ __NTH (wcsncat (wchar_t *__restrict __dest, const wchar_t *__restrict __src,
   return __wcsncat_alias (__dest, __src, __n);
 }
 
-
-extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
-			   int __flag, size_t __s_len,
-			   const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
-
-extern int __swprintf_alias (wchar_t *__restrict __s, size_t __n,
-			     const wchar_t *__restrict __fmt, ...)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("swprintf"))
-#endif
-     ;
-
+extern int __REDIRECT_LDBL_NTH (__swprintf_chk, (wchar_t *__restrict __s,
+						 size_t __n,
+						 int __flag, size_t __s_len,
+						 const wchar_t *__restrict __format,
+						 ...),
+				__swprintf_chkieee128, __nldbl___swprintf_chk);
+extern int __REDIRECT_LDBL_NTH (__vswprintf_chk, (wchar_t *__restrict __s,
+						  size_t __n,
+						  int __flag, size_t __s_len,
+						  const wchar_t *__restrict __format,
+						  __gnuc_va_list __arg),
+				__vswprintf_chkieee128, __nldbl___vswprintf_chk);
 
 #ifdef __va_arg_pack
 __fortify_function int
@@ -250,7 +249,7 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __swprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
 			   sz / sizeof (wchar_t), __fmt, __va_arg_pack ());
-  return __swprintf_alias (__s, __n, __fmt, __va_arg_pack ());
+  return swprintf (__s, __n, __fmt, __va_arg_pack ());
 }
 #elif !defined __cplusplus
 /* XXX We might want to have support in gcc for swprintf.  */
@@ -261,20 +260,6 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
    : swprintf (s, n, __VA_ARGS__))
 #endif
 
-extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
-			    int __flag, size_t __s_len,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-
-extern int __vswprintf_alias (wchar_t *__restrict __s, size_t __n,
-			      const wchar_t *__restrict __fmt,
-			      __gnuc_va_list __ap)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("vswprintf"))
-#endif
-     ;
-
 __fortify_function int
 __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
 		  const wchar_t *__restrict __fmt, __gnuc_va_list __ap))
@@ -283,21 +268,30 @@ __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __vswprintf_chk (__s, __n,  __USE_FORTIFY_LEVEL - 1,
 			    sz / sizeof (wchar_t), __fmt, __ap);
-  return __vswprintf_alias (__s, __n, __fmt, __ap);
+  return vswprintf (__s, __n, __fmt, __ap);
 }
 
 
 #if __USE_FORTIFY_LEVEL > 1
 
-extern int __fwprintf_chk (__FILE *__restrict __stream, int __flag,
-			   const wchar_t *__restrict __format, ...);
-extern int __wprintf_chk (int __flag, const wchar_t *__restrict __format,
-			  ...);
-extern int __vfwprintf_chk (__FILE *__restrict __stream, int __flag,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __ap);
-extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format,
-			   __gnuc_va_list __ap);
+extern int __REDIRECT_LDBL (__fwprintf_chk, (__FILE *__restrict __stream,
+					     int __flag,
+					     const wchar_t *__restrict __format,
+					     ...),
+			    __fwprintf_chkieee128, __nldbl___fwprintf_chk);
+extern int __REDIRECT_LDBL (__wprintf_chk, (int __flag,
+					    const wchar_t *__restrict __format,
+					    ...),
+			    __wprintf_chkieee128, __nldbl___wprintf_chk);
+extern int __REDIRECT_LDBL (__vfwprintf_chk, (__FILE *__restrict __stream,
+					      int __flag,
+					      const wchar_t *__restrict __format,
+					      __gnuc_va_list __ap),
+			   __vfwprintf_chkieee128, __nldbl___vfwprintf_chk);
+extern int __REDIRECT_LDBL (__vwprintf_chk, (int __flag,
+					     const wchar_t *__restrict __format,
+					     __gnuc_va_list __ap),
+			    __vwprintf_chkieee128, __nldbl___vwprintf_chk);
 
 # ifdef __va_arg_pack
 __fortify_function int
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 5d6a40853d..27406d0edb 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -382,8 +382,10 @@ extern double wcstod (const wchar_t *__restrict __nptr,
 /* Likewise for `float' and `long double' sizes of floating-point numbers.  */
 extern float wcstof (const wchar_t *__restrict __nptr,
 		     wchar_t **__restrict __endptr) __THROW;
-extern long double wcstold (const wchar_t *__restrict __nptr,
-			    wchar_t **__restrict __endptr) __THROW;
+extern long double __REDIRECT_LDBL_NTH (wcstold,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr),
+					__wcstoieee128, wcstod);
 #endif /* C99 */
 
 /* Likewise for `_FloatN' and `_FloatNx' when support is enabled.  */
@@ -498,9 +500,12 @@ extern float wcstof_l (const wchar_t *__restrict __nptr,
 		       wchar_t **__restrict __endptr, locale_t __loc)
      __THROW;
 
-extern long double wcstold_l (const wchar_t *__restrict __nptr,
-			      wchar_t **__restrict __endptr,
-			      locale_t __loc) __THROW;
+
+extern long double __REDIRECT_LDBL_NTH (wcstold_l,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr,
+					 locale_t __loc),
+					__wcstoieee128_l, wcstod_l);
 
 # if __HAVE_FLOAT16
 extern _Float16 wcstof16_l (const wchar_t *__restrict __nptr,
@@ -587,73 +592,61 @@ extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW
 /* Select orientation for stream.  */
 extern int fwide (__FILE *__fp, int __mode) __THROW;
 
-
 /* Write formatted output to STREAM.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int fwprintf (__FILE *__restrict __stream,
-		     const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (fwprintf, (__FILE *__restrict __stream,
+					  const wchar_t *__restrict __format,
+					  ...))
      /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
 /* Write formatted output to stdout.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int wprintf (const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (wprintf, (const wchar_t *__restrict __format, ...))
      /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
 /* Write formatted output of at most N characters to S.  */
-extern int swprintf (wchar_t *__restrict __s, size_t __n,
-		     const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
+extern int __REDIRECT_LDBL128_NTH (swprintf, (wchar_t *__restrict __s, size_t __n,
+					      const wchar_t *__restrict __format,
+					      ...))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
 
 /* Write formatted output to S from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vfwprintf (__FILE *__restrict __s,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vfwprintf, (__FILE *__restrict __s,
+					const wchar_t *__restrict __format,
+					__gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
 /* Write formatted output to stdout from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vwprintf (const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vwprintf, (const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
 /* Write formatted output of at most N character to S from argument
    list ARG.  */
-extern int vswprintf (wchar_t *__restrict __s, size_t __n,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
-
-
-/* Read formatted input from STREAM.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int fwscanf (__FILE *__restrict __stream,
-		    const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-/* Read formatted input from stdin.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int wscanf (const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
-/* Read formatted input from S.  */
-extern int swscanf (const wchar_t *__restrict __s,
-		    const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-
-/* For historical reasons, the C99-compliant versions of the scanf
-   functions are at alternative names.  When __LDBL_COMPAT or
-   __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
-   bits/wchar-ldbl.h.  */
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
+extern int __REDIRECT_LDBL128_NTH (vswprintf, (wchar_t *__restrict __s, size_t __n,
+				      const wchar_t *__restrict __format,
+					      __gnuc_va_list __arg))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
+
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __isoc99_fwscanfieee128, __nldbl___isoc99_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __isoc99_wscanfieee128,__nldbl___isoc99_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__isoc99_swscanfieee128, __nldbl___isoc99_swscanf);
+#  else
+#   ifdef __REDIRECT
 extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
 				 const wchar_t *__restrict __format, ...),
 		       __isoc99_fwscanf)
@@ -665,72 +658,129 @@ extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s,
 				     const wchar_t *__restrict __format,
 				     ...), __isoc99_swscanf)
      /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-#  else
+#   else
 extern int __isoc99_fwscanf (__FILE *__restrict __stream,
 			     const wchar_t *__restrict __format, ...);
 extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...);
 extern int __isoc99_swscanf (const wchar_t *__restrict __s,
 			     const wchar_t *__restrict __format, ...)
      __THROW;
-#   define fwscanf __isoc99_fwscanf
-#   define wscanf __isoc99_wscanf
-#   define swscanf __isoc99_swscanf
+#    define fwscanf __isoc99_fwscanf
+#    define wscanf __isoc99_wscanf
+#    define swscanf __isoc99_swscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __fwscanfieee128, __nldbl_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __wscanfieee128,__nldbl_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__swscanfieee128, __nldbl_swscanf);
+#  else
+/* Read formatted input from STREAM.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int fwscanf (__FILE *__restrict __stream,
+                    const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
+/* Read formatted input from stdin.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int wscanf (const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
+/* Read formatted input from S.  */
+extern int swscanf (const wchar_t *__restrict __s,
+                    const wchar_t *__restrict __format, ...)
+     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
 #  endif
 # endif
 
 #endif /* Use ISO C95, C99 and Unix98. */
 
 #ifdef __USE_ISOC99
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __isoc99_vfwscanfieee128, __nldbl___isoc99_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __isoc99_vwscanfieee128, __nldbl___isoc99_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__isoc99_vswscanfieee128,
+				__nldbl___isoc99_vswscanf);
+#  else
+#   ifdef __REDIRECT
+extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
+                                  const wchar_t *__restrict __format,
+                                  __gnuc_va_list __arg), __isoc99_vfwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
+                                 __gnuc_va_list __arg), __isoc99_vwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
+extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
+                                      const wchar_t *__restrict __format,
+                                      __gnuc_va_list __arg), __isoc99_vswscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+#   else
+extern int __isoc99_vfwscanf (__FILE *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg);
+extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
+                             __gnuc_va_list __arg);
+extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg) __THROW;
+#    define vfwscanf __isoc99_vfwscanf
+#    define vwscanf __isoc99_vwscanf
+#    define vswscanf __isoc99_vswscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __vfwscanfieee128, __nldbl_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __vwscanfieee128, __nldbl_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__vswscanfieee128,
+				__nldbl_vswscanf);
+#  else
 /* Read formatted input from S into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vfwscanf (__FILE *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
 /* Read formatted input from stdin into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vwscanf (const wchar_t *__restrict __format,
-		    __gnuc_va_list __arg)
+                    __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
 /* Read formatted input from S into argument list ARG.  */
 extern int vswscanf (const wchar_t *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-
-/* Same redirection as above for the v*wscanf family.  */
-# if !__GLIBC_USE (DEPRECATED_SCANF) \
-     && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
-     && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
-extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
-				  const wchar_t *__restrict __format,
-				  __gnuc_va_list __arg), __isoc99_vfwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
-				 __gnuc_va_list __arg), __isoc99_vwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
-extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
-				      const wchar_t *__restrict __format,
-				      __gnuc_va_list __arg), __isoc99_vswscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-#  else
-extern int __isoc99_vfwscanf (__FILE *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg);
-extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
-			     __gnuc_va_list __arg);
-extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg) __THROW;
-#   define vfwscanf __isoc99_vfwscanf
-#   define vwscanf __isoc99_vwscanf
-#   define vswscanf __isoc99_vswscanf
 #  endif
 # endif
 
@@ -867,11 +917,6 @@ extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
 # include <bits/wchar2.h>
 #endif
 
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/wchar-ldbl.h>
-#endif
-
 __END_DECLS
 
 #endif /* wchar.h  */


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

* [glibc/azanella/clang] Remove wchar-ldbl.h
@ 2022-03-15 18:35 Adhemerval Zanella
  0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-03-15 18:35 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ea6fa3c1b13feb63599de6708652660dae94750a

commit ea6fa3c1b13feb63599de6708652660dae94750a
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Feb 25 11:02:21 2022 -0300

    Remove wchar-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.
    
    A new macro, __REDIRECT_LDBL128, is used for function where only
    the binary128 alias is required.
    
    Checked on x86_64-linux-gnu and powerpc64le-linux-gnu.

Diff:
---
 include/bits/wchar-ldbl.h |   1 -
 misc/sys/cdefs.h          |  13 +++
 wcsmbs/Makefile           |   2 +-
 wcsmbs/bits/wchar-ldbl.h  |  91 ------------------
 wcsmbs/bits/wchar2.h      |  70 +++++++-------
 wcsmbs/wchar.h            | 229 +++++++++++++++++++++++++++-------------------
 6 files changed, 183 insertions(+), 223 deletions(-)

diff --git a/include/bits/wchar-ldbl.h b/include/bits/wchar-ldbl.h
deleted file mode 100644
index 29baa2f4d5..0000000000
--- a/include/bits/wchar-ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <wcsmbs/bits/wchar-ldbl.h>
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index e43b5d4b36..d8069a7590 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -567,16 +567,26 @@
 #  ifdef __REDIRECT
 #   define __REDIRECT_LDBL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , , proto, ieee128)
+#   define __REDIRECT_LDBL128(name, proto) \
+      __REDIRECT_LDBL1 (name, , , proto, __##name##ieee128)
 #   ifdef __cplusplus
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROW, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROW, , proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROWNL, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROWNL, , proto, __##name##ieee128)
 #   else
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROW, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROW, proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROWNL, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROWNL, proto, __##name##ieee128)
 #   endif /* __cplusplus */
 #  else
 _Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
@@ -606,6 +616,9 @@ _Static_assert (0, "Compat long double requires redirection on this platform");
 # define __REDIRECT_LDBL(name, proto, ieee128, compat) name proto
 # define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) name proto __THROW
 # define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) name proto __THROWNL
+# define __REDIRECT_LDBL128(name, proto) name proto
+# define __REDIRECT_LDBL128_NTH(name, proto) name proto __THROW
+# define __REDIRECT_LDBL128_NTHNL(name, proto) name proto __THROWNL
 #endif
 
 #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index df9a85f4a9..b67202526d 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -22,7 +22,7 @@ subdir	:= wcsmbs
 
 include ../Makeconfig
 
-headers	:= wchar.h bits/wchar.h bits/wchar2.h bits/wchar-ldbl.h uchar.h \
+headers	:= wchar.h bits/wchar.h bits/wchar2.h uchar.h \
 	   bits/types/__mbstate_t.h bits/types/mbstate_t.h bits/types/wint_t.h
 
 routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
diff --git a/wcsmbs/bits/wchar-ldbl.h b/wcsmbs/bits/wchar-ldbl.h
deleted file mode 100644
index f0d8506f83..0000000000
--- a/wcsmbs/bits/wchar-ldbl.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -mlong-double-64 compatibility mode for <wchar.h> functions.
-   Copyright (C) 2006-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 _WCHAR_H
-# error "Never include <bits/wchar-ldbl.h> directly; use <wchar.h> instead."
-#endif
-
-#if defined __USE_ISOC95 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (fwprintf);
-__LDBL_REDIR_DECL (wprintf);
-__LDBL_REDIR_DECL (swprintf);
-__LDBL_REDIR_DECL (vfwprintf);
-__LDBL_REDIR_DECL (vwprintf);
-__LDBL_REDIR_DECL (vswprintf);
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (fwscanf, __nldbl___isoc99_fwscanf)
-__LDBL_REDIR1_DECL (wscanf, __nldbl___isoc99_wscanf)
-__LDBL_REDIR1_DECL (swscanf, __nldbl___isoc99_swscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (fwscanf, __isoc99_fwscanfieee128)
-__LDBL_REDIR1_DECL (wscanf, __isoc99_wscanfieee128)
-__LDBL_REDIR1_DECL (swscanf, __isoc99_swscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (fwscanf);
-__LDBL_REDIR_DECL (wscanf);
-__LDBL_REDIR_DECL (swscanf);
-# endif
-#endif
-
-#ifdef __USE_ISOC99
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold, wcstod);
-# else
-__LDBL_REDIR1_DECL (wcstold, __wcstoieee128)
-# endif
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (vfwscanf, __nldbl___isoc99_vfwscanf)
-__LDBL_REDIR1_DECL (vwscanf, __nldbl___isoc99_vwscanf)
-__LDBL_REDIR1_DECL (vswscanf, __nldbl___isoc99_vswscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (vfwscanf, __isoc99_vfwscanfieee128)
-__LDBL_REDIR1_DECL (vwscanf, __isoc99_vwscanfieee128)
-__LDBL_REDIR1_DECL (vswscanf, __isoc99_vswscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (vfwscanf);
-__LDBL_REDIR_DECL (vwscanf);
-__LDBL_REDIR_DECL (vswscanf);
-# endif
-#endif
-
-#ifdef __USE_GNU
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold_l, wcstod_l);
-# else
-__LDBL_REDIR1_DECL (wcstold_l, __wcstoieee128_l)
-# endif
-#endif
-
-#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR2_DECL (swprintf_chk)
-__LDBL_REDIR2_DECL (vswprintf_chk)
-# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR2_DECL (fwprintf_chk)
-__LDBL_REDIR2_DECL (wprintf_chk)
-__LDBL_REDIR2_DECL (vfwprintf_chk)
-__LDBL_REDIR2_DECL (vwprintf_chk)
-# endif
-#endif
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index f2dca7711a..548deeedbf 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -227,19 +227,18 @@ __NTH (wcsncat (wchar_t *__restrict __dest, const wchar_t *__restrict __src,
   return __wcsncat_alias (__dest, __src, __n);
 }
 
-
-extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
-			   int __flag, size_t __s_len,
-			   const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
-
-extern int __swprintf_alias (wchar_t *__restrict __s, size_t __n,
-			     const wchar_t *__restrict __fmt, ...)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("swprintf"))
-#endif
-     ;
-
+extern int __REDIRECT_LDBL_NTH (__swprintf_chk, (wchar_t *__restrict __s,
+						 size_t __n,
+						 int __flag, size_t __s_len,
+						 const wchar_t *__restrict __format,
+						 ...),
+				__swprintf_chkieee128, __nldbl___swprintf_chk);
+extern int __REDIRECT_LDBL_NTH (__vswprintf_chk, (wchar_t *__restrict __s,
+						  size_t __n,
+						  int __flag, size_t __s_len,
+						  const wchar_t *__restrict __format,
+						  __gnuc_va_list __arg),
+				__vswprintf_chkieee128, __nldbl___vswprintf_chk);
 
 #ifdef __va_arg_pack
 __fortify_function int
@@ -250,7 +249,7 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __swprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
 			   sz / sizeof (wchar_t), __fmt, __va_arg_pack ());
-  return __swprintf_alias (__s, __n, __fmt, __va_arg_pack ());
+  return swprintf (__s, __n, __fmt, __va_arg_pack ());
 }
 #elif !defined __cplusplus
 /* XXX We might want to have support in gcc for swprintf.  */
@@ -261,20 +260,6 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
    : swprintf (s, n, __VA_ARGS__))
 #endif
 
-extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
-			    int __flag, size_t __s_len,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-
-extern int __vswprintf_alias (wchar_t *__restrict __s, size_t __n,
-			      const wchar_t *__restrict __fmt,
-			      __gnuc_va_list __ap)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("vswprintf"))
-#endif
-     ;
-
 __fortify_function int
 __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
 		  const wchar_t *__restrict __fmt, __gnuc_va_list __ap))
@@ -283,21 +268,30 @@ __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __vswprintf_chk (__s, __n,  __USE_FORTIFY_LEVEL - 1,
 			    sz / sizeof (wchar_t), __fmt, __ap);
-  return __vswprintf_alias (__s, __n, __fmt, __ap);
+  return vswprintf (__s, __n, __fmt, __ap);
 }
 
 
 #if __USE_FORTIFY_LEVEL > 1
 
-extern int __fwprintf_chk (__FILE *__restrict __stream, int __flag,
-			   const wchar_t *__restrict __format, ...);
-extern int __wprintf_chk (int __flag, const wchar_t *__restrict __format,
-			  ...);
-extern int __vfwprintf_chk (__FILE *__restrict __stream, int __flag,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __ap);
-extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format,
-			   __gnuc_va_list __ap);
+extern int __REDIRECT_LDBL (__fwprintf_chk, (__FILE *__restrict __stream,
+					     int __flag,
+					     const wchar_t *__restrict __format,
+					     ...),
+			    __fwprintf_chkieee128, __nldbl___fwprintf_chk);
+extern int __REDIRECT_LDBL (__wprintf_chk, (int __flag,
+					    const wchar_t *__restrict __format,
+					    ...),
+			    __wprintf_chkieee128, __nldbl___wprintf_chk);
+extern int __REDIRECT_LDBL (__vfwprintf_chk, (__FILE *__restrict __stream,
+					      int __flag,
+					      const wchar_t *__restrict __format,
+					      __gnuc_va_list __ap),
+			   __vfwprintf_chkieee128, __nldbl___vfwprintf_chk);
+extern int __REDIRECT_LDBL (__vwprintf_chk, (int __flag,
+					     const wchar_t *__restrict __format,
+					     __gnuc_va_list __ap),
+			    __vwprintf_chkieee128, __nldbl___vwprintf_chk);
 
 # ifdef __va_arg_pack
 __fortify_function int
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 5d6a40853d..27406d0edb 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -382,8 +382,10 @@ extern double wcstod (const wchar_t *__restrict __nptr,
 /* Likewise for `float' and `long double' sizes of floating-point numbers.  */
 extern float wcstof (const wchar_t *__restrict __nptr,
 		     wchar_t **__restrict __endptr) __THROW;
-extern long double wcstold (const wchar_t *__restrict __nptr,
-			    wchar_t **__restrict __endptr) __THROW;
+extern long double __REDIRECT_LDBL_NTH (wcstold,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr),
+					__wcstoieee128, wcstod);
 #endif /* C99 */
 
 /* Likewise for `_FloatN' and `_FloatNx' when support is enabled.  */
@@ -498,9 +500,12 @@ extern float wcstof_l (const wchar_t *__restrict __nptr,
 		       wchar_t **__restrict __endptr, locale_t __loc)
      __THROW;
 
-extern long double wcstold_l (const wchar_t *__restrict __nptr,
-			      wchar_t **__restrict __endptr,
-			      locale_t __loc) __THROW;
+
+extern long double __REDIRECT_LDBL_NTH (wcstold_l,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr,
+					 locale_t __loc),
+					__wcstoieee128_l, wcstod_l);
 
 # if __HAVE_FLOAT16
 extern _Float16 wcstof16_l (const wchar_t *__restrict __nptr,
@@ -587,73 +592,61 @@ extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW
 /* Select orientation for stream.  */
 extern int fwide (__FILE *__fp, int __mode) __THROW;
 
-
 /* Write formatted output to STREAM.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int fwprintf (__FILE *__restrict __stream,
-		     const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (fwprintf, (__FILE *__restrict __stream,
+					  const wchar_t *__restrict __format,
+					  ...))
      /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
 /* Write formatted output to stdout.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int wprintf (const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (wprintf, (const wchar_t *__restrict __format, ...))
      /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
 /* Write formatted output of at most N characters to S.  */
-extern int swprintf (wchar_t *__restrict __s, size_t __n,
-		     const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
+extern int __REDIRECT_LDBL128_NTH (swprintf, (wchar_t *__restrict __s, size_t __n,
+					      const wchar_t *__restrict __format,
+					      ...))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
 
 /* Write formatted output to S from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vfwprintf (__FILE *__restrict __s,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vfwprintf, (__FILE *__restrict __s,
+					const wchar_t *__restrict __format,
+					__gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
 /* Write formatted output to stdout from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vwprintf (const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vwprintf, (const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
 /* Write formatted output of at most N character to S from argument
    list ARG.  */
-extern int vswprintf (wchar_t *__restrict __s, size_t __n,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
-
-
-/* Read formatted input from STREAM.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int fwscanf (__FILE *__restrict __stream,
-		    const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-/* Read formatted input from stdin.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int wscanf (const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
-/* Read formatted input from S.  */
-extern int swscanf (const wchar_t *__restrict __s,
-		    const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-
-/* For historical reasons, the C99-compliant versions of the scanf
-   functions are at alternative names.  When __LDBL_COMPAT or
-   __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
-   bits/wchar-ldbl.h.  */
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
+extern int __REDIRECT_LDBL128_NTH (vswprintf, (wchar_t *__restrict __s, size_t __n,
+				      const wchar_t *__restrict __format,
+					      __gnuc_va_list __arg))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
+
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __isoc99_fwscanfieee128, __nldbl___isoc99_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __isoc99_wscanfieee128,__nldbl___isoc99_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__isoc99_swscanfieee128, __nldbl___isoc99_swscanf);
+#  else
+#   ifdef __REDIRECT
 extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
 				 const wchar_t *__restrict __format, ...),
 		       __isoc99_fwscanf)
@@ -665,72 +658,129 @@ extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s,
 				     const wchar_t *__restrict __format,
 				     ...), __isoc99_swscanf)
      /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-#  else
+#   else
 extern int __isoc99_fwscanf (__FILE *__restrict __stream,
 			     const wchar_t *__restrict __format, ...);
 extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...);
 extern int __isoc99_swscanf (const wchar_t *__restrict __s,
 			     const wchar_t *__restrict __format, ...)
      __THROW;
-#   define fwscanf __isoc99_fwscanf
-#   define wscanf __isoc99_wscanf
-#   define swscanf __isoc99_swscanf
+#    define fwscanf __isoc99_fwscanf
+#    define wscanf __isoc99_wscanf
+#    define swscanf __isoc99_swscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __fwscanfieee128, __nldbl_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __wscanfieee128,__nldbl_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__swscanfieee128, __nldbl_swscanf);
+#  else
+/* Read formatted input from STREAM.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int fwscanf (__FILE *__restrict __stream,
+                    const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
+/* Read formatted input from stdin.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int wscanf (const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
+/* Read formatted input from S.  */
+extern int swscanf (const wchar_t *__restrict __s,
+                    const wchar_t *__restrict __format, ...)
+     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
 #  endif
 # endif
 
 #endif /* Use ISO C95, C99 and Unix98. */
 
 #ifdef __USE_ISOC99
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __isoc99_vfwscanfieee128, __nldbl___isoc99_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __isoc99_vwscanfieee128, __nldbl___isoc99_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__isoc99_vswscanfieee128,
+				__nldbl___isoc99_vswscanf);
+#  else
+#   ifdef __REDIRECT
+extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
+                                  const wchar_t *__restrict __format,
+                                  __gnuc_va_list __arg), __isoc99_vfwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
+                                 __gnuc_va_list __arg), __isoc99_vwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
+extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
+                                      const wchar_t *__restrict __format,
+                                      __gnuc_va_list __arg), __isoc99_vswscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+#   else
+extern int __isoc99_vfwscanf (__FILE *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg);
+extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
+                             __gnuc_va_list __arg);
+extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg) __THROW;
+#    define vfwscanf __isoc99_vfwscanf
+#    define vwscanf __isoc99_vwscanf
+#    define vswscanf __isoc99_vswscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __vfwscanfieee128, __nldbl_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __vwscanfieee128, __nldbl_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__vswscanfieee128,
+				__nldbl_vswscanf);
+#  else
 /* Read formatted input from S into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vfwscanf (__FILE *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
 /* Read formatted input from stdin into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vwscanf (const wchar_t *__restrict __format,
-		    __gnuc_va_list __arg)
+                    __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
 /* Read formatted input from S into argument list ARG.  */
 extern int vswscanf (const wchar_t *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-
-/* Same redirection as above for the v*wscanf family.  */
-# if !__GLIBC_USE (DEPRECATED_SCANF) \
-     && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
-     && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
-extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
-				  const wchar_t *__restrict __format,
-				  __gnuc_va_list __arg), __isoc99_vfwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
-				 __gnuc_va_list __arg), __isoc99_vwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
-extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
-				      const wchar_t *__restrict __format,
-				      __gnuc_va_list __arg), __isoc99_vswscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-#  else
-extern int __isoc99_vfwscanf (__FILE *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg);
-extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
-			     __gnuc_va_list __arg);
-extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg) __THROW;
-#   define vfwscanf __isoc99_vfwscanf
-#   define vwscanf __isoc99_vwscanf
-#   define vswscanf __isoc99_vswscanf
 #  endif
 # endif
 
@@ -867,11 +917,6 @@ extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
 # include <bits/wchar2.h>
 #endif
 
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/wchar-ldbl.h>
-#endif
-
 __END_DECLS
 
 #endif /* wchar.h  */


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

* [glibc/azanella/clang] Remove wchar-ldbl.h
@ 2022-03-11 17:19 Adhemerval Zanella
  0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-03-11 17:19 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8fa924dc22a40c8e9d7b76ab6e7ec18ee3ac0b19

commit 8fa924dc22a40c8e9d7b76ab6e7ec18ee3ac0b19
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Feb 25 11:02:21 2022 -0300

    Remove wchar-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.
    
    A new macro, __REDIRECT_LDBL128, is used for function where only
    the binary128 alias is required.
    
    Checked on x86_64-linux-gnu and powerpc64le-linux-gnu.

Diff:
---
 include/bits/wchar-ldbl.h |   1 -
 misc/sys/cdefs.h          |  13 +++
 wcsmbs/Makefile           |   2 +-
 wcsmbs/bits/wchar-ldbl.h  |  91 ------------------
 wcsmbs/bits/wchar2.h      |  70 +++++++-------
 wcsmbs/wchar.h            | 229 +++++++++++++++++++++++++++-------------------
 6 files changed, 183 insertions(+), 223 deletions(-)

diff --git a/include/bits/wchar-ldbl.h b/include/bits/wchar-ldbl.h
deleted file mode 100644
index 29baa2f4d5..0000000000
--- a/include/bits/wchar-ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <wcsmbs/bits/wchar-ldbl.h>
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index e43b5d4b36..d8069a7590 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -567,16 +567,26 @@
 #  ifdef __REDIRECT
 #   define __REDIRECT_LDBL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , , proto, ieee128)
+#   define __REDIRECT_LDBL128(name, proto) \
+      __REDIRECT_LDBL1 (name, , , proto, __##name##ieee128)
 #   ifdef __cplusplus
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROW, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROW, , proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROWNL, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROWNL, , proto, __##name##ieee128)
 #   else
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROW, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROW, proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROWNL, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROWNL, proto, __##name##ieee128)
 #   endif /* __cplusplus */
 #  else
 _Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
@@ -606,6 +616,9 @@ _Static_assert (0, "Compat long double requires redirection on this platform");
 # define __REDIRECT_LDBL(name, proto, ieee128, compat) name proto
 # define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) name proto __THROW
 # define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) name proto __THROWNL
+# define __REDIRECT_LDBL128(name, proto) name proto
+# define __REDIRECT_LDBL128_NTH(name, proto) name proto __THROW
+# define __REDIRECT_LDBL128_NTHNL(name, proto) name proto __THROWNL
 #endif
 
 #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index df9a85f4a9..b67202526d 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -22,7 +22,7 @@ subdir	:= wcsmbs
 
 include ../Makeconfig
 
-headers	:= wchar.h bits/wchar.h bits/wchar2.h bits/wchar-ldbl.h uchar.h \
+headers	:= wchar.h bits/wchar.h bits/wchar2.h uchar.h \
 	   bits/types/__mbstate_t.h bits/types/mbstate_t.h bits/types/wint_t.h
 
 routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
diff --git a/wcsmbs/bits/wchar-ldbl.h b/wcsmbs/bits/wchar-ldbl.h
deleted file mode 100644
index f0d8506f83..0000000000
--- a/wcsmbs/bits/wchar-ldbl.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -mlong-double-64 compatibility mode for <wchar.h> functions.
-   Copyright (C) 2006-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 _WCHAR_H
-# error "Never include <bits/wchar-ldbl.h> directly; use <wchar.h> instead."
-#endif
-
-#if defined __USE_ISOC95 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (fwprintf);
-__LDBL_REDIR_DECL (wprintf);
-__LDBL_REDIR_DECL (swprintf);
-__LDBL_REDIR_DECL (vfwprintf);
-__LDBL_REDIR_DECL (vwprintf);
-__LDBL_REDIR_DECL (vswprintf);
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (fwscanf, __nldbl___isoc99_fwscanf)
-__LDBL_REDIR1_DECL (wscanf, __nldbl___isoc99_wscanf)
-__LDBL_REDIR1_DECL (swscanf, __nldbl___isoc99_swscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (fwscanf, __isoc99_fwscanfieee128)
-__LDBL_REDIR1_DECL (wscanf, __isoc99_wscanfieee128)
-__LDBL_REDIR1_DECL (swscanf, __isoc99_swscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (fwscanf);
-__LDBL_REDIR_DECL (wscanf);
-__LDBL_REDIR_DECL (swscanf);
-# endif
-#endif
-
-#ifdef __USE_ISOC99
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold, wcstod);
-# else
-__LDBL_REDIR1_DECL (wcstold, __wcstoieee128)
-# endif
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (vfwscanf, __nldbl___isoc99_vfwscanf)
-__LDBL_REDIR1_DECL (vwscanf, __nldbl___isoc99_vwscanf)
-__LDBL_REDIR1_DECL (vswscanf, __nldbl___isoc99_vswscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (vfwscanf, __isoc99_vfwscanfieee128)
-__LDBL_REDIR1_DECL (vwscanf, __isoc99_vwscanfieee128)
-__LDBL_REDIR1_DECL (vswscanf, __isoc99_vswscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (vfwscanf);
-__LDBL_REDIR_DECL (vwscanf);
-__LDBL_REDIR_DECL (vswscanf);
-# endif
-#endif
-
-#ifdef __USE_GNU
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold_l, wcstod_l);
-# else
-__LDBL_REDIR1_DECL (wcstold_l, __wcstoieee128_l)
-# endif
-#endif
-
-#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR2_DECL (swprintf_chk)
-__LDBL_REDIR2_DECL (vswprintf_chk)
-# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR2_DECL (fwprintf_chk)
-__LDBL_REDIR2_DECL (wprintf_chk)
-__LDBL_REDIR2_DECL (vfwprintf_chk)
-__LDBL_REDIR2_DECL (vwprintf_chk)
-# endif
-#endif
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index f2dca7711a..548deeedbf 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -227,19 +227,18 @@ __NTH (wcsncat (wchar_t *__restrict __dest, const wchar_t *__restrict __src,
   return __wcsncat_alias (__dest, __src, __n);
 }
 
-
-extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
-			   int __flag, size_t __s_len,
-			   const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
-
-extern int __swprintf_alias (wchar_t *__restrict __s, size_t __n,
-			     const wchar_t *__restrict __fmt, ...)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("swprintf"))
-#endif
-     ;
-
+extern int __REDIRECT_LDBL_NTH (__swprintf_chk, (wchar_t *__restrict __s,
+						 size_t __n,
+						 int __flag, size_t __s_len,
+						 const wchar_t *__restrict __format,
+						 ...),
+				__swprintf_chkieee128, __nldbl___swprintf_chk);
+extern int __REDIRECT_LDBL_NTH (__vswprintf_chk, (wchar_t *__restrict __s,
+						  size_t __n,
+						  int __flag, size_t __s_len,
+						  const wchar_t *__restrict __format,
+						  __gnuc_va_list __arg),
+				__vswprintf_chkieee128, __nldbl___vswprintf_chk);
 
 #ifdef __va_arg_pack
 __fortify_function int
@@ -250,7 +249,7 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __swprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
 			   sz / sizeof (wchar_t), __fmt, __va_arg_pack ());
-  return __swprintf_alias (__s, __n, __fmt, __va_arg_pack ());
+  return swprintf (__s, __n, __fmt, __va_arg_pack ());
 }
 #elif !defined __cplusplus
 /* XXX We might want to have support in gcc for swprintf.  */
@@ -261,20 +260,6 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
    : swprintf (s, n, __VA_ARGS__))
 #endif
 
-extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
-			    int __flag, size_t __s_len,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-
-extern int __vswprintf_alias (wchar_t *__restrict __s, size_t __n,
-			      const wchar_t *__restrict __fmt,
-			      __gnuc_va_list __ap)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("vswprintf"))
-#endif
-     ;
-
 __fortify_function int
 __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
 		  const wchar_t *__restrict __fmt, __gnuc_va_list __ap))
@@ -283,21 +268,30 @@ __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __vswprintf_chk (__s, __n,  __USE_FORTIFY_LEVEL - 1,
 			    sz / sizeof (wchar_t), __fmt, __ap);
-  return __vswprintf_alias (__s, __n, __fmt, __ap);
+  return vswprintf (__s, __n, __fmt, __ap);
 }
 
 
 #if __USE_FORTIFY_LEVEL > 1
 
-extern int __fwprintf_chk (__FILE *__restrict __stream, int __flag,
-			   const wchar_t *__restrict __format, ...);
-extern int __wprintf_chk (int __flag, const wchar_t *__restrict __format,
-			  ...);
-extern int __vfwprintf_chk (__FILE *__restrict __stream, int __flag,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __ap);
-extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format,
-			   __gnuc_va_list __ap);
+extern int __REDIRECT_LDBL (__fwprintf_chk, (__FILE *__restrict __stream,
+					     int __flag,
+					     const wchar_t *__restrict __format,
+					     ...),
+			    __fwprintf_chkieee128, __nldbl___fwprintf_chk);
+extern int __REDIRECT_LDBL (__wprintf_chk, (int __flag,
+					    const wchar_t *__restrict __format,
+					    ...),
+			    __wprintf_chkieee128, __nldbl___wprintf_chk);
+extern int __REDIRECT_LDBL (__vfwprintf_chk, (__FILE *__restrict __stream,
+					      int __flag,
+					      const wchar_t *__restrict __format,
+					      __gnuc_va_list __ap),
+			   __vfwprintf_chkieee128, __nldbl___vfwprintf_chk);
+extern int __REDIRECT_LDBL (__vwprintf_chk, (int __flag,
+					     const wchar_t *__restrict __format,
+					     __gnuc_va_list __ap),
+			    __vwprintf_chkieee128, __nldbl___vwprintf_chk);
 
 # ifdef __va_arg_pack
 __fortify_function int
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 5d6a40853d..27406d0edb 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -382,8 +382,10 @@ extern double wcstod (const wchar_t *__restrict __nptr,
 /* Likewise for `float' and `long double' sizes of floating-point numbers.  */
 extern float wcstof (const wchar_t *__restrict __nptr,
 		     wchar_t **__restrict __endptr) __THROW;
-extern long double wcstold (const wchar_t *__restrict __nptr,
-			    wchar_t **__restrict __endptr) __THROW;
+extern long double __REDIRECT_LDBL_NTH (wcstold,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr),
+					__wcstoieee128, wcstod);
 #endif /* C99 */
 
 /* Likewise for `_FloatN' and `_FloatNx' when support is enabled.  */
@@ -498,9 +500,12 @@ extern float wcstof_l (const wchar_t *__restrict __nptr,
 		       wchar_t **__restrict __endptr, locale_t __loc)
      __THROW;
 
-extern long double wcstold_l (const wchar_t *__restrict __nptr,
-			      wchar_t **__restrict __endptr,
-			      locale_t __loc) __THROW;
+
+extern long double __REDIRECT_LDBL_NTH (wcstold_l,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr,
+					 locale_t __loc),
+					__wcstoieee128_l, wcstod_l);
 
 # if __HAVE_FLOAT16
 extern _Float16 wcstof16_l (const wchar_t *__restrict __nptr,
@@ -587,73 +592,61 @@ extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW
 /* Select orientation for stream.  */
 extern int fwide (__FILE *__fp, int __mode) __THROW;
 
-
 /* Write formatted output to STREAM.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int fwprintf (__FILE *__restrict __stream,
-		     const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (fwprintf, (__FILE *__restrict __stream,
+					  const wchar_t *__restrict __format,
+					  ...))
      /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
 /* Write formatted output to stdout.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int wprintf (const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (wprintf, (const wchar_t *__restrict __format, ...))
      /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
 /* Write formatted output of at most N characters to S.  */
-extern int swprintf (wchar_t *__restrict __s, size_t __n,
-		     const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
+extern int __REDIRECT_LDBL128_NTH (swprintf, (wchar_t *__restrict __s, size_t __n,
+					      const wchar_t *__restrict __format,
+					      ...))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
 
 /* Write formatted output to S from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vfwprintf (__FILE *__restrict __s,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vfwprintf, (__FILE *__restrict __s,
+					const wchar_t *__restrict __format,
+					__gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
 /* Write formatted output to stdout from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vwprintf (const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vwprintf, (const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
 /* Write formatted output of at most N character to S from argument
    list ARG.  */
-extern int vswprintf (wchar_t *__restrict __s, size_t __n,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
-
-
-/* Read formatted input from STREAM.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int fwscanf (__FILE *__restrict __stream,
-		    const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-/* Read formatted input from stdin.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int wscanf (const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
-/* Read formatted input from S.  */
-extern int swscanf (const wchar_t *__restrict __s,
-		    const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-
-/* For historical reasons, the C99-compliant versions of the scanf
-   functions are at alternative names.  When __LDBL_COMPAT or
-   __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
-   bits/wchar-ldbl.h.  */
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
+extern int __REDIRECT_LDBL128_NTH (vswprintf, (wchar_t *__restrict __s, size_t __n,
+				      const wchar_t *__restrict __format,
+					      __gnuc_va_list __arg))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
+
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __isoc99_fwscanfieee128, __nldbl___isoc99_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __isoc99_wscanfieee128,__nldbl___isoc99_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__isoc99_swscanfieee128, __nldbl___isoc99_swscanf);
+#  else
+#   ifdef __REDIRECT
 extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
 				 const wchar_t *__restrict __format, ...),
 		       __isoc99_fwscanf)
@@ -665,72 +658,129 @@ extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s,
 				     const wchar_t *__restrict __format,
 				     ...), __isoc99_swscanf)
      /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-#  else
+#   else
 extern int __isoc99_fwscanf (__FILE *__restrict __stream,
 			     const wchar_t *__restrict __format, ...);
 extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...);
 extern int __isoc99_swscanf (const wchar_t *__restrict __s,
 			     const wchar_t *__restrict __format, ...)
      __THROW;
-#   define fwscanf __isoc99_fwscanf
-#   define wscanf __isoc99_wscanf
-#   define swscanf __isoc99_swscanf
+#    define fwscanf __isoc99_fwscanf
+#    define wscanf __isoc99_wscanf
+#    define swscanf __isoc99_swscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __fwscanfieee128, __nldbl_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __wscanfieee128,__nldbl_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__swscanfieee128, __nldbl_swscanf);
+#  else
+/* Read formatted input from STREAM.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int fwscanf (__FILE *__restrict __stream,
+                    const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
+/* Read formatted input from stdin.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int wscanf (const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
+/* Read formatted input from S.  */
+extern int swscanf (const wchar_t *__restrict __s,
+                    const wchar_t *__restrict __format, ...)
+     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
 #  endif
 # endif
 
 #endif /* Use ISO C95, C99 and Unix98. */
 
 #ifdef __USE_ISOC99
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __isoc99_vfwscanfieee128, __nldbl___isoc99_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __isoc99_vwscanfieee128, __nldbl___isoc99_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__isoc99_vswscanfieee128,
+				__nldbl___isoc99_vswscanf);
+#  else
+#   ifdef __REDIRECT
+extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
+                                  const wchar_t *__restrict __format,
+                                  __gnuc_va_list __arg), __isoc99_vfwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
+                                 __gnuc_va_list __arg), __isoc99_vwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
+extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
+                                      const wchar_t *__restrict __format,
+                                      __gnuc_va_list __arg), __isoc99_vswscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+#   else
+extern int __isoc99_vfwscanf (__FILE *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg);
+extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
+                             __gnuc_va_list __arg);
+extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg) __THROW;
+#    define vfwscanf __isoc99_vfwscanf
+#    define vwscanf __isoc99_vwscanf
+#    define vswscanf __isoc99_vswscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __vfwscanfieee128, __nldbl_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __vwscanfieee128, __nldbl_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__vswscanfieee128,
+				__nldbl_vswscanf);
+#  else
 /* Read formatted input from S into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vfwscanf (__FILE *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
 /* Read formatted input from stdin into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vwscanf (const wchar_t *__restrict __format,
-		    __gnuc_va_list __arg)
+                    __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
 /* Read formatted input from S into argument list ARG.  */
 extern int vswscanf (const wchar_t *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-
-/* Same redirection as above for the v*wscanf family.  */
-# if !__GLIBC_USE (DEPRECATED_SCANF) \
-     && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
-     && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
-extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
-				  const wchar_t *__restrict __format,
-				  __gnuc_va_list __arg), __isoc99_vfwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
-				 __gnuc_va_list __arg), __isoc99_vwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
-extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
-				      const wchar_t *__restrict __format,
-				      __gnuc_va_list __arg), __isoc99_vswscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-#  else
-extern int __isoc99_vfwscanf (__FILE *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg);
-extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
-			     __gnuc_va_list __arg);
-extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg) __THROW;
-#   define vfwscanf __isoc99_vfwscanf
-#   define vwscanf __isoc99_vwscanf
-#   define vswscanf __isoc99_vswscanf
 #  endif
 # endif
 
@@ -867,11 +917,6 @@ extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
 # include <bits/wchar2.h>
 #endif
 
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/wchar-ldbl.h>
-#endif
-
 __END_DECLS
 
 #endif /* wchar.h  */


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

* [glibc/azanella/clang] Remove wchar-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=5fd894f6b93efe64beae887d2547afeb70f06137

commit 5fd894f6b93efe64beae887d2547afeb70f06137
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Feb 25 11:02:21 2022 -0300

    Remove wchar-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.
    
    A new macro, __REDIRECT_LDBL128, is used for function where only
    the binary128 alias is required.
    
    Checked on x86_64-linux-gnu and powerpc64le-linux-gnu.

Diff:
---
 include/bits/wchar-ldbl.h |   1 -
 misc/sys/cdefs.h          |  13 +++
 wcsmbs/Makefile           |   2 +-
 wcsmbs/bits/wchar-ldbl.h  |  91 ------------------
 wcsmbs/bits/wchar2.h      |  70 +++++++-------
 wcsmbs/wchar.h            | 229 +++++++++++++++++++++++++++-------------------
 6 files changed, 183 insertions(+), 223 deletions(-)

diff --git a/include/bits/wchar-ldbl.h b/include/bits/wchar-ldbl.h
deleted file mode 100644
index 29baa2f4d5..0000000000
--- a/include/bits/wchar-ldbl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <wcsmbs/bits/wchar-ldbl.h>
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index e43b5d4b36..d8069a7590 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -567,16 +567,26 @@
 #  ifdef __REDIRECT
 #   define __REDIRECT_LDBL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , , proto, ieee128)
+#   define __REDIRECT_LDBL128(name, proto) \
+      __REDIRECT_LDBL1 (name, , , proto, __##name##ieee128)
 #   ifdef __cplusplus
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROW, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROW, , proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, __THROWNL, , proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, __THROWNL, , proto, __##name##ieee128)
 #   else
 #    define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROW, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTH(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROW, proto, __##name##ieee128)
 #    define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) \
       __REDIRECT_LDBL1 (name, , __THROWNL, proto, ieee128)
+#    define __REDIRECT_LDBL128_NTHNL(name, proto) \
+      __REDIRECT_LDBL1 (name, , __THROWNL, proto, __##name##ieee128)
 #   endif /* __cplusplus */
 #  else
 _Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
@@ -606,6 +616,9 @@ _Static_assert (0, "Compat long double requires redirection on this platform");
 # define __REDIRECT_LDBL(name, proto, ieee128, compat) name proto
 # define __REDIRECT_LDBL_NTH(name, proto, ieee128, compat) name proto __THROW
 # define __REDIRECT_LDBL_NTHNL(name, proto, ieee128, compat) name proto __THROWNL
+# define __REDIRECT_LDBL128(name, proto) name proto
+# define __REDIRECT_LDBL128_NTH(name, proto) name proto __THROW
+# define __REDIRECT_LDBL128_NTHNL(name, proto) name proto __THROWNL
 #endif
 
 #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index df9a85f4a9..b67202526d 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -22,7 +22,7 @@ subdir	:= wcsmbs
 
 include ../Makeconfig
 
-headers	:= wchar.h bits/wchar.h bits/wchar2.h bits/wchar-ldbl.h uchar.h \
+headers	:= wchar.h bits/wchar.h bits/wchar2.h uchar.h \
 	   bits/types/__mbstate_t.h bits/types/mbstate_t.h bits/types/wint_t.h
 
 routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
diff --git a/wcsmbs/bits/wchar-ldbl.h b/wcsmbs/bits/wchar-ldbl.h
deleted file mode 100644
index f0d8506f83..0000000000
--- a/wcsmbs/bits/wchar-ldbl.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -mlong-double-64 compatibility mode for <wchar.h> functions.
-   Copyright (C) 2006-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 _WCHAR_H
-# error "Never include <bits/wchar-ldbl.h> directly; use <wchar.h> instead."
-#endif
-
-#if defined __USE_ISOC95 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (fwprintf);
-__LDBL_REDIR_DECL (wprintf);
-__LDBL_REDIR_DECL (swprintf);
-__LDBL_REDIR_DECL (vfwprintf);
-__LDBL_REDIR_DECL (vwprintf);
-__LDBL_REDIR_DECL (vswprintf);
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (fwscanf, __nldbl___isoc99_fwscanf)
-__LDBL_REDIR1_DECL (wscanf, __nldbl___isoc99_wscanf)
-__LDBL_REDIR1_DECL (swscanf, __nldbl___isoc99_swscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (fwscanf, __isoc99_fwscanfieee128)
-__LDBL_REDIR1_DECL (wscanf, __isoc99_wscanfieee128)
-__LDBL_REDIR1_DECL (swscanf, __isoc99_swscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (fwscanf);
-__LDBL_REDIR_DECL (wscanf);
-__LDBL_REDIR_DECL (swscanf);
-# endif
-#endif
-
-#ifdef __USE_ISOC99
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold, wcstod);
-# else
-__LDBL_REDIR1_DECL (wcstold, __wcstoieee128)
-# endif
-# if !__GLIBC_USE (DEPRECATED_SCANF)
-#  if defined __LDBL_COMPAT
-__LDBL_REDIR1_DECL (vfwscanf, __nldbl___isoc99_vfwscanf)
-__LDBL_REDIR1_DECL (vwscanf, __nldbl___isoc99_vwscanf)
-__LDBL_REDIR1_DECL (vswscanf, __nldbl___isoc99_vswscanf)
-#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-__LDBL_REDIR1_DECL (vfwscanf, __isoc99_vfwscanfieee128)
-__LDBL_REDIR1_DECL (vwscanf, __isoc99_vwscanfieee128)
-__LDBL_REDIR1_DECL (vswscanf, __isoc99_vswscanfieee128)
-#  else
-#   error bits/stdlib-ldbl.h included when no ldbl redirections are required.
-#  endif
-# else
-__LDBL_REDIR_DECL (vfwscanf);
-__LDBL_REDIR_DECL (vwscanf);
-__LDBL_REDIR_DECL (vswscanf);
-# endif
-#endif
-
-#ifdef __USE_GNU
-# ifdef __LDBL_COMPAT
-__LDBL_REDIR1_DECL (wcstold_l, wcstod_l);
-# else
-__LDBL_REDIR1_DECL (wcstold_l, __wcstoieee128_l)
-# endif
-#endif
-
-#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR2_DECL (swprintf_chk)
-__LDBL_REDIR2_DECL (vswprintf_chk)
-# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR2_DECL (fwprintf_chk)
-__LDBL_REDIR2_DECL (wprintf_chk)
-__LDBL_REDIR2_DECL (vfwprintf_chk)
-__LDBL_REDIR2_DECL (vwprintf_chk)
-# endif
-#endif
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index f2dca7711a..548deeedbf 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -227,19 +227,18 @@ __NTH (wcsncat (wchar_t *__restrict __dest, const wchar_t *__restrict __src,
   return __wcsncat_alias (__dest, __src, __n);
 }
 
-
-extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
-			   int __flag, size_t __s_len,
-			   const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
-
-extern int __swprintf_alias (wchar_t *__restrict __s, size_t __n,
-			     const wchar_t *__restrict __fmt, ...)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("swprintf"))
-#endif
-     ;
-
+extern int __REDIRECT_LDBL_NTH (__swprintf_chk, (wchar_t *__restrict __s,
+						 size_t __n,
+						 int __flag, size_t __s_len,
+						 const wchar_t *__restrict __format,
+						 ...),
+				__swprintf_chkieee128, __nldbl___swprintf_chk);
+extern int __REDIRECT_LDBL_NTH (__vswprintf_chk, (wchar_t *__restrict __s,
+						  size_t __n,
+						  int __flag, size_t __s_len,
+						  const wchar_t *__restrict __format,
+						  __gnuc_va_list __arg),
+				__vswprintf_chkieee128, __nldbl___vswprintf_chk);
 
 #ifdef __va_arg_pack
 __fortify_function int
@@ -250,7 +249,7 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __swprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
 			   sz / sizeof (wchar_t), __fmt, __va_arg_pack ());
-  return __swprintf_alias (__s, __n, __fmt, __va_arg_pack ());
+  return swprintf (__s, __n, __fmt, __va_arg_pack ());
 }
 #elif !defined __cplusplus
 /* XXX We might want to have support in gcc for swprintf.  */
@@ -261,20 +260,6 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
    : swprintf (s, n, __VA_ARGS__))
 #endif
 
-extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
-			    int __flag, size_t __s_len,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-
-extern int __vswprintf_alias (wchar_t *__restrict __s, size_t __n,
-			      const wchar_t *__restrict __fmt,
-			      __gnuc_va_list __ap)
-#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-     __asm__ (__ASMNAME ("vswprintf"))
-#endif
-     ;
-
 __fortify_function int
 __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
 		  const wchar_t *__restrict __fmt, __gnuc_va_list __ap))
@@ -283,21 +268,30 @@ __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
   if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
     return __vswprintf_chk (__s, __n,  __USE_FORTIFY_LEVEL - 1,
 			    sz / sizeof (wchar_t), __fmt, __ap);
-  return __vswprintf_alias (__s, __n, __fmt, __ap);
+  return vswprintf (__s, __n, __fmt, __ap);
 }
 
 
 #if __USE_FORTIFY_LEVEL > 1
 
-extern int __fwprintf_chk (__FILE *__restrict __stream, int __flag,
-			   const wchar_t *__restrict __format, ...);
-extern int __wprintf_chk (int __flag, const wchar_t *__restrict __format,
-			  ...);
-extern int __vfwprintf_chk (__FILE *__restrict __stream, int __flag,
-			    const wchar_t *__restrict __format,
-			    __gnuc_va_list __ap);
-extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format,
-			   __gnuc_va_list __ap);
+extern int __REDIRECT_LDBL (__fwprintf_chk, (__FILE *__restrict __stream,
+					     int __flag,
+					     const wchar_t *__restrict __format,
+					     ...),
+			    __fwprintf_chkieee128, __nldbl___fwprintf_chk);
+extern int __REDIRECT_LDBL (__wprintf_chk, (int __flag,
+					    const wchar_t *__restrict __format,
+					    ...),
+			    __wprintf_chkieee128, __nldbl___wprintf_chk);
+extern int __REDIRECT_LDBL (__vfwprintf_chk, (__FILE *__restrict __stream,
+					      int __flag,
+					      const wchar_t *__restrict __format,
+					      __gnuc_va_list __ap),
+			   __vfwprintf_chkieee128, __nldbl___vfwprintf_chk);
+extern int __REDIRECT_LDBL (__vwprintf_chk, (int __flag,
+					     const wchar_t *__restrict __format,
+					     __gnuc_va_list __ap),
+			    __vwprintf_chkieee128, __nldbl___vwprintf_chk);
 
 # ifdef __va_arg_pack
 __fortify_function int
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 5d6a40853d..27406d0edb 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -382,8 +382,10 @@ extern double wcstod (const wchar_t *__restrict __nptr,
 /* Likewise for `float' and `long double' sizes of floating-point numbers.  */
 extern float wcstof (const wchar_t *__restrict __nptr,
 		     wchar_t **__restrict __endptr) __THROW;
-extern long double wcstold (const wchar_t *__restrict __nptr,
-			    wchar_t **__restrict __endptr) __THROW;
+extern long double __REDIRECT_LDBL_NTH (wcstold,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr),
+					__wcstoieee128, wcstod);
 #endif /* C99 */
 
 /* Likewise for `_FloatN' and `_FloatNx' when support is enabled.  */
@@ -498,9 +500,12 @@ extern float wcstof_l (const wchar_t *__restrict __nptr,
 		       wchar_t **__restrict __endptr, locale_t __loc)
      __THROW;
 
-extern long double wcstold_l (const wchar_t *__restrict __nptr,
-			      wchar_t **__restrict __endptr,
-			      locale_t __loc) __THROW;
+
+extern long double __REDIRECT_LDBL_NTH (wcstold_l,
+					(const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr,
+					 locale_t __loc),
+					__wcstoieee128_l, wcstod_l);
 
 # if __HAVE_FLOAT16
 extern _Float16 wcstof16_l (const wchar_t *__restrict __nptr,
@@ -587,73 +592,61 @@ extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW
 /* Select orientation for stream.  */
 extern int fwide (__FILE *__fp, int __mode) __THROW;
 
-
 /* Write formatted output to STREAM.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int fwprintf (__FILE *__restrict __stream,
-		     const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (fwprintf, (__FILE *__restrict __stream,
+					  const wchar_t *__restrict __format,
+					  ...))
      /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
 /* Write formatted output to stdout.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int wprintf (const wchar_t *__restrict __format, ...)
+extern int __REDIRECT_LDBL128 (wprintf, (const wchar_t *__restrict __format, ...))
      /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
 /* Write formatted output of at most N characters to S.  */
-extern int swprintf (wchar_t *__restrict __s, size_t __n,
-		     const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
+extern int __REDIRECT_LDBL128_NTH (swprintf, (wchar_t *__restrict __s, size_t __n,
+					      const wchar_t *__restrict __format,
+					      ...))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
 
 /* Write formatted output to S from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vfwprintf (__FILE *__restrict __s,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vfwprintf, (__FILE *__restrict __s,
+					const wchar_t *__restrict __format,
+					__gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
 /* Write formatted output to stdout from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vwprintf (const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+extern int __REDIRECT_LDBL128 (vwprintf, (const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg))
      /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
 /* Write formatted output of at most N character to S from argument
    list ARG.  */
-extern int vswprintf (wchar_t *__restrict __s, size_t __n,
-		      const wchar_t *__restrict __format,
-		      __gnuc_va_list __arg)
-     __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
-
-
-/* Read formatted input from STREAM.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int fwscanf (__FILE *__restrict __stream,
-		    const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-/* Read formatted input from stdin.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int wscanf (const wchar_t *__restrict __format, ...)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
-/* Read formatted input from S.  */
-extern int swscanf (const wchar_t *__restrict __s,
-		    const wchar_t *__restrict __format, ...)
-     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-
-/* For historical reasons, the C99-compliant versions of the scanf
-   functions are at alternative names.  When __LDBL_COMPAT or
-   __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
-   bits/wchar-ldbl.h.  */
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
+extern int __REDIRECT_LDBL128_NTH (vswprintf, (wchar_t *__restrict __s, size_t __n,
+				      const wchar_t *__restrict __format,
+					      __gnuc_va_list __arg))
+     /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
+
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __isoc99_fwscanfieee128, __nldbl___isoc99_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __isoc99_wscanfieee128,__nldbl___isoc99_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__isoc99_swscanfieee128, __nldbl___isoc99_swscanf);
+#  else
+#   ifdef __REDIRECT
 extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
 				 const wchar_t *__restrict __format, ...),
 		       __isoc99_fwscanf)
@@ -665,72 +658,129 @@ extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s,
 				     const wchar_t *__restrict __format,
 				     ...), __isoc99_swscanf)
      /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-#  else
+#   else
 extern int __isoc99_fwscanf (__FILE *__restrict __stream,
 			     const wchar_t *__restrict __format, ...);
 extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...);
 extern int __isoc99_swscanf (const wchar_t *__restrict __s,
 			     const wchar_t *__restrict __format, ...)
      __THROW;
-#   define fwscanf __isoc99_fwscanf
-#   define wscanf __isoc99_wscanf
-#   define swscanf __isoc99_swscanf
+#    define fwscanf __isoc99_fwscanf
+#    define wscanf __isoc99_wscanf
+#    define swscanf __isoc99_swscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (fwscanf, (__FILE *__restrict __stream,
+				      const wchar_t *__restrict __format, ...),
+			    __fwscanfieee128, __nldbl_fwscanf);
+extern int __REDIRECT_LDBL (wscanf, (const wchar_t *__restrict __format, ...),
+			    __wscanfieee128,__nldbl_wscanf);
+extern int __REDIRECT_LDBL_NTH (swscanf, (const wchar_t *__restrict __s,
+					  const wchar_t *__restrict __format,
+					  ...),
+				__swscanfieee128, __nldbl_swscanf);
+#  else
+/* Read formatted input from STREAM.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int fwscanf (__FILE *__restrict __stream,
+                    const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
+/* Read formatted input from stdin.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int wscanf (const wchar_t *__restrict __format, ...)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
+/* Read formatted input from S.  */
+extern int swscanf (const wchar_t *__restrict __s,
+                    const wchar_t *__restrict __format, ...)
+     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
 #  endif
 # endif
 
 #endif /* Use ISO C95, C99 and Unix98. */
 
 #ifdef __USE_ISOC99
+# if !__GLIBC_USE (DEPRECATED_SCANF)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __isoc99_vfwscanfieee128, __nldbl___isoc99_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __isoc99_vwscanfieee128, __nldbl___isoc99_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__isoc99_vswscanfieee128,
+				__nldbl___isoc99_vswscanf);
+#  else
+#   ifdef __REDIRECT
+extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
+                                  const wchar_t *__restrict __format,
+                                  __gnuc_va_list __arg), __isoc99_vfwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
+                                 __gnuc_va_list __arg), __isoc99_vwscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
+extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
+                                      const wchar_t *__restrict __format,
+                                      __gnuc_va_list __arg), __isoc99_vswscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+#   else
+extern int __isoc99_vfwscanf (__FILE *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg);
+extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
+                             __gnuc_va_list __arg);
+extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
+                              const wchar_t *__restrict __format,
+                              __gnuc_va_list __arg) __THROW;
+#    define vfwscanf __isoc99_vfwscanf
+#    define vwscanf __isoc99_vwscanf
+#    define vswscanf __isoc99_vswscanf
+#   endif /* __REDIRECT */
+#  endif
+# else
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 || defined __LDBL_COMPAT
+extern int __REDIRECT_LDBL (vfwscanf, (__FILE *__restrict __stream,
+				       const wchar_t *__restrict __format,
+				       __gnuc_va_list __arg),
+			    __vfwscanfieee128, __nldbl_vfwscanf);
+extern int __REDIRECT_LDBL (vwscanf, (const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg),
+			    __vwscanfieee128, __nldbl_vwscanf);
+extern int __REDIRECT_LDBL_NTH (vswscanf, (const wchar_t *__restrict __s,
+					   const wchar_t *__restrict __format,
+					   __gnuc_va_list __arg),
+				__vswscanfieee128,
+				__nldbl_vswscanf);
+#  else
 /* Read formatted input from S into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vfwscanf (__FILE *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
 /* Read formatted input from stdin into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vwscanf (const wchar_t *__restrict __format,
-		    __gnuc_va_list __arg)
+                    __gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
 /* Read formatted input from S into argument list ARG.  */
 extern int vswscanf (const wchar_t *__restrict __s,
-		     const wchar_t *__restrict __format,
-		     __gnuc_va_list __arg)
+                     const wchar_t *__restrict __format,
+                     __gnuc_va_list __arg)
      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-
-/* Same redirection as above for the v*wscanf family.  */
-# if !__GLIBC_USE (DEPRECATED_SCANF) \
-     && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
-     && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) \
-     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
-#  ifdef __REDIRECT
-extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
-				  const wchar_t *__restrict __format,
-				  __gnuc_va_list __arg), __isoc99_vfwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
-				 __gnuc_va_list __arg), __isoc99_vwscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
-extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
-				      const wchar_t *__restrict __format,
-				      __gnuc_va_list __arg), __isoc99_vswscanf)
-     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-#  else
-extern int __isoc99_vfwscanf (__FILE *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg);
-extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
-			     __gnuc_va_list __arg);
-extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
-			      const wchar_t *__restrict __format,
-			      __gnuc_va_list __arg) __THROW;
-#   define vfwscanf __isoc99_vfwscanf
-#   define vwscanf __isoc99_vwscanf
-#   define vswscanf __isoc99_vswscanf
 #  endif
 # endif
 
@@ -867,11 +917,6 @@ extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
 # include <bits/wchar2.h>
 #endif
 
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/wchar-ldbl.h>
-#endif
-
 __END_DECLS
 
 #endif /* wchar.h  */


^ 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-06-09 13:13 [glibc/azanella/clang] Remove wchar-ldbl.h Adhemerval Zanella
  -- strict thread matches above, loose matches on Subject: below --
2022-06-09 21:16 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-04-04 12:50 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:35 Adhemerval Zanella
2022-03-11 17:19 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).