summary refs log tree commit diff
path: root/argp
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gabriel@inconstante.eti.br>2018-07-04 11:54:11 -0300
committerGabriel F. T. Gomes <gabriel@inconstante.eti.br>2019-03-01 15:21:32 -0300
commit6e1f6440b99d74db314a9f1a1b27c050ef62a45c (patch)
tree4e4426ee1e4130fa089e0a1295f5078a35d38472 /argp
parentc259196b5005812aa3294dbf4eeca29b266a4522 (diff)
downloadglibc-6e1f6440b99d74db314a9f1a1b27c050ef62a45c.tar.gz
glibc-6e1f6440b99d74db314a9f1a1b27c050ef62a45c.tar.xz
glibc-6e1f6440b99d74db314a9f1a1b27c050ef62a45c.zip
ldbl-opt: Add argp_error and argp_failure (bug 23983)
The functions argp_error and argp_failure are missing support for
printing long double values when long double has the same format as
double.  This patch adds the new functions __nldbl_argp_error and
__nldbl_argp_failure, as well as header magic to redirect calls to them
when -mlong-double-64 is in use.

Tested for powerpc, powerpc64 and powerpc64le.
Diffstat (limited to 'argp')
-rw-r--r--argp/Makefile2
-rw-r--r--argp/argp.h4
-rw-r--r--argp/bits/argp-ldbl.h24
3 files changed, 29 insertions, 1 deletions
diff --git a/argp/Makefile b/argp/Makefile
index bebd71c564..d5c2d77658 100644
--- a/argp/Makefile
+++ b/argp/Makefile
@@ -22,7 +22,7 @@ subdir	:= argp
 
 include ../Makeconfig
 
-headers		= argp.h
+headers		= argp.h bits/argp-ldbl.h
 routines	= $(addprefix argp-, ba fmtstream fs-xinl help parse pv \
 				     pvh xinl eexst)
 
diff --git a/argp/argp.h b/argp/argp.h
index fae6dfb3ef..c7322581bf 100644
--- a/argp/argp.h
+++ b/argp/argp.h
@@ -554,6 +554,10 @@ __NTH (__option_is_end (const struct argp_option *__opt))
 # endif
 #endif /* Use extern inlines.  */
 
+#ifdef __LDBL_COMPAT
+# include <bits/argp-ldbl.h>
+#endif
+
 __END_DECLS
 
 #endif /* argp.h */
diff --git a/argp/bits/argp-ldbl.h b/argp/bits/argp-ldbl.h
new file mode 100644
index 0000000000..86022a04ac
--- /dev/null
+++ b/argp/bits/argp-ldbl.h
@@ -0,0 +1,24 @@
+/* Redirections for argp functions for -mlong-double-64.
+   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/>.  */
+
+#ifndef _ARGP_H
+# error "Never include <bits/argp-ldbl.h> directly; use <argp.h> instead."
+#endif
+
+__LDBL_REDIR_DECL (argp_error)
+__LDBL_REDIR_DECL (argp_failure)