aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2018-08-08 10:41:58 +0200
committerCorinna Vinschen <corinna@vinschen.de>2018-08-08 10:50:19 +0200
commit2d87d95f12bbbb8bff611c8a19b943b9ebedb1fd (patch)
treef59aa2e3271c3cf7baa629e1cedc567ef46526de /newlib/libc
parent5ace9004d9b982ba8887df41139295792c130020 (diff)
downloadnewlib-2d87d95f12bbbb8bff611c8a19b943b9ebedb1fd.zip
newlib-2d87d95f12bbbb8bff611c8a19b943b9ebedb1fd.tar.gz
newlib-2d87d95f12bbbb8bff611c8a19b943b9ebedb1fd.tar.bz2
newlib: fix various gcc warnings
* unused variables * potentially used uninitialized * suggested bracketing * misleading indentation Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'newlib/libc')
-rw-r--r--newlib/libc/stdio/vfscanf.c2
-rw-r--r--newlib/libc/stdlib/ldtoa.c7
-rw-r--r--newlib/libc/stdlib/strtodg.c10
-rw-r--r--newlib/libc/stdlib/strtoimax.c7
-rw-r--r--newlib/libc/stdlib/strtoumax.c2
-rw-r--r--newlib/libc/time/strftime.c3
6 files changed, 17 insertions, 14 deletions
diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c
index b972355..080dcf4 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 10a7537..7513862 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 d8546c3..4ac1f8e 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 b0efa3e..6901612 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 aa4a0ac..cf1a427 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 0cb3123..429ae99 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. */