diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2018-08-08 11:41:58 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2018-08-08 11:50:19 +0300 |
commit | 2d87d95f12bbbb8bff611c8a19b943b9ebedb1fd (patch) | |
tree | f59aa2e3271c3cf7baa629e1cedc567ef46526de | |
parent | 5ace9004d9b982ba8887df41139295792c130020 (diff) |
newlib: fix various gcc warnings
* unused variables
* potentially used uninitialized
* suggested bracketing
* misleading indentation
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r-- | newlib/libc/stdio/vfscanf.c | 2 | ||||
-rw-r--r-- | newlib/libc/stdlib/ldtoa.c | 7 | ||||
-rw-r--r-- | newlib/libc/stdlib/strtodg.c | 10 | ||||
-rw-r--r-- | newlib/libc/stdlib/strtoimax.c | 7 | ||||
-rw-r--r-- | newlib/libc/stdlib/strtoumax.c | 2 | ||||
-rw-r--r-- | newlib/libc/time/strftime.c | 3 | ||||
-rw-r--r-- | newlib/libm/common/math_config.h | 2 | ||||
-rw-r--r-- | newlib/libm/common/sqrtl.c | 2 | ||||
-rw-r--r-- | newlib/libm/math/ef_jn.c | 1 | ||||
-rw-r--r-- | newlib/libm/math/k_rem_pio2.c | 3 | ||||
-rw-r--r-- | newlib/libm/math/kf_rem_pio2.c | 3 |
11 files changed, 24 insertions, 18 deletions
diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c index b97235559..080dcf400 100644 --- a/newlib/libc/stdio/vfscanf.c +++ b/newlib/libc/stdio/vfscanf.c @@ -421,7 +421,7 @@ __SVFSCANF_R (struct _reent *rptr, int nbytes = 1; /* number of bytes read from fmt string */ wchar_t wc; /* wchar to use to read format string */ wchar_t *wcp; /* handy wide character pointer */ - size_t mbslen; /* length of converted multibyte sequence */ + size_t mbslen = 0; /* length of converted multibyte sequence */ #ifdef _MB_CAPABLE mbstate_t state; /* value to keep track of multibyte state */ #endif diff --git a/newlib/libc/stdlib/ldtoa.c b/newlib/libc/stdlib/ldtoa.c index 10a7537cc..751386233 100644 --- a/newlib/libc/stdlib/ldtoa.c +++ b/newlib/libc/stdlib/ldtoa.c @@ -412,8 +412,10 @@ static void eaddm (short unsigned int *x, short unsigned int *y); static void esubm (short unsigned int *x, short unsigned int *y); static void emdnorm (short unsigned int *s, int lost, int subflg, long int exp, int rcntrl, LDPARMS * ldp); +#if 0 /* Broken, unusable implementation of strtold */ static int asctoeg (char *ss, short unsigned int *y, int oprec, LDPARMS * ldp); +#endif static void enan (short unsigned int *nan, int size); #if LDBL_MANT_DIG == 24 static void toe24 (short unsigned int *x, short unsigned int *y); @@ -1834,6 +1836,7 @@ e113toe (short unsigned int *pe, short unsigned int *y, LDPARMS * ldp) /* move out internal format to ieee long double */ static void +__attribute__ ((__unused__)) toe113 (short unsigned int *a, short unsigned int *b) { register unsigned short *p, *q; @@ -1970,6 +1973,7 @@ e64toe (short unsigned int *pe, short unsigned int *y, LDPARMS * ldp) /* move out internal format to ieee long double */ static void +__attribute__ ((__unused__)) toe64 (short unsigned int *a, short unsigned int *b) { register unsigned short *p, *q; @@ -2150,6 +2154,7 @@ etoe53 (x, e) } static void +__attribute__ ((__unused__)) toe53 (x, y) unsigned short *x, *y; { @@ -2159,6 +2164,7 @@ toe53 (x, y) #else static void +__attribute__ ((__unused__)) toe53 (short unsigned int *x, short unsigned int *y) { unsigned short i; @@ -2327,6 +2333,7 @@ e24toe (short unsigned int *pe, short unsigned int *y, LDPARMS * ldp) } static void +__attribute__ ((__unused__)) toe24 (short unsigned int *x, short unsigned int *y) { unsigned short i; diff --git a/newlib/libc/stdlib/strtodg.c b/newlib/libc/stdlib/strtodg.c index d8546c336..4ac1f8eb2 100644 --- a/newlib/libc/stdlib/strtodg.c +++ b/newlib/libc/stdlib/strtodg.c @@ -688,13 +688,13 @@ _strtodg_l (struct _reent *p, const char *s00, char **se, FPI *fpi, Long *exp, dval(rv) *= tens[i]; if (e1 &= ~15) { e1 >>= 4; - while(e1 >= (1 << n_bigtens-1)) { + while(e1 >= (1 << (n_bigtens-1))) { e2 += ((word0(rv) & Exp_mask) >> Exp_shift1) - Bias; word0(rv) &= ~Exp_mask; word0(rv) |= Bias << Exp_shift1; dval(rv) *= bigtens[n_bigtens-1]; - e1 -= 1 << n_bigtens-1; + e1 -= 1 << (n_bigtens-1); } e2 += ((word0(rv) & Exp_mask) >> Exp_shift1) - Bias; word0(rv) &= ~Exp_mask; @@ -710,13 +710,13 @@ _strtodg_l (struct _reent *p, const char *s00, char **se, FPI *fpi, Long *exp, dval(rv) /= tens[i]; if (e1 &= ~15) { e1 >>= 4; - while(e1 >= (1 << n_bigtens-1)) { + while(e1 >= (1 << (n_bigtens-1))) { e2 += ((word0(rv) & Exp_mask) >> Exp_shift1) - Bias; word0(rv) &= ~Exp_mask; word0(rv) |= Bias << Exp_shift1; dval(rv) *= tinytens[n_bigtens-1]; - e1 -= 1 << n_bigtens-1; + e1 -= 1 << (n_bigtens-1); } e2 += ((word0(rv) & Exp_mask) >> Exp_shift1) - Bias; word0(rv) &= ~Exp_mask; @@ -912,7 +912,7 @@ _strtodg_l (struct _reent *p, const char *s00, char **se, FPI *fpi, Long *exp, } else irv = STRTOG_Normal | STRTOG_Inexhi; - if (bbbits < nbits && !denorm || !(rvb->_x[0] & 1)) + if ((bbbits < nbits && !denorm) || !(rvb->_x[0] & 1)) break; if (dsign) { rvb = increment(p, rvb); diff --git a/newlib/libc/stdlib/strtoimax.c b/newlib/libc/stdlib/strtoimax.c index b0efa3e51..6901612c3 100644 --- a/newlib/libc/stdlib/strtoimax.c +++ b/newlib/libc/stdlib/strtoimax.c @@ -60,11 +60,11 @@ static intmax_t _strtoimax_l(struct _reent *rptr, const char * __restrict nptr, char ** __restrict endptr, int base, locale_t loc) { - const char *s = (const unsigned char *)nptr; - uintmax_t acc; + const char *s = nptr; + uintmax_t acc = 0; char c; uintmax_t cutoff; - int neg = 0, any, cutlim; + int neg = 0, any = 0, cutlim; /* * Skip white space and pick up leading +/- sign if any. @@ -135,7 +135,6 @@ _strtoimax_l(struct _reent *rptr, const char * __restrict nptr, acc = neg ? INTMAX_MIN : INTMAX_MAX; rptr->_errno = ERANGE; } else if (!any) { -noconv: rptr->_errno = EINVAL; } else if (neg) acc = -acc; diff --git a/newlib/libc/stdlib/strtoumax.c b/newlib/libc/stdlib/strtoumax.c index aa4a0ac42..cf1a427fe 100644 --- a/newlib/libc/stdlib/strtoumax.c +++ b/newlib/libc/stdlib/strtoumax.c @@ -60,7 +60,7 @@ static uintmax_t _strtoumax_l(struct _reent *rptr, const char * __restrict nptr, char ** __restrict endptr, int base, locale_t loc) { - const char *s = (const unsigned char *)nptr; + const char *s = nptr; uintmax_t acc; char c; uintmax_t cutoff; diff --git a/newlib/libc/time/strftime.c b/newlib/libc/time/strftime.c index 0cb31238a..429ae99ac 100644 --- a/newlib/libc/time/strftime.c +++ b/newlib/libc/time/strftime.c @@ -339,9 +339,6 @@ locale, hard-coding the "C" locale settings. # error "YEAR_BASE < 0" #endif -static const int dname_len[7] = -{6, 6, 7, 9, 8, 6, 8}; - /* Using the tm_year, tm_wday, and tm_yday components of TIM_P, return -1, 0, or 1 as the adjustment to add to the year for the ISO week numbering used in "%g%G%V", avoiding overflow. */ 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; |