[klibc] [PATCH] fix warnings with GCC 10

Christophe Leroy christophe.leroy at csgroup.eu
Thu Jun 18 10:05:20 PDT 2020


Many warnings are encountered with GCC 10. Fix them.

Signed-off-by: Christophe Leroy <christophe.leroy at csgroup.eu>
---
 usr/dash/eval.c          |  2 +-
 usr/klibc/zlib/infback.c |  2 +-
 usr/klibc/zlib/inflate.c | 20 ++++++++++++++++++++
 3 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/usr/dash/eval.c b/usr/dash/eval.c
index dd144948a9fa..6b2b01e19a47 100644
--- a/usr/dash/eval.c
+++ b/usr/dash/eval.c
@@ -274,7 +274,7 @@ checkexit:
 			n->nbinary.ch1,
 			(flags | ((isor >> 1) - 1)) & EV_TESTED
 		);
-		if (!exitstatus == isor)
+		if ((!exitstatus) == isor)
 			break;
 		if (!evalskip) {
 			n = n->nbinary.ch2;
diff --git a/usr/klibc/zlib/infback.c b/usr/klibc/zlib/infback.c
index 455dbc9ee843..be5eace3ad1a 100644
--- a/usr/klibc/zlib/infback.c
+++ b/usr/klibc/zlib/infback.c
@@ -460,7 +460,7 @@ void FAR *out_desc;
             }
             Tracev((stderr, "inflate:       codes ok\n"));
             state->mode = LEN;
-
+	    /* fallthrough */
         case LEN:
             /* use inflate_fast() if we have enough input and output */
             if (have >= 6 && left >= 258) {
diff --git a/usr/klibc/zlib/inflate.c b/usr/klibc/zlib/inflate.c
index 792fdee8e9c7..0a706208cf4c 100644
--- a/usr/klibc/zlib/inflate.c
+++ b/usr/klibc/zlib/inflate.c
@@ -649,6 +649,7 @@ int flush;
             if (state->flags & 0x0200) CRC2(state->check, hold);
             INITBITS();
             state->mode = TIME;
+	    /* fallthrough */
         case TIME:
             NEEDBITS(32);
             if (state->head != Z_NULL)
@@ -656,6 +657,7 @@ int flush;
             if (state->flags & 0x0200) CRC4(state->check, hold);
             INITBITS();
             state->mode = OS;
+	    /* fallthrough */
         case OS:
             NEEDBITS(16);
             if (state->head != Z_NULL) {
@@ -665,6 +667,7 @@ int flush;
             if (state->flags & 0x0200) CRC2(state->check, hold);
             INITBITS();
             state->mode = EXLEN;
+	    /* fallthrough */
         case EXLEN:
             if (state->flags & 0x0400) {
                 NEEDBITS(16);
@@ -677,6 +680,7 @@ int flush;
             else if (state->head != Z_NULL)
                 state->head->extra = Z_NULL;
             state->mode = EXTRA;
+	    /* fallthrough */
         case EXTRA:
             if (state->flags & 0x0400) {
                 copy = state->length;
@@ -699,6 +703,7 @@ int flush;
             }
             state->length = 0;
             state->mode = NAME;
+	    /* fallthrough */
         case NAME:
             if (state->flags & 0x0800) {
                 if (have == 0) goto inf_leave;
@@ -720,6 +725,7 @@ int flush;
                 state->head->name = Z_NULL;
             state->length = 0;
             state->mode = COMMENT;
+	    /* fallthrough */
         case COMMENT:
             if (state->flags & 0x1000) {
                 if (have == 0) goto inf_leave;
@@ -740,6 +746,7 @@ int flush;
             else if (state->head != Z_NULL)
                 state->head->comment = Z_NULL;
             state->mode = HCRC;
+	    /* fallthrough */
         case HCRC:
             if (state->flags & 0x0200) {
                 NEEDBITS(16);
@@ -763,6 +770,7 @@ int flush;
             strm->adler = state->check = REVERSE(hold);
             INITBITS();
             state->mode = DICT;
+	    /* fallthrough */
         case DICT:
             if (state->havedict == 0) {
                 RESTORE();
@@ -770,8 +778,10 @@ int flush;
             }
             strm->adler = state->check = adler32(0L, Z_NULL, 0);
             state->mode = TYPE;
+	    /* fallthrough */
         case TYPE:
             if (flush == Z_BLOCK) goto inf_leave;
+	    /* fallthrough */
         case TYPEDO:
             if (state->last) {
                 BYTEBITS();
@@ -817,6 +827,7 @@ int flush;
                     state->length));
             INITBITS();
             state->mode = COPY;
+	    /* fallthrough */
         case COPY:
             copy = state->length;
             if (copy) {
@@ -852,6 +863,7 @@ int flush;
             Tracev((stderr, "inflate:       table sizes ok\n"));
             state->have = 0;
             state->mode = LENLENS;
+	    /* fallthrough */
         case LENLENS:
             while (state->have < state->ncode) {
                 NEEDBITS(3);
@@ -873,6 +885,7 @@ int flush;
             Tracev((stderr, "inflate:       code lengths ok\n"));
             state->have = 0;
             state->mode = CODELENS;
+	    /* fallthrough */
         case CODELENS:
             while (state->have < state->nlen + state->ndist) {
                 for (;;) {
@@ -947,6 +960,7 @@ int flush;
             }
             Tracev((stderr, "inflate:       codes ok\n"));
             state->mode = LEN;
+	    /* fallthrough */
         case LEN:
             if (have >= 6 && left >= 258) {
                 RESTORE();
@@ -990,6 +1004,7 @@ int flush;
             }
             state->extra = (unsigned)(this.op) & 15;
             state->mode = LENEXT;
+	    /* fallthrough */
         case LENEXT:
             if (state->extra) {
                 NEEDBITS(state->extra);
@@ -998,6 +1013,7 @@ int flush;
             }
             Tracevv((stderr, "inflate:         length %u\n", state->length));
             state->mode = DIST;
+	    /* fallthrough */
         case DIST:
             for (;;) {
                 this = state->distcode[BITS(state->distbits)];
@@ -1023,6 +1039,7 @@ int flush;
             state->offset = (unsigned)this.val;
             state->extra = (unsigned)(this.op) & 15;
             state->mode = DISTEXT;
+	    /* fallthrough */
         case DISTEXT:
             if (state->extra) {
                 NEEDBITS(state->extra);
@@ -1043,6 +1060,7 @@ int flush;
             }
             Tracevv((stderr, "inflate:         distance %u\n", state->offset));
             state->mode = MATCH;
+	    /* fallthrough */
         case MATCH:
             if (left == 0) goto inf_leave;
             copy = out - left;
@@ -1098,6 +1116,7 @@ int flush;
             }
 #ifdef GUNZIP
             state->mode = LENGTH;
+	    /* fallthrough */
         case LENGTH:
             if (state->wrap && state->flags) {
                 NEEDBITS(32);
@@ -1111,6 +1130,7 @@ int flush;
             }
 #endif
             state->mode = DONE;
+	    /* fallthrough */
         case DONE:
             ret = Z_STREAM_END;
             goto inf_leave;
-- 
2.25.0



More information about the klibc mailing list