From: John Marino Date: Sun, 12 Jul 2015 20:16:29 +0000 (+0200) Subject: OpenLIBM: remaining local modifications X-Git-Tag: v4.3.1~185 X-Git-Url: https://gitweb.dragonflybsd.org/~tuxillo/dragonfly.git/commitdiff_plain/74b7c7a8f84d2074b354ec1a601ec20152ace31f OpenLIBM: remaining local modifications The following section is an excerpt of DRAGONFLY.README for this vendor branch. Many of these patched issued exist in the current libm as well, but they are masked with WARNS?=1. Other fixes adjust for differences between DragonFly and OpenBSD. The WARNS level has been raised to 3, and it could be raised to 4 by fixing "set-but-unused" errors. The following files have been patched ===================================== arch/amd64/*.S (elf note added to all assembly files) arch/amd64/fenv.c (#include diff from OpenBSD) arch/amd64/fenv.h (#include for CDECL) include/global/math.h (#include diff, double/float typedefs) src/e_j0.c (full coverage) src/e_j0f.c (full coverage, fix sign comparison mismatch) src/e_j1.c (full coverage) src/e_j1f.c (full coverage, fix sign comparison mismatch) src/e_jnf.c (sign comparison mismatch) src/e_pow.c (sign comparison mismatch) src/e_powf.c (sign comparison mismatch) src/e_rem_pio2f.c (sign comparison mismatch) src/ld80/e_fmodl.c (sign comparison mismatch) src/ld80/s_ceill.c (sign comparison mismatch) src/ld80/s_floorl.c (sign comparison mismatch) src/ld80/s_nextafterl.c (strong alias, explicit eval order, always true) src/ld80/s_remquol.c (sign comparison mismatch) src/s_lround.c (sign comparison mismatch) src/s_lroundf.c (sign comparison mismatch) src/s_nan.c (#include diff from OpenBSD) src/w_drem.c (ansify prototype) --- diff --git a/contrib/openbsd_libm/arch/amd64/fenv.c b/contrib/openbsd_libm/arch/amd64/fenv.c index 708259d4d3..6169212900 100644 --- a/contrib/openbsd_libm/arch/amd64/fenv.c +++ b/contrib/openbsd_libm/arch/amd64/fenv.c @@ -28,7 +28,7 @@ */ #include -#include +#include /* * The following constant represents the default floating-point environment diff --git a/contrib/openbsd_libm/include/amd64/fenv.h b/contrib/openbsd_libm/include/amd64/fenv.h index 8dc2343943..483dbc178f 100644 --- a/contrib/openbsd_libm/include/amd64/fenv.h +++ b/contrib/openbsd_libm/include/amd64/fenv.h @@ -30,6 +30,8 @@ #ifndef _AMD64_FENV_H_ #define _AMD64_FENV_H_ +#include + /* * Each symbol representing a floating point exception expands to an integer * constant expression with values, such that bitwise-inclusive ORs of _all diff --git a/contrib/openbsd_libm/include/global/math.h b/contrib/openbsd_libm/include/global/math.h index 02e1417ab7..ad5e715d9d 100644 --- a/contrib/openbsd_libm/include/global/math.h +++ b/contrib/openbsd_libm/include/global/math.h @@ -17,7 +17,7 @@ #ifndef _MATH_H_ #define _MATH_H_ -#include +#include #include __BEGIN_DECLS @@ -35,8 +35,8 @@ extern char __infinity[]; * C99 */ #if __ISO_C_VISIBLE >= 1999 -typedef __double_t double_t; -typedef __float_t float_t; +typedef double double_t; +typedef float float_t; #if __GNUC_PREREQ__(3, 3) && !defined(__vax__) #define HUGE_VALF __builtin_huge_valf() @@ -71,7 +71,7 @@ extern char __nan[]; ((sizeof (x) == sizeof (float)) ? \ __fpclassifyf(x) \ : (sizeof (x) == sizeof (double)) ? \ - __fpclassify(x) \ + __fpclassifyd(x) \ : __fpclassifyl(x)) #define isfinite(x) \ ((sizeof (x) == sizeof (float)) ? \ diff --git a/contrib/openbsd_libm/src/e_j0.c b/contrib/openbsd_libm/src/e_j0.c index 138d90c055..a1b372261f 100644 --- a/contrib/openbsd_libm/src/e_j0.c +++ b/contrib/openbsd_libm/src/e_j0.c @@ -275,7 +275,7 @@ pzero(double x) if(ix>=0x40200000) {p = pR8; q= pS8;} else if(ix>=0x40122E8B){p = pR5; q= pS5;} else if(ix>=0x4006DB6D){p = pR3; q= pS3;} - else if(ix>=0x40000000){p = pR2; q= pS2;} + else /*if(ix>=0x40000000)*/ {p = pR2; q= pS2;} z = one/(x*x); r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); @@ -371,7 +371,7 @@ qzero(double x) if(ix>=0x40200000) {p = qR8; q= qS8;} else if(ix>=0x40122E8B){p = qR5; q= qS5;} else if(ix>=0x4006DB6D){p = qR3; q= qS3;} - else if(ix>=0x40000000){p = qR2; q= qS2;} + else /*if(ix>=0x40000000)*/ {p = qR2; q= qS2;} z = one/(x*x); r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*(q[4]+z*q[5]))))); diff --git a/contrib/openbsd_libm/src/e_j0f.c b/contrib/openbsd_libm/src/e_j0f.c index e485e55f75..8e323ba797 100644 --- a/contrib/openbsd_libm/src/e_j0f.c +++ b/contrib/openbsd_libm/src/e_j0f.c @@ -59,7 +59,7 @@ j0f(float x) * j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x) * y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x) */ - if(ix>0x80000000U) z = (invsqrtpi*cc)/sqrtf(x); + if((u_int32_t)ix>0x80000000U) z = (invsqrtpi*cc)/sqrtf(x); else { u = pzerof(x); v = qzerof(x); z = invsqrtpi*(u*cc-v*ss)/sqrtf(x); @@ -133,7 +133,7 @@ y0f(float x) if ((s*c)0x80000000U) z = (invsqrtpi*ss)/sqrtf(x); + if((u_int32_t)ix>0x80000000U) z = (invsqrtpi*ss)/sqrtf(x); else { u = pzerof(x); v = qzerof(x); z = invsqrtpi*(u*ss+v*cc)/sqrtf(x); @@ -232,7 +232,7 @@ pzerof(float x) if(ix>=0x41000000) {p = pR8; q= pS8;} else if(ix>=0x40f71c58){p = pR5; q= pS5;} else if(ix>=0x4036db68){p = pR3; q= pS3;} - else if(ix>=0x40000000){p = pR2; q= pS2;} + else /*if(ix>=0x40000000)*/ {p = pR2; q= pS2;} z = one/(x*x); r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); @@ -328,7 +328,7 @@ qzerof(float x) if(ix>=0x41000000) {p = qR8; q= qS8;} else if(ix>=0x40f71c58){p = qR5; q= qS5;} else if(ix>=0x4036db68){p = qR3; q= qS3;} - else if(ix>=0x40000000){p = qR2; q= qS2;} + else /*if(ix>=0x40000000)*/ {p = qR2; q= qS2;} z = one/(x*x); r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*(q[4]+z*q[5]))))); diff --git a/contrib/openbsd_libm/src/e_j1.c b/contrib/openbsd_libm/src/e_j1.c index 2c475a5f1a..aba397dbd1 100644 --- a/contrib/openbsd_libm/src/e_j1.c +++ b/contrib/openbsd_libm/src/e_j1.c @@ -269,7 +269,7 @@ pone(double x) if(ix>=0x40200000) {p = pr8; q= ps8;} else if(ix>=0x40122E8B){p = pr5; q= ps5;} else if(ix>=0x4006DB6D){p = pr3; q= ps3;} - else if(ix>=0x40000000){p = pr2; q= ps2;} + else /*if(ix>=0x40000000)*/ {p = pr2; q= ps2;} z = one/(x*x); r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); @@ -366,7 +366,7 @@ qone(double x) if(ix>=0x40200000) {p = qr8; q= qs8;} else if(ix>=0x40122E8B){p = qr5; q= qs5;} else if(ix>=0x4006DB6D){p = qr3; q= qs3;} - else if(ix>=0x40000000){p = qr2; q= qs2;} + else /*if(ix>=0x40000000)*/ {p = qr2; q= qs2;} z = one/(x*x); r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*(q[4]+z*q[5]))))); diff --git a/contrib/openbsd_libm/src/e_j1f.c b/contrib/openbsd_libm/src/e_j1f.c index b65abc0e44..4266127f96 100644 --- a/contrib/openbsd_libm/src/e_j1f.c +++ b/contrib/openbsd_libm/src/e_j1f.c @@ -60,7 +60,7 @@ j1f(float x) * j1(x) = 1/sqrt(pi) * (P(1,x)*cc - Q(1,x)*ss) / sqrt(x) * y1(x) = 1/sqrt(pi) * (P(1,x)*ss + Q(1,x)*cc) / sqrt(x) */ - if(ix>0x80000000U) z = (invsqrtpi*cc)/sqrtf(y); + if((u_int64_t)ix>0x80000000U) z = (invsqrtpi*cc)/sqrtf(y); else { u = ponef(y); v = qonef(y); z = invsqrtpi*(u*cc-v*ss)/sqrtf(y); @@ -227,7 +227,7 @@ ponef(float x) if(ix>=0x41000000) {p = pr8; q= ps8;} else if(ix>=0x40f71c58){p = pr5; q= ps5;} else if(ix>=0x4036db68){p = pr3; q= ps3;} - else if(ix>=0x40000000){p = pr2; q= ps2;} + else /*if(ix>=0x40000000)*/ {p = pr2; q= ps2;} z = one/(x*x); r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); @@ -324,7 +324,7 @@ qonef(float x) if(ix>=0x40200000) {p = qr8; q= qs8;} else if(ix>=0x40f71c58){p = qr5; q= qs5;} else if(ix>=0x4036db68){p = qr3; q= qs3;} - else if(ix>=0x40000000){p = qr2; q= qs2;} + else /*if(ix>=0x40000000)*/ {p = qr2; q= qs2;} z = one/(x*x); r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*(q[4]+z*q[5]))))); diff --git a/contrib/openbsd_libm/src/e_jnf.c b/contrib/openbsd_libm/src/e_jnf.c index daaf1aea74..ecec51b916 100644 --- a/contrib/openbsd_libm/src/e_jnf.c +++ b/contrib/openbsd_libm/src/e_jnf.c @@ -181,7 +181,7 @@ ynf(int n, float x) b = y1f(x); /* quit if b is -inf */ GET_FLOAT_WORD(ib,b); - for(i=1;i>20)-0x3ff; /* exponent */ if(k>20) { j = ly>>(52-k); - if((j<<(52-k))==ly) yisint = 2-(j&1); + if((u_int32_t)(j<<(52-k))==ly) yisint = 2-(j&1); } else if(ly==0) { j = iy>>(20-k); if((j<<(20-k))==iy) yisint = 2-(j&1); diff --git a/contrib/openbsd_libm/src/e_powf.c b/contrib/openbsd_libm/src/e_powf.c index 3c4269d714..3931008ce3 100644 --- a/contrib/openbsd_libm/src/e_powf.c +++ b/contrib/openbsd_libm/src/e_powf.c @@ -208,7 +208,7 @@ powf(float x, float y) } else if ((j&0x7fffffff)>0x43160000) /* z <= -150 */ return s*tiny*tiny; /* underflow */ - else if (j==0xc3160000){ /* z == -150 */ + else if ((u_int32_t)j==0xc3160000){ /* z == -150 */ if(p_l<=z-p_h) return s*tiny*tiny; /* underflow */ } /* diff --git a/contrib/openbsd_libm/src/e_rem_pio2f.c b/contrib/openbsd_libm/src/e_rem_pio2f.c index f2af8c4950..1e86ddf133 100644 --- a/contrib/openbsd_libm/src/e_rem_pio2f.c +++ b/contrib/openbsd_libm/src/e_rem_pio2f.c @@ -125,7 +125,7 @@ __ieee754_rem_pio2f(float x, float *y) fn = (float)n; r = t-fn*pio2_1; w = fn*pio2_1t; /* 1st round good to 40 bit */ - if(n<32&&(ix&0xffffff00)!=npio2_hw[n-1]) { + if(n<32&&(ix&0xffffff00)!=(u_int32_t)npio2_hw[n-1]) { y[0] = r-w; /* quick check no cancellation */ } else { u_int32_t high; diff --git a/contrib/openbsd_libm/src/ld80/e_fmodl.c b/contrib/openbsd_libm/src/ld80/e_fmodl.c index a7cf3472a9..a0e9c038a7 100644 --- a/contrib/openbsd_libm/src/ld80/e_fmodl.c +++ b/contrib/openbsd_libm/src/ld80/e_fmodl.c @@ -125,7 +125,7 @@ fmodl(long double x, long double y) /* convert back to floating value and restore the sign */ if((hx|lx)==0) /* return sign(x)*0 */ return Zero[sx]; - while(hx<(1ULL<>MANL_SHIFT); lx = lx+lx; iy -= 1; } diff --git a/contrib/openbsd_libm/src/ld80/s_ceill.c b/contrib/openbsd_libm/src/ld80/s_ceill.c index bff5277806..50de1d5fd7 100644 --- a/contrib/openbsd_libm/src/ld80/s_ceill.c +++ b/contrib/openbsd_libm/src/ld80/s_ceill.c @@ -66,7 +66,7 @@ ceill(long double x) if(jj0==31) i0+=1; else { j = i1 + (1<<(63-jj0)); - if(j +#include #include "math_private.h" @@ -32,8 +33,8 @@ nextafterl(long double x, long double y) ix = esx&0x7fff; /* |x| */ iy = esy&0x7fff; /* |y| */ - if (((ix==0x7fff)&&((hx&0x7fffffff|lx)!=0)) || /* x is nan */ - ((iy==0x7fff)&&((hy&0x7fffffff|ly)!=0))) /* y is nan */ + if (((ix==0x7fff)&&(((hx&0x7fffffff)|lx)!=0)) || /* x is nan */ + ((iy==0x7fff)&&(((hy&0x7fffffff)|ly)!=0))) /* y is nan */ return x+y; if(x==y) return y; /* x=y, return y */ if((ix|hx|lx)==0) { /* x == 0 */ @@ -59,7 +60,7 @@ nextafterl(long double x, long double y) } } } else { /* x < 0 */ - if(esy>=0||(ix>iy||((ix==iy)&&(hx>hy||((hx==hy)&&(lx>ly)))))){ + if(/*esy>=0||*/(ix>iy||((ix==iy)&&(hx>hy||((hx==hy)&&(lx>ly)))))){ /* x < y, x -= ulp */ if(lx==0) { if ((hx&0x7fffffff)==0) esx -= 1; @@ -87,4 +88,4 @@ nextafterl(long double x, long double y) return x; } -__strong_alias(nexttowardl, nextafterl); +__strong_reference(nextafterl, nexttowardl); diff --git a/contrib/openbsd_libm/src/ld80/s_remquol.c b/contrib/openbsd_libm/src/ld80/s_remquol.c index 244c1053f1..a361e34f44 100644 --- a/contrib/openbsd_libm/src/ld80/s_remquol.c +++ b/contrib/openbsd_libm/src/ld80/s_remquol.c @@ -131,7 +131,7 @@ remquol(long double x, long double y, int *quo) *quo = (sxy ? -q : q); return Zero[sx!=0]; } - while(hx<(1ULL<>MANL_SHIFT); lx = lx+lx; iy -= 1; } diff --git a/contrib/openbsd_libm/src/s_lround.c b/contrib/openbsd_libm/src/s_lround.c index 15ac8e9c91..4e02ebac0d 100644 --- a/contrib/openbsd_libm/src/s_lround.c +++ b/contrib/openbsd_libm/src/s_lround.c @@ -42,7 +42,7 @@ #define RESTYPE_MAX LONG_MAX #endif -#define RESTYPE_BITS (sizeof(RESTYPE) * 8) +#define RESTYPE_BITS (int)(sizeof(RESTYPE) * 8) RESTYPE LROUNDNAME(double x) @@ -60,7 +60,7 @@ LROUNDNAME(double x) if (e < -1) return (0); /* 1.0 x 2^31 (or 2^63) is already too large */ - if (e >= (int)RESTYPE_BITS - 1) + if (e >= RESTYPE_BITS - 1) return (s ? RESTYPE_MIN : RESTYPE_MAX); /* ??? unspecified */ /* >= 2^52 is already an exact integer */ diff --git a/contrib/openbsd_libm/src/s_lroundf.c b/contrib/openbsd_libm/src/s_lroundf.c index 7858008cab..2b9f8ba02c 100644 --- a/contrib/openbsd_libm/src/s_lroundf.c +++ b/contrib/openbsd_libm/src/s_lroundf.c @@ -41,7 +41,7 @@ #define RESTYPE_MAX LONG_MAX #endif -#define RESTYPE_BITS (sizeof(RESTYPE) * 8) +#define RESTYPE_BITS (int)(sizeof(RESTYPE) * 8) RESTYPE LROUNDNAME(float x) @@ -59,7 +59,7 @@ LROUNDNAME(float x) if (e < -1) return (0); /* 1.0 x 2^31 (or 2^63) is already too large */ - if (e >= (int)RESTYPE_BITS - 1) + if (e >= RESTYPE_BITS - 1) return (s ? RESTYPE_MIN : RESTYPE_MAX); /* ??? unspecified */ /* >= 2^23 is already an exact integer */ diff --git a/contrib/openbsd_libm/src/s_nan.c b/contrib/openbsd_libm/src/s_nan.c index 33628c8239..d7d8a69b81 100644 --- a/contrib/openbsd_libm/src/s_nan.c +++ b/contrib/openbsd_libm/src/s_nan.c @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include #include diff --git a/contrib/openbsd_libm/src/w_drem.c b/contrib/openbsd_libm/src/w_drem.c index 7f50493403..5038f5c409 100644 --- a/contrib/openbsd_libm/src/w_drem.c +++ b/contrib/openbsd_libm/src/w_drem.c @@ -8,8 +8,7 @@ #include double -drem(x, y) - double x, y; +drem(double x, double y) { return remainder(x, y); }