Browse Source

address compiler warnings in #3

Keno Fischer 13 years ago
parent
commit
04e12006e5
18 changed files with 29 additions and 57 deletions
  1. 1 1
      src/e_atan2.c
  2. 0 4
      src/e_sqrtf.c
  3. 2 0
      src/e_sqrtl.c
  4. 2 0
      src/s_csqrt.c
  5. 2 0
      src/s_csqrtf.c
  6. 2 1
      src/s_csqrtl.c
  7. 0 4
      src/s_fabs.c
  8. 4 4
      src/s_fma.c
  9. 4 4
      src/s_fmal.c
  10. 0 11
      src/s_fpclassify.c
  11. 0 4
      src/s_logbl.c
  12. 0 4
      src/s_modf.c
  13. 1 1
      src/s_nextafterl.c
  14. 1 1
      src/s_nexttoward.c
  15. 1 1
      src/s_nexttowardf.c
  16. 3 6
      src/s_scalbn.c
  17. 3 5
      src/s_scalbnf.c
  18. 3 6
      src/s_scalbnl.c

+ 1 - 1
src/e_atan2.c

@@ -71,7 +71,7 @@ __ieee754_atan2(double y, double x)
 	if(((ix|((lx|-lx)>>31))>0x7ff00000)||
 	   ((iy|((ly|-ly)>>31))>0x7ff00000))	/* x or y is NaN */
 	   return x+y;
-	if((hx-0x3ff00000|lx)==0) return atan(y);   /* x=1.0 */
+	if(((hx-0x3ff00000)|lx)==0) return atan(y);   /* x=1.0 */
 	m = ((hy>>31)&1)|((hx>>30)&2);	/* 2*sign(x)+sign(y) */
 
     /* when y = 0 */

+ 0 - 4
src/e_sqrtf.c

@@ -13,10 +13,6 @@
  * ====================================================
  */
 
-#ifndef lint
-static char rcsid[] = "$FreeBSD: src/lib/msun/src/e_sqrtf.c,v 1.7 2002/05/28 18:15:04 alfred Exp $";
-#endif
-
 #include "openlibm.h"
 #include "math_private.h"
 

+ 2 - 0
src/e_sqrtl.c

@@ -65,7 +65,9 @@ dec(long double x)
 	return (u.e);
 }
 
+#ifndef __GNUC__
 #pragma STDC FENV_ACCESS ON
+#endif
 
 /*
  * This is slow, but simple and portable. You should use hardware sqrt

+ 2 - 0
src/s_csqrt.c

@@ -40,7 +40,9 @@
  * gcc generates is acceptable, since the special cases have already been
  * handled.
  */
+#ifndef __GNUC__
 #pragma	STDC CX_LIMITED_RANGE	ON
+#endif
 
 /* We risk spurious overflow for components >= DBL_MAX / (1 + sqrt(2)). */
 #define	THRESH	0x1.a827999fcef32p+1022

+ 2 - 0
src/s_csqrtf.c

@@ -39,7 +39,9 @@
  * gcc generates is acceptable, since the special cases have already been
  * handled.
  */
+#ifndef __GNUC__
 #pragma	STDC CX_LIMITED_RANGE	ON
+#endif
 
 float complex
 csqrtf(float complex z)

+ 2 - 1
src/s_csqrtl.c

@@ -25,7 +25,6 @@
  */
 
 #include "cdefs-compat.h"
-//__FBSDID("$FreeBSD: src/lib/msun/src/s_csqrtl.c,v 1.2 2008/08/08 00:15:16 das Exp $");
 
 #include <complex.h>
 #include <float.h>
@@ -40,7 +39,9 @@
  * gcc generates is acceptable, since the special cases have already been
  * handled.
  */
+#ifndef __GNUC__
 #pragma	STDC CX_LIMITED_RANGE	ON
+#endif
 
 /* We risk spurious overflow for components >= LDBL_MAX / (1 + sqrt(2)). */
 #define	THRESH	(LDBL_MAX / 2.414213562373095048801688724209698L)

+ 0 - 4
src/s_fabs.c

@@ -10,10 +10,6 @@
  * ====================================================
  */
 
-#ifndef lint
-static char rcsid[] = "$FreeBSD: src/lib/msun/src/s_fabs.c,v 1.7 2002/05/28 18:15:04 alfred Exp $";
-#endif
-
 /*
  * fabs(x) returns the absolute value of x.
  */

+ 4 - 4
src/s_fma.c

@@ -117,7 +117,7 @@ add_and_denormalize(double a, double b, int scale)
 	if (sum.lo != 0) {
 		EXTRACT_WORD64(hibits, sum.hi);
 		bits_lost = -((int)(hibits >> 52) & 0x7ff) - scale + 1;
-		if (bits_lost != 1 ^ (int)(hibits & 1)) {
+		if ((bits_lost != 1) ^ (int)(hibits & 1)) {
 			/* hibits += (int)copysign(1.0, sum.hi * sum.lo) */
 			EXTRACT_WORD64(lobits, sum.lo);
 			hibits += 1 - (((hibits ^ lobits) >> 62) & 2);
@@ -216,17 +216,17 @@ fma(double x, double y, double z)
 		case FE_TONEAREST:
 			return (z);
 		case FE_TOWARDZERO:
-			if (x > 0.0 ^ y < 0.0 ^ z < 0.0)
+			if ((x > 0.0) ^ (y < 0.0) ^ (z < 0.0))
 				return (z);
 			else
 				return (nextafter(z, 0));
 		case FE_DOWNWARD:
-			if (x > 0.0 ^ y < 0.0)
+			if ((x > 0.0) ^ (y < 0.0))
 				return (z);
 			else
 				return (nextafter(z, -INFINITY));
 		default:	/* FE_UPWARD */
-			if (x > 0.0 ^ y < 0.0)
+			if ((x > 0.0) ^ (y < 0.0))
 				return (nextafter(z, INFINITY));
 			else
 				return (z);

+ 4 - 4
src/s_fmal.c

@@ -113,7 +113,7 @@ add_and_denormalize(long double a, long double b, int scale)
 	if (sum.lo != 0) {
 		u.e = sum.hi;
 		bits_lost = -u.bits.exp - scale + 1;
-		if (bits_lost != 1 ^ (int)(u.bits.manl & 1))
+		if ((bits_lost != 1) ^ (int)(u.bits.manl & 1))
 			sum.hi = nextafterl(sum.hi, INFINITY * sum.lo);
 	}
 	return (ldexp(sum.hi, scale));
@@ -204,17 +204,17 @@ fmal(long double x, long double y, long double z)
 		case FE_TONEAREST:
 			return (z);
 		case FE_TOWARDZERO:
-			if (x > 0.0 ^ y < 0.0 ^ z < 0.0)
+			if ((x > 0.0) ^ (y < 0.0) ^ (z < 0.0))
 				return (z);
 			else
 				return (nextafterl(z, 0));
 		case FE_DOWNWARD:
-			if (x > 0.0 ^ y < 0.0)
+			if ((x > 0.0) ^ (y < 0.0))
 				return (z);
 			else
 				return (nextafterl(z, -INFINITY));
 		default:	/* FE_UPWARD */
-			if (x > 0.0 ^ y < 0.0)
+			if ((x > 0.0) ^ (y < 0.0))
 				return (nextafterl(z, INFINITY));
 			else
 				return (z);

+ 0 - 11
src/s_fpclassify.c

@@ -29,17 +29,6 @@
 
 #include "fpmath.h"
 
-//#define FP_INFINITE     0x01
-//#define FP_NAN          0x02
-//#define FP_NORMAL       0x04
-//#define FP_SUBNORMAL    0x08
-//#define FP_ZERO         0x10
-//#define fpclassify(x) \
-//    ((sizeof (x) == sizeof (float)) ? __fpclassifyf(x) \
-//    : (sizeof (x) == sizeof (double)) ? __fpclassifyd(x) \
-//    : __fpclassifyl(x))
-//
-
 int
 __fpclassifyd(double d)
 {

+ 0 - 4
src/s_logbl.c

@@ -10,10 +10,6 @@
  * ====================================================
  */
 
-#ifndef lint
-static char rcsid[] = "$FreeBSD: src/lib/msun/src/s_logbl.c,v 1.1 2007/12/17 03:53:38 das Exp $";
-#endif
-
 #include <float.h>
 #include <limits.h>
 #include <openlibm.h>

+ 0 - 4
src/s_modf.c

@@ -10,10 +10,6 @@
  * ====================================================
  */
 
-#ifndef lint
-static char rcsid[] = "$FreeBSD: src/lib/msun/src/s_modf.c,v 1.8 2007/01/06 21:22:38 das Exp $";
-#endif
-
 /*
  * modf(double x, double *iptr)
  * return fraction part of x, and return x's integral part in *iptr.

+ 1 - 1
src/s_nextafterl.c

@@ -52,7 +52,7 @@ nextafterl(long double x, long double y)
 	    t = ux.e*ux.e;
 	    if(t==ux.e) return t; else return ux.e; /* raise underflow flag */
 	}
-	if(x>0.0 ^ x<y) {			/* x -= ulp */
+	if((x>0.0) ^ (x<y)) {			/* x -= ulp */
 	    if(ux.bits.manl==0) {
 		if ((ux.bits.manh&~LDBL_NBIT)==0)
 		    ux.bits.exp -= 1;

+ 1 - 1
src/s_nexttoward.c

@@ -51,7 +51,7 @@ nexttoward(double x, long double y)
 	    t = x*x;
 	    if(t==x) return t; else return x;	/* raise underflow flag */
 	}
-	if(hx>0.0 ^ x < y) {			/* x -= ulp */
+	if((hx>0.0) ^ (x < y)) {			/* x -= ulp */
 	    if(lx==0) hx -= 1;
 	    lx -= 1;
 	} else {				/* x += ulp */

+ 1 - 1
src/s_nexttowardf.c

@@ -41,7 +41,7 @@ nexttowardf(float x, long double y)
 	    t = x*x;
 	    if(t==x) return t; else return x;	/* raise underflow flag */
 	}
-	if(hx>=0 ^ x < y)			/* x -= ulp */
+	if((hx>=0) ^ (x < y))			/* x -= ulp */
 	    hx -= 1;
 	else					/* x += ulp */
 	    hx += 1;

+ 3 - 6
src/s_scalbn.c

@@ -10,10 +10,6 @@
  * ====================================================
  */
 
-#ifndef lint
-static char rcsid[] = "$FreeBSD: src/lib/msun/src/s_scalbn.c,v 1.11 2005/03/07 21:27:37 das Exp $";
-#endif
-
 /*
  * scalbn (double x, int n)
  * scalbn(x,n) returns x* 2**n  computed by  exponent
@@ -51,11 +47,12 @@ scalbn (double x, int n)
         if (k >  0x7fe) return huge*copysign(huge,x); /* overflow  */
         if (k > 0) 				/* normal result */
 	    {SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;}
-        if (k <= -54)
+        if (k <= -54) {
             if (n > 50000) 	/* in case integer overflow in n+k */
 		return huge*copysign(huge,x);	/*overflow*/
 	    else return tiny*copysign(tiny,x); 	/*underflow*/
-        k += 54;				/* subnormal result */
+        } 
+	k += 54;				/* subnormal result */
 	SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20));
         return x*twom54;
 }

+ 3 - 5
src/s_scalbnf.c

@@ -13,9 +13,6 @@
  * ====================================================
  */
 
-#ifndef lint
-static char rcsid[] = "$FreeBSD: src/lib/msun/src/s_scalbnf.c,v 1.8 2005/03/07 04:52:43 das Exp $";
-#endif
 
 #include "cdefs-compat.h"
 
@@ -46,11 +43,12 @@ scalbnf (float x, int n)
         if (k >  0xfe) return huge*copysignf(huge,x); /* overflow  */
         if (k > 0) 				/* normal result */
 	    {SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); return x;}
-        if (k <= -25)
+        if (k <= -25) {
             if (n > 50000) 	/* in case integer overflow in n+k */
 		return huge*copysignf(huge,x);	/*overflow*/
 	    else return tiny*copysignf(tiny,x);	/*underflow*/
-        k += 25;				/* subnormal result */
+        }
+	k += 25;				/* subnormal result */
 	SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23));
         return x*twom25;
 }

+ 3 - 6
src/s_scalbnl.c

@@ -10,10 +10,6 @@
  * ====================================================
  */
 
-#ifndef lint
-static char rcsid[] = "$FreeBSD: src/lib/msun/src/s_scalbnl.c,v 1.1 2005/03/07 04:52:58 das Exp $";
-#endif
-
 /*
  * scalbnl (long double x, int n)
  * scalbnl(x,n) returns x* 2**n  computed by  exponent
@@ -59,11 +55,12 @@ scalbnl (long double x, int n)
         if (k >= 0x7fff) return huge*copysignl(huge,x); /* overflow  */
         if (k > 0) 				/* normal result */
 	    {u.bits.exp = k; return u.e;}
-        if (k <= -128)
+        if (k <= -128) {
             if (n > 50000) 	/* in case integer overflow in n+k */
 		return huge*copysign(huge,x);	/*overflow*/
 	    else return tiny*copysign(tiny,x); 	/*underflow*/
-        k += 128;				/* subnormal result */
+        }
+	k += 128;				/* subnormal result */
 	u.bits.exp = k;
         return u.e*0x1p-128;
 }