From c346e3bc8bc8e8c844a0d53686c8c3cae315deaa Mon Sep 17 00:00:00 2001 From: Ben Taylor Date: Thu, 5 Jan 2023 16:35:54 -0800 Subject: [PATCH] Disable implicit-fallthrough warnings on gcc7 or higher when building the bundled version of zlib. --- .../share/native/libzip/zlib/infback.c | 2 +- .../share/native/libzip/zlib/inflate.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/java.base/share/native/libzip/zlib/infback.c b/src/java.base/share/native/libzip/zlib/infback.c index 4c8283909c1..1a9cc6b6013 100644 --- a/src/java.base/share/native/libzip/zlib/infback.c +++ b/src/java.base/share/native/libzip/zlib/infback.c @@ -501,7 +501,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/src/java.base/share/native/libzip/zlib/inflate.c b/src/java.base/share/native/libzip/zlib/inflate.c index ca904e74427..4abfe84a5d3 100644 --- a/src/java.base/share/native/libzip/zlib/inflate.c +++ b/src/java.base/share/native/libzip/zlib/inflate.c @@ -764,6 +764,7 @@ int flush; CRC2(state->check, hold); INITBITS(); state->mode = EXLEN; + /* FALLTHROUGH */ case EXLEN: if (state->flags & 0x0400) { NEEDBITS(16); @@ -777,6 +778,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; @@ -799,6 +801,7 @@ int flush; } state->length = 0; state->mode = NAME; + /* FALLTHROUGH */ case NAME: if (state->flags & 0x0800) { if (have == 0) goto inf_leave; @@ -820,6 +823,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; @@ -840,6 +844,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); @@ -863,6 +868,7 @@ int flush; strm->adler = state->check = ZSWAP32(hold); INITBITS(); state->mode = DICT; + /* FALLTHROUGH */ case DICT: if (state->havedict == 0) { RESTORE(); @@ -870,8 +876,10 @@ int flush; } strm->adler = state->check = adler32(0L, Z_NULL, 0); state->mode = TYPE; + /* FALLTHROUGH */ case TYPE: if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave; + /* FALLTHROUGH */ case TYPEDO: if (state->last) { BYTEBITS(); @@ -922,8 +930,10 @@ int flush; INITBITS(); state->mode = COPY_; if (flush == Z_TREES) goto inf_leave; + /* FALLTHROUGH */ case COPY_: state->mode = COPY; + /* FALLTHROUGH */ case COPY: copy = state->length; if (copy) { @@ -1063,8 +1073,10 @@ int flush; Tracev((stderr, "inflate: codes ok\n")); state->mode = LEN_; if (flush == Z_TREES) goto inf_leave; + /* FALLTHROUGH */ case LEN_: state->mode = LEN; + /* FALLTHROUGH */ case LEN: if (have >= 6 && left >= 258) { RESTORE(); @@ -1114,6 +1126,7 @@ int flush; } state->extra = (unsigned)(here.op) & 15; state->mode = LENEXT; + /* FALLTHROUGH */ case LENEXT: if (state->extra) { NEEDBITS(state->extra); @@ -1124,6 +1137,7 @@ int flush; Tracevv((stderr, "inflate: length %u\n", state->length)); state->was = state->length; state->mode = DIST; + /* FALLTHROUGH */ case DIST: for (;;) { here = state->distcode[BITS(state->distbits)]; @@ -1151,6 +1165,7 @@ int flush; state->offset = (unsigned)here.val; state->extra = (unsigned)(here.op) & 15; state->mode = DISTEXT; + /* FALLTHROUGH */ case DISTEXT: if (state->extra) { NEEDBITS(state->extra); @@ -1167,6 +1182,7 @@ int flush; #endif Tracevv((stderr, "inflate: distance %u\n", state->offset)); state->mode = MATCH; + /* FALLTHROUGH */ case MATCH: if (left == 0) goto inf_leave; copy = out - left; @@ -1242,6 +1258,7 @@ int flush; } #ifdef GUNZIP state->mode = LENGTH; + /* FALLTHROUGH */ case LENGTH: if (state->wrap && state->flags) { NEEDBITS(32); @@ -1255,6 +1272,7 @@ int flush; } #endif state->mode = DONE; + /* FALLTHROUGH */ case DONE: ret = Z_STREAM_END; goto inf_leave; -- 2.39.0