diff options
author | Gabriel F. T. Gomes <gabriel@inconstante.eti.br> | 2018-08-08 17:26:22 -0300 |
---|---|---|
committer | Gabriel F. T. Gomes <gabriel@inconstante.eti.br> | 2019-03-01 15:26:36 -0300 |
commit | d11086a9391b6066458947b80c0d0059b6b461d8 (patch) | |
tree | 91d537afc5f7a3c50c2b0002ec626de9353abc69 /misc | |
parent | 90188e7d1adc5d8743d7933c9ed1bf95f91dda62 (diff) | |
download | glibc-d11086a9391b6066458947b80c0d0059b6b461d8.zip glibc-d11086a9391b6066458947b80c0d0059b6b461d8.tar.gz glibc-d11086a9391b6066458947b80c0d0059b6b461d8.tar.bz2 |
ldbl-opt: Add error and error_at_line (bug 23984)
On platforms where long double may have the same format as double
(-mlong-double-64), error and error_at_line do not take that into
account and might produce wrong output if a long double conversion is
requested by the format string ('%Lf'). This patch adds compatibility
functions for this situation and redirects calls via header magic.
Tested for powerpc, powerpc64 and powerpc64le.
Diffstat (limited to 'misc')
-rw-r--r-- | misc/Makefile | 2 | ||||
-rw-r--r-- | misc/bits/error-ldbl.h | 24 | ||||
-rw-r--r-- | misc/error.h | 12 |
3 files changed, 34 insertions, 4 deletions
diff --git a/misc/Makefile b/misc/Makefile index 6cb660b..032f28f 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -37,7 +37,7 @@ headers := sys/uio.h bits/uio-ext.h bits/uio_lim.h \ bits/syslog.h bits/syslog-ldbl.h bits/syslog-path.h bits/error.h \ bits/select2.h bits/hwcap.h sys/auxv.h \ sys/sysmacros.h bits/sysmacros.h bits/types/struct_iovec.h \ - bits/err-ldbl.h + bits/err-ldbl.h bits/error-ldbl.h routines := brk sbrk sstk ioctl \ readv writev preadv preadv64 pwritev pwritev64 \ diff --git a/misc/bits/error-ldbl.h b/misc/bits/error-ldbl.h new file mode 100644 index 0000000..c3883da --- /dev/null +++ b/misc/bits/error-ldbl.h @@ -0,0 +1,24 @@ +/* Redirections for error.h 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 _ERROR_H +# error "Never include <bits/error-ldbl.h> directly; use <error.h> instead." +#endif + +__LDBL_REDIR_DECL (error) +__LDBL_REDIR_DECL (error_at_line) diff --git a/misc/error.h b/misc/error.h index 34d4a6d..ba0c929 100644 --- a/misc/error.h +++ b/misc/error.h @@ -47,9 +47,15 @@ extern unsigned int error_message_count; variable controls whether this mode is selected or not. */ extern int error_one_per_line; - -#if defined __extern_always_inline && defined __va_arg_pack -# include <bits/error.h> +#ifdef __LDBL_COMPAT +# include <bits/error-ldbl.h> +#else +/* Do not inline error and error_at_line when long double has the same + size of double, because that would invalidate the redirections to the + compatibility functions. */ +# if defined __extern_always_inline && defined __va_arg_pack +# include <bits/error.h> +# endif #endif __END_DECLS |