diff options
11 files changed, 248 insertions, 1 deletions
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile index a1f0f7d74e..031ee0b38f 100644 --- a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile +++ b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile @@ -1,3 +1,11 @@ +ifeq ($(subdir),libio) +ldbl-extra-routines += fwscanf \ + swscanf \ + wscanf \ + vswscanf \ + vwscanf +endif + ifeq ($(subdir),stdio-common) ldbl-extra-routines += printf_size \ asprintf \ @@ -23,7 +31,8 @@ ldbl-extra-routines += printf_size \ sscanf \ vfscanf \ vscanf \ - vsscanf + vsscanf \ + vfwscanf # Printing long double values with IEEE binary128 format reuses part # of the internal float128 implementation (__printf_fp, __printf_fphex, @@ -34,6 +43,7 @@ ldbl-extra-routines += printf_size \ CFLAGS-vfprintf-internal.c += -mfloat128 -mabi=ibmlongdouble CFLAGS-vfwprintf-internal.c += -mfloat128 -mabi=ibmlongdouble CFLAGS-vfscanf-internal.c += -mfloat128 -mabi=ibmlongdouble +CFLAGS-vfwscanf-internal.c += -mfloat128 -mabi=ibmlongdouble # Basic tests for the implementation of long double with IEEE binary128 # format and for the related redirections in installed headers. @@ -51,9 +61,18 @@ CFLAGS-test-scanf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi $(objpfx)test-scanf-ieee128: gnulib-tests += $(f128-loader-link) +tests-internal += test-wscanf-ieee128 test-wscanf-ibm128 +CFLAGS-test-wscanf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi +CFLAGS-test-wscanf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi + +$(objpfx)test-wscanf-ieee128: gnulib-tests += $(f128-loader-link) + ifeq ($(run-built-tests),yes) tests-special += $(objpfx)test-scanf-ieee128.out tests-special += $(objpfx)test-scanf-ibm128.out + +tests-special += $(objpfx)test-wscanf-ieee128.out +tests-special += $(objpfx)test-wscanf-ibm128.out endif $(objpfx)test-scanf-ieee128.out: \ @@ -68,6 +87,18 @@ $(objpfx)test-scanf-ibm128.out: \ $(SHELL) $^ '$(test-program-prefix)' $@; \ $(evaluate-test) +$(objpfx)test-wscanf-ieee128.out: \ + ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \ + $(objpfx)test-wscanf-ieee128 + $(SHELL) $^ '$(test-program-prefix)' $@; \ + $(evaluate-test) + +$(objpfx)test-wscanf-ibm128.out: \ + ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \ + $(objpfx)test-wscanf-ibm128 + $(SHELL) $^ '$(test-program-prefix)' $@; \ + $(evaluate-test) + tests-internal += test-printf-size-ieee128 test-printf-size-ibm128 CFLAGS-test-printf-size-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi CFLAGS-test-printf-size-ibm128.c += -mabi=ibmlongdouble -Wno-psabi diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Versions b/sysdeps/ieee754/ldbl-128ibm-compat/Versions index 7971c7a7d1..8b23fdf56f 100644 --- a/sysdeps/ieee754/ldbl-128ibm-compat/Versions +++ b/sysdeps/ieee754/ldbl-128ibm-compat/Versions @@ -172,5 +172,13 @@ libc { __vfscanfieee128; __vscanfieee128; __vsscanfieee128; + + __fwscanfieee128; + __swscanfieee128; + __wscanfieee128; + + __vfwscanfieee128; + __vswscanfieee128; + __vwscanfieee128; } } diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fwscanf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fwscanf.c new file mode 100644 index 0000000000..35ad72ec3d --- /dev/null +++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fwscanf.c @@ -0,0 +1,35 @@ +/* Wrapper for fwscanf. IEEE128 version. + Copyright (C) 2019 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 + <http://www.gnu.org/licenses/>. */ + +#include <stdarg.h> +#include <libioP.h> + +extern int +___ieee128_fwscanf (FILE *fp, const wchar_t *format, ...) +{ + va_list ap; + int done; + + va_start (ap, format); + done = __vfwscanf_internal (fp, format, ap, + SCANF_LDBL_USES_FLOAT128); + va_end (ap); + + return done; +} +strong_alias (___ieee128_fwscanf, __fwscanfieee128) diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-swscanf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-swscanf.c new file mode 100644 index 0000000000..1ee4662013 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-swscanf.c @@ -0,0 +1,40 @@ +/* Wrapper for swscanf. IEEE128 version. + Copyright (C) 2019 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 + <http://www.gnu.org/licenses/>. */ + +#include <stdarg.h> +#include <strfile.h> +#include <libioP.h> + +extern int +___ieee128_swscanf (const wchar_t *string, const wchar_t *format, ...) +{ + va_list ap; + int done; + + _IO_strfile sf; + struct _IO_wide_data wd; + FILE *fp = _IO_strfile_readw (&sf, &wd, string); + + va_start (ap, format); + done = __vfwscanf_internal (fp, format, ap, + SCANF_LDBL_USES_FLOAT128); + va_end (ap); + + return done; +} +strong_alias (___ieee128_swscanf, __swscanfieee128) diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfwscanf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfwscanf.c new file mode 100644 index 0000000000..94a3e2153f --- /dev/null +++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfwscanf.c @@ -0,0 +1,27 @@ +/* Wrapper for vfwscanf. IEEE128 version. + Copyright (C) 2019 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 + <http://www.gnu.org/licenses/>. */ + +#include <libioP.h> + +extern int +___ieee128_vfwscanf (FILE *fp, const wchar_t *format, va_list ap) +{ + return __vfwscanf_internal (fp, format, ap, + SCANF_LDBL_USES_FLOAT128); +} +strong_alias (___ieee128_vfwscanf, __vfwscanfieee128) diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vswscanf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vswscanf.c new file mode 100644 index 0000000000..c08c7e3c89 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vswscanf.c @@ -0,0 +1,32 @@ +/* Wrapper for vswscanf. IEEE128 version. + Copyright (C) 2019 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 + <http://www.gnu.org/licenses/>. */ + +#include <libioP.h> +#include <wchar.h> +#include <strfile.h> + +extern int +___ieee128_vswscanf (const wchar_t *string, const wchar_t *format, + va_list ap) +{ + _IO_strfile sf; + struct _IO_wide_data wd; + FILE *fp = _IO_strfile_readw (&sf, &wd, string); + return __vfwscanf_internal (fp, format, ap, SCANF_LDBL_USES_FLOAT128); +} +strong_alias (___ieee128_vswscanf, __vswscanfieee128) diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vwscanf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vwscanf.c new file mode 100644 index 0000000000..6ec324e910 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vwscanf.c @@ -0,0 +1,27 @@ +/* Wrapper for vwscanf. IEEE128 version. + Copyright (C) 2019 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 + <http://www.gnu.org/licenses/>. */ + +#include <libioP.h> + +extern int +___ieee128_vwscanf (const wchar_t *format, va_list ap) +{ + return __vfwscanf_internal (stdin, format, ap, + SCANF_LDBL_USES_FLOAT128); +} +strong_alias (___ieee128_vwscanf, __vwscanfieee128) diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-wscanf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-wscanf.c new file mode 100644 index 0000000000..1bce512059 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-wscanf.c @@ -0,0 +1,35 @@ +/* Wrapper for wscanf. IEEE128 version. + Copyright (C) 2019 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 + <http://www.gnu.org/licenses/>. */ + +#include <stdarg.h> +#include <libioP.h> + +extern int +___ieee128_wscanf (const wchar_t *format, ...) +{ + va_list ap; + int done; + + va_start (ap, format); + done = __vfwscanf_internal (stdin, format, ap, + SCANF_LDBL_USES_FLOAT128); + va_end (ap); + + return done; +} +strong_alias (___ieee128_wscanf, __wscanfieee128) diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/test-wscanf-ibm128.c b/sysdeps/ieee754/ldbl-128ibm-compat/test-wscanf-ibm128.c new file mode 100644 index 0000000000..ef21fc4741 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128ibm-compat/test-wscanf-ibm128.c @@ -0,0 +1 @@ +#include <test-wscanf-ldbl-compat.c> diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/test-wscanf-ieee128.c b/sysdeps/ieee754/ldbl-128ibm-compat/test-wscanf-ieee128.c new file mode 100644 index 0000000000..ef21fc4741 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128ibm-compat/test-wscanf-ieee128.c @@ -0,0 +1 @@ +#include <test-wscanf-ldbl-compat.c> diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/test-wscanf-ldbl-compat.c b/sysdeps/ieee754/ldbl-128ibm-compat/test-wscanf-ldbl-compat.c new file mode 100644 index 0000000000..e93cf3b9bd --- /dev/null +++ b/sysdeps/ieee754/ldbl-128ibm-compat/test-wscanf-ldbl-compat.c @@ -0,0 +1,10 @@ +#define CHAR wchar_t +#define L(x) L##x +#define FSCANF fwscanf +#define SSCANF swscanf +#define SCANF wscanf +#define VFSCANF vfwscanf +#define VSSCANF vswscanf +#define VSCANF vwscanf +#define STRCPY wcscpy +#include <test-scanf-ldbl-compat-template.c> |