aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gabrielftg@linux.ibm.com>2019-12-19 12:06:09 -0300
committerPaul E. Murphy <murphyp@linux.vnet.ibm.com>2020-02-17 15:28:29 -0600
commite4a399921390509418826e8e8995d2441f29e243 (patch)
treecc9f1df5edb43ade00aa12cc1ba1c5a662e5f1c8
parent1f1c65e232878bca88fe8551318c7bc02b90ee90 (diff)
downloadglibc-e4a399921390509418826e8e8995d2441f29e243.tar
glibc-e4a399921390509418826e8e8995d2441f29e243.tar.gz
glibc-e4a399921390509418826e8e8995d2441f29e243.tar.bz2
glibc-e4a399921390509418826e8e8995d2441f29e243.zip
Prepare redirections for IEEE long double on powerpc64le
All functions that have a format string, which can consume a long double argument, must have one version for each long double format supported on a platform. On powerpc64le, these functions currently have two versions (i.e.: long double with the same format as double, and long double with IBM Extended Precision format). Support for a third long double format option (i.e. long double with IEEE long double format) is being prepared and all the aforementioned functions now have a third version (not yet exported on the master branch, but the code is in). For these functions to get selected (during build time), references to them in user programs (or dependent libraries) must get redirected to the aforementioned new versions of the functions. This patch installs the header magic required to perform such redirections. Notice, however, that since the redirections only happen when __LONG_DOUBLE_USES_FLOAT128 is set to 1, and no platform (including powerpc64le) currently does it, no redirections actually happen. Redirections and the exporting of the new functions will happen at the same time (when powerpc64le adds ldbl-128ibm-compat to their Implies. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com> Reviewed-by: Paul E. Murphy <murphyp@linux.vnet.ibm.com>
-rw-r--r--argp/argp.h3
-rw-r--r--libio/bits/stdio-ldbl.h46
-rw-r--r--libio/stdio.h16
-rw-r--r--misc/bits/syslog-ldbl.h4
-rw-r--r--misc/err.h3
-rw-r--r--misc/error.h6
-rw-r--r--misc/sys/cdefs.h38
-rw-r--r--misc/sys/syslog.h4
-rw-r--r--stdio-common/printf.h3
-rw-r--r--stdlib/bits/stdlib-ldbl.h22
-rw-r--r--stdlib/monetary.h3
-rw-r--r--stdlib/stdlib.h4
-rw-r--r--wcsmbs/bits/wchar-ldbl.h36
-rw-r--r--wcsmbs/wchar.h14
14 files changed, 159 insertions, 43 deletions
diff --git a/argp/argp.h b/argp/argp.h
index 329aae097f..358d9b43cd 100644
--- a/argp/argp.h
+++ b/argp/argp.h
@@ -554,7 +554,8 @@ __NTH (__option_is_end (const struct argp_option *__opt))
# endif
#endif /* Use extern inlines. */
-#ifdef __LDBL_COMPAT
+#include <bits/floatn.h>
+#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
# include <bits/argp-ldbl.h>
#endif
diff --git a/libio/bits/stdio-ldbl.h b/libio/bits/stdio-ldbl.h
index 6626412fce..3bb9f7dd2c 100644
--- a/libio/bits/stdio-ldbl.h
+++ b/libio/bits/stdio-ldbl.h
@@ -27,9 +27,17 @@ __LDBL_REDIR_DECL (vfprintf)
__LDBL_REDIR_DECL (vprintf)
__LDBL_REDIR_DECL (vsprintf)
#if !__GLIBC_USE (DEPRECATED_SCANF)
+# if defined __LDBL_COMPAT
__LDBL_REDIR1_DECL (fscanf, __nldbl___isoc99_fscanf)
__LDBL_REDIR1_DECL (scanf, __nldbl___isoc99_scanf)
__LDBL_REDIR1_DECL (sscanf, __nldbl___isoc99_sscanf)
+# elif __LONG_DOUBLE_USES_FLOAT128 == 1
+__LDBL_REDIR1_DECL (fscanf, __isoc99_fscanfieee128)
+__LDBL_REDIR1_DECL (scanf, __isoc99_scanfieee128)
+__LDBL_REDIR1_DECL (sscanf, __isoc99_sscanfieee128)
+# else
+# error bits/stdlib-ldbl.h included when no ldbl redirections are required.
+# endif
#else
__LDBL_REDIR_DECL (fscanf)
__LDBL_REDIR_DECL (scanf)
@@ -43,9 +51,17 @@ __LDBL_REDIR_DECL (vsnprintf)
#ifdef __USE_ISOC99
# if !__GLIBC_USE (DEPRECATED_SCANF)
+# if defined __LDBL_COMPAT
__LDBL_REDIR1_DECL (vfscanf, __nldbl___isoc99_vfscanf)
__LDBL_REDIR1_DECL (vscanf, __nldbl___isoc99_vscanf)
__LDBL_REDIR1_DECL (vsscanf, __nldbl___isoc99_vsscanf)
+# elif __LONG_DOUBLE_USES_FLOAT128 == 1
+__LDBL_REDIR1_DECL (vfscanf, __isoc99_vfscanfieee128)
+__LDBL_REDIR1_DECL (vscanf, __isoc99_vscanfieee128)
+__LDBL_REDIR1_DECL (vsscanf, __isoc99_vsscanfieee128)
+# else
+# error bits/stdlib-ldbl.h included when no ldbl redirections are required.
+# endif
# else
__LDBL_REDIR_DECL (vfscanf)
__LDBL_REDIR_DECL (vsscanf)
@@ -60,33 +76,33 @@ __LDBL_REDIR_DECL (dprintf)
#ifdef __USE_GNU
__LDBL_REDIR_DECL (vasprintf)
-__LDBL_REDIR_DECL (__asprintf)
+__LDBL_REDIR2_DECL (asprintf)
__LDBL_REDIR_DECL (asprintf)
__LDBL_REDIR_DECL (obstack_printf)
__LDBL_REDIR_DECL (obstack_vprintf)
#endif
#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR_DECL (__sprintf_chk)
-__LDBL_REDIR_DECL (__vsprintf_chk)
+__LDBL_REDIR2_DECL (sprintf_chk)
+__LDBL_REDIR2_DECL (vsprintf_chk)
# if defined __USE_ISOC99 || defined __USE_UNIX98
-__LDBL_REDIR_DECL (__snprintf_chk)
-__LDBL_REDIR_DECL (__vsnprintf_chk)
+__LDBL_REDIR2_DECL (snprintf_chk)
+__LDBL_REDIR2_DECL (vsnprintf_chk)
# endif
# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR_DECL (__fprintf_chk)
-__LDBL_REDIR_DECL (__printf_chk)
-__LDBL_REDIR_DECL (__vfprintf_chk)
-__LDBL_REDIR_DECL (__vprintf_chk)
+__LDBL_REDIR2_DECL (fprintf_chk)
+__LDBL_REDIR2_DECL (printf_chk)
+__LDBL_REDIR2_DECL (vfprintf_chk)
+__LDBL_REDIR2_DECL (vprintf_chk)
# ifdef __USE_XOPEN2K8
-__LDBL_REDIR_DECL (__dprintf_chk)
-__LDBL_REDIR_DECL (__vdprintf_chk)
+__LDBL_REDIR2_DECL (dprintf_chk)
+__LDBL_REDIR2_DECL (vdprintf_chk)
# endif
# ifdef __USE_GNU
-__LDBL_REDIR_DECL (__asprintf_chk)
-__LDBL_REDIR_DECL (__vasprintf_chk)
-__LDBL_REDIR_DECL (__obstack_printf_chk)
-__LDBL_REDIR_DECL (__obstack_vprintf_chk)
+__LDBL_REDIR2_DECL (asprintf_chk)
+__LDBL_REDIR2_DECL (vasprintf_chk)
+__LDBL_REDIR2_DECL (obstack_printf_chk)
+__LDBL_REDIR2_DECL (obstack_vprintf_chk)
# endif
# endif
#endif
diff --git a/libio/stdio.h b/libio/stdio.h
index 5a10a4d3ee..18e29752c4 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -400,9 +400,12 @@ extern int sscanf (const char *__restrict __s,
const char *__restrict __format, ...) __THROW;
/* For historical reasons, the C99-compliant versions of the scanf
- functions are at alternative names. When __LDBL_COMPAT is in
- effect, this is handled in bits/stdio-ldbl.h. */
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT
+ functions are at alternative names. When __LDBL_COMPAT or
+ __LONG_DOUBLE_USES_FLOAT128 are in effect, this is handled in
+ bits/stdio-ldbl.h. */
+#include <bits/floatn.h>
+#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
+ && __LONG_DOUBLE_USES_FLOAT128 == 0
# ifdef __REDIRECT
extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
const char *__restrict __format, ...),
@@ -447,7 +450,8 @@ extern int vsscanf (const char *__restrict __s,
/* Same redirection as above for the v*scanf family. */
# if !__GLIBC_USE (DEPRECATED_SCANF)
-# if defined __REDIRECT && !defined __LDBL_COMPAT
+# if defined __REDIRECT && !defined __LDBL_COMPAT \
+ && __LONG_DOUBLE_USES_FLOAT128 == 0
extern int __REDIRECT (vfscanf,
(FILE *__restrict __s,
const char *__restrict __format, __gnuc_va_list __arg),
@@ -866,7 +870,9 @@ extern int __overflow (FILE *, int);
#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
# include <bits/stdio2.h>
#endif
-#ifdef __LDBL_COMPAT
+
+#include <bits/floatn.h>
+#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
# include <bits/stdio-ldbl.h>
#endif
diff --git a/misc/bits/syslog-ldbl.h b/misc/bits/syslog-ldbl.h
index fead0d4648..657b192b9b 100644
--- a/misc/bits/syslog-ldbl.h
+++ b/misc/bits/syslog-ldbl.h
@@ -27,9 +27,9 @@ __LDBL_REDIR_DECL (vsyslog)
#endif
#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
-__LDBL_REDIR_DECL (__syslog_chk)
+__LDBL_REDIR2_DECL (syslog_chk)
# ifdef __USE_MISC
-__LDBL_REDIR_DECL (__vsyslog_chk)
+__LDBL_REDIR2_DECL (vsyslog_chk)
# endif
#endif
diff --git a/misc/err.h b/misc/err.h
index f6fd72945f..d146a55054 100644
--- a/misc/err.h
+++ b/misc/err.h
@@ -52,7 +52,8 @@ extern void errx (int __status, const char *__format, ...)
extern void verrx (int __status, const char *, __gnuc_va_list)
__attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
-#ifdef __LDBL_COMPAT
+#include <bits/floatn.h>
+#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
# include <bits/err-ldbl.h>
#endif
diff --git a/misc/error.h b/misc/error.h
index a456695f1a..bb8a3b26a4 100644
--- a/misc/error.h
+++ b/misc/error.h
@@ -47,11 +47,13 @@ extern unsigned int error_message_count;
variable controls whether this mode is selected or not. */
extern int error_one_per_line;
-#ifdef __LDBL_COMPAT
+#include <bits/floatn.h>
+#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
# include <bits/error-ldbl.h>
#else
/* Do not inline error and error_at_line when long double has the same
- size of double, because that would invalidate the redirections to the
+ size of double, nor when long double reuses the float128
+ implementation, because that would invalidate the redirections to the
compatibility functions. */
# if defined __extern_always_inline && defined __va_arg_pack
# include <bits/error.h>
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index ff7144f3f3..dd5f69f833 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -452,7 +452,37 @@
#include <bits/wordsize.h>
#include <bits/long-double.h>
-#if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
+#if __LONG_DOUBLE_USES_FLOAT128 == 1
+# ifdef __REDIRECT
+
+/* Alias name defined automatically. */
+# define __LDBL_REDIR(name, proto) ... unused__ldbl_redir
+# define __LDBL_REDIR_DECL(name) \
+ extern __typeof (name) name __asm (__ASMNAME ("__" #name "ieee128"));
+
+/* Alias name defined automatically, with leading underscores. */
+# define __LDBL_REDIR2_DECL(name) \
+ extern __typeof (__##name) __##name \
+ __asm (__ASMNAME ("__" #name "ieee128"));
+
+/* Alias name defined manually. */
+# define __LDBL_REDIR1(name, proto, alias) ... unused__ldbl_redir1
+# define __LDBL_REDIR1_DECL(name, alias) \
+ extern __typeof (name) name __asm (__ASMNAME (#alias));
+
+# define __LDBL_REDIR1_NTH(name, proto, alias) \
+ __REDIRECT_NTH (name, proto, alias)
+# define __REDIRECT_NTH_LDBL(name, proto, alias) \
+ __LDBL_REDIR1_NTH (name, proto, __##alias##ieee128)
+
+/* Unused. */
+# define __REDIRECT_LDBL(name, proto, alias) ... unused__redirect_ldbl
+# define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth
+
+# else
+_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
+# endif
+#elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
# define __LDBL_COMPAT 1
# ifdef __REDIRECT
# define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias)
@@ -461,6 +491,8 @@
# define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias)
# define __LDBL_REDIR_NTH(name, proto) \
__LDBL_REDIR1_NTH (name, proto, __nldbl_##name)
+# define __LDBL_REDIR2_DECL(name) \
+ extern __typeof (__##name) __##name __asm (__ASMNAME ("__nldbl___" #name));
# define __LDBL_REDIR1_DECL(name, alias) \
extern __typeof (name) name __asm (__ASMNAME (#alias));
# define __LDBL_REDIR_DECL(name) \
@@ -471,11 +503,13 @@
__LDBL_REDIR1_NTH (name, proto, __nldbl_##alias)
# endif
#endif
-#if !defined __LDBL_COMPAT || !defined __REDIRECT
+#if (!defined __LDBL_COMPAT && __LONG_DOUBLE_USES_FLOAT128 == 0) \
+ || !defined __REDIRECT
# define __LDBL_REDIR1(name, proto, alias) name proto
# define __LDBL_REDIR(name, proto) name proto
# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW
# define __LDBL_REDIR_NTH(name, proto) name proto __THROW
+# define __LDBL_REDIR2_DECL(name)
# define __LDBL_REDIR_DECL(name)
# ifdef __REDIRECT
# define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias)
diff --git a/misc/sys/syslog.h b/misc/sys/syslog.h
index ee01478c4b..c000b8e915 100644
--- a/misc/sys/syslog.h
+++ b/misc/sys/syslog.h
@@ -206,7 +206,9 @@ extern void vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap)
#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
# include <bits/syslog.h>
#endif
-#ifdef __LDBL_COMPAT
+
+#include <bits/floatn.h>
+#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
# include <bits/syslog-ldbl.h>
#endif
diff --git a/stdio-common/printf.h b/stdio-common/printf.h
index ad3c8a4254..00bedebfdb 100644
--- a/stdio-common/printf.h
+++ b/stdio-common/printf.h
@@ -182,7 +182,8 @@ extern int printf_size_info (const struct printf_info *__restrict
__info, size_t __n, int *__restrict __argtypes)
__THROW;
-#ifdef __LDBL_COMPAT
+#include <bits/floatn.h>
+#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
# include <bits/printf-ldbl.h>
#endif
diff --git a/stdlib/bits/stdlib-ldbl.h b/stdlib/bits/stdlib-ldbl.h
index 5c6294ed9b..2469474532 100644
--- a/stdlib/bits/stdlib-ldbl.h
+++ b/stdlib/bits/stdlib-ldbl.h
@@ -21,21 +21,43 @@
#endif
#ifdef __USE_ISOC99
+# ifdef __LDBL_COMPAT
__LDBL_REDIR1_DECL (strtold, strtod)
+# else
+__LDBL_REDIR1_DECL (strtold, __strtoieee128)
+# endif
#endif
#ifdef __USE_GNU
+# ifdef __LDBL_COMPAT
__LDBL_REDIR1_DECL (strtold_l, strtod_l)
+# else
+__LDBL_REDIR1_DECL (strtold_l, __strtoieee128_l)
+# endif
#endif
#if __GLIBC_USE (IEC_60559_BFP_EXT_C2X)
+# ifdef __LDBL_COMPAT
__LDBL_REDIR1_DECL (strfroml, strfromd)
+# else
+__LDBL_REDIR1_DECL (strfroml, __strfromieee128)
+# endif
#endif
#ifdef __USE_MISC
+# if defined __LDBL_COMPAT
__LDBL_REDIR1_DECL (qecvt, ecvt)
__LDBL_REDIR1_DECL (qfcvt, fcvt)
__LDBL_REDIR1_DECL (qgcvt, gcvt)
__LDBL_REDIR1_DECL (qecvt_r, ecvt_r)
__LDBL_REDIR1_DECL (qfcvt_r, fcvt_r)
+# elif __LONG_DOUBLE_USES_FLOAT128 == 1
+__LDBL_REDIR1_DECL (qecvt, __qecvtieee128)
+__LDBL_REDIR1_DECL (qfcvt, __qfcvtieee128)
+__LDBL_REDIR1_DECL (qgcvt, __qgcvtieee128)
+__LDBL_REDIR1_DECL (qecvt_r, __qecvtieee128_r)
+__LDBL_REDIR1_DECL (qfcvt_r, __qfcvtieee128_r)
+# else
+# error bits/stdlib-ldbl.h included when no ldbl redirections are required.
+# endif
#endif
diff --git a/stdlib/monetary.h b/stdlib/monetary.h
index dfb6ed5c0c..4a6d61fd2d 100644
--- a/stdlib/monetary.h
+++ b/stdlib/monetary.h
@@ -50,7 +50,8 @@ extern ssize_t strfmon_l (char *__restrict __s, size_t __maxsize,
__THROW __attribute_format_strfmon__ (4, 5);
#endif
-#ifdef __LDBL_COMPAT
+#include <bits/floatn.h>
+#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
# include <bits/monetary-ldbl.h>
#endif
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index e3470631e1..a7c0c71a80 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -1016,7 +1016,9 @@ extern int ttyslot (void) __THROW;
#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
# include <bits/stdlib.h>
#endif
-#ifdef __LDBL_COMPAT
+
+#include <bits/floatn.h>
+#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
# include <bits/stdlib-ldbl.h>
#endif
diff --git a/wcsmbs/bits/wchar-ldbl.h b/wcsmbs/bits/wchar-ldbl.h
index fc50ee26de..75d547f680 100644
--- a/wcsmbs/bits/wchar-ldbl.h
+++ b/wcsmbs/bits/wchar-ldbl.h
@@ -28,9 +28,17 @@ __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 __LONG_DOUBLE_USES_FLOAT128 == 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);
@@ -39,11 +47,23 @@ __LDBL_REDIR_DECL (swscanf);
#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 __LONG_DOUBLE_USES_FLOAT128 == 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);
@@ -52,16 +72,20 @@ __LDBL_REDIR_DECL (vswscanf);
#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_REDIR_DECL (__swprintf_chk)
-__LDBL_REDIR_DECL (__vswprintf_chk)
+__LDBL_REDIR2_DECL (swprintf_chk)
+__LDBL_REDIR2_DECL (vswprintf_chk)
# if __USE_FORTIFY_LEVEL > 1
-__LDBL_REDIR_DECL (__fwprintf_chk)
-__LDBL_REDIR_DECL (__wprintf_chk)
-__LDBL_REDIR_DECL (__vfwprintf_chk)
-__LDBL_REDIR_DECL (__vwprintf_chk)
+__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/wchar.h b/wcsmbs/wchar.h
index 5e0d65b14e..fb2cec8167 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -633,9 +633,11 @@ extern int swscanf (const wchar_t *__restrict __s,
__THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
/* For historical reasons, the C99-compliant versions of the scanf
- functions are at alternative names. When __LDBL_COMPAT is in
- effect, this is handled in bits/wchar-ldbl.h. */
-#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT
+ functions are at alternative names. When __LDBL_COMPAT or
+ __LONG_DOUBLE_USES_FLOAT128 are in effect, this is handled in
+ bits/wchar-ldbl.h. */
+#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
+ && __LONG_DOUBLE_USES_FLOAT128 == 0
# ifdef __REDIRECT
extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
const wchar_t *__restrict __format, ...),
@@ -688,7 +690,8 @@ extern int vswscanf (const wchar_t *__restrict __s,
/* 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)
+ && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) \
+ && __LONG_DOUBLE_USES_FLOAT128 == 0
# ifdef __REDIRECT
extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
const wchar_t *__restrict __format,
@@ -849,7 +852,8 @@ extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
# include <bits/wchar2.h>
#endif
-#ifdef __LDBL_COMPAT
+#include <bits/floatn.h>
+#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
# include <bits/wchar-ldbl.h>
#endif