new file mode 100644
@@ -0,0 +1,29 @@
+/* Prototypes for internal argp.h 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 <argp.h>
+
+void
+__argp_error_internal (const struct argp_state *state, const char *fmt,
+ va_list ap, unsigned int mode_flags);
+
+void
+__argp_failure_internal (const struct argp_state *state, int status,
+ int errnum, const char *fmt, va_list ap,
+ unsigned int mode_flags);
@@ -193,3 +193,49 @@ $(objpfx)test-wscanf-ibm128.out: \
$(SHELL) $^ '$(test-program-prefix)' $@; \
$(evaluate-test)
endif
+
+ifeq ($(subdir),argp)
+# Wrappers for argp functions that take long double arguments with
+# IEEE binary128 format
+routines += ieee128-argp_error
+routines += ieee128-argp_failure
+
+tests-internal += test-argp-error-ieee128 test-argp-error-ibm128
+CFLAGS-test-argp-error-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
+CFLAGS-test-argp-error-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
+
+tests-internal += test-argp-failure-ieee128 test-argp-failure-ibm128
+CFLAGS-test-argp-failure-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
+CFLAGS-test-argp-failure-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
+
+ifeq ($(run-built-tests),yes)
+tests-special += $(objpfx)test-argp-error-ieee128.out
+tests-special += $(objpfx)test-argp-error-ibm128.out
+tests-special += $(objpfx)test-argp-failure-ieee128.out
+tests-special += $(objpfx)test-argp-failure-ibm128.out
+endif
+
+$(objpfx)test-argp-error-ieee128.out: \
+ ../sysdeps/ieee754/ldbl-128ibm-compat/test-argp-error-ldbl-compat.sh \
+ $(objpfx)test-argp-error-ieee128
+ $(SHELL) $^ '$(test-program-prefix)' $@; \
+ $(evaluate-test)
+
+$(objpfx)test-argp-error-ibm128.out: \
+ ../sysdeps/ieee754/ldbl-128ibm-compat/test-argp-error-ldbl-compat.sh \
+ $(objpfx)test-argp-error-ibm128
+ $(SHELL) $^ '$(test-program-prefix)' $@; \
+ $(evaluate-test)
+
+$(objpfx)test-argp-failure-ieee128.out: \
+ ../sysdeps/ieee754/ldbl-128ibm-compat/test-argp-failure-ldbl-compat.sh \
+ $(objpfx)test-argp-failure-ieee128
+ $(SHELL) $^ '$(test-program-prefix)' $@; \
+ $(evaluate-test)
+
+$(objpfx)test-argp-failure-ibm128.out: \
+ ../sysdeps/ieee754/ldbl-128ibm-compat/test-argp-failure-ldbl-compat.sh \
+ $(objpfx)test-argp-failure-ibm128
+ $(SHELL) $^ '$(test-program-prefix)' $@; \
+ $(evaluate-test)
+endif
@@ -172,5 +172,8 @@ libc {
__vfwscanfieee128;
__vswscanfieee128;
__vwscanfieee128;
+
+ __argp_errorieee128;
+ __argp_failureieee128;
}
}
new file mode 100644
@@ -0,0 +1,30 @@
+/* Wrapper for argp_error. 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 <argp/argpP.h>
+#include <libio/libioP.h>
+
+void
+___ieee128_argp_error (const struct argp_state *state, const char *fmt, ...)
+{
+ va_list ap;
+ va_start (ap, fmt);
+ __argp_error_internal (state, fmt, ap, PRINTF_LDBL_USES_FLOAT128);
+ va_end (ap);
+}
+strong_alias (___ieee128_argp_error, __argp_errorieee128)
new file mode 100644
@@ -0,0 +1,32 @@
+/* Wrapper for argp_failure. 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 <argp/argpP.h>
+#include <libio/libioP.h>
+
+void
+___ieee128_argp_failure (const struct argp_state *state, int status,
+ int errnum, const char *fmt, ...)
+{
+ va_list ap;
+ va_start (ap, fmt);
+ __argp_failure_internal (state, status, errnum, fmt, ap,
+ PRINTF_LDBL_USES_FLOAT128);
+ va_end (ap);
+}
+strong_alias (___ieee128_argp_failure, __argp_failureieee128)
new file mode 100644
@@ -0,0 +1 @@
+#include <test-argp-error-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1 @@
+#include <test-argp-error-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1,3 @@
+#define ARGP_FUNCTION argp_error
+#define ARGP_FUNCTION_PARAMS (state, arg, (long double) -1)
+#include <test-argp-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1,46 @@
+#!/bin/sh
+# Testing of argp_error. 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
+
+# Allow argp_error to end with non-zero exit status, run the test
+# program, then restore the exit-on-error behavior
+set +e
+${test_program_prefix} \
+ ${test_program} \
+ 2> ${test_program_output}
+set -e
+
+cat <<'EOF' |
+test-argp: -1.000000000000000000000000000000000000000000000000000000000000
+Try `test-argp --help' or `test-argp --usage' for more information.
+EOF
+cmp - ${test_program_output} > /dev/null 2>&1 ||
+{
+ status=1
+ echo "*** output comparison failed"
+}
+
+exit $status
new file mode 100644
@@ -0,0 +1 @@
+#include <test-argp-failure-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1 @@
+#include <test-argp-failure-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1,3 @@
+#define ARGP_FUNCTION argp_failure
+#define ARGP_FUNCTION_PARAMS (state, 0, 0, arg, (long double) -1)
+#include <test-argp-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1,45 @@
+#!/bin/sh
+# Testing of argp_failure. 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
+
+# Allow argp_failure to end with non-zero exit status, run the test
+# program, then restore the exit-on-error behavior
+set +e
+${test_program_prefix} \
+ ${test_program} \
+ 2> ${test_program_output}
+set -e
+
+cat <<'EOF' |
+test-argp: -1.000000000000000000000000000000000000000000000000000000000000
+EOF
+cmp - ${test_program_output} > /dev/null 2>&1 ||
+{
+ status=1
+ echo "*** output comparison failed"
+}
+
+exit $status
new file mode 100644
@@ -0,0 +1,69 @@
+/* Test for the long double variants of argp* 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 <argp.h>
+#include <string.h>
+
+#include <support/check.h>
+
+static const struct argp_option
+options[] =
+{
+ { "test", 't', "format", 0, "Run argp function with a format string", 0 },
+ { NULL, 0, NULL, 0, NULL }
+};
+
+static error_t
+parser (int key, char *arg, struct argp_state *state)
+{
+ switch (key)
+ {
+ case 't':
+ ARGP_FUNCTION ARGP_FUNCTION_PARAMS;
+ break;
+ default:
+ return ARGP_ERR_UNKNOWN;
+ }
+ return 0;
+}
+
+static struct argp
+argp =
+{
+ options, parser
+};
+
+static int
+do_test (void)
+{
+ int remaining;
+ int argc = 3;
+ char *argv[4] =
+ {
+ (char *) "test-argp",
+ (char *) "--test",
+ (char *) "%.60Lf",
+ NULL
+ };
+
+ argp_parse (&argp, argc, argv, 0, &remaining, NULL);
+
+ return 0;
+}
+
+#include <support/test-driver.c>