Skip to content

Commit

Permalink
lib/zlib_inflate/inflate.c: remove fall through warnings
Browse files Browse the repository at this point in the history
This patch remove all following fall through warnings by
adding /* fall through */ markers.
Note that we cannot add "__attribute__ ((fallthrough));" due to it is GCC7 only
arch/arm/boot/compressed/../../../../lib/zlib_inflate/inflate.c:384:25: warning: this statement may fall through [-Wimplicit-fallthrough=]
arch/arm/boot/compressed/../../../../lib/zlib_inflate/inflate.c:391:25: warning: this statement may fall through [-Wimplicit-fallthrough=]
arch/arm/boot/compressed/../../../../lib/zlib_inflate/inflate.c:393:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
arch/arm/boot/compressed/../../../../lib/zlib_inflate/inflate.c:430:25: warning: this statement may fall through [-Wimplicit-fallthrough=]
arch/arm/boot/compressed/../../../../lib/zlib_inflate/inflate.c:556:25: warning: this statement may fall through [-Wimplicit-fallthrough=]
arch/arm/boot/compressed/../../../../lib/zlib_inflate/inflate.c:595:25: warning: this statement may fall through [-Wimplicit-fallthrough=]
arch/arm/boot/compressed/../../../../lib/zlib_inflate/inflate.c:602:25: warning: this statement may fall through [-Wimplicit-fallthrough=]
arch/arm/boot/compressed/../../../../lib/zlib_inflate/inflate.c:627:25: warning: this statement may fall through [-Wimplicit-fallthrough=]
arch/arm/boot/compressed/../../../../lib/zlib_inflate/inflate.c:646:25: warning: this statement may fall through [-Wimplicit-fallthrough=]
arch/arm/boot/compressed/../../../../lib/zlib_inflate/inflate.c:696:25: warning: this statement may fall through [-Wimplicit-fallthrough=]

It is easy to see that thoses fall through are needed since in each case state->mode are set to the case value just below.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Corentin Labbe <[email protected]>
Cc: David Miller <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
montjoie authored and torvalds committed Oct 31, 2018
1 parent 36c8d1e commit 7a20c2f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/zlib_inflate/inflate.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,15 +382,18 @@ int zlib_inflate(z_streamp strm, int flush)
strm->adler = state->check = REVERSE(hold);
INITBITS();
state->mode = DICT;
/* fall through */
case DICT:
if (state->havedict == 0) {
RESTORE();
return Z_NEED_DICT;
}
strm->adler = state->check = zlib_adler32(0L, NULL, 0);
state->mode = TYPE;
/* fall through */
case TYPE:
if (flush == Z_BLOCK) goto inf_leave;
/* fall through */
case TYPEDO:
if (state->last) {
BYTEBITS();
Expand Down Expand Up @@ -428,6 +431,7 @@ int zlib_inflate(z_streamp strm, int flush)
state->length = (unsigned)hold & 0xffff;
INITBITS();
state->mode = COPY;
/* fall through */
case COPY:
copy = state->length;
if (copy) {
Expand Down Expand Up @@ -461,6 +465,7 @@ int zlib_inflate(z_streamp strm, int flush)
#endif
state->have = 0;
state->mode = LENLENS;
/* fall through */
case LENLENS:
while (state->have < state->ncode) {
NEEDBITS(3);
Expand All @@ -481,6 +486,7 @@ int zlib_inflate(z_streamp strm, int flush)
}
state->have = 0;
state->mode = CODELENS;
/* fall through */
case CODELENS:
while (state->have < state->nlen + state->ndist) {
for (;;) {
Expand Down Expand Up @@ -554,6 +560,7 @@ int zlib_inflate(z_streamp strm, int flush)
break;
}
state->mode = LEN;
/* fall through */
case LEN:
if (have >= 6 && left >= 258) {
RESTORE();
Expand Down Expand Up @@ -593,13 +600,15 @@ int zlib_inflate(z_streamp strm, int flush)
}
state->extra = (unsigned)(this.op) & 15;
state->mode = LENEXT;
/* fall through */
case LENEXT:
if (state->extra) {
NEEDBITS(state->extra);
state->length += BITS(state->extra);
DROPBITS(state->extra);
}
state->mode = DIST;
/* fall through */
case DIST:
for (;;) {
this = state->distcode[BITS(state->distbits)];
Expand All @@ -625,6 +634,7 @@ int zlib_inflate(z_streamp strm, int flush)
state->offset = (unsigned)this.val;
state->extra = (unsigned)(this.op) & 15;
state->mode = DISTEXT;
/* fall through */
case DISTEXT:
if (state->extra) {
NEEDBITS(state->extra);
Expand All @@ -644,6 +654,7 @@ int zlib_inflate(z_streamp strm, int flush)
break;
}
state->mode = MATCH;
/* fall through */
case MATCH:
if (left == 0) goto inf_leave;
copy = out - left;
Expand Down Expand Up @@ -694,6 +705,7 @@ int zlib_inflate(z_streamp strm, int flush)
INITBITS();
}
state->mode = DONE;
/* fall through */
case DONE:
ret = Z_STREAM_END;
goto inf_leave;
Expand Down

0 comments on commit 7a20c2f

Please sign in to comment.