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 --- stdlib/Makefile | 9 ++++++--- stdlib/bits/monetary-ldbl.h | 28 ++++++++++++++++++++++++++++ stdlib/bits/stdlib-ldbl.h | 42 ++++++++++++++++++++++++++++++++++++++++++ stdlib/fpioconst.c | 2 +- stdlib/monetary.h | 7 ++++++- stdlib/stdlib.h | 7 ++++++- stdlib/strfmon.c | 8 +++++--- stdlib/strfmon_l.c | 43 +++++++++++-------------------------------- stdlib/strtod.c | 15 ++++++++++++++- stdlib/strtod_l.c | 29 +++++++++++++++++++++++++---- stdlib/strtold.c | 36 ++++++++++++++++++++++++++++++++---- 11 files changed, 176 insertions(+), 50 deletions(-) create mode 100644 stdlib/bits/monetary-ldbl.h create mode 100644 stdlib/bits/stdlib-ldbl.h (limited to 'stdlib') diff --git a/stdlib/Makefile b/stdlib/Makefile index f44c66b283..2690d5dd47 100644 --- a/stdlib/Makefile +++ b/stdlib/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,9 +21,12 @@ # subdir := stdlib -headers := stdlib.h alloca.h monetary.h fmtmsg.h ucontext.h sys/ucontext.h \ +headers := stdlib.h bits/stdlib.h bits/stdlib-ldbl.h \ + monetary.h bits/monetary-ldbl.h \ inttypes.h stdint.h bits/wordsize.h \ - errno.h sys/errno.h bits/errno.h bits/stdlib.h + errno.h sys/errno.h bits/errno.h \ + ucontext.h sys/ucontext.h \ + alloca.h fmtmsg.h routines := \ atof atoi atol atoll \ diff --git a/stdlib/bits/monetary-ldbl.h b/stdlib/bits/monetary-ldbl.h new file mode 100644 index 0000000000..3e080f93f0 --- /dev/null +++ b/stdlib/bits/monetary-ldbl.h @@ -0,0 +1,28 @@ +/* -mlong-double-64 compatibility mode for monetary 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 _MONETARY_H +# error "Never include directly; use instead." +#endif + +__LDBL_REDIR_DECL (strfmon) + +#ifdef __USE_GNU +__LDBL_REDIR_DECL (strfmon_l) +#endif diff --git a/stdlib/bits/stdlib-ldbl.h b/stdlib/bits/stdlib-ldbl.h new file mode 100644 index 0000000000..f966bd92e7 --- /dev/null +++ b/stdlib/bits/stdlib-ldbl.h @@ -0,0 +1,42 @@ +/* -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 _STDLIB_H +# error "Never include directly; use instead." +#endif + +#ifdef __USE_ISOC99 +__BEGIN_NAMESPACE_C99 +__LDBL_REDIR1_DECL (strtold, strtod) +__END_NAMESPACE_C99 +#endif + +#ifdef __USE_GNU +__LDBL_REDIR1_DECL (strtold_l, strtod_l) +#endif + +__LDBL_REDIR1_DECL (__strtold_internal, __strtod_internal) + +#ifdef __USE_MISC +__LDBL_REDIR1_DECL (qecvt, ecvt) +__LDBL_REDIR1_DECL (qfcvt, fcvt) +__LDBL_REDIR1_DECL (qgcvt, gcvt) +__LDBL_REDIR1_DECL (qecvt_r, ecvt_r) +__LDBL_REDIR1_DECL (qfcvt_r, fcvt_r) +#endif diff --git a/stdlib/fpioconst.c b/stdlib/fpioconst.c index 59a5e43a82..0e36da65b2 100644 --- a/stdlib/fpioconst.c +++ b/stdlib/fpioconst.c @@ -278,7 +278,7 @@ const mp_limb_t __tens[] = 0x26b2716ed595d80full, 0x1d153624adc666b0ull, 0x63ff540e3c42d35aull, 0x65f9ef17cc5573c0ull, 0x80dcc7f755bc28f2ull, 0x5fdcefcef46eeddcull, 0x00000000000553f7ull, -#if!defined __NO_LONG_DOUBLE_MATH && __LDBL_MAX_EXP__ > 1024 +#if !defined __NO_LONG_DOUBLE_MATH && __LDBL_MAX_EXP__ > 1024 # define TENS_P9_IDX (TENS_P8_IDX + TENS_P8_SIZE) # define TENS_P9_SIZE 28 [TENS_P9_IDX] = 0x0000000000000000ull, 0x0000000000000000ull, diff --git a/stdlib/monetary.h b/stdlib/monetary.h index 4c8a4cd3d4..d9234ca61b 100644 --- a/stdlib/monetary.h +++ b/stdlib/monetary.h @@ -1,5 +1,6 @@ /* Header file for monetary value formatting functions. - Copyright (C) 1996,97,98,99,2000,02 Free Software Foundation, Inc. + Copyright (C) 1996,1997,1998,1999,2000,2002,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 @@ -50,6 +51,10 @@ extern ssize_t strfmon_l (char *__restrict __s, size_t __maxsize, __THROW __attribute_format_strfmon__ (4, 5); #endif +#ifdef __LDBL_COMPAT +# include +#endif + __END_DECLS #endif /* monetary.h */ diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h index 085130cafa..c3fc14562e 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2003, 2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 1991-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 @@ -350,11 +350,13 @@ __NTH (strtof (__const char *__restrict __nptr, char **__restrict __endptr)) { return __strtof_internal (__nptr, __endptr, 0); } +# ifndef __LDBL_COMPAT extern __inline long double __NTH (strtold (__const char *__restrict __nptr, char **__restrict __endptr)) { return __strtold_internal (__nptr, __endptr, 0); } +# endif __END_NAMESPACE_C99 # endif @@ -966,6 +968,9 @@ extern int getloadavg (double __loadavg[], int __nelem) #if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus # include #endif +#ifdef __LDBL_COMPAT +# include +#endif #endif /* don't just need malloc and calloc */ #undef __need_malloc_and_calloc diff --git a/stdlib/strfmon.c b/stdlib/strfmon.c index b11f95c9ac..11ae931d13 100644 --- a/stdlib/strfmon.c +++ b/stdlib/strfmon.c @@ -1,5 +1,6 @@ /* Formatting a monetary value according to the current locale. - Copyright (C) 1996-2001, 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1996-2001, 2002, 2003, 2004, 2006 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper and Jochen Hein , 1996. @@ -22,10 +23,10 @@ #include #include #include - +#include ssize_t -strfmon (char *s, size_t maxsize, const char *format, ...) +__strfmon (char *s, size_t maxsize, const char *format, ...) { va_list ap; @@ -37,3 +38,4 @@ strfmon (char *s, size_t maxsize, const char *format, ...) return res; } +ldbl_strong_alias (__strfmon, strfmon) diff --git a/stdlib/strfmon_l.c b/stdlib/strfmon_l.c index 58dab340cf..f6d52e0b56 100644 --- a/stdlib/strfmon_l.c +++ b/stdlib/strfmon_l.c @@ -1,5 +1,5 @@ /* Formatting a monetary value according to the given locale. - Copyright (C) 1996, 1997, 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 2002, 2004, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -23,10 +23,8 @@ #include #include #include -#ifdef USE_IN_LIBIO -# include "../libio/libioP.h" -# include "../libio/strfile.h" -#endif +#include "../libio/libioP.h" +#include "../libio/strfile.h" #include #include #include @@ -91,13 +89,9 @@ __vstrfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, va_list ap) { struct locale_data *current = loc->__locales[LC_MONETARY]; -#ifdef USE_IN_LIBIO _IO_strfile f; -# ifdef _IO_MTSAFE_IO +#ifdef _IO_MTSAFE_IO _IO_lock_t lock; -# endif -#else - FILE f; #endif struct printf_info info; char *dest; /* Pointer so copy the output. */ @@ -278,7 +272,8 @@ __vstrfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, if (*fmt == 'L') { ++fmt; - is_long_double = 1; + if (!__ldbl_is_dbl) + is_long_double = 1; } /* Handle format specifier. */ @@ -515,30 +510,13 @@ __vstrfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, out_string (sign_string); /* Print the number. */ -#ifdef USE_IN_LIBIO -# ifdef _IO_MTSAFE_IO +#ifdef _IO_MTSAFE_IO f._sbf._f._lock = &lock; -# endif +#endif INTUSE(_IO_init) ((_IO_FILE *) &f, 0); _IO_JUMPS ((struct _IO_FILE_plus *) &f) = &_IO_str_jumps; INTUSE(_IO_str_init_static) ((_IO_strfile *) &f, dest, (s + maxsize) - dest, dest); -#else - memset ((void *) &f, 0, sizeof (f)); - f.__magic = _IOMAGIC; - f.__mode.__write = 1; - /* The buffer size is one less than MAXLEN - so we have space for the null terminator. */ - f.__bufp = f.__buffer = (char *) dest; - f.__bufsize = (s + maxsize) - dest; - f.__put_limit = f.__buffer + f.__bufsize; - f.__get_limit = f.__buffer; - /* After the buffer is full (MAXLEN characters have been written), - any more characters written will go to the bit bucket. */ - f.__room_funcs = __default_room_functions; - f.__io_funcs.__write = NULL; - f.__seen = 1; -#endif /* We clear the last available byte so we can find out whether the numeric representation is too long. */ s[maxsize - 1] = '\0'; @@ -633,7 +611,7 @@ __vstrfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, } ssize_t -__strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...) +___strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...) { va_list ap; @@ -645,4 +623,5 @@ __strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...) return res; } -weak_alias (__strfmon_l, strfmon_l) +ldbl_strong_alias (___strfmon_l, __strfmon_l) +ldbl_weak_alias (___strfmon_l, strfmon_l) diff --git a/stdlib/strtod.c b/stdlib/strtod.c index 1d4e4a4c29..d124bcdcd9 100644 --- a/stdlib/strtod.c +++ b/stdlib/strtod.c @@ -1,6 +1,6 @@ /* Read decimal floating point numbers. This file is part of the GNU C Library. - Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1995-2002, 2003, 2004, 2006 Free Software Foundation, Inc. Contributed by Ulrich Drepper , 1995. The GNU C Library is free software; you can redistribute it and/or @@ -24,6 +24,7 @@ #ifndef FLOAT +# include # define FLOAT double # ifdef USE_WIDE_CHAR # define STRTOF wcstod @@ -68,3 +69,15 @@ STRTOF (nptr, endptr) { return INTERNAL(STRTOF_L) (nptr, endptr, 0, _NL_CURRENT_LOCALE); } + +#ifdef LONG_DOUBLE_COMPAT +# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) +# ifdef USE_WIDE_CHAR +compat_symbol (libc, wcstod, wcstold, GLIBC_2_0); +compat_symbol (libc, __wcstod_internal, __wcstold_internal, GLIBC_2_0); +# else +compat_symbol (libc, strtod, strtold, GLIBC_2_0); +compat_symbol (libc, __strtod_internal, __strtold_internal, GLIBC_2_0); +# endif +# endif +#endif diff --git a/stdlib/strtod_l.c b/stdlib/strtod_l.c index 5743ee434c..e13f1086da 100644 --- a/stdlib/strtod_l.c +++ b/stdlib/strtod_l.c @@ -1,5 +1,5 @@ /* Convert string representing a number to float value, using given locale. - Copyright (C) 1997,98,2002,2004,2005 Free Software Foundation, Inc. + Copyright (C) 1997,1998,2002,2004,2005,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -28,6 +28,7 @@ extern unsigned long long int ____strtoull_l_internal (const char *, char **, `strtof.c', `wcstod.c', `wcstold.c', and `wcstof.c' to produce the `long double' and `float' versions of the reader. */ #ifndef FLOAT +# include # define FLOAT double # define FLT DBL # ifdef USE_WIDE_CHAR @@ -406,6 +407,9 @@ __mpn_lshift_1 (mp_limb_t *ptr, mp_size_t size, unsigned int count, #define INTERNAL(x) INTERNAL1(x) #define INTERNAL1(x) __##x##_internal +#ifndef ____STRTOF_INTERNAL +# define ____STRTOF_INTERNAL INTERNAL (__STRTOF) +#endif /* This file defines a function to check for correct grouping. */ #include "grouping.h" @@ -417,7 +421,7 @@ __mpn_lshift_1 (mp_limb_t *ptr, mp_size_t size, unsigned int count, return 0.0. If the number is too big to be represented, set `errno' to ERANGE and return HUGE_VAL with the appropriate sign. */ FLOAT -INTERNAL (__STRTOF) (nptr, endptr, group, loc) +____STRTOF_INTERNAL (nptr, endptr, group, loc) const STRING_TYPE *nptr; STRING_TYPE **endptr; int group; @@ -1557,7 +1561,7 @@ INTERNAL (__STRTOF) (nptr, endptr, group, loc) /* NOTREACHED */ } #if defined _LIBC && !defined USE_WIDE_CHAR -libc_hidden_def (INTERNAL (__STRTOF)) +libc_hidden_def (____STRTOF_INTERNAL) #endif /* External user entry point. */ @@ -1571,6 +1575,23 @@ __STRTOF (nptr, endptr, loc) STRING_TYPE **endptr; __locale_t loc; { - return INTERNAL (__STRTOF) (nptr, endptr, 0, loc); + return ____STRTOF_INTERNAL (nptr, endptr, 0, loc); } weak_alias (__STRTOF, STRTOF) + +#ifdef LONG_DOUBLE_COMPAT +# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_1) +# ifdef USE_WIDE_CHAR +compat_symbol (libc, __wcstod_l, __wcstold_l, GLIBC_2_1); +# else +compat_symbol (libc, __strtod_l, __strtold_l, GLIBC_2_1); +# endif +# endif +# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_3) +# ifdef USE_WIDE_CHAR +compat_symbol (libc, wcstod_l, wcstold_l, GLIBC_2_3); +# else +compat_symbol (libc, strtod_l, strtold_l, GLIBC_2_3); +# endif +# endif +#endif diff --git a/stdlib/strtold.c b/stdlib/strtold.c index 0bb227a84f..1f56deaa01 100644 --- a/stdlib/strtold.c +++ b/stdlib/strtold.c @@ -1,6 +1,6 @@ /* Read decimal floating point numbers. This file is part of the GNU C Library. - Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1995-2002, 2003, 2004, 2006 Free Software Foundation, Inc. Contributed by Ulrich Drepper , 1995. The GNU C Library is free software; you can redistribute it and/or @@ -21,15 +21,43 @@ /* The actual implementation for all floating point sizes is in strtod.c. These macros tell it to produce the `float' version, `strtof'. */ +#include + +#ifdef __LONG_DOUBLE_MATH_OPTIONAL +# include +# define NEW(x) NEW1(x) +# define NEW1(x) __new_##x +long double ____new_strtold_internal (const char *, char **, int); +long double __new_strtold (const char *, char **); +long double ____new_wcstold_internal (const wchar_t *, wchar_t **, int); +long double __new_wcstold (const wchar_t *, wchar_t **); +libc_hidden_proto (____new_strtold_internal) +libc_hidden_proto (____new_wcstold_internal) +#else +# define NEW(x) x +#endif + #define FLOAT long double #define FLT LDBL #ifdef USE_WIDE_CHAR -# define STRTOF wcstold +# define STRTOF NEW (wcstold) # define STRTOF_L __wcstold_l #else -# define STRTOF strtold +# define STRTOF NEW (strtold) # define STRTOF_L __strtold_l #endif - #include "strtod.c" + +#ifdef __LONG_DOUBLE_MATH_OPTIONAL +# include +# ifdef USE_WIDE_CHAR +long_double_symbol (libc, __new_wcstold, wcstold); +long_double_symbol (libc, ____new_wcstold_internal, __wcstold_internal); +libc_hidden_ver (____new_wcstold_internal, __wcstold_internal) +# else +long_double_symbol (libc, __new_strtold, strtold); +long_double_symbol (libc, ____new_strtold_internal, __strtold_internal); +libc_hidden_ver (____new_strtold_internal, __strtold_internal) +# endif +#endif -- cgit 1.4.1