This is the mail archive of the libc-alpha@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]

[PATCH 07/14] ldbl-128ibm-compat: Add wide character, fortified printing functions


Similarly to what was done for the regular character, fortified printing
functions, this patch combines the mode masks PRINTF_LDBL_USES_FLOAT128
and PRINTF_FORTIFY to provide wide character versions of fortified
printf functions.

Tested for powerpc64le.

	* sysdeps/ieee754/ldbl-128ibm-compat/Makefile:
	[subdir == stdio-common] (routines): Add ieee128-fwprintf_chk,
	ieee128-swprintf_chk, ieee128-wprintf_chk,
	ieee128-vfwprintf_chk, ieee128-vswprintf_chk, and
	ieee128-vwprintf_chk.
	[subdir == stdio-common] (tests-internal): Add
	test-wprintf-chk-ieee128 and test-wprintf-chk-ibm128.
	[subdir == stdio-common] (CFLAGS-test-wprintf-chk-ieee128.c): New
	variable to add the relevant -mabi flags to the compilation.
	[subdir == stdio-common] (CFLAGS-test-wprintf-chk-ibm128.c): Likewise.
	[subdir == stdio-common && run-built-tests == yes]
	(tests-special): Add $(objpfx)test-wprintf-chk-ieee128.out, and
	$(objpfx)test-wprintf-chk-ibm128.out.
	[subdir == stdio-common] ($(objpfx)test-wprintf-chk-ieee128.out):
	New build and test rule.
	[subdir == stdio-common] ($(objpfx)test-wprintf-chk-ibm128.out):
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm-compat/Versions (libc): Add
	__fwprintf_chkieee128, __swprintf_chkieee128,
	__wprintf_chkieee128, __vfwprintf_chkieee128,
	__vswprintf_chkieee128, and __vwprintf_chkieee128;
	* sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fwprintf_chk.c:
	New file.
	* sysdeps/ieee754/ldbl-128ibm-compat/ieee128-swprintf_chk.c:
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfwprintf_chk.c:
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vswprintf_chk.c:
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vwprintf_chk.c:
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm-compat/ieee128-wprintf_chk.c:
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ibm128.c:
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ieee128.c:
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ldbl-compat.c:
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ldbl-compat.sh:
	Likewise.
---
 sysdeps/ieee754/ldbl-128ibm-compat/Makefile        | 27 +++++++
 sysdeps/ieee754/ldbl-128ibm-compat/Versions        |  8 ++
 .../ldbl-128ibm-compat/ieee128-fwprintf_chk.c      | 38 +++++++++
 .../ldbl-128ibm-compat/ieee128-swprintf_chk.c      | 42 ++++++++++
 .../ldbl-128ibm-compat/ieee128-vfwprintf_chk.c     | 31 ++++++++
 .../ldbl-128ibm-compat/ieee128-vswprintf_chk.c     | 34 +++++++++
 .../ldbl-128ibm-compat/ieee128-vwprintf_chk.c      | 30 ++++++++
 .../ldbl-128ibm-compat/ieee128-wprintf_chk.c       | 38 +++++++++
 .../ldbl-128ibm-compat/test-wprintf-chk-ibm128.c   |  1 +
 .../ldbl-128ibm-compat/test-wprintf-chk-ieee128.c  |  1 +
 .../test-wprintf-chk-ldbl-compat.c                 | 89 ++++++++++++++++++++++
 .../test-wprintf-chk-ldbl-compat.sh                | 52 +++++++++++++
 12 files changed, 391 insertions(+)
 create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fwprintf_chk.c
 create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/ieee128-swprintf_chk.c
 create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfwprintf_chk.c
 create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vswprintf_chk.c
 create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vwprintf_chk.c
 create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/ieee128-wprintf_chk.c
 create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ibm128.c
 create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ieee128.c
 create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ldbl-compat.c
 create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ldbl-compat.sh

diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
index 78400a7a4a..88cb36576b 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
@@ -37,6 +37,14 @@ routines += ieee128-vprintf_chk
 routines += ieee128-vsnprintf_chk
 routines += ieee128-vsprintf_chk
 
+routines += ieee128-fwprintf_chk
+routines += ieee128-swprintf_chk
+routines += ieee128-wprintf_chk
+
+routines += ieee128-vfwprintf_chk
+routines += ieee128-vswprintf_chk
+routines += ieee128-vwprintf_chk
+
 # 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
@@ -58,6 +66,10 @@ tests-internal += test-printf-chk-ieee128 test-printf-chk-ibm128
 CFLAGS-test-printf-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
 CFLAGS-test-printf-chk-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
 
+tests-internal += test-wprintf-chk-ieee128 test-wprintf-chk-ibm128
+CFLAGS-test-wprintf-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
+CFLAGS-test-wprintf-chk-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
+
 ifeq ($(run-built-tests),yes)
 tests-special += $(objpfx)test-printf-ieee128.out
 tests-special += $(objpfx)test-printf-ibm128.out
@@ -67,6 +79,9 @@ tests-special += $(objpfx)test-wprintf-ibm128.out
 
 tests-special += $(objpfx)test-printf-chk-ieee128.out
 tests-special += $(objpfx)test-printf-chk-ibm128.out
+
+tests-special += $(objpfx)test-wprintf-chk-ieee128.out
+tests-special += $(objpfx)test-wprintf-chk-ibm128.out
 endif
 
 $(objpfx)test-printf-ieee128.out: \
@@ -104,4 +119,16 @@ $(objpfx)test-printf-chk-ibm128.out: \
   $(objpfx)test-printf-chk-ibm128
 	$(SHELL) $^ '$(test-program-prefix)' $@; \
 	$(evaluate-test)
