1 This patch is applied to disable implicit-fallthrough warnings on gcc7 or
  2 higher when building the bundled version of zlib.
  3 
  4 diff --git src/java.base/share/native/libzip/zlib/infback.c src/java.base/share/native/libzip/zlib/infback.c
  5 index 4c8283909..1a9cc6b60 100644
  6 --- src/java.base/share/native/libzip/zlib/infback.c
  7 +++ src/java.base/share/native/libzip/zlib/infback.c
  8 @@ -501,7 +501,7 @@ void FAR *out_desc;
  9              }
 10              Tracev((stderr, "inflate:       codes ok\n"));
 11              state->mode = LEN;
 12 -
 13 +            /* FALLTHROUGH */
 14          case LEN:
 15              /* use inflate_fast() if we have enough input and output */
 16              if (have >= 6 && left >= 258) {
 17 diff --git src/java.base/share/native/libzip/zlib/inflate.c src/java.base/share/native/libzip/zlib/inflate.c
 18 index ca904e744..4abfe84a5 100644
 19 --- src/java.base/share/native/libzip/zlib/inflate.c
 20 +++ src/java.base/share/native/libzip/zlib/inflate.c
 21 @@ -764,6 +764,7 @@ int flush;
 22                  CRC2(state->check, hold);
 23              INITBITS();
 24              state->mode = EXLEN;
 25 +            /* FALLTHROUGH */
 26          case EXLEN:
 27              if (state->flags & 0x0400) {
 28                  NEEDBITS(16);
 29 @@ -777,6 +778,7 @@ int flush;
 30              else if (state->head != Z_NULL)
 31                  state->head->extra = Z_NULL;
 32              state->mode = EXTRA;
 33 +            /* FALLTHROUGH */
 34          case EXTRA:
 35              if (state->flags & 0x0400) {
 36                  copy = state->length;
 37 @@ -799,6 +801,7 @@ int flush;
 38              }
 39              state->length = 0;
 40              state->mode = NAME;
 41 +            /* FALLTHROUGH */
 42          case NAME:
 43              if (state->flags & 0x0800) {
 44                  if (have == 0) goto inf_leave;
 45 @@ -820,6 +823,7 @@ int flush;
 46                  state->head->name = Z_NULL;
 47              state->length = 0;
 48              state->mode = COMMENT;
 49 +            /* FALLTHROUGH */
 50          case COMMENT:
 51              if (state->flags & 0x1000) {
 52                  if (have == 0) goto inf_leave;
 53 @@ -840,6 +844,7 @@ int flush;
 54              else if (state->head != Z_NULL)
 55                  state->head->comment = Z_NULL;
 56              state->mode = HCRC;
 57 +            /* FALLTHROUGH */
 58          case HCRC:
 59              if (state->flags & 0x0200) {
 60                  NEEDBITS(16);
 61 @@ -863,6 +868,7 @@ int flush;
 62              strm->adler = state->check = ZSWAP32(hold);
 63              INITBITS();
 64              state->mode = DICT;
 65 +            /* FALLTHROUGH */
 66          case DICT:
 67              if (state->havedict == 0) {
 68                  RESTORE();
 69 @@ -870,8 +876,10 @@ int flush;
 70              }
 71              strm->adler = state->check = adler32(0L, Z_NULL, 0);
 72              state->mode = TYPE;
 73 +            /* FALLTHROUGH */
 74          case TYPE:
 75              if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
 76 +            /* FALLTHROUGH */
 77          case TYPEDO:
 78              if (state->last) {
 79                  BYTEBITS();
 80 @@ -922,8 +930,10 @@ int flush;
 81              INITBITS();
 82              state->mode = COPY_;
 83              if (flush == Z_TREES) goto inf_leave;
 84 +            /* FALLTHROUGH */
 85          case COPY_:
 86              state->mode = COPY;
 87 +            /* FALLTHROUGH */
 88          case COPY:
 89              copy = state->length;
 90              if (copy) {
 91 @@ -1063,8 +1073,10 @@ int flush;
 92              Tracev((stderr, "inflate:       codes ok\n"));
 93              state->mode = LEN_;
 94              if (flush == Z_TREES) goto inf_leave;
 95 +            /* FALLTHROUGH */
 96          case LEN_:
 97              state->mode = LEN;
 98 +            /* FALLTHROUGH */
 99          case LEN:
100              if (have >= 6 && left >= 258) {
101                  RESTORE();
102 @@ -1114,6 +1126,7 @@ int flush;
103              }
104              state->extra = (unsigned)(here.op) & 15;
105              state->mode = LENEXT;
106 +            /* FALLTHROUGH */
107          case LENEXT:
108              if (state->extra) {
109                  NEEDBITS(state->extra);
110 @@ -1124,6 +1137,7 @@ int flush;
111              Tracevv((stderr, "inflate:         length %u\n", state->length));
112              state->was = state->length;
113              state->mode = DIST;
114 +            /* FALLTHROUGH */
115          case DIST:
116              for (;;) {
117                  here = state->distcode[BITS(state->distbits)];
118 @@ -1151,6 +1165,7 @@ int flush;
119              state->offset = (unsigned)here.val;
120              state->extra = (unsigned)(here.op) & 15;
121              state->mode = DISTEXT;
122 +            /* FALLTHROUGH */
123          case DISTEXT:
124              if (state->extra) {
125                  NEEDBITS(state->extra);
126 @@ -1167,6 +1182,7 @@ int flush;
127  #endif
128              Tracevv((stderr, "inflate:         distance %u\n", state->offset));
129              state->mode = MATCH;
130 +            /* FALLTHROUGH */
131          case MATCH:
132              if (left == 0) goto inf_leave;
133              copy = out - left;
134 @@ -1242,6 +1258,7 @@ int flush;
135              }
136  #ifdef GUNZIP
137              state->mode = LENGTH;
138 +            /* FALLTHROUGH */
139          case LENGTH:
140              if (state->wrap && state->flags) {
141                  NEEDBITS(32);
142 @@ -1255,6 +1272,7 @@ int flush;
143              }
144  #endif
145              state->mode = DONE;
146 +            /* FALLTHROUGH */
147          case DONE:
148              ret = Z_STREAM_END;
149              goto inf_leave;