From 3e543bc56346540cbf73fd48d0172fc6a588efd5 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 30 Jan 2006 09:30:09 +0000 Subject: Updated to fedora-glibc-20060130T0922 --- stdio-common/Makefile | 4 ++-- stdio-common/asprintf.c | 12 ++++++---- stdio-common/bits/printf-ldbl.h | 24 +++++++++++++++++++ stdio-common/dprintf.c | 9 +++---- stdio-common/fprintf.c | 10 ++++---- stdio-common/fscanf.c | 6 +++-- stdio-common/printf.c | 8 ++++--- stdio-common/printf.h | 6 ++++- stdio-common/printf_fp.c | 12 ++++++---- stdio-common/printf_size.c | 6 +++-- stdio-common/scanf.c | 5 ++-- stdio-common/snprintf.c | 8 +++---- stdio-common/sprintf.c | 12 +++++----- stdio-common/sscanf.c | 12 +++++----- stdio-common/vfprintf.c | 52 ++++++++++++++++++++++++----------------- stdio-common/vfscanf.c | 38 ++++++++++++------------------ stdio-common/vprintf.c | 9 +++---- 17 files changed, 138 insertions(+), 95 deletions(-) create mode 100644 stdio-common/bits/printf-ldbl.h (limited to 'stdio-common') diff --git a/stdio-common/Makefile b/stdio-common/Makefile index a2cfbe720c..70f6d64c9a 100644 --- a/stdio-common/Makefile +++ b/stdio-common/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991-2002, 2003, 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 1991-2002,2003,2004,2005,2006 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 @@ -21,7 +21,7 @@ # subdir := stdio-common -headers := printf.h stdio_ext.h +headers := stdio_ext.h printf.h bits/printf-ldbl.h routines := \ ctermid cuserid \ diff --git a/stdio-common/asprintf.c b/stdio-common/asprintf.c index 2c466d28d5..66e766ebfb 100644 --- a/stdio-common/asprintf.c +++ b/stdio-common/asprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1995, 1997, 1998, 2002, 2004 +/* Copyright (C) 1991, 1995, 1997, 1998, 2002, 2004, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -20,7 +20,7 @@ #include #include -#include +#include #define vasprintf(s, f, a) _IO_vasprintf (s, f, a) #undef __asprintf @@ -28,7 +28,7 @@ allocated with malloc and stored in *STRING_PTR. */ /* VARARGS2 */ int -__asprintf (char **string_ptr, const char *format, ...) +___asprintf (char **string_ptr, const char *format, ...) { va_list arg; int done; @@ -39,5 +39,7 @@ __asprintf (char **string_ptr, const char *format, ...) return done; } -INTDEF(__asprintf) -weak_alias (__asprintf, asprintf) +INTDEF2(___asprintf, __asprintf) + +ldbl_strong_alias (___asprintf, __asprintf) +ldbl_weak_alias (___asprintf, asprintf) diff --git a/stdio-common/bits/printf-ldbl.h b/stdio-common/bits/printf-ldbl.h new file mode 100644 index 0000000000..cbdc3f1cbc --- /dev/null +++ b/stdio-common/bits/printf-ldbl.h @@ -0,0 +1,24 @@ +/* -mlong-double-64 compatibility mode for functions. + Copyright (C) 2006 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _PRINTF_H +# error "Never include directly; use instead." +#endif + +__LDBL_REDIR_DECL (printf_size) diff --git a/stdio-common/dprintf.c b/stdio-common/dprintf.c index b362e5fa71..6d00e10a63 100644 --- a/stdio-common/dprintf.c +++ b/stdio-common/dprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,95,97,98,2002,2004 Free Software Foundation, Inc. +/* Copyright (C) 1991,95,97,98,2002,2004,2006 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 @@ -19,13 +19,13 @@ #include #include -#include +#include #define vdprintf(d, f, a) _IO_vdprintf (d, f, a) /* Write formatted output to D, according to the format string FORMAT. */ /* VARARGS2 */ int -dprintf (int d, const char *format, ...) +__dprintf (int d, const char *format, ...) { va_list arg; int done; @@ -36,4 +36,5 @@ dprintf (int d, const char *format, ...) return done; } -libc_hidden_def (dprintf) +ldbl_hidden_def (__dprintf, dprintf) +ldbl_strong_alias (__dprintf, dprintf) diff --git a/stdio-common/fprintf.c b/stdio-common/fprintf.c index 0b99fc8994..689e80f466 100644 --- a/stdio-common/fprintf.c +++ b/stdio-common/fprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,97,2002,2004 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1997, 2002, 2004, 2006 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 @@ -18,12 +18,13 @@ #include #include +#include /* Write formatted output to STREAM from the format string FORMAT. */ /* VARARGS2 */ int -fprintf (FILE *stream, const char *format, ...) +__fprintf (FILE *stream, const char *format, ...) { va_list arg; int done; @@ -34,9 +35,10 @@ fprintf (FILE *stream, const char *format, ...) return done; } -libc_hidden_def (fprintf) +ldbl_hidden_def (__fprintf, fprintf) +ldbl_strong_alias (__fprintf, fprintf) /* We define the function with the real name here. But deep down in libio the original function _IO_fprintf is also needed. So make an alias. */ -weak_alias (fprintf, _IO_fprintf) +ldbl_weak_alias (__fprintf, _IO_fprintf) diff --git a/stdio-common/fscanf.c b/stdio-common/fscanf.c index 58a66eaf30..a6b60162cf 100644 --- a/stdio-common/fscanf.c +++ b/stdio-common/fscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1997, 2006 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 @@ -16,13 +16,14 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include #include #include /* Read formatted input from STREAM according to the format string FORMAT. */ /* VARARGS2 */ int -fscanf (FILE *stream, const char *format, ...) +__fscanf (FILE *stream, const char *format, ...) { va_list arg; int done; @@ -33,3 +34,4 @@ fscanf (FILE *stream, const char *format, ...) return done; } +ldbl_strong_alias (__fscanf, fscanf) diff --git a/stdio-common/printf.c b/stdio-common/printf.c index e28c5837e5..4c8f3a2a0c 100644 --- a/stdio-common/printf.c +++ b/stdio-common/printf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004 +/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include #include #include @@ -25,7 +26,7 @@ /* Write formatted output to stdout from the format string FORMAT. */ /* VARARGS1 */ int -printf (const char *format, ...) +__printf (const char *format, ...) { va_list arg; int done; @@ -38,5 +39,6 @@ printf (const char *format, ...) } #undef _IO_printf +ldbl_strong_alias (__printf, printf); /* This is for libg++. */ -strong_alias (printf, _IO_printf); +ldbl_strong_alias (__printf, _IO_printf); diff --git a/stdio-common/printf.h b/stdio-common/printf.h index c16569b59b..360cdcce1d 100644 --- a/stdio-common/printf.h +++ b/stdio-common/printf.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1991-1993,1995-1999,2000,2001 Free Software Foundation, Inc. +/* Copyright (C) 1991-1993,1995-1999,2000,2001,2006 + 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 @@ -139,6 +140,9 @@ extern int printf_size_info (__const struct printf_info *__restrict __info, size_t __n, int *__restrict __argtypes) __THROW; +#ifdef __LDBL_COMPAT +# include +#endif __END_DECLS diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c index ed225e05a6..8a68f1948d 100644 --- a/stdio-common/printf_fp.c +++ b/stdio-common/printf_fp.c @@ -1,5 +1,6 @@ /* Floating point output for `printf'. - Copyright (C) 1995-1999,2000,2001,2002,2003 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2006 + Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Ulrich Drepper , 1995. @@ -138,9 +139,9 @@ static wchar_t *group_number (wchar_t *buf, wchar_t *bufend, int -__printf_fp (FILE *fp, - const struct printf_info *info, - const void *const *args) +___printf_fp (FILE *fp, + const struct printf_info *info, + const void *const *args) { /* The floating-point value to output. */ union @@ -1153,7 +1154,8 @@ __printf_fp (FILE *fp, } return done; } -libc_hidden_def (__printf_fp) +ldbl_hidden_def (___printf_fp, __printf_fp) +ldbl_strong_alias (___printf_fp, __printf_fp) /* Return the number of extra grouping characters that will be inserted into a number with INTDIG_MAX integer digits. */ diff --git a/stdio-common/printf_size.c b/stdio-common/printf_size.c index 32f262ead0..957de2f571 100644 --- a/stdio-common/printf_size.c +++ b/stdio-common/printf_size.c @@ -1,5 +1,5 @@ /* Print size value using units for orders of magnitude. - Copyright (C) 1997-2002, 2004 Free Software Foundation, Inc. + Copyright (C) 1997-2002, 2004, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. Based on a proposal by Larry McVoy . @@ -86,7 +86,8 @@ extern int __printf_fp (FILE *fp, const struct printf_info *info, int -printf_size (FILE *fp, const struct printf_info *info, const void *const *args) +__printf_size (FILE *fp, const struct printf_info *info, + const void *const *args) { /* Units for the both formats. */ #define BINARY_UNITS " kmgtpezy" @@ -233,6 +234,7 @@ printf_size (FILE *fp, const struct printf_info *info, const void *const *args) return done; } +ldbl_strong_alias (__printf_size, printf_size); /* This is the function used by `vfprintf' to determine number and type of the arguments. */ diff --git a/stdio-common/scanf.c b/stdio-common/scanf.c index 62c9959651..d4a4daf726 100644 --- a/stdio-common/scanf.c +++ b/stdio-common/scanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 2002, 2004 +/* Copyright (C) 1991, 1995, 1996, 1997, 2002, 2004, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -26,7 +26,7 @@ /* Read formatted input from stdin according to the format string FORMAT. */ /* VARARGS1 */ int -scanf (const char *format, ...) +__scanf (const char *format, ...) { va_list arg; int done; @@ -37,3 +37,4 @@ scanf (const char *format, ...) return done; } +ldbl_strong_alias (__scanf, scanf) diff --git a/stdio-common/snprintf.c b/stdio-common/snprintf.c index ce392f0096..00d2082350 100644 --- a/stdio-common/snprintf.c +++ b/stdio-common/snprintf.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1991, 1995, 1997, 1998, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1995, 1997, 1998, 2004, 2006 + 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 @@ -18,8 +19,7 @@ #include #include - -#include +#include #define __vsnprintf(s, l, f, a) _IO_vsnprintf (s, l, f, a) /* Write formatted output into S, according to the format @@ -37,4 +37,4 @@ __snprintf (char *s, size_t maxlen, const char *format, ...) return done; } -weak_alias (__snprintf, snprintf) +ldbl_weak_alias (__snprintf, snprintf) diff --git a/stdio-common/sprintf.c b/stdio-common/sprintf.c index 249fcb0dde..7f564d5635 100644 --- a/stdio-common/sprintf.c +++ b/stdio-common/sprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1995, 1997, 1998, 2002, 2004 +/* Copyright (C) 1991, 1995, 1997, 1998, 2002, 2004, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -19,13 +19,13 @@ #include #include -#include +#include #define vsprintf(s, f, a) INTUSE(_IO_vsprintf) (s, f, a) /* Write formatted output into S, according to the format string FORMAT. */ /* VARARGS2 */ int -sprintf (char *s, const char *format, ...) +__sprintf (char *s, const char *format, ...) { va_list arg; int done; @@ -36,6 +36,6 @@ sprintf (char *s, const char *format, ...) return done; } -libc_hidden_def (sprintf) - -strong_alias(sprintf, _IO_sprintf) +ldbl_hidden_def (__sprintf, sprintf) +ldbl_strong_alias (__sprintf, sprintf) +ldbl_strong_alias (__sprintf, _IO_sprintf) diff --git a/stdio-common/sscanf.c b/stdio-common/sscanf.c index b36976710b..384a6977dc 100644 --- a/stdio-common/sscanf.c +++ b/stdio-common/sscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1995, 1996, 1998, 2002, 2003, 2004 +/* Copyright (C) 1991, 1995, 1996, 1998, 2002, 2003, 2004, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -19,13 +19,13 @@ #include #include -#include +#include #define __vsscanf(s, f, a) _IO_vsscanf (s, f, a) /* Read formatted input from S, according to the format string FORMAT. */ /* VARARGS2 */ int -sscanf (const char *s, const char *format, ...) +__sscanf (const char *s, const char *format, ...) { va_list arg; int done; @@ -36,8 +36,8 @@ sscanf (const char *s, const char *format, ...) return done; } -libc_hidden_def (sscanf) - +ldbl_hidden_def (__sscanf, sscanf) +ldbl_strong_alias (__sscanf, sscanf) #undef _IO_sscanf /* This is for libg++. */ -strong_alias (sscanf, _IO_sscanf) +ldbl_strong_alias (__sscanf, _IO_sscanf) diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c index 83da710a2a..eb11ac2806 100644 --- a/stdio-common/vfprintf.c +++ b/stdio-common/vfprintf.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1991-2002, 2003, 2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006 + 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 @@ -64,7 +65,7 @@ #define UNBUFFERED_P(S) ((S)->_IO_file_flags & _IO_UNBUFFERED) #ifndef COMPILE_WPRINTF -# define vfprintf _IO_vfprintf +# define vfprintf _IO_vfprintf_internal # define CHAR_T char # define UCHAR_T unsigned char # define INT_T int @@ -758,6 +759,9 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) \ if (fspec == NULL) \ { \ + if (__ldbl_is_dbl) \ + is_long_double = 0; \ + \ struct printf_info info = { .prec = prec, \ .width = width, \ .spec = spec, \ @@ -785,6 +789,11 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) else \ { \ ptr = (const void *) &args_value[fspec->data_arg]; \ + if (__ldbl_is_dbl) \ + { \ + fspec->data_arg_type = PA_DOUBLE; \ + fspec->info.is_long_double = 0; \ + } \ \ function_done = __printf_fp (s, &fspec->info, &ptr); \ } \ @@ -808,6 +817,9 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) \ if (fspec == NULL) \ { \ + if (__ldbl_is_dbl) \ + is_long_double = 0; \ + \ struct printf_info info = { .prec = prec, \ .width = width, \ .spec = spec, \ @@ -834,6 +846,8 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) else \ { \ ptr = (const void *) &args_value[fspec->data_arg]; \ + if (__ldbl_is_dbl) \ + fspec->info.is_long_double = 0; \ \ function_done = __printf_fphex (s, &fspec->info, &ptr); \ } \ @@ -1704,7 +1718,15 @@ do_positional: T (PA_INT|PA_FLAG_LONG_LONG, pa_long_long_int, long long int); T (PA_FLOAT, pa_double, double); /* Promoted. */ T (PA_DOUBLE, pa_double, double); - T (PA_DOUBLE|PA_FLAG_LONG_DOUBLE, pa_long_double, long double); + case PA_DOUBLE|PA_FLAG_LONG_DOUBLE: + if (__ldbl_is_dbl) + { + args_value[cnt].pa_double = va_arg (ap_save, double); + args_type[cnt] &= ~PA_FLAG_LONG_DOUBLE; + } + else + args_value[cnt].pa_long_double = va_arg (ap_save, long double); + break; T (PA_STRING, pa_string, const char *); T (PA_WSTRING, pa_wstring, const wchar_t *); T (PA_POINTER, pa_pointer, void *); @@ -2154,25 +2176,11 @@ buffered_vfprintf (register _IO_FILE *s, const CHAR_T *format, } #undef vfprintf -#ifdef strong_alias -/* This is for glibc. */ -# ifdef COMPILE_WPRINTF +#ifdef COMPILE_WPRINTF strong_alias (_IO_vfwprintf, __vfwprintf); -weak_alias (_IO_vfwprintf, vfwprintf); -# else -strong_alias (_IO_vfprintf, vfprintf); -libc_hidden_def (vfprintf) -INTDEF(_IO_vfprintf) -# endif +ldbl_weak_alias (_IO_vfwprintf, vfwprintf); #else -# if defined __ELF__ || defined __GNU_LIBRARY__ -# include -# ifdef weak_alias -# ifdef COMPILE_WPRINTF -weak_alias (_IO_vfwprintf, vfwprintf); -# else -weak_alias (_IO_vfprintf, vfprintf); -# endif -# endif -# endif +ldbl_strong_alias (_IO_vfprintf_internal, vfprintf); +ldbl_hidden_def (_IO_vfprintf_internal, vfprintf) +ldbl_strong_alias (_IO_vfprintf_internal, _IO_vfprintf); #endif diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c index be008dc687..4dd7768431 100644 --- a/stdio-common/vfscanf.c +++ b/stdio-common/vfscanf.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1991-2002, 2003, 2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006 + 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 @@ -178,18 +179,12 @@ Return the number of assignments made, or -1 for an input error. */ #ifdef COMPILE_WSCANF int -_IO_vfwscanf (s, format, argptr, errp) - _IO_FILE *s; - const wchar_t *format; - _IO_va_list argptr; - int *errp; +_IO_vfwscanf (_IO_FILE *s, const wchar_t *format, _IO_va_list argptr, + int *errp) #else int -_IO_vfscanf (s, format, argptr, errp) - _IO_FILE *s; - const char *format; - _IO_va_list argptr; - int *errp; +_IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr, + int *errp) #endif { va_list arg; @@ -1891,13 +1886,13 @@ _IO_vfscanf (s, format, argptr, errp) scan_float: /* Convert the number. */ ADDW (L_('\0')); - if (flags & LONGDBL) + if ((flags & LONGDBL) && !__ldbl_is_dbl) { long double d = __strtold_internal (wp, &tw, flags & GROUP); if (!(flags & SUPPRESS) && tw != wp) *ARG (long double *) = negative ? -d : d; } - else if (flags & LONG) + else if (flags & (LONG | LONGDBL)) { double d = __strtod_internal (wp, &tw, flags & GROUP); if (!(flags & SUPPRESS) && tw != wp) @@ -2460,18 +2455,15 @@ __vfwscanf (FILE *s, const wchar_t *format, va_list argptr) { return _IO_vfwscanf (s, format, argptr, NULL); } +ldbl_weak_alias (__vfwscanf, vfwscanf) #else int -__vfscanf (FILE *s, const char *format, va_list argptr) +___vfscanf (FILE *s, const char *format, va_list argptr) { - return INTUSE(_IO_vfscanf) (s, format, argptr, NULL); + return _IO_vfscanf_internal (s, format, argptr, NULL); } -libc_hidden_def (__vfscanf) -#endif - -#ifdef COMPILE_WSCANF -weak_alias (__vfwscanf, vfwscanf) -#else -weak_alias (__vfscanf, vfscanf) -INTDEF(_IO_vfscanf) +ldbl_strong_alias (_IO_vfscanf_internal, _IO_vfscanf) +ldbl_strong_alias (___vfscanf, __vfscanf) +ldbl_hidden_def (___vfscanf, __vfscanf) +ldbl_weak_alias (___vfscanf, vfscanf) #endif diff --git a/stdio-common/vprintf.c b/stdio-common/vprintf.c index a8c4a53cd8..5c9cac494a 100644 --- a/stdio-common/vprintf.c +++ b/stdio-common/vprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1993, 1995, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1993, 1995, 1997, 2006 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 @@ -19,15 +19,16 @@ #include #undef __OPTIMIZE__ /* Avoid inline `vprintf' function. */ #include +#include #undef vprintf /* Write formatted output to stdout according to the format string FORMAT, using the argument list in ARG. */ int -vprintf (format, arg) - const char *format; - __gnuc_va_list arg; +__vprintf (const char *format, __gnuc_va_list arg) { return vfprintf (stdout, format, arg); } + +ldbl_strong_alias (__vprintf, vprintf) -- cgit 1.4.1