+
+$(objpfx)test-wprintf-chk-ieee128.out: \
+  ../sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ldbl-compat.sh \
+  $(objpfx)test-wprintf-chk-ieee128
+	$(SHELL) $^ '$(test-program-prefix)' $@; \
+	$(evaluate-test)
+
+$(objpfx)test-wprintf-chk-ibm128.out: \
+  ../sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ldbl-compat.sh \
+  $(objpfx)test-wprintf-chk-ibm128
+	$(SHELL) $^ '$(test-program-prefix)' $@; \
+	$(evaluate-test)
 endif
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Versions b/sysdeps/ieee754/ldbl-128ibm-compat/Versions
index 540237d6d4..583c05cca7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/Versions
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/Versions
@@ -148,5 +148,13 @@ libc {
     __vprintf_chkieee128;
     __vsnprintf_chkieee128;
     __vsprintf_chkieee128;
+
+    __fwprintf_chkieee128;
+    __swprintf_chkieee128;
+    __wprintf_chkieee128;
+
+    __vfwprintf_chkieee128;
+    __vswprintf_chkieee128;
+    __vwprintf_chkieee128;
   }
 }
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fwprintf_chk.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fwprintf_chk.c
new file mode 100644
index 0000000000..bdf48633de
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fwprintf_chk.c
@@ -0,0 +1,38 @@
+/* Wrapper for __fwprintf_chk.  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_fwprintf_chk (FILE *fp, int flag, const wchar_t *format, ...)
+{
+  va_list ap;
+  int done;
+
+  unsigned int mode = PRINTF_LDBL_USES_FLOAT128;
+  if (flag > 0)
+    mode |= PRINTF_FORTIFY;
+
+  va_start (ap, format);
+  done = __vfwprintf_internal (fp, format, ap, mode);
+  va_end (ap);
+
+  return done;
+}
+strong_alias (___ieee128_fwprintf_chk, __fwprintf_chkieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-swprintf_chk.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-swprintf_chk.c
new file mode 100644
index 0000000000..411da9a0de
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-swprintf_chk.c
@@ -0,0 +1,42 @@
+/* Wrapper for __swprintf_chk.  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_swprintf_chk (wchar_t *string, size_t maxlen, int flag,
+			size_t slen, const wchar_t *format, ...)
+{
+  va_list ap;
+  int done;
+
+  unsigned int mode = PRINTF_LDBL_USES_FLOAT128;
+  if (flag > 0)
+    mode |= PRINTF_FORTIFY;
+
+  if (__glibc_unlikely (slen < maxlen))
+    __chk_fail ();
+
+  va_start (ap, format);
+  done = __vswprintf_internal (string, maxlen, format, ap, mode);
+  va_end (ap);
+
+  return done;
+}
+strong_alias (___ieee128_swprintf_chk, __swprintf_chkieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfwprintf_chk.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfwprintf_chk.c
new file mode 100644
index 0000000000..2d6fe6d429
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfwprintf_chk.c
@@ -0,0 +1,31 @@
+/* Wrapper for __vfwprintf_chk.  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_vfwprintf_chk (FILE *fp, int flag, const wchar_t *format,
+			 va_list ap)
+{
+  unsigned int mode = PRINTF_LDBL_USES_FLOAT128;
+  if (flag > 0)
+    mode |= PRINTF_FORTIFY;
+
+  return __vfwprintf_internal (fp, format, ap, mode);
+}
+strong_alias (___ieee128_vfwprintf_chk, __vfwprintf_chkieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vswprintf_chk.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vswprintf_chk.c
new file mode 100644
index 0000000000..702fdda0c7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vswprintf_chk.c
@@ -0,0 +1,34 @@
+/* Wrapper for __vswprintf_chk.  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_vswprintf_chk (wchar_t *string, size_t maxlen, int flag,
+			 size_t slen, const wchar_t *format, va_list ap)
+{
+  unsigned int mode = PRINTF_LDBL_USES_FLOAT128;
+  if (flag > 0)
+    mode |= PRINTF_FORTIFY;
+
+  if (__glibc_unlikely (slen < maxlen))
+    __chk_fail ();
+
+  return __vswprintf_internal (string, maxlen, format, ap, mode);
+}
+strong_alias (___ieee128_vswprintf_chk, __vswprintf_chkieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vwprintf_chk.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vwprintf_chk.c
new file mode 100644
index 0000000000..54f763bc58
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vwprintf_chk.c
@@ -0,0 +1,30 @@
+/* Wrapper for __vwprintf_chk.  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_vwprintf_chk (int flag, const wchar_t *format, va_list ap)
+{
+  unsigned int mode = PRINTF_LDBL_USES_FLOAT128;
+  if (flag > 0)
+    mode |= PRINTF_FORTIFY;
+
+  return __vfwprintf_internal (stdout, format, ap, mode);
+}
+strong_alias (___ieee128_vwprintf_chk, __vwprintf_chkieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-wprintf_chk.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-wprintf_chk.c
new file mode 100644
index 0000000000..82b6d85c23
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-wprintf_chk.c
@@ -0,0 +1,38 @@
+/* Wrapper for __wprintf_chk.  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_wprintf_chk (int flag, const wchar_t *format, ...)
+{
+  va_list ap;
+  int done;
+
+  unsigned int mode = PRINTF_LDBL_USES_FLOAT128;
+  if (flag > 0)
+    mode |= PRINTF_FORTIFY;
+
+  va_start (ap, format);
+  done = __vfwprintf_internal (stdout, format, ap, mode);
+  va_end (ap);
+
+  return done;
+}
+strong_alias (___ieee128_wprintf_chk, __wprintf_chkieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ibm128.c b/sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ibm128.c
new file mode 100644
index 0000000000..5323df71e2
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ibm128.c
@@ -0,0 +1 @@
+#include <test-wprintf-chk-ldbl-compat.c>
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ieee128.c b/sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ieee128.c
new file mode 100644
index 0000000000..5323df71e2
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ieee128.c
@@ -0,0 +1 @@
+#include <test-wprintf-chk-ldbl-compat.c>
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ldbl-compat.c b/sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ldbl-compat.c
new file mode 100644
index 0000000000..d68e7fd7eb
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ldbl-compat.c
@@ -0,0 +1,89 @@
+/* Test for the long double variants of *w*printf_chk 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/>.  */
+
+#define _FORTIFY_SOURCE 2
+
+#include <stdarg.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <wchar.h>
+
+#include <support/check.h>
+
+static void
+do_test_call_varg (FILE *stream, const wchar_t *format, ...)
+{
+  wchar_t string[128];
+  va_list args;
+
+  wprintf (L"%20Ls", L"__vfwprintf_chk: ");
+  va_start (args, format);
+  __vfwprintf_chk (stream, 1, format, args);
+  va_end (args);
+  wprintf (L"\n");
+
+  wprintf (L"%20Ls", L"__vswprintf_chk: ");
+  va_start (args, format);
+  __vswprintf_chk (string, 79, 1, 127, format, args);
+  va_end (args);
+  wprintf (L"%Ls", string);
+  wprintf (L"\n");
+
+  wprintf (L"%20Ls", L"__vwprintf_chk: ");
+  va_start (args, format);
+  __vwprintf_chk (1, format, args);
+  va_end (args);
+  wprintf (L"\n");
+}
+
+static void
+do_test_call_rarg (FILE *stream, const wchar_t *format, long double ld)
+{
+  wchar_t string[128];
+
+  wprintf (L"%20Ls", L"__fwprintf_chk: ");
+  __fwprintf_chk (stream, 1, format, ld);
+  wprintf (L"\n");
+
+  wprintf (L"%20Ls", L"__swprintf_chk: ");
+  __swprintf_chk (string, 79, 1, 127, format, ld);
+  wprintf (L"%Ls", string);
+  wprintf (L"\n");
+
+  wprintf (L"%20Ls", L"__wprintf_chk: ");
+  __wprintf_chk (1, format, ld);
+  wprintf (L"\n");
+}
+
+static int
+do_test (void)
+{
+  long double ld = -1;
+
+  /* Print in decimal notation.  */
+  do_test_call_rarg (stdout, L"%.60Lf", ld);
+  do_test_call_varg (stdout, L"%.60Lf", ld);
+
+  /* Print in hexadecimal notation.  */
+  do_test_call_rarg (stdout, L"%.60La", ld);
+  do_test_call_varg (stdout, L"%.60La", ld);
+
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ldbl-compat.sh b/sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ldbl-compat.sh
new file mode 100644
index 0000000000..e87a2eef2e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ldbl-compat.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+# Testing of *w*printf_chk.  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
+
+${test_program_prefix} \
+  ${test_program} \
+  > ${test_program_output} || status=1
+
+cat <<'EOF' |
+    __fwprintf_chk: -1.000000000000000000000000000000000000000000000000000000000000
+    __swprintf_chk: -1.000000000000000000000000000000000000000000000000000000000000
+     __wprintf_chk: -1.000000000000000000000000000000000000000000000000000000000000
+   __vfwprintf_chk: -1.000000000000000000000000000000000000000000000000000000000000
+   __vswprintf_chk: -1.000000000000000000000000000000000000000000000000000000000000
+    __vwprintf_chk: -1.000000000000000000000000000000000000000000000000000000000000
+    __fwprintf_chk: -0x1.000000000000000000000000000000000000000000000000000000000000p+0
+    __swprintf_chk: -0x1.000000000000000000000000000000000000000000000000000000000000p+0
+     __wprintf_chk: -0x1.000000000000000000000000000000000000000000000000000000000000p+0
+   __vfwprintf_chk: -0x1.000000000000000000000000000000000000000000000000000000000000p+0
+   __vswprintf_chk: -0x1.000000000000000000000000000000000000000000000000000000000000p+0
+    __vwprintf_chk: -0x1.000000000000000000000000000000000000000000000000000000000000p+0
+EOF
+cmp - ${test_program_output} > /dev/null 2>&1 ||
+{
+  status=1
+  echo "*** output comparison failed"
+}
+
+exit $status
-- 
2.14.4


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