Sourceware Bugzilla – Attachment 30 Details for
Bug 66
wcstold functions are incorrect for 128bit long double
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
A patch to fix 128bit wcstold/wcstold_l
libc-strtold-1.patch (text/plain), 9.57 KB, created by
H.J. Lu
on 2004-03-11 16:27:18 UTC
(
hide
)
Description:
A patch to fix 128bit wcstold/wcstold_l
Filename:
MIME Type:
Creator:
H.J. Lu
Created:
2004-03-11 16:27:18 UTC
Size:
9.57 KB
patch
obsolete
>2004-03-10 H.J. Lu <hongjiu.lu@intel.com> > > * include/wchar.h (____wcstoull_l_internal): New. > > * stdlib/strtold_l.c: Simplified. > * wcsmbs/wcstold.c: Likewise. > * wcsmbs/wcstold_l.c: Likewise. > > * sysdeps/generic/strtold.c: Support wcstold and __wcstold_l. > * sysdeps/ieee754/ldbl-128/strtold.c: Likewise. > * sysdeps/ieee754/ldbl-96/strtold.c: Likewise. > > >--- libc/include/wchar.h.128 2003-11-19 10:52:45.000000000 -0800 >+++ libc/include/wchar.h 2004-03-10 13:14:39.000000000 -0800 >@@ -114,6 +114,10 @@ extern int __vfwprintf (__FILE *__restri > extern size_t __mbsrtowcs_l (wchar_t *dst, const char **src, size_t len, > mbstate_t *ps, __locale_t l) attribute_hidden; > >+extern unsigned long long int ____wcstoull_l_internal (const wchar_t *, >+ wchar_t **, int, int, >+ __locale_t); >+ > /* Special version. We know that all uses of mbsinit inside the libc > have a non-NULL parameter. And certainly we can access the > internals of the data structure directly. */ >--- libc/stdlib/strtold_l.c.128 2002-08-06 01:39:58.000000000 -0700 >+++ libc/stdlib/strtold_l.c 2004-03-10 10:41:48.000000000 -0800 >@@ -1,5 +1,5 @@ > /* Convert string representing a number to float value, using given locale. >- Copyright (C) 1997,98,99,2002 Free Software Foundation, Inc. >+ Copyright (C) 1997,98,99,2002,2004 Free Software Foundation, Inc. > This file is part of the GNU C Library. > Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. > >@@ -18,36 +18,14 @@ > Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA > 02111-1307 USA. */ > >-#include <math.h> >-#include <xlocale.h> >- >-#ifndef __NO_LONG_DOUBLE_MATH >- > #define USE_IN_EXTENDED_LOCALE_MODEL 1 > >-extern long double ____strtold_l_internal (const char *, char **, int, >- __locale_t); >-extern unsigned long long int ____strtoull_l_internal (const char *, char **, >- int, int, __locale_t); >- >-# include <strtold.c> >+#include <strtold.c> > >+#ifdef USE_WIDE_CHAR >+# define STRTOF_L wcstold_l > #else >-/* There is no `long double' type, use the `double' implementations. */ >-extern double ____strtod_l_internal (const char *, char **, int, >- __locale_t); >-long double >-____strtold_l_internal (const char *nptr, char **endptr, int group, >- __locale_t loc) >-{ >- return ____strtod_l_internal (nptr, endptr, group, loc); >-} >- >-long double >-__strtold_l (const char *nptr, char **endptr, __locale_t loc) >-{ >- return ____strtod_l_internal (nptr, endptr, 0, loc); >-} >+# define STRTOF_L strtold_l > #endif > >-weak_alias (__strtold_l, strtold_l) >+weak_alias (STRTOF, STRTOF_L) >--- libc/sysdeps/generic/strtold.c.128 2002-08-13 10:16:45.000000000 -0700 >+++ libc/sysdeps/generic/strtold.c 2004-03-10 10:41:55.000000000 -0800 >@@ -1,4 +1,4 @@ >-/* Copyright (C) 1999, 2002 Free Software Foundation, Inc. >+/* Copyright (C) 1999, 2002, 2004 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,17 +18,48 @@ > > #include <math.h> > #include <stdlib.h> >+#ifdef USE_WIDE_CHAR >+# define STRING_TYPE wchar_t >+# include <wchar.h> >+#else >+# define STRING_TYPE char >+#endif >+ >+#ifdef USE_IN_EXTENDED_LOCALE_MODEL >+# include <xlocale.h> >+# define LOCALE_PARAM , loc >+# define LOCALE_PARAM_DECL , __locale_t loc >+# ifdef USE_WIDE_CHAR >+# define STRTOF __wcstold_l >+# define STRTOD __wcstod_l >+# else >+# define STRTOF __strtold_l >+# define STRTOD __strtod_l >+# endif >+#else >+# define LOCALE_PARAM >+# define LOCALE_PARAM_DECL >+# ifdef USE_WIDE_CHAR >+# define STRTOF wcstold >+# define STRTOD wcstod >+# else >+# define STRTOF strtold >+# define STRTOD strtod >+# endif >+#endif > > /* There is no `long double' type, use the `double' implementations. */ > long double >-__strtold_internal (const char *nptr, char **endptr, int group) >+INTERNAL (STRTOF) (const STRING_TYPE *nptr, STRING_TYPE **endptr, >+ int group LOCALE_PARAM_DECL) > { >- return __strtod_internal (nptr, endptr, group); >+ return INTERNAL (STRTOD) (nptr, endptr, group LOCALE_PARAM); > } >-libc_hidden_def (__strtold_internal) >+libc_hidden_def (INTERNAL (STRTOF)) > > long double >-strtold (const char *nptr, char **endptr) >+STRTOF (const STRING_TYPE *nptr, STRING_TYPE **endptr >+ LOCALE_PARAM_DECL) > { >- return __strtod_internal (nptr, endptr, 0); >+ return INTERNAL (STRTOD) (nptr, endptr, 0 LOCALE_PARAM); > } >--- libc/sysdeps/ieee754/ldbl-128/strtold.c.128 2001-07-05 21:55:55.000000000 -0700 >+++ libc/sysdeps/ieee754/ldbl-128/strtold.c 2004-03-10 12:46:35.000000000 -0800 >@@ -18,15 +18,31 @@ > > #include <math.h> > >+#ifdef USE_WIDE_CHAR >+# define STRING_TYPE wchar_t >+# include <wchar.h> >+#else >+# define STRING_TYPE char >+#endif >+ > /* The actual implementation for all floating point sizes is in strtod.c. > These macros tell it to produce the `long double' version, `strtold'. */ > > # define FLOAT long double > # define FLT LDBL > # ifdef USE_IN_EXTENDED_LOCALE_MODEL >-# define STRTOF __strtold_l >+# include <xlocale.h> >+# ifdef USE_WIDE_CHAR >+# define STRTOF __wcstold_l >+# else >+# define STRTOF __strtold_l >+# endif > # else >-# define STRTOF strtold >+# ifdef USE_WIDE_CHAR >+# define STRTOF wcstold >+# else >+# define STRTOF strtold >+# endif > # endif > # define MPN2FLOAT __mpn_construct_long_double > # define FLOAT_HUGE_VAL HUGE_VALL >--- libc/sysdeps/ieee754/ldbl-96/strtold.c.128 2001-07-05 21:55:55.000000000 -0700 >+++ libc/sysdeps/ieee754/ldbl-96/strtold.c 2004-03-10 12:45:01.000000000 -0800 >@@ -18,15 +18,31 @@ > > #include <math.h> > >+#ifdef USE_WIDE_CHAR >+# define STRING_TYPE wchar_t >+# include <wchar.h> >+#else >+# define STRING_TYPE char >+#endif >+ > /* The actual implementation for all floating point sizes is in strtod.c. > These macros tell it to produce the `long double' version, `strtold'. */ > > # define FLOAT long double > # define FLT LDBL > # ifdef USE_IN_EXTENDED_LOCALE_MODEL >-# define STRTOF __strtold_l >+# include <xlocale.h> >+# ifdef USE_WIDE_CHAR >+# define STRTOF __wcstold_l >+# else >+# define STRTOF __strtold_l >+# endif > # else >-# define STRTOF strtold >+# ifdef USE_WIDE_CHAR >+# define STRTOF wcstold >+# else >+# define STRTOF strtold >+# endif > # endif > # define MPN2FLOAT __mpn_construct_long_double > # define FLOAT_HUGE_VAL HUGE_VALL >--- libc/wcsmbs/wcstold.c.128 2002-08-13 10:16:45.000000000 -0700 >+++ libc/wcsmbs/wcstold.c 2004-03-10 10:36:19.000000000 -0800 >@@ -1,4 +1,4 @@ >-/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. >+/* Copyright (C) 1996, 1997, 1998, 2004 Free Software Foundation, Inc. > This file is part of the GNU C Library. > Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996. > >@@ -17,46 +17,5 @@ > Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA > 02111-1307 USA. */ > >-#include <math.h> >-#include <wchar.h> >- >-#ifndef __NO_LONG_DOUBLE_MATH >-/* The actual implementation for all floating point sizes is in strtod.c. >- These macros tell it to produce the `long double' version, `wcstold'. */ >- >-# define FLOAT long double >-# define FLT LDBL >-# ifdef USE_IN_EXTENDED_LOCALE_MODEL >-# define STRTOF __wcstold_l >-# else >-# define STRTOF wcstold >-# endif >-# define MPN2FLOAT __mpn_construct_long_double >-# define FLOAT_HUGE_VAL HUGE_VALL >-# define USE_WIDE_CHAR 1 >-# define SET_MANTISSA(flt, mant) \ >- do { union ieee854_long_double u; \ >- u.d = (flt); \ >- if ((mant & 0x7fffffffffffffffULL) == 0) \ >- mant = 0x4000000000000000ULL; \ >- u.ieee.mantissa0 = (((mant) >> 32) & 0x7fffffff) | 0x80000000; \ >- u.ieee.mantissa1 = (mant) & 0xffffffff; \ >- (flt) = u.d; \ >- } while (0) >- >-# include <stdlib/strtod.c> >-#else >-/* There is no `long double' type, use the `double' implementations. */ >-long double >-__wcstold_internal (const wchar_t *nptr, wchar_t **endptr, int group) >-{ >- return __wcstod_internal (nptr, endptr, group); >-} >-libc_hidden_def (__wcstold_internal) >- >-long double >-wcstold (const wchar_t *nptr, wchar_t **endptr) >-{ >- return __wcstod_internal (nptr, endptr, 0); >-} >-#endif >+#define USE_WIDE_CHAR 1 >+#include <strtold.c> >--- libc/wcsmbs/wcstold_l.c.128 2002-08-06 01:39:59.000000000 -0700 >+++ libc/wcsmbs/wcstold_l.c 2004-03-10 10:40:00.000000000 -0800 >@@ -1,5 +1,5 @@ > /* Convert string representing a number to integer value, using given locale. >- Copyright (C) 1997,98,99,2002 Free Software Foundation, Inc. >+ Copyright (C) 1997,98,99,2002,2004 Free Software Foundation, Inc. > This file is part of the GNU C Library. > Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. > >@@ -18,39 +18,5 @@ > Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA > 02111-1307 USA. */ > >-#define __need_wchar_t >-#include <math.h> >-#include <stddef.h> >-#include <locale.h> >-#include <wchar.h> >- >-#define USE_IN_EXTENDED_LOCALE_MODEL 1 >- >-#ifndef __NO_LONG_DOUBLE_MATH >- >-extern long double ____wcstold_l_internal (const wchar_t *, wchar_t **, int, >- __locale_t); >-extern unsigned long long int ____wcstoull_l_internal (const wchar_t *, >- wchar_t **, int, int, >- __locale_t); >- >-# include <wcstold.c> >-#else >-/* There is no `long double' type, use the `double' implementations. */ >-extern double ____wcstod_l_internal (const wchar_t *, wchar_t **, int, >- __locale_t); >-long double >-____wcstold_l_internal (const wchar_t *nptr, wchar_t **endptr, int group, >- __locale_t loc) >-{ >- return ____wcstod_l_internal (nptr, endptr, group, loc); >-} >- >-long double >-__wcstold_l (const wchar_t *nptr, wchar_t **endptr, __locale_t loc) >-{ >- return ____wcstod_l_internal (nptr, endptr, 0, loc); >-} >-#endif >- >-weak_alias (__wcstold_l, wcstold_l) >+#define USE_WIDE_CHAR 1 >+#include <strtold_l.c>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 66
: 30