Преглед изворни кода

fix unused variable warnings in new nextafter/nexttoward code

apparently initializing a variable is not "using" it but assigning to
it is "using" it. i don't really like this fix, but it's better than
trying to make a bigger cleanup just before a release, and it should
work fine (tested against nsz's math tests).
Rich Felker пре 13 година
родитељ
комит
4e597feef0
5 измењених фајлова са 12 додато и 6 уклоњено
  1. 2 1
      src/math/nextafter.c
  2. 2 1
      src/math/nextafterf.c
  3. 4 2
      src/math/nextafterl.c
  4. 2 1
      src/math/nexttoward.c
  5. 2 1
      src/math/nexttowardf.c

+ 2 - 1
src/math/nextafter.c

@@ -30,7 +30,8 @@ double nextafter(double x, double y)
 		return x + x;
 	/* raise underflow if ux.value is subnormal or zero */
 	if (e == 0) {
-		volatile double z = x*x + ux.value*ux.value;
+		volatile double z;
+		z = x*x + ux.value*ux.value;
 	}
 	return ux.value;
 }

+ 2 - 1
src/math/nextafterf.c

@@ -29,7 +29,8 @@ float nextafterf(float x, float y)
 		return x + x;
 	/* raise underflow if ux.value is subnormal or zero */
 	if (e == 0) {
-		volatile float z = x*x + ux.value*ux.value;
+		volatile float z;
+		z = x*x + ux.value*ux.value;
 	}
 	return ux.value;
 }

+ 4 - 2
src/math/nextafterl.c

@@ -39,7 +39,8 @@ long double nextafterl(long double x, long double y)
 		return x + x;
 	/* raise underflow if ux.value is subnormal or zero */
 	if (ux.bits.exp == 0) {
-		volatile float z = x*x + ux.value*ux.value;
+		volatile float z;
+		z = x*x + ux.value*ux.value;
 	}
 	return ux.value;
 }
@@ -77,7 +78,8 @@ long double nextafterl(long double x, long double y)
 		return x + x;
 	/* raise underflow if ux.value is subnormal or zero */
 	if (ux.bits.exp == 0) {
-		volatile float z = x*x + ux.value*ux.value;
+		volatile float z;
+		z = x*x + ux.value*ux.value;
 	}
 	return ux.value;
 }

+ 2 - 1
src/math/nexttoward.c

@@ -39,7 +39,8 @@ double nexttoward(double x, long double y)
 		return x + x;
 	/* raise underflow if ux.value is subnormal or zero */
 	if (e == 0) {
-		volatile float z = x*x + ux.value*ux.value;
+		volatile float z;
+		z = x*x + ux.value*ux.value;
 	}
 	return ux.value;
 }

+ 2 - 1
src/math/nexttowardf.c

@@ -31,7 +31,8 @@ float nexttowardf(float x, long double y)
 		return x + x;
 	/* raise underflow if ux.value is subnormal or zero */
 	if (e == 0) {
-		volatile float z = x*x + ux.value*ux.value;
+		volatile float z;
+		z = x*x + ux.value*ux.value;
 	}
 	return ux.value;
 }