From 2d87d95f12bbbb8bff611c8a19b943b9ebedb1fd Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 8 Aug 2018 10:41:58 +0200 Subject: newlib: fix various gcc warnings * unused variables * potentially used uninitialized * suggested bracketing * misleading indentation Signed-off-by: Corinna Vinschen --- newlib/libm/common/math_config.h | 2 ++ newlib/libm/common/sqrtl.c | 2 +- newlib/libm/math/ef_jn.c | 1 - newlib/libm/math/k_rem_pio2.c | 3 ++- newlib/libm/math/kf_rem_pio2.c | 3 ++- 5 files changed, 7 insertions(+), 4 deletions(-) (limited to 'newlib/libm') diff --git a/newlib/libm/common/math_config.h b/newlib/libm/common/math_config.h index d5896bbdd..cca682ed7 100644 --- a/newlib/libm/common/math_config.h +++ b/newlib/libm/common/math_config.h @@ -205,6 +205,7 @@ opt_barrier_double (double x) volatile double y = x; return y; } +#pragma GCC diagnostic ignored "-Wunused-variable" static inline void force_eval_float (float x) { @@ -215,6 +216,7 @@ force_eval_double (double x) { volatile double y = x; } +#pragma GCC diagnostic pop #endif /* Evaluate an expression as the specified type, normally a type diff --git a/newlib/libm/common/sqrtl.c b/newlib/libm/common/sqrtl.c index 8cd717e19..9976f35e7 100644 --- a/newlib/libm/common/sqrtl.c +++ b/newlib/libm/common/sqrtl.c @@ -123,7 +123,7 @@ long double sqrtl (long double x) { union ieee_ext_u ux = { .extu_ld = x, }; - int k, r; + int k; long double lo, xn; /* If x = NaN, then sqrt(x) = NaN. */ diff --git a/newlib/libm/math/ef_jn.c b/newlib/libm/math/ef_jn.c index bedfb3ed5..e872c09c7 100644 --- a/newlib/libm/math/ef_jn.c +++ b/newlib/libm/math/ef_jn.c @@ -20,7 +20,6 @@ static const float #else static float #endif -invsqrtpi= 5.6418961287e-01, /* 0x3f106ebb */ two = 2.0000000000e+00, /* 0x40000000 */ one = 1.0000000000e+00; /* 0x3F800000 */ diff --git a/newlib/libm/math/k_rem_pio2.c b/newlib/libm/math/k_rem_pio2.c index 856925668..46201874c 100644 --- a/newlib/libm/math/k_rem_pio2.c +++ b/newlib/libm/math/k_rem_pio2.c @@ -187,7 +187,8 @@ twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */ /* compute q[0],q[1],...q[jk] */ for (i=0;i<=jk;i++) { - for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw; + for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; + q[i] = fw; } jz = jk; diff --git a/newlib/libm/math/kf_rem_pio2.c b/newlib/libm/math/kf_rem_pio2.c index 261c48129..1573ca9f6 100644 --- a/newlib/libm/math/kf_rem_pio2.c +++ b/newlib/libm/math/kf_rem_pio2.c @@ -77,7 +77,8 @@ twon8 = 3.9062500000e-03; /* 0x3b800000 */ /* compute q[0],q[1],...q[jk] */ for (i=0;i<=jk;i++) { - for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw; + for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; + q[i] = fw; } jz = jk; -- cgit v1.2.3