[PATCH] clean up warnings in libm on ia64

Al Stone ahs3 at fc.hp.com
Tue Mar 6 19:40:22 UTC 2007


Attached is a small patch that cleans up some warnings found while
compiling libm on a Debian ia64 system.  No functionality is affected,
but I also have not been paying attention to uClibc long enough to
know whether or not folks like these sorts of things cleaned up.

This has also been reported as issue 0001253.

Signed-off-by: Al Stone <ahs3 at fc.hp.com>

-- 
Ciao,
al
----------------------------------------------------------------------
Al Stone                                      Alter Ego:
Open Source and Linux R&D                     Debian Developer
Hewlett-Packard Company                       http://www.debian.org
E-mail: ahs3 at fc.hp.com                        ahs3 at debian.org
----------------------------------------------------------------------


diff --exclude .svn --exclude '.config*' -Naur svn/libm/e_pow.c uClibc-ia64-current/libm/e_pow.c
--- svn/libm/e_pow.c	2007-02-07 17:39:14.000000000 -0700
+++ uClibc-ia64-current/libm/e_pow.c	2007-03-02 15:18:20.000000000 -0700
@@ -110,7 +110,9 @@
 #endif
 {
 	double z,ax,z_h,z_l,p_h,p_l;
-	double y1,t1,t2,r,s,t,u,v,w;
+	/* The variable yone used to be called y1 but that collided with
+	 * and shadowed a global variable. */
+	double yone,t1,t2,r,s,t,u,v,w;
 	int32_t i,j,k,yisint,n;
 	int32_t hx,hy,ix,iy;
 	u_int32_t lx,ly;
@@ -258,11 +260,11 @@
 	if(((((u_int32_t)hx>>31)-1)|(yisint-1))==0)
 	    s = -one;/* (-ve)**(odd int) */
 
-    /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */
-	y1  = y;
-	SET_LOW_WORD(y1,0);
-	p_l = (y-y1)*t1+y*t2;
-	p_h = y1*t1;
+    /* split up y into yone+y2 and compute (yone+y2)*(t1+t2) */
+	yone  = y;
+	SET_LOW_WORD(yone,0);
+	p_l = (y-yone)*t1+y*t2;
+	p_h = yone*t1;
 	z = p_l+p_h;
 	EXTRACT_WORDS(j,i,z);
 	if (j>=0x40900000) {				/* z >= 1024 */
diff --exclude .svn --exclude '.config*' -Naur svn/libm/s_ceil.c uClibc-ia64-current/libm/s_ceil.c
--- svn/libm/s_ceil.c	2007-02-07 17:39:14.000000000 -0700
+++ uClibc-ia64-current/libm/s_ceil.c	2007-03-02 15:09:18.000000000 -0700
@@ -40,35 +40,37 @@
 	double x;
 #endif
 {
-	int32_t i0,i1,j0;
+        /* The variable k0 used to be named j0, but that collides with
+	 * the names of Bessel functions. */
+	int32_t i0,i1,k0;
 	u_int32_t i,j;
 	EXTRACT_WORDS(i0,i1,x);
-	j0 = ((i0>>20)&0x7ff)-0x3ff;
-	if(j0<20) {
-	    if(j0<0) { 	/* raise inexact if x != 0 */
+	k0 = ((i0>>20)&0x7ff)-0x3ff;
+	if(k0<20) {
+	    if(k0<0) { 	/* raise inexact if x != 0 */
 		if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */
 		    if(i0<0) {i0=0x80000000;i1=0;}
 		    else if((i0|i1)!=0) { i0=0x3ff00000;i1=0;}
 		}
 	    } else {
-		i = (0x000fffff)>>j0;
+		i = (0x000fffff)>>k0;
 		if(((i0&i)|i1)==0) return x; /* x is integral */
 		if(huge+x>0.0) {	/* raise inexact flag */
-		    if(i0>0) i0 += (0x00100000)>>j0;
+		    if(i0>0) i0 += (0x00100000)>>k0;
 		    i0 &= (~i); i1=0;
 		}
 	    }
-	} else if (j0>51) {
-	    if(j0==0x400) return x+x;	/* inf or NaN */
+	} else if (k0>51) {
+	    if(k0==0x400) return x+x;	/* inf or NaN */
 	    else return x;		/* x is integral */
 	} else {
-	    i = ((u_int32_t)(0xffffffff))>>(j0-20);
+	    i = ((u_int32_t)(0xffffffff))>>(k0-20);
 	    if((i1&i)==0) return x;	/* x is integral */
 	    if(huge+x>0.0) { 		/* raise inexact flag */
 		if(i0>0) {
-		    if(j0==20) i0+=1;
+		    if(k0==20) i0+=1;
 		    else {
-			j = i1 + (1<<(52-j0));
+			j = i1 + (1<<(52-k0));
 			if(j<i1) i0+=1;	/* got a carry */
 			i1 = j;
 		    }
diff --exclude .svn --exclude '.config*' -Naur svn/libm/s_floor.c uClibc-ia64-current/libm/s_floor.c
--- svn/libm/s_floor.c	2007-02-07 17:39:13.000000000 -0700
+++ uClibc-ia64-current/libm/s_floor.c	2007-03-02 15:11:28.000000000 -0700
@@ -40,36 +40,38 @@
 	double x;
 #endif
 {
-	int32_t i0,i1,j0;
+        /* The variable k0 used to be called j0, but that name collides
+	 * with the names of Bessel functions. */
+	int32_t i0,i1,k0;
 	u_int32_t i,j;
 	EXTRACT_WORDS(i0,i1,x);
-	j0 = ((i0>>20)&0x7ff)-0x3ff;
-	if(j0<20) {
-	    if(j0<0) { 	/* raise inexact if x != 0 */
+	k0 = ((i0>>20)&0x7ff)-0x3ff;
+	if(k0<20) {
+	    if(k0<0) { 	/* raise inexact if x != 0 */
 		if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */
 		    if(i0>=0) {i0=i1=0;}
 		    else if(((i0&0x7fffffff)|i1)!=0)
 			{ i0=0xbff00000;i1=0;}
 		}
 	    } else {
-		i = (0x000fffff)>>j0;
+		i = (0x000fffff)>>k0;
 		if(((i0&i)|i1)==0) return x; /* x is integral */
 		if(huge+x>0.0) {	/* raise inexact flag */
-		    if(i0<0) i0 += (0x00100000)>>j0;
+		    if(i0<0) i0 += (0x00100000)>>k0;
 		    i0 &= (~i); i1=0;
 		}
 	    }
-	} else if (j0>51) {
-	    if(j0==0x400) return x+x;	/* inf or NaN */
+	} else if (k0>51) {
+	    if(k0==0x400) return x+x;	/* inf or NaN */
 	    else return x;		/* x is integral */
 	} else {
-	    i = ((u_int32_t)(0xffffffff))>>(j0-20);
+	    i = ((u_int32_t)(0xffffffff))>>(k0-20);
 	    if((i1&i)==0) return x;	/* x is integral */
 	    if(huge+x>0.0) { 		/* raise inexact flag */
 		if(i0<0) {
-		    if(j0==20) i0+=1;
+		    if(k0==20) i0+=1;
 		    else {
-			j = i1+(1<<(52-j0));
+			j = i1+(1<<(52-k0));
 			if(j<i1) i0 +=1 ; 	/* got a carry */
 			i1=j;
 		    }
diff --exclude .svn --exclude '.config*' -Naur svn/libm/s_ldexp.c uClibc-ia64-current/libm/s_ldexp.c
--- svn/libm/s_ldexp.c	2007-02-07 17:39:14.000000000 -0700
+++ uClibc-ia64-current/libm/s_ldexp.c	2007-03-02 15:15:18.000000000 -0700
@@ -23,14 +23,14 @@
 
 libm_hidden_proto(ldexp)
 #ifdef __STDC__
-	double ldexp(double value, int exp)
+	double ldexp(double value, int exponent)
 #else
-	double ldexp(value, exp)
-	double value; int exp;
+	double ldexp(value, exponent)
+	double value; int exponent;
 #endif
 {
 	if(!finite(value)||value==0.0) return value;
-	value = scalbn(value,exp);
+	value = scalbn(value,exponent);
 	if(!finite(value)||value==0.0) errno = ERANGE;
 	return value;
 }
diff --exclude .svn --exclude '.config*' -Naur svn/libm/s_modf.c uClibc-ia64-current/libm/s_modf.c
--- svn/libm/s_modf.c	2007-02-07 17:39:14.000000000 -0700
+++ uClibc-ia64-current/libm/s_modf.c	2007-03-02 15:16:17.000000000 -0700
@@ -41,16 +41,18 @@
 	double x,*iptr;
 #endif
 {
-	int32_t i0,i1,j0;
+        /* The variable k0 used to be called j0, but that name collides
+	 * with the Bessel functions. */
+	int32_t i0,i1,k0;
 	u_int32_t i;
 	EXTRACT_WORDS(i0,i1,x);
-	j0 = ((i0>>20)&0x7ff)-0x3ff;	/* exponent of x */
-	if(j0<20) {			/* integer part in high x */
-	    if(j0<0) {			/* |x|<1 */
+	k0 = ((i0>>20)&0x7ff)-0x3ff;	/* exponent of x */
+	if(k0<20) {			/* integer part in high x */
+	    if(k0<0) {			/* |x|<1 */
 	        INSERT_WORDS(*iptr,i0&0x80000000,0);	/* *iptr = +-0 */
 		return x;
 	    } else {
-		i = (0x000fffff)>>j0;
+		i = (0x000fffff)>>k0;
 		if(((i0&i)|i1)==0) {		/* x is integral */
 		    u_int32_t high;
 		    *iptr = x;
@@ -62,14 +64,14 @@
 		    return x - *iptr;
 		}
 	    }
-	} else if (j0>51) {		/* no fraction part */
+	} else if (k0>51) {		/* no fraction part */
 	    u_int32_t high;
 	    *iptr = x*one;
 	    GET_HIGH_WORD(high,x);
 	    INSERT_WORDS(x,high&0x80000000,0);	/* return +-0 */
 	    return x;
 	} else {			/* fraction part in low x */
-	    i = ((u_int32_t)(0xffffffff))>>(j0-20);
+	    i = ((u_int32_t)(0xffffffff))>>(k0-20);
 	    if((i1&i)==0) { 		/* x is integral */
 	        u_int32_t high;
 		*iptr = x;





More information about the uClibc mailing list