diff options
Diffstat (limited to 'libio')
-rw-r--r-- | libio/bits/stdio-ldbl.h | 24 | ||||
-rw-r--r-- | libio/libioP.h | 6 | ||||
-rw-r--r-- | libio/stdio.h | 73 |
3 files changed, 92 insertions, 11 deletions
diff --git a/libio/bits/stdio-ldbl.h b/libio/bits/stdio-ldbl.h index b54d00b68b..ed68fc4e28 100644 --- a/libio/bits/stdio-ldbl.h +++ b/libio/bits/stdio-ldbl.h @@ -28,13 +28,25 @@ __LDBL_REDIR_DECL (vprintf) __LDBL_REDIR_DECL (vsprintf) #if !__GLIBC_USE (DEPRECATED_SCANF) # if defined __LDBL_COMPAT +# if __GLIBC_USE (C2X_STRTOL) +__LDBL_REDIR1_DECL (fscanf, __nldbl___isoc23_fscanf) +__LDBL_REDIR1_DECL (scanf, __nldbl___isoc23_scanf) +__LDBL_REDIR1_DECL (sscanf, __nldbl___isoc23_sscanf) +# else __LDBL_REDIR1_DECL (fscanf, __nldbl___isoc99_fscanf) __LDBL_REDIR1_DECL (scanf, __nldbl___isoc99_scanf) __LDBL_REDIR1_DECL (sscanf, __nldbl___isoc99_sscanf) +# endif # elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 +# if __GLIBC_USE (C2X_STRTOL) +__LDBL_REDIR1_DECL (fscanf, __isoc23_fscanfieee128) +__LDBL_REDIR1_DECL (scanf, __isoc23_scanfieee128) +__LDBL_REDIR1_DECL (sscanf, __isoc23_sscanfieee128) +# else __LDBL_REDIR1_DECL (fscanf, __isoc99_fscanfieee128) __LDBL_REDIR1_DECL (scanf, __isoc99_scanfieee128) __LDBL_REDIR1_DECL (sscanf, __isoc99_sscanfieee128) +# endif # else # error bits/stdlib-ldbl.h included when no ldbl redirections are required. # endif @@ -52,13 +64,25 @@ __LDBL_REDIR_DECL (vsnprintf) #ifdef __USE_ISOC99 # if !__GLIBC_USE (DEPRECATED_SCANF) # if defined __LDBL_COMPAT +# if __GLIBC_USE (C2X_STRTOL) +__LDBL_REDIR1_DECL (vfscanf, __nldbl___isoc23_vfscanf) +__LDBL_REDIR1_DECL (vscanf, __nldbl___isoc23_vscanf) +__LDBL_REDIR1_DECL (vsscanf, __nldbl___isoc23_vsscanf) +# else __LDBL_REDIR1_DECL (vfscanf, __nldbl___isoc99_vfscanf) __LDBL_REDIR1_DECL (vscanf, __nldbl___isoc99_vscanf) __LDBL_REDIR1_DECL (vsscanf, __nldbl___isoc99_vsscanf) +# endif # elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 +# if __GLIBC_USE (C2X_STRTOL) +__LDBL_REDIR1_DECL (vfscanf, __isoc23_vfscanfieee128) +__LDBL_REDIR1_DECL (vscanf, __isoc23_vscanfieee128) +__LDBL_REDIR1_DECL (vsscanf, __isoc23_vsscanfieee128) +# else __LDBL_REDIR1_DECL (vfscanf, __isoc99_vfscanfieee128) __LDBL_REDIR1_DECL (vscanf, __isoc99_vscanfieee128) __LDBL_REDIR1_DECL (vsscanf, __isoc99_vsscanfieee128) +# endif # else # error bits/stdlib-ldbl.h included when no ldbl redirections are required. # endif diff --git a/libio/libioP.h b/libio/libioP.h index a5f00822ab..38507388fd 100644 --- a/libio/libioP.h +++ b/libio/libioP.h @@ -781,6 +781,9 @@ extern off64_t _IO_seekpos_unlocked (FILE *, off64_t, int) functions use. When the flag is set to zero, automatic allocation is enabled. + SCANF_ISOC23_BIN_CST, when set to one, indicates the %i accepts + binary constants starting 0b or 0B. + SCANF_LDBL_USES_FLOAT128 is used on platforms where the long double format used to be different from the IEC 60559 double format *and* also different from the Quadruple 128-bits IEC 60559 format (such as @@ -793,7 +796,8 @@ extern off64_t _IO_seekpos_unlocked (FILE *, off64_t, int) as the previous format on that platform. */ #define SCANF_LDBL_IS_DBL 0x0001 #define SCANF_ISOC99_A 0x0002 -#define SCANF_LDBL_USES_FLOAT128 0x0004 +#define SCANF_ISOC23_BIN_CST 0x0004 +#define SCANF_LDBL_USES_FLOAT128 0x0008 extern int __vfscanf_internal (FILE *fp, const char *format, va_list argp, unsigned int flags) diff --git a/libio/stdio.h b/libio/stdio.h index ed80420a2b..857f02888d 100644 --- a/libio/stdio.h +++ b/libio/stdio.h @@ -430,7 +430,28 @@ extern int sscanf (const char *__restrict __s, #include <bits/floatn.h> #if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \ && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0 -# ifdef __REDIRECT +# if __GLIBC_USE (C2X_STRTOL) +# ifdef __REDIRECT +extern int __REDIRECT (fscanf, (FILE *__restrict __stream, + const char *__restrict __format, ...), + __isoc23_fscanf) __wur; +extern int __REDIRECT (scanf, (const char *__restrict __format, ...), + __isoc23_scanf) __wur; +extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s, + const char *__restrict __format, ...), + __isoc23_sscanf); +# else +extern int __isoc23_fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) __wur; +extern int __isoc23_scanf (const char *__restrict __format, ...) __wur; +extern int __isoc23_sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __THROW; +# define fscanf __isoc23_fscanf +# define scanf __isoc23_scanf +# define sscanf __isoc23_sscanf +# endif +# else +# ifdef __REDIRECT extern int __REDIRECT (fscanf, (FILE *__restrict __stream, const char *__restrict __format, ...), __isoc99_fscanf) __wur; @@ -439,15 +460,16 @@ extern int __REDIRECT (scanf, (const char *__restrict __format, ...), extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s, const char *__restrict __format, ...), __isoc99_sscanf); -# else +# else extern int __isoc99_fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __wur; extern int __isoc99_scanf (const char *__restrict __format, ...) __wur; extern int __isoc99_sscanf (const char *__restrict __s, const char *__restrict __format, ...) __THROW; -# define fscanf __isoc99_fscanf -# define scanf __isoc99_scanf -# define sscanf __isoc99_sscanf +# define fscanf __isoc99_fscanf +# define scanf __isoc99_scanf +# define sscanf __isoc99_sscanf +# endif # endif #endif @@ -474,7 +496,37 @@ 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 __GLIBC_USE (C2X_STRTOL) +# if defined __REDIRECT && !defined __LDBL_COMPAT \ + && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0 +extern int __REDIRECT (vfscanf, + (FILE *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg), + __isoc23_vfscanf) + __attribute__ ((__format__ (__scanf__, 2, 0))) __wur; +extern int __REDIRECT (vscanf, (const char *__restrict __format, + __gnuc_va_list __arg), __isoc23_vscanf) + __attribute__ ((__format__ (__scanf__, 1, 0))) __wur; +extern int __REDIRECT_NTH (vsscanf, + (const char *__restrict __s, + const char *__restrict __format, + __gnuc_va_list __arg), __isoc23_vsscanf) + __attribute__ ((__format__ (__scanf__, 2, 0))); +# elif !defined __REDIRECT +extern int __isoc23_vfscanf (FILE *__restrict __s, + const char *__restrict __format, + __gnuc_va_list __arg) __wur; +extern int __isoc23_vscanf (const char *__restrict __format, + __gnuc_va_list __arg) __wur; +extern int __isoc23_vsscanf (const char *__restrict __s, + const char *__restrict __format, + __gnuc_va_list __arg) __THROW; +# define vfscanf __isoc23_vfscanf +# define vscanf __isoc23_vscanf +# define vsscanf __isoc23_vsscanf +# endif +# else +# if defined __REDIRECT && !defined __LDBL_COMPAT \ && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0 extern int __REDIRECT (vfscanf, (FILE *__restrict __s, @@ -489,7 +541,7 @@ extern int __REDIRECT_NTH (vsscanf, const char *__restrict __format, __gnuc_va_list __arg), __isoc99_vsscanf) __attribute__ ((__format__ (__scanf__, 2, 0))); -# elif !defined __REDIRECT +# elif !defined __REDIRECT extern int __isoc99_vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __wur; @@ -498,9 +550,10 @@ extern int __isoc99_vscanf (const char *__restrict __format, extern int __isoc99_vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __THROW; -# define vfscanf __isoc99_vfscanf -# define vscanf __isoc99_vscanf -# define vsscanf __isoc99_vsscanf +# define vfscanf __isoc99_vfscanf +# define vscanf __isoc99_vscanf +# define vsscanf __isoc99_vsscanf +# endif # endif # endif #endif /* Use ISO C9x. */ |