From dee2bea048b688b643a9a3b44b26ca9f7a706fe8 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 2 Mar 2023 19:10:37 +0000 Subject: C2x scanf binary constant handling C2x adds binary integer constants starting with 0b or 0B, and supports those constants for the %i scanf format (in addition to the %b format, which isn't yet implemented for scanf in glibc). Implement that scanf support for glibc. As with the strtol support, this is incompatible with previous C standard versions, in that such an input string starting with 0b or 0B was previously required to be parsed as 0 (with the rest of the input potentially matching subsequent parts of the scanf format string). Thus this patch adds 12 new __isoc23_* functions per long double format (12, 24 or 36 depending on how many long double formats the glibc configuration supports), with appropriate header redirection support (generally very closely following that for the __isoc99_* scanf functions - note that __GLIBC_USE (DEPRECATED_SCANF) takes precedence over __GLIBC_USE (C2X_STRTOL), so the case of GNU extensions to C89 continues to get old-style GNU %a and does not get this new feature). The function names would remain as __isoc23_* even if C2x ends up published in 2024 rather than 2023. When scanf %b support is added, I think it will be appropriate for all versions of scanf to follow C2x rules for inputs to the %b format (given that there are no compatibility concerns for a new format). Tested for x86_64 (full glibc testsuite). The first version was also tested for powerpc (32-bit) and powerpc64le (stdio-common/ and wcsmbs/ tests), and with build-many-glibcs.py. --- wcsmbs/Makefile | 16 ++++++++- wcsmbs/Versions | 6 ++++ wcsmbs/bits/wchar-ldbl.h | 24 +++++++++++++ wcsmbs/isoc23_fwscanf.c | 36 +++++++++++++++++++ wcsmbs/isoc23_swscanf.c | 38 ++++++++++++++++++++ wcsmbs/isoc23_vfwscanf.c | 29 +++++++++++++++ wcsmbs/isoc23_vswscanf.c | 30 ++++++++++++++++ wcsmbs/isoc23_vwscanf.c | 28 +++++++++++++++ wcsmbs/isoc23_wscanf.c | 37 +++++++++++++++++++ wcsmbs/tst-wscanf-binary-c11.c | 28 +++++++++++++++ wcsmbs/tst-wscanf-binary-c2x.c | 31 ++++++++++++++++ wcsmbs/tst-wscanf-binary-gnu11.c | 26 ++++++++++++++ wcsmbs/tst-wscanf-binary-gnu89.c | 26 ++++++++++++++ wcsmbs/wchar.h | 76 ++++++++++++++++++++++++++++++++++------ 14 files changed, 419 insertions(+), 12 deletions(-) create mode 100644 wcsmbs/isoc23_fwscanf.c create mode 100644 wcsmbs/isoc23_swscanf.c create mode 100644 wcsmbs/isoc23_vfwscanf.c create mode 100644 wcsmbs/isoc23_vswscanf.c create mode 100644 wcsmbs/isoc23_vwscanf.c create mode 100644 wcsmbs/isoc23_wscanf.c create mode 100644 wcsmbs/tst-wscanf-binary-c11.c create mode 100644 wcsmbs/tst-wscanf-binary-c2x.c create mode 100644 wcsmbs/tst-wscanf-binary-gnu11.c create mode 100644 wcsmbs/tst-wscanf-binary-gnu89.c (limited to 'wcsmbs') diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile index 16ece4c110..b12a3b0750 100644 --- a/wcsmbs/Makefile +++ b/wcsmbs/Makefile @@ -43,6 +43,8 @@ routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \ wcsmbsload mbsrtowcs_l \ isoc99_wscanf isoc99_vwscanf isoc99_fwscanf isoc99_vfwscanf \ isoc99_swscanf isoc99_vswscanf \ + isoc23_wscanf isoc23_vwscanf isoc23_fwscanf isoc23_vfwscanf \ + isoc23_swscanf isoc23_vswscanf \ mbrtoc8 c8rtomb mbrtoc16 c16rtomb mbrtoc32 c32rtomb strop-tests := wcscmp wcsncmp wmemcmp wcslen wcschr wcsrchr wcscpy wcsnlen \ @@ -59,7 +61,11 @@ tests := tst-wcstof wcsmbs-tst1 tst-wcsnlen tst-btowc tst-mbrtowc \ tst-wcstol-binary-c11 \ tst-wcstol-binary-c2x \ tst-wcstol-binary-gnu11 \ - tst-wcstol-binary-gnu2x + tst-wcstol-binary-gnu2x \ + tst-wscanf-binary-c11 \ + tst-wscanf-binary-c2x \ + tst-wscanf-binary-gnu11 \ + tst-wscanf-binary-gnu89 include ../Rules @@ -118,6 +124,10 @@ CFLAGS-isoc99_wscanf.c += -fexceptions CFLAGS-isoc99_fwscanf.c += -fexceptions CFLAGS-isoc99_vwscanf.c += -fexceptions CFLAGS-isoc99_vfwscanf.c += -fexceptions +CFLAGS-isoc23_wscanf.c += -fexceptions +CFLAGS-isoc23_fwscanf.c += -fexceptions +CFLAGS-isoc23_vwscanf.c += -fexceptions +CFLAGS-isoc23_vfwscanf.c += -fexceptions CPPFLAGS += $(libio-mtsafe) @@ -134,3 +144,7 @@ CFLAGS-tst-wcstol-binary-c11.c += -std=c11 CFLAGS-tst-wcstol-binary-c2x.c += -std=c11 CFLAGS-tst-wcstol-binary-gnu11.c += -std=gnu11 CFLAGS-tst-wcstol-binary-gnu2x.c += -std=gnu11 +CFLAGS-tst-wscanf-binary-c11.c += -std=c11 -DOBJPFX=\"$(objpfx)\" +CFLAGS-tst-wscanf-binary-c2x.c += -std=c11 -DOBJPFX=\"$(objpfx)\" +CFLAGS-tst-wscanf-binary-gnu11.c += -std=gnu11 -DOBJPFX=\"$(objpfx)\" +CFLAGS-tst-wscanf-binary-gnu89.c += -std=gnu89 -DOBJPFX=\"$(objpfx)\" diff --git a/wcsmbs/Versions b/wcsmbs/Versions index 1866cd8d6e..2d9391348a 100644 --- a/wcsmbs/Versions +++ b/wcsmbs/Versions @@ -59,5 +59,11 @@ libc { __isoc23_wcstoull; __isoc23_wcstoimax; __isoc23_wcstoumax; + __isoc23_fwscanf; + __isoc23_swscanf; + __isoc23_vfwscanf; + __isoc23_vswscanf; + __isoc23_vwscanf; + __isoc23_wscanf; } } diff --git a/wcsmbs/bits/wchar-ldbl.h b/wcsmbs/bits/wchar-ldbl.h index 4c6f850a45..ee4a6391c8 100644 --- a/wcsmbs/bits/wchar-ldbl.h +++ b/wcsmbs/bits/wchar-ldbl.h @@ -29,13 +29,25 @@ __LDBL_REDIR_DECL (vwprintf); __LDBL_REDIR_DECL (vswprintf); # if !__GLIBC_USE (DEPRECATED_SCANF) # if defined __LDBL_COMPAT +# if __GLIBC_USE (C2X_STRTOL) +__LDBL_REDIR1_DECL (fwscanf, __nldbl___isoc23_fwscanf) +__LDBL_REDIR1_DECL (wscanf, __nldbl___isoc23_wscanf) +__LDBL_REDIR1_DECL (swscanf, __nldbl___isoc23_swscanf) +# else __LDBL_REDIR1_DECL (fwscanf, __nldbl___isoc99_fwscanf) __LDBL_REDIR1_DECL (wscanf, __nldbl___isoc99_wscanf) __LDBL_REDIR1_DECL (swscanf, __nldbl___isoc99_swscanf) +# endif # elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 +# if __GLIBC_USE (C2X_STRTOL) +__LDBL_REDIR1_DECL (fwscanf, __isoc23_fwscanfieee128) +__LDBL_REDIR1_DECL (wscanf, __isoc23_wscanfieee128) +__LDBL_REDIR1_DECL (swscanf, __isoc23_swscanfieee128) +# else __LDBL_REDIR1_DECL (fwscanf, __isoc99_fwscanfieee128) __LDBL_REDIR1_DECL (wscanf, __isoc99_wscanfieee128) __LDBL_REDIR1_DECL (swscanf, __isoc99_swscanfieee128) +# endif # else # error bits/stdlib-ldbl.h included when no ldbl redirections are required. # endif @@ -54,13 +66,25 @@ __LDBL_REDIR1_DECL (wcstold, __wcstoieee128) # endif # if !__GLIBC_USE (DEPRECATED_SCANF) # if defined __LDBL_COMPAT +# if __GLIBC_USE (C2X_STRTOL) +__LDBL_REDIR1_DECL (vfwscanf, __nldbl___isoc23_vfwscanf) +__LDBL_REDIR1_DECL (vwscanf, __nldbl___isoc23_vwscanf) +__LDBL_REDIR1_DECL (vswscanf, __nldbl___isoc23_vswscanf) +# else __LDBL_REDIR1_DECL (vfwscanf, __nldbl___isoc99_vfwscanf) __LDBL_REDIR1_DECL (vwscanf, __nldbl___isoc99_vwscanf) __LDBL_REDIR1_DECL (vswscanf, __nldbl___isoc99_vswscanf) +# endif # elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 +# if __GLIBC_USE (C2X_STRTOL) +__LDBL_REDIR1_DECL (vfwscanf, __isoc23_vfwscanfieee128) +__LDBL_REDIR1_DECL (vwscanf, __isoc23_vwscanfieee128) +__LDBL_REDIR1_DECL (vswscanf, __isoc23_vswscanfieee128) +# else __LDBL_REDIR1_DECL (vfwscanf, __isoc99_vfwscanfieee128) __LDBL_REDIR1_DECL (vwscanf, __isoc99_vwscanfieee128) __LDBL_REDIR1_DECL (vswscanf, __isoc99_vswscanfieee128) +# endif # else # error bits/stdlib-ldbl.h included when no ldbl redirections are required. # endif diff --git a/wcsmbs/isoc23_fwscanf.c b/wcsmbs/isoc23_fwscanf.c new file mode 100644 index 0000000000..90499bb098 --- /dev/null +++ b/wcsmbs/isoc23_fwscanf.c @@ -0,0 +1,36 @@ +/* Copyright (C) 1991-2023 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 + . */ + +#include +#include +#include +#include + +/* Read formatted input from STREAM according to the format string FORMAT. */ +int +__isoc23_fwscanf (FILE *stream, const wchar_t *format, ...) +{ + va_list arg; + int done; + + va_start (arg, format); + done = __vfwscanf_internal (stream, format, arg, + SCANF_ISOC99_A | SCANF_ISOC23_BIN_CST); + va_end (arg); + + return done; +} diff --git a/wcsmbs/isoc23_swscanf.c b/wcsmbs/isoc23_swscanf.c new file mode 100644 index 0000000000..75021a0657 --- /dev/null +++ b/wcsmbs/isoc23_swscanf.c @@ -0,0 +1,38 @@ +/* Copyright (C) 1991-2023 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 + . */ + +#include +#include + +/* Read formatted input from S, according to the format string FORMAT. */ + +int +__isoc23_swscanf (const wchar_t *s, const wchar_t *format, ...) +{ + va_list arg; + int done; + _IO_strfile sf; + struct _IO_wide_data wd; + FILE *f = _IO_strfile_readw (&sf, &wd, s); + + va_start (arg, format); + done = __vfwscanf_internal (f, format, arg, + SCANF_ISOC99_A | SCANF_ISOC23_BIN_CST); + va_end (arg); + + return done; +} diff --git a/wcsmbs/isoc23_vfwscanf.c b/wcsmbs/isoc23_vfwscanf.c new file mode 100644 index 0000000000..6134a84b2e --- /dev/null +++ b/wcsmbs/isoc23_vfwscanf.c @@ -0,0 +1,29 @@ +/* Copyright (C) 1991-2023 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 + . */ + +#include +#include +#include + +/* Read formatted input from STREAM according to the format string FORMAT. */ +int +__isoc23_vfwscanf (FILE *stream, const wchar_t *format, va_list args) +{ + return __vfwscanf_internal (stream, format, args, + SCANF_ISOC99_A | SCANF_ISOC23_BIN_CST); +} +libc_hidden_def (__isoc23_vfwscanf) diff --git a/wcsmbs/isoc23_vswscanf.c b/wcsmbs/isoc23_vswscanf.c new file mode 100644 index 0000000000..77c0e97986 --- /dev/null +++ b/wcsmbs/isoc23_vswscanf.c @@ -0,0 +1,30 @@ +/* Copyright (C) 1993-2023 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 + . */ + +#include +#include + +int +__isoc23_vswscanf (const wchar_t *string, const wchar_t *format, va_list args) +{ + _IO_strfile sf; + struct _IO_wide_data wd; + FILE *f = _IO_strfile_readw (&sf, &wd, string); + return __vfwscanf_internal (f, format, args, + SCANF_ISOC99_A | SCANF_ISOC23_BIN_CST); +} +libc_hidden_def (__isoc23_vswscanf) diff --git a/wcsmbs/isoc23_vwscanf.c b/wcsmbs/isoc23_vwscanf.c new file mode 100644 index 0000000000..95d929268c --- /dev/null +++ b/wcsmbs/isoc23_vwscanf.c @@ -0,0 +1,28 @@ +/* Copyright (C) 1991-2023 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 + . */ + +#include +#include +#include + +/* Read formatted input from STDIN according to the format string FORMAT. */ +int +__isoc23_vwscanf (const wchar_t *format, va_list args) +{ + return __vfwscanf_internal (stdin, format, args, + SCANF_ISOC99_A | SCANF_ISOC23_BIN_CST); +} diff --git a/wcsmbs/isoc23_wscanf.c b/wcsmbs/isoc23_wscanf.c new file mode 100644 index 0000000000..4fb54438cc --- /dev/null +++ b/wcsmbs/isoc23_wscanf.c @@ -0,0 +1,37 @@ +/* Copyright (C) 1991-2023 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 + . */ + +#include +#include +#include +#include + + +/* Read formatted input from stdin according to the format string FORMAT. */ +int +__isoc23_wscanf (const wchar_t *format, ...) +{ + va_list arg; + int done; + + va_start (arg, format); + done = __vfwscanf_internal (stdin, format, arg, + SCANF_ISOC99_A | SCANF_ISOC23_BIN_CST); + va_end (arg); + + return done; +} diff --git a/wcsmbs/tst-wscanf-binary-c11.c b/wcsmbs/tst-wscanf-binary-c11.c new file mode 100644 index 0000000000..cd1127ef5e --- /dev/null +++ b/wcsmbs/tst-wscanf-binary-c11.c @@ -0,0 +1,28 @@ +/* Test wscanf functions with C2X binary integers (wide strings, + no extensions to C11). + Copyright (C) 2022-2023 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 + . */ + +#undef _GNU_SOURCE + +#define CHAR wchar_t +#define FNW w +#define L_(C) L ## C +#define TEST_C2X 0 +#define STD "c11" + +#include "../stdio-common/tst-scanf-binary-main.c" diff --git a/wcsmbs/tst-wscanf-binary-c2x.c b/wcsmbs/tst-wscanf-binary-c2x.c new file mode 100644 index 0000000000..05260b8cfd --- /dev/null +++ b/wcsmbs/tst-wscanf-binary-c2x.c @@ -0,0 +1,31 @@ +/* Test wscanf functions with C2X binary integers (wide strings, + no extensions). + Copyright (C) 2022-2023 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 + . */ + +/* Some versions of GCC supported for building glibc do not support + -std=c2x. */ +#undef _GNU_SOURCE +#define _ISOC2X_SOURCE + +#define CHAR wchar_t +#define FNW w +#define L_(C) L ## C +#define TEST_C2X 1 +#define STD "c2x" + +#include "../stdio-common/tst-scanf-binary-main.c" diff --git a/wcsmbs/tst-wscanf-binary-gnu11.c b/wcsmbs/tst-wscanf-binary-gnu11.c new file mode 100644 index 0000000000..4af479e968 --- /dev/null +++ b/wcsmbs/tst-wscanf-binary-gnu11.c @@ -0,0 +1,26 @@ +/* Test wscanf functions with C2X binary integers (wide strings, + GNU extensions to C11). + Copyright (C) 2022-2023 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 + . */ + +#define CHAR wchar_t +#define FNW w +#define L_(C) L ## C +#define TEST_C2X 1 +#define STD "gnu11" + +#include "../stdio-common/tst-scanf-binary-main.c" diff --git a/wcsmbs/tst-wscanf-binary-gnu89.c b/wcsmbs/tst-wscanf-binary-gnu89.c new file mode 100644 index 0000000000..85226aeef9 --- /dev/null +++ b/wcsmbs/tst-wscanf-binary-gnu89.c @@ -0,0 +1,26 @@ +/* Test wscanf functions with C2X binary integers (wide strings, + GNU extensions to C89). + Copyright (C) 2022-2023 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 + . */ + +#define CHAR wchar_t +#define FNW w +#define L_(C) L ## C +#define TEST_C2X 0 +#define STD "gnu89" + +#include "../stdio-common/tst-scanf-binary-main.c" diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h index cde0d32b0a..7ab99ba93b 100644 --- a/wcsmbs/wchar.h +++ b/wcsmbs/wchar.h @@ -762,9 +762,34 @@ extern int swscanf (const wchar_t *__restrict __s, 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 \ +# 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 (fwscanf, (__FILE *__restrict __stream, + const wchar_t *__restrict __format, ...), + __isoc23_fwscanf) + /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; +extern int __REDIRECT (wscanf, (const wchar_t *__restrict __format, ...), + __isoc23_wscanf) + /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */; +extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s, + const wchar_t *__restrict __format, + ...), __isoc23_swscanf) + /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; +# else +extern int __isoc23_fwscanf (__FILE *__restrict __stream, + const wchar_t *__restrict __format, ...); +extern int __isoc23_wscanf (const wchar_t *__restrict __format, ...); +extern int __isoc23_swscanf (const wchar_t *__restrict __s, + const wchar_t *__restrict __format, ...) + __THROW; +# define fwscanf __isoc23_fwscanf +# define wscanf __isoc23_wscanf +# define swscanf __isoc23_swscanf +# endif +# else +# ifdef __REDIRECT extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream, const wchar_t *__restrict __format, ...), __isoc99_fwscanf) @@ -776,16 +801,17 @@ 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 # endif # endif @@ -818,7 +844,34 @@ extern int vswscanf (const wchar_t *__restrict __s, && (!defined __LDBL_COMPAT || !defined __REDIRECT) \ && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) \ && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0 -# ifdef __REDIRECT +# if __GLIBC_USE (C2X_STRTOL) +# ifdef __REDIRECT +extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s, + const wchar_t *__restrict __format, + __gnuc_va_list __arg), __isoc23_vfwscanf) + /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; +extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format, + __gnuc_va_list __arg), __isoc23_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), __isoc23_vswscanf) + /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; +# else +extern int __isoc23_vfwscanf (__FILE *__restrict __s, + const wchar_t *__restrict __format, + __gnuc_va_list __arg); +extern int __isoc23_vwscanf (const wchar_t *__restrict __format, + __gnuc_va_list __arg); +extern int __isoc23_vswscanf (const wchar_t *__restrict __s, + const wchar_t *__restrict __format, + __gnuc_va_list __arg) __THROW; +# define vfwscanf __isoc23_vfwscanf +# define vwscanf __isoc23_vwscanf +# define vswscanf __isoc23_vswscanf +# endif +# else +# ifdef __REDIRECT extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s, const wchar_t *__restrict __format, __gnuc_va_list __arg), __isoc99_vfwscanf) @@ -830,7 +883,7 @@ 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 +# else extern int __isoc99_vfwscanf (__FILE *__restrict __s, const wchar_t *__restrict __format, __gnuc_va_list __arg); @@ -839,9 +892,10 @@ extern int __isoc99_vwscanf (const wchar_t *__restrict __format, 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 +# define vfwscanf __isoc99_vfwscanf +# define vwscanf __isoc99_vwscanf +# define vswscanf __isoc99_vswscanf +# endif # endif # endif -- cgit 1.4.1