This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[glibc/gabriel/powerpc-ieee128-printscan] ldbl-128ibm-compat: Add regular character scanning functions


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

commit 3f27187fb28c21c56370d95cf2305c126abc8bac
Author: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
Date:   Thu Jul 11 11:47:16 2019 -0300

    ldbl-128ibm-compat: Add regular character scanning functions
    
    The 'mode' argument to __vfscanf_internal allows the selection of the
    long double format for all long double arguments requested by the format
    string.  Currently, there are two possibilities: long double with the
    same format as double or long double as something else.  The 'something
    else' format varies between architectures, and on powerpc64le, it means
    IBM Extended Precision format.
    
    In preparation for the third option of long double format on
    powerpc64le, this patch uses the new mode mask,
    SCANF_LDBL_USES_FLOAT128, which tells __vfscanf_internal to call
    __strtof128_internal, instead of __strtold_internal, and save the output
    into a _Float128 variable.
    
    Tested for powerpc64le.
    
    	* sysdeps/ieee754/ldbl-128ibm-compat/Makefile
    	[subdir == stdio-common] (ldbl-extra-routines): Add fscanf,
    	scanf, sscanf, vfscanf, vscanf, and vsscanf.
    	(CFLAGS-vfscanf-internal.c): Add -mfloat128 to the compiler
    	command used to build vfscanf-internal.c.  This is needed to
    	extend __vfscanf_internal with the support to redirect the call
    	to __strtold_internal to __strtof128_internal.
    	(tests-internal): Add test-scanf-ieee128 and test-scanf-ibm128.
    	(CFLAGS-test-scanf-ieee128.c): New variable.
    	(CFLAGS-test-scanf-ibm128.c): Likewise.
    	($(objpfx)test-scanf-ieee128): Link the loader after libgcc.
    	[run-built-tests] (tests-special): Add
    	$(objpfx)test-scanf-ieee128.out and
    	$(objpfx)test-scanf-ibm128.out.
    	($(objpfx)test-scanf-ieee128.out): New build and run rule.
    	($(objpfx)test-scanf-ibm128.out): Likewise.
    	* sysdeps/ieee754/ldbl-128ibm-compat/Versions (libc): Add
    	__fscanfieee128, __scanfieee128, __sscanfieee128,
    	__vfscanfieee128, __vscanfieee128, and __vsscanfieee128.
    	* sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fscanf.c: New file.
    	* sysdeps/ieee754/ldbl-128ibm-compat/ieee128-scanf.c: Likewise.
    	* sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sscanf.c: Likewise.
    	* sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfscanf.c:
    	Likewise.
    	* sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vscanf.c: Likewise.
    	* sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vsscanf.c:
    	Likewise.
    	* sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ibm128.c:
    	Likewise.
    	* sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ieee128.c:
    	Likewise.
    	* sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat-template.c:
    	Likewise.
    	* sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.c:
    	Likewise.
    	* sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh:
    	Likewise.

Diff:
---
 sysdeps/ieee754/ldbl-128ibm-compat/Makefile        |  37 ++++++-
 sysdeps/ieee754/ldbl-128ibm-compat/Versions        |   8 ++
 .../ieee754/ldbl-128ibm-compat/ieee128-fscanf.c    |  34 ++++++
 sysdeps/ieee754/ldbl-128ibm-compat/ieee128-scanf.c |  34 ++++++
 .../ieee754/ldbl-128ibm-compat/ieee128-sscanf.c    |  38 +++++++
 .../ieee754/ldbl-128ibm-compat/ieee128-vfscanf.c   |  26 +++++
 .../ieee754/ldbl-128ibm-compat/ieee128-vscanf.c    |  26 +++++
 .../ieee754/ldbl-128ibm-compat/ieee128-vsscanf.c   |  29 +++++
 .../ieee754/ldbl-128ibm-compat/test-scanf-ibm128.c |   1 +
 .../ldbl-128ibm-compat/test-scanf-ieee128.c        |   1 +
 .../test-scanf-ldbl-compat-template.c              | 117 +++++++++++++++++++++
 .../ldbl-128ibm-compat/test-scanf-ldbl-compat.c    |  10 ++
 .../ldbl-128ibm-compat/test-scanf-ldbl-compat.sh   |  63 +++++++++++
 13 files changed, 421 insertions(+), 3 deletions(-)

diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
index 4a2c594..cc1890e 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
@@ -17,15 +17,23 @@ ldbl-extra-routines += printf_size \
 		       wprintf \
 		       vfwprintf \
 		       vswprintf \
-		       vwprintf
+		       vwprintf \
+		       fscanf \
+		       scanf \
+		       sscanf \
+		       vfscanf \
+		       vscanf \
+		       vsscanf
 
 # Printing long double values with IEEE binary128 format reuses part
 # of the internal float128 implementation (__printf_fp, __printf_fphex,
-# and __float128 variables and union members).  Thus, the compilation of
-# the following functions, must have -mfloat128 and -mabi=ibmlongdouble
+# and __float128 variables and union members).  Likewise, reading these
+# values reuses __strtof128_internal.  Thus, the compilation of the
+# following functions, must have -mfloat128 and -mabi=ibmlongdouble
 # passed to the compiler.
 CFLAGS-vfprintf-internal.c += -mfloat128 -mabi=ibmlongdouble
 CFLAGS-vfwprintf-internal.c += -mfloat128 -mabi=ibmlongdouble
+CFLAGS-vfscanf-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.
@@ -37,6 +45,29 @@ tests-internal += test-wprintf-ieee128 test-wprintf-ibm128
 CFLAGS-test-wprintf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
 CFLAGS-test-wprintf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
 
+tests-internal += test-scanf-ieee128 test-scanf-ibm128
+CFLAGS-test-scanf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
+CFLAGS-test-scanf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
+
+$(objpfx)test-scanf-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
+endif
+
+$(objpfx)test-scanf-ieee128.out: \
+  ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
+  $(objpfx)test-scanf-ieee128
+	$(SHELL) $^ '$(test-program-prefix)' $@; \
+	$(evaluate-test)
+
+$(objpfx)test-scanf-ibm128.out: \
+  ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
+  $(objpfx)test-scanf-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 e438c7c..7971c7a 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/Versions
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/Versions
@@ -164,5 +164,13 @@ libc {
     __vfwprintf_chkieee128;
     __vswprintf_chkieee128;
     __vwprintf_chkieee128;
+
+    __fscanfieee128;
+    __scanfieee128;
+    __sscanfieee128;
+
+    __vfscanfieee128;
+    __vscanfieee128;
+    __vsscanfieee128;
   }
 }
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fscanf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fscanf.c
new file mode 100644
index 0000000..f51e822
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fscanf.c
@@ -0,0 +1,34 @@
+/* Wrapper for fscanf.  IEEE128 version.
+   Copyright (C) 2018 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 <libio/libioP.h>
+
+extern int
+___ieee128_fscanf (FILE *fp, const char *format, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, format);
+  done = __vfscanf_internal (fp, format, arg, SCANF_LDBL_USES_FLOAT128);
+  va_end (arg);
+
+  return done;
+}
+strong_alias (___ieee128_fscanf, __fscanfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-scanf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-scanf.c
new file mode 100644
index 0000000..571cf7d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-scanf.c
@@ -0,0 +1,34 @@
+/* Wrapper for scanf.  IEEE128 version.
+   Copyright (C) 2018 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 <libio/libioP.h>
+
+extern int
+___ieee128_scanf (const char *format, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, format);
+  done = __vfscanf_internal (stdin, format, arg, SCANF_LDBL_USES_FLOAT128);
+  va_end (arg);
+
+  return done;
+}
+strong_alias (___ieee128_scanf, __scanfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sscanf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sscanf.c
new file mode 100644
index 0000000..7c93295
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sscanf.c
@@ -0,0 +1,38 @@
+/* Wrapper for sscanf.  IEEE128 version.
+   Copyright (C) 2018 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_sscanf (const char *string, const char *format, ...)
+{
+  va_list arg;
+  int done;
+
+  _IO_strfile sf;
+  FILE *fp = _IO_strfile_read (&sf, string);
+
+  va_start (arg, format);
+  done = __vfscanf_internal (fp, format, arg, SCANF_LDBL_USES_FLOAT128);
+  va_end (arg);
+
+  return done;
+}
+strong_alias (___ieee128_sscanf, __sscanfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfscanf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfscanf.c
new file mode 100644
index 0000000..d6654e0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfscanf.c
@@ -0,0 +1,26 @@
+/* Wrapper for vfscanf.  IEEE128 version.
+   Copyright (C) 2018 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 <libio/libioP.h>
+
+extern int
+___ieee128_vfscanf (FILE *fp, const char *format, va_list ap)
+{
+  return __vfscanf_internal (fp, format, ap, SCANF_LDBL_USES_FLOAT128);
+}
+strong_alias (___ieee128_vfscanf, __vfscanfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vscanf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vscanf.c
new file mode 100644
index 0000000..5780c06
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vscanf.c
@@ -0,0 +1,26 @@
+/* Wrapper for vscanf.  IEEE128 version.
+   Copyright (C) 2018 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 <libio/libioP.h>
+
+extern int
+___ieee128_vscanf (const char *format, va_list ap)
+{
+  return __vfscanf_internal (stdin, format, ap, SCANF_LDBL_USES_FLOAT128);
+}
+strong_alias (___ieee128_vscanf, __vscanfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vsscanf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vsscanf.c
new file mode 100644
index 0000000..8ff43a9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vsscanf.c
@@ -0,0 +1,29 @@
+/* Wrapper for vsscanf.  IEEE128 version.
+   Copyright (C) 2018 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 <strfile.h>
+#include <libioP.h>
+
+extern int
+___ieee128_vsscanf (const char *string, const char *format, va_list ap)
+{
+  _IO_strfile sf;
+  FILE *fp = _IO_strfile_read (&sf, string);
+  return __vfscanf_internal (fp, format, ap, SCANF_LDBL_USES_FLOAT128);
+}
+strong_alias (___ieee128_vsscanf, __vsscanfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ibm128.c b/sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ibm128.c
new file mode 100644
index 0000000..8cdee60
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ibm128.c
@@ -0,0 +1 @@
+#include <test-scanf-ldbl-compat.c>
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ieee128.c b/sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ieee128.c
new file mode 100644
index 0000000..8cdee60
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ieee128.c
@@ -0,0 +1 @@
+#include <test-scanf-ldbl-compat.c>
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat-template.c b/sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat-template.c
new file mode 100644
index 0000000..4590e9d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat-template.c
@@ -0,0 +1,117 @@
+/* Test for the long double variants of *scanf functions.
+   Copyright (C) 2018 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 <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <wchar.h>
+
+#include <support/check.h>
+
+#define CLEAR								\
+  va_start (args, format);						\
+  ld = va_arg (args, long double *);					\
+  *ld = 0;								\
+  va_end (args);
+
+#define CLEAR_VALUE value = 0;
+
+#define CHECK								\
+  va_start (args, format);						\
+  ld = va_arg (args, long double *);					\
+  va_end (args);							\
+  if (*ld == -1.0L)							\
+    printf ("OK");							\
+  else									\
+    printf ("ERROR (%.60Lf)", *ld);					\
+  printf ("\n");
+
+#define CHECK_VALUE							\
+  if (value == -1.0L)							\
+    printf ("OK");							\
+  else									\
+    printf ("ERROR (%.60Lf)", value);					\
+  printf ("\n");
+
+static void
+do_test_call (FILE *stream, CHAR *string, const CHAR *format, ...)
+{
+  long double value;
+  long double *ld;
+  va_list args;
+
+  CLEAR_VALUE
+  printf ("fscanf: ");
+  FSCANF (stream, format, &value);
+  CHECK_VALUE
+
+  CLEAR_VALUE
+  printf ("scanf: ");
+  SCANF (format, &value);
+  CHECK_VALUE
+
+  CLEAR_VALUE
+  printf ("sscanf: ");
+  SSCANF (string, format, &value);
+  CHECK_VALUE
+
+  CLEAR
+  printf ("vfscanf: ");
+  va_start (args, format);
+  VFSCANF (stream, format, args);
+  va_end (args);
+  CHECK
+
+  CLEAR
+  printf ("vscanf: ");
+  va_start (args, format);
+  VSCANF (format, args);
+  va_end (args);
+  CHECK
+
+  CLEAR
+  printf ("vsscanf: ");
+  va_start (args, format);
+  VSSCANF (string, format, args);
+  va_end (args);
+  CHECK
+}
+
+static int
+do_test (void)
+{
+  CHAR string[256];
+  long double ld;
+
+  /* Scan in decimal notation.  */
+  STRCPY (string,
+	  L ("-1.0\n")
+	  L ("-1.0\n") );
+  do_test_call (stdin, string, L("%Lf"), &ld);
+
+  /* Scan in hexadecimal notation.  */
+  STRCPY (string,
+	  L ("-0x1.0p+0\n")
+	  L ("-0x1.0p+0\n") );
+  do_test_call (stdin, string, L("%La"), &ld);
+
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.c b/sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.c
new file mode 100644
index 0000000..0759d8a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.c
@@ -0,0 +1,10 @@
+#define CHAR char
+#define L(x) x
+#define FSCANF fscanf
+#define SSCANF sscanf
+#define SCANF scanf
+#define VFSCANF vfscanf
+#define VSSCANF vsscanf
+#define VSCANF vscanf
+#define STRCPY strcpy
+#include <test-scanf-ldbl-compat-template.c>
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh b/sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh
new file mode 100644
index 0000000..822b4c3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh
@@ -0,0 +1,63 @@
+#!/bin/sh
+# Testing of *scanf.  IEEE binary128 for powerpc64le version.
+# Copyright (C) 2018 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/>.
+
+set -e
+
+test_program=$1; shift
+test_program_prefix=$1; shift
+test_program_output=$1; shift
+
+status=0
+
+cat <<'EOF' |
+-1.000000000000000000000000000000000000000000000000000000000000
+-1.000000000000000000000000000000000000000000000000000000000000
+-1.000000000000000000000000000000000000000000000000000000000000
+-1.000000000000000000000000000000000000000000000000000000000000
+-0x1.000000000000000000000000000000000000000000000000000000000000p+0
+-0x1.000000000000000000000000000000000000000000000000000000000000p+0
+-0x1.000000000000000000000000000000000000000000000000000000000000p+0
+-0x1.000000000000000000000000000000000000000000000000000000000000p+0
+EOF
+${test_program_prefix} \
+  ${test_program} \
+  - \
+  > ${test_program_output} || status=1
+
+cat <<'EOF' |
+fscanf: OK
+scanf: OK
+sscanf: OK
+vfscanf: OK
+vscanf: OK
+vsscanf: OK
+fscanf: OK
+scanf: OK
+sscanf: OK
+vfscanf: OK
+vscanf: OK
+vsscanf: OK
+EOF
+cmp - ${test_program_output} > /dev/null 2>&1 ||
+{
+  status=1
+  echo "*** output comparison failed"
+}
+
+exit $status


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]