Updated patch for dealing with __infinity and small data areas
Chris Faylor
cgf@cygnus.com
Fri Jul 28 22:28:00 GMT 2000
I don't understand the reason for using __INFINITY_DECL__. It seems
gratuitous unless somebody is declaring this in a Makefile somewhere.
Since the __declspec(dllimport) stuff is already sprinkled throughout
the header files, special casing it in this one place seems like it
will just generate future confusion.
DJ has proposed a generic method for dealing with the windows export
criteria. I think it will probably supersede this change, assuming
that it is accepted.
cgf
On Fri, Jul 28, 2000 at 12:30:20PM -0400, Michael Meissner wrote:
>*** newlib/libc/include/math.h.~1~ Fri Jul 28 12:23:56 2000
>--- newlib/libc/include/math.h Fri Jul 28 11:25:19 2000
>*************** union __dmath
>*** 21,33 ****
> double d;
> };
>
> #if !defined(__CYGWIN__) || defined(__INSIDE_CYGWIN__) || defined(_COMPILING_NEWLIB)
>! extern const union __dmath __infinity;
> #else
>! extern __declspec(dllimport) const union __dmath __infinity;
> #endif
>
>! #define HUGE_VAL (__infinity.d)
>
> #endif /* ! defined (HUGE_VAL) */
>
>--- 21,43 ----
> double d;
> };
>
>+ /* Declare this as an array without bounds so that no matter what small data
>+ support a port and/or library has, this reference will be via the general
>+ method for accessing globals.
>+
>+ Also under Cygwin, the library exports a pointer to the real value, so we
>+ need to properly dereference it. */
>+ #ifndef __INFINITY_DECL__
> #if !defined(__CYGWIN__) || defined(__INSIDE_CYGWIN__) || defined(_COMPILING_NEWLIB)
>! #define __INFINITY_DECL__
> #else
>! #define __INFINITY_DECL__ __declspec(dllimport)
>! #endif
> #endif
>
>! extern __INFINITY_DECL__ const union __dmath __infinity[];
>!
>! #define HUGE_VAL (__infinity[0].d)
>
> #endif /* ! defined (HUGE_VAL) */
>
>*** newlib/libm/math/s_infconst.c.~1~ Thu Feb 17 14:39:51 2000
>--- newlib/libm/math/s_infconst.c Fri Jul 28 10:38:40 2000
>***************
>*** 6,15 ****
>
> #ifndef _DOUBLE_IS_32BITS
> #ifdef __IEEE_BIG_ENDIAN
>! const union __dmath __infinity = { 0x7ff00000, 0 };
> #else
>! const union __dmath __infinity = { 0, 0x7ff00000 };
> #endif
> #else /* defined (_DOUBLE_IS_32BITS) */
>! const union __dmath __infinity = { 0x7f800000, 0 };
> #endif /* defined (_DOUBLE_IS_32BITS) */
>--- 6,15 ----
>
> #ifndef _DOUBLE_IS_32BITS
> #ifdef __IEEE_BIG_ENDIAN
>! const union __dmath __infinity[1] = {{ 0x7ff00000, 0 }};
> #else
>! const union __dmath __infinity[1] = {{ 0, 0x7ff00000 }};
> #endif
> #else /* defined (_DOUBLE_IS_32BITS) */
>! const union __dmath __infinity[1] = {{ 0x7f800000, 0 }};
> #endif /* defined (_DOUBLE_IS_32BITS) */
>*** newlib/libm/mathfp/s_infconst.c.~1~ Thu Feb 17 14:39:52 2000
>--- newlib/libm/mathfp/s_infconst.c Fri Jul 28 10:38:09 2000
>***************
>*** 6,15 ****
>
> #ifndef _DOUBLE_IS_32BITS
> #ifdef __IEEE_BIG_ENDIAN
>! const union __dmath __infinity = { 0x7ff00000, 0 };
> #else
>! const union __dmath __infinity = { 0, 0x7ff00000 };
> #endif
> #else /* defined (_DOUBLE_IS_32BITS) */
>! const union __dmath __infinity = { 0x7f800000, 0 };
> #endif /* defined (_DOUBLE_IS_32BITS) */
>--- 6,15 ----
>
> #ifndef _DOUBLE_IS_32BITS
> #ifdef __IEEE_BIG_ENDIAN
>! const union __dmath __infinity[1] = {{ 0x7ff00000, 0 }};
> #else
>! const union __dmath __infinity[1] = {{ 0, 0x7ff00000 }};
> #endif
> #else /* defined (_DOUBLE_IS_32BITS) */
>! const union __dmath __infinity[1] = {{ 0x7f800000, 0 }};
> #endif /* defined (_DOUBLE_IS_32BITS) */
>
>--
>Michael Meissner, Red Hat, Inc.
>PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
>Work: meissner@redhat.com phone: +1 978-486-9304
>Non-work: meissner@spectacle-pond.org fax: +1 978-692-4482
--
cgf@cygnus.com Cygnus Solutions, a Red Hat company
http://sourceware.cygnus.com/ http://www.redhat.com/
More information about the Newlib
mailing list