source: branches/backfire/toolchain/uClibc/patches-0.9.30.1/150-c99_ldbl_math.patch

Last change on this file was 15670, checked in by nbd, 8 years ago

uclibc 0.9.30.1: add c99 long double math fix from gentoo (thx, ralph)
fixes compile error on powerpc

File size: 16.8 KB
  • uClibc-0.9.30.1/libm/ldouble_wrappers.c

     
    1313#include "math.h" 
    1414#include <complex.h> 
    1515 
     16#if defined __NO_LONG_DOUBLE_MATH 
     17# define int_WRAPPER_C99(func) /* not needed */ 
     18# else 
     19# define int_WRAPPER_C99(func) \ 
     20int func##l(long double x) \ 
     21{ \ 
     22    return func((double) x); \ 
     23} \ 
     24libm_hidden_def(func##l) 
     25#endif 
    1626 
    1727/* Implement the following, as defined by SuSv3 */ 
    1828#if 0 
    long double truncl (long double x) 
    543553#endif 
    544554 
    545555 
    546 #ifdef __DO_C99_MATH__ 
     556#if defined __DO_C99_MATH__ 
    547557 
    548558#ifdef L_fpclassifyl 
    549 int __fpclassifyl (long double x) 
    550 { 
    551         return __fpclassify ( (double) x ); 
    552 } 
    553 libm_hidden_def(__fpclassifyl) 
     559int_WRAPPER_C99(__fpclassify) 
    554560#endif 
    555561 
    556562#ifdef L_finitel 
    557 int __finitel (long double x) 
    558 { 
    559         return __finite ( (double)x ); 
    560 } 
    561 libm_hidden_def(__finitel) 
     563int_WRAPPER_C99(__finite) 
    562564#endif 
    563565 
    564566#ifdef L_signbitl 
    565 int __signbitl (long double x) 
    566 { 
    567         return __signbitl ( (double)x ); 
    568 } 
    569 libm_hidden_def(__signbitl) 
     567int_WRAPPER_C99(__signbit) 
    570568#endif 
    571569 
    572570#ifdef L_isnanl 
    573 int __isnanl (long double x) 
    574 { 
    575         return __isnan ( (double)x ); 
    576 } 
    577 libm_hidden_def(__isnanl) 
     571int_WRAPPER_C99(__isnan) 
    578572#endif 
    579573 
    580574#ifdef L_isinfl 
    581 int __isinfl (long double x) 
    582 { 
    583         return __isinf ( (double)x ); 
    584 } 
    585 libm_hidden_def(__isinfl) 
     575int_WRAPPER_C99(__isinf) 
    586576#endif 
    587577 
    588 #endif 
     578#endif /* DO_C99_MATH */ 
     579 
     580#undef int_WRAPPER_C99 
  • uClibc-0.9.30.1/libm/nan.c

    float nanf (const char *tagp) 
    4545} 
    4646libm_hidden_def(nanf) 
    4747 
    48 #if defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     48#if defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ && !defined __NO_LONG_DOUBLE_MATH 
    4949libm_hidden_proto(nanl) 
    5050long double nanl (const char *tagp) 
    5151{ 
  • uClibc-0.9.30.1/include/math.h

    __BEGIN_DECLS 
    118118# undef __MATH_PRECNAME 
    119119 
    120120# if (__STDC__ - 0 || __GNUC__ - 0) \ 
    121      && (defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ || defined __LDBL_COMPAT) 
     121     && (!defined __NO_LONG_DOUBLE_MATH || defined __LDBL_COMPAT) 
    122122#  ifdef __LDBL_COMPAT 
    123123 
    124124#   ifdef __USE_ISOC99 
    enum 
    230230  }; 
    231231 
    232232/* Return number of classification appropriate for X.  */ 
    233 # ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     233# ifdef __NO_LONG_DOUBLE_MATH 
    234234#  define fpclassify(x) \ 
    235235     (sizeof (x) == sizeof (float) ? __fpclassifyf (x) : __fpclassify (x)) 
    236236# else 
    enum 
    242242# endif 
    243243 
    244244/* Return nonzero value if sign of X is negative.  */ 
    245 # ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     245# ifdef __NO_LONG_DOUBLE_MATH 
    246246#  define signbit(x) \ 
    247247     (sizeof (x) == sizeof (float) ? __signbitf (x) : __signbit (x)) 
    248248# else 
    enum 
    254254# endif 
    255255 
    256256/* Return nonzero value if X is not +-Inf or NaN.  */ 
    257 # ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     257# ifdef __NO_LONG_DOUBLE_MATH 
    258258#  define isfinite(x) \ 
    259259     (sizeof (x) == sizeof (float) ? __finitef (x) : __finite (x)) 
    260260# else 
    enum 
    270270 
    271271/* Return nonzero value if X is a NaN.  We could use `fpclassify' but 
    272272   we already have this functions `__isnan' and it is faster.  */ 
    273 # ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     273# ifdef __NO_LONG_DOUBLE_MATH 
    274274#  define isnan(x) \ 
    275275     (sizeof (x) == sizeof (float) ? __isnanf (x) : __isnan (x)) 
    276276# else 
    enum 
    282282# endif 
    283283 
    284284/* Return nonzero value is X is positive or negative infinity.  */ 
    285 # ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     285# ifdef __NO_LONG_DOUBLE_MATH 
    286286#  define isinf(x) \ 
    287287     (sizeof (x) == sizeof (float) ? __isinff (x) : __isinf (x)) 
    288288# else 
  • uClibc-0.9.30.1/include/tgmath.h

     
    3636 
    3737#if __GNUC_PREREQ (2, 7) 
    3838 
    39 # ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     39# ifdef __NO_LONG_DOUBLE_MATH 
    4040#  define __tgml(fct) fct 
    4141# else 
    4242#  define __tgml(fct) fct ## l 
  • uClibc-0.9.30.1/libc/sysdeps/linux/powerpc/bits/wordsize.h

     
    77# define __WORDSIZE     32 
    88#endif 
    99 
    10 #if defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ && !defined __LONG_DOUBLE_MATH_OPTIONAL 
     10#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL 
    1111 
    1212/* Signal the glibc ABI didn't used to have a `long double'. 
    1313   The changes all the `long double' function variants to be redirects 
    1414   to the double functions.  */ 
    1515# define __LONG_DOUBLE_MATH_OPTIONAL   1 
    1616# ifndef __LONG_DOUBLE_128__ 
    17 undef __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     17define __NO_LONG_DOUBLE_MATH        1 
    1818# endif 
    1919#endif 
  • uClibc-0.9.30.1/libc/sysdeps/linux/powerpc/bits/mathdef.h

    typedef double double_t; 
    6565 
    6666#endif  /* ISO C99 */ 
    6767 
    68 #ifdef __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     68#ifndef __NO_LONG_DOUBLE_MATH 
    6969#include <bits/wordsize.h> 
    7070/* Signal that we do not really have a `long double'.  The disables the 
    7171   declaration of all the `long double' function variants.  */ 
    7272# if __WORDSIZE == 32 
    73 #  undef __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     73#  define __NO_LONG_DOUBLE_MATH 1 
     74# elif !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     75#  define __NO_LONG_DOUBLE_MATH 1 
    7476# endif  /* __WORDSIZE == 32 */ 
    75 #endif  /* __UCLIBC_HAS_LONG_DOUBLE_MATH__ */ 
     77#endif  /* __NO_LONG_DOUBLE_MATH */ 
  • uClibc-0.9.30.1/libc/sysdeps/linux/arm/bits/mathdef.h

    typedef double double_t; /* `double' exp 
    3434# define FP_ILOGBNAN    (2147483647) 
    3535 
    3636#endif  /* ISO C99 */ 
     37 
     38#ifndef __NO_LONG_DOUBLE_MATH 
     39/* Signal that we do not really have a `long double'.  This disables the 
     40   declaration of all the `long double' function variants.  */ 
     41/* XXX The FPA does support this but the patterns in GCC are currently 
     42   turned off.  */ 
     43# define __NO_LONG_DOUBLE_MATH  1 
     44#endif 
  • uClibc-0.9.30.1/libc/sysdeps/linux/m68k/bits/mathdef.h

    typedef long double double_t; /* `double 
    3636# define FP_ILOGBNAN    (2147483647) 
    3737 
    3838#endif  /* ISO C99 */ 
     39 
     40#if !defined __NO_LONG_DOUBLE_MATH && !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     41# define __NO_LONG_DOUBLE_MATH  1 
     42#endif 
  • uClibc-0.9.30.1/libc/sysdeps/linux/alpha/bits/wordsize.h

     
    1818 
    1919#define __WORDSIZE      64 
    2020 
    21 #if defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ && !defined __LONG_DOUBLE_MATH_OPTIONAL 
     21#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL 
    2222 
    2323/* Signal that we didn't used to have a `long double'. The changes all 
    2424   the `long double' function variants to be redirects to the double 
    2525   functions.  */ 
    2626# define __LONG_DOUBLE_MATH_OPTIONAL    1 
    2727# ifndef __LONG_DOUBLE_128__ 
    28 undef __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     28define __NO_LONG_DOUBLE_MATH         1 
    2929# endif 
    3030#endif 
  • uClibc-0.9.30.1/libc/sysdeps/linux/alpha/bits/mathdef.h

    typedef double double_t; 
    7878 
    7979# endif /* GNUC before 3.4 */ 
    8080#endif /* COMPLEX_H */ 
     81 
     82#if !defined __NO_LONG_DOUBLE_MATH && !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     83# define __NO_LONG_DOUBLE_MATH  1 
     84#endif 
  • uClibc-0.9.30.1/libc/sysdeps/linux/common/bits/mathdef.h

    typedef double double_t; /* `double' exp 
    3535# define FP_ILOGBNAN    2147483647 
    3636 
    3737#endif  /* ISO C99 */ 
     38 
     39#ifndef __NO_LONG_DOUBLE_MATH 
     40/* Signal that we do not really have a `long double'.  The disables the 
     41   declaration of all the `long double' function variants.  */ 
     42# define __NO_LONG_DOUBLE_MATH  1 
     43#endif 
  • uClibc-0.9.30.1/libc/sysdeps/linux/i386/bits/mathdef.h

    typedef long double double_t; /* `double 
    4444# define FP_ILOGBNAN    (-2147483647 - 1) 
    4545 
    4646#endif  /* ISO C99 */ 
     47 
     48#if !defined __NO_LONG_DOUBLE_MATH && !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     49# define __NO_LONG_DOUBLE_MATH  1 
     50#endif 
  • uClibc-0.9.30.1/libc/sysdeps/linux/nios2/bits/mathdef.h

    typedef double double_t; /* `double' exp 
    3434# define FP_ILOGBNAN    (2147483647) 
    3535 
    3636#endif  /* ISO C99 */ 
     37 
     38#ifndef __NO_LONG_DOUBLE_MATH 
     39/* Signal that we do not really have a `long double'.  This disables the 
     40   declaration of all the `long double' function variants.  */ 
     41/* XXX The FPA does support this but the patterns in GCC are currently 
     42   turned off.  */ 
     43# define __NO_LONG_DOUBLE_MATH  1 
     44#endif 
  • uClibc-0.9.30.1/libc/sysdeps/linux/x86_64/bits/mathdef.h

    typedef long double double_t; /* `double 
    4646# define FP_ILOGBNAN    (-2147483647 - 1) 
    4747 
    4848#endif  /* ISO C99 */ 
     49 
     50#if !defined __NO_LONG_DOUBLE_MATH && !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     51# define __NO_LONG_DOUBLE_MATH  1 
     52#endif 
  • uClibc-0.9.30.1/libc/sysdeps/linux/xtensa/bits/mathdef.h

    typedef double double_t; /* `double' exp 
    3636 
    3737#endif  /* ISO C99 */ 
    3838 
    39 #if defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     39#ifndef __NO_LONG_DOUBLE_MATH 
    4040/* Signal that we do not really have a `long double'.  The disables the 
    4141   declaration of all the `long double' function variants.  */ 
    42 # undef __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     42# define __NO_LONG_DOUBLE_MATH  1 
    4343#endif 
  • uClibc-0.9.30.1/libc/sysdeps/linux/ia64/bits/mathdef.h

    typedef double double_t; /* `double' exp 
    3535# define FP_ILOGBNAN    2147483647 
    3636 
    3737#endif  /* ISO C99 */ 
     38 
     39#if !defined __NO_LONG_DOUBLE_MATH && !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     40# define __NO_LONG_DOUBLE_MATH  1 
     41#endif 
  • uClibc-0.9.30.1/libc/sysdeps/linux/mips/bits/mathdef.h

    typedef double double_t; /* `double' exp 
    3939 
    4040#endif  /* ISO C99 */ 
    4141 
    42 #if defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ && _MIPS_SIM == _ABIO32 
     42#if ! defined __NO_LONG_DOUBLE_MATH && _MIPS_SIM == _ABIO32 
    4343/* Signal that we do not really have a `long double'.  This disables the 
    4444   declaration of all the `long double' function variants.  */ 
    45 # error defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ and _MIPS_SIM == _ABIO32 
     45# define __NO_LONG_DOUBLE_MATH  1 
     46#elif !defined __NO_LONG_DOUBLE_MATH && !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     47# define __NO_LONG_DOUBLE_MATH  1 
    4648#endif 
  • uClibc-0.9.30.1/libc/sysdeps/linux/nios/bits/mathdef.h

    typedef double double_t; /* `double' exp 
    3434# define FP_ILOGBNAN    (2147483647) 
    3535 
    3636#endif  /* ISO C99 */ 
     37 
     38#ifndef __NO_LONG_DOUBLE_MATH 
     39/* Signal that we do not really have a `long double'.  This disables the 
     40   declaration of all the `long double' function variants.  */ 
     41/* XXX The FPA does support this but the patterns in GCC are currently 
     42   turned off.  */ 
     43# define __NO_LONG_DOUBLE_MATH  1 
     44#endif 
  • uClibc-0.9.30.1/libc/sysdeps/linux/sparc/bits/wordsize.h

     
    66# define __WORDSIZE     32 
    77#endif 
    88 
    9 #if 0 /* uClibc: done in mathdefs.h: defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ && !defined __LONG_DOUBLE_MATH_OPTIONAL*/ 
     9#if 0 /* uClibc: done in mathdefs.h: !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL*/ 
    1010 
    1111# if __WORDSIZE == 32 
    1212/* Signal that in 32bit ABI we didn't used to have a `long double'. 
     
    1414   to the double functions.  */ 
    1515#  define __LONG_DOUBLE_MATH_OPTIONAL   1 
    1616#  ifndef __LONG_DOUBLE_128__ 
    17 #   undef __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     17#   define __NO_LONG_DOUBLE_MATH        1 
    1818#  endif 
    1919# endif 
    2020#endif 
  • uClibc-0.9.30.1/libc/sysdeps/linux/sparc/bits/mathdef.h

    typedef double double_t; 
    5757 
    5858#endif  /* ISO C99 */ 
    5959 
    60 #ifdef __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     60#ifndef __NO_LONG_DOUBLE_MATH 
    6161 
    6262# if __WORDSIZE == 32 
    6363/* Signal that in 32bit ABI we do not really have a `long double'. 
    6464   The disables the declaration of all the `long double' function 
    6565   variants.  */ 
    66 #  undef __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     66#  define __NO_LONG_DOUBLE_MATH 1 
     67# elif !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     68#  define __NO_LONG_DOUBLE_MATH 1 
    6769# endif 
    6870 
    6971#endif 
  • uClibc-0.9.30.1/libc/sysdeps/linux/sparc/bits/mathinline.h

     
    3737 
    3838# if __WORDSIZE == 32 
    3939 
    40 #  ifdef __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     40#  ifndef __NO_LONG_DOUBLE_MATH 
    4141 
    4242#   define __unordered_cmp(x, y) \ 
    4343  (__extension__                                                              \ 
    __NTH (__signbit (double __x)) 
    157157  return __u.__i[0] < 0; 
    158158} 
    159159 
    160 #    ifdef __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     160#    ifndef __NO_LONG_DOUBLE_MATH 
    161161__MATH_INLINE int 
    162162__NTH (__signbitl (long double __x)) 
    163163{ 
    __NTH (sqrtl (long double __x)) 
    219219  _Qp_sqrt (&__r, &__x); 
    220220  return __r; 
    221221} 
    222 #   elif defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     222#   elif !defined __NO_LONG_DOUBLE_MATH 
    223223__MATH_INLINE long double 
    224224sqrtl (long double __x) __THROW 
    225225{ 
    __ieee754_sqrtl (long double __x) 
    257257  _Qp_sqrt(&__r, &__x); 
    258258  return __r; 
    259259} 
    260 #   elif defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ 
     260#   elif !defined __NO_LONG_DOUBLE_MATH 
    261261__MATH_INLINE long double 
    262262__ieee754_sqrtl (long double __x) 
    263263{ 
  • uClibc-0.9.30.1/libc/sysdeps/linux/sh/bits/mathdef.h

    typedef double double_t; 
    6161# define FP_ILOGBNAN    0x7fffffff 
    6262 
    6363#endif  /* ISO C99 */ 
     64 
     65#ifndef __NO_LONG_DOUBLE_MATH 
     66/* Signal that we do not really have a `long double'.  The disables the 
     67   declaration of all the `long double' function variants.  */ 
     68# define __NO_LONG_DOUBLE_MATH  1 
     69#endif 
Note: See TracBrowser for help on using the repository browser.