diff --git a/lib/zlib/infback.c b/lib/zlib/infback.c index 6f4279439..fac20afa1 100644 --- a/lib/zlib/infback.c +++ b/lib/zlib/infback.c @@ -477,7 +477,7 @@ void FAR *out_desc; } Tracev((stderr, "inflate: codes ok\n")); state->mode = LEN; - /* FALLTHROUGH */ + ZFALLTHROUGH; case LEN: /* use inflate_fast() if we have enough input and output */ diff --git a/lib/zlib/inflate.c b/lib/zlib/inflate.c index b623ba707..86a0f3d79 100644 --- a/lib/zlib/inflate.c +++ b/lib/zlib/inflate.c @@ -740,7 +740,7 @@ int flush; CRC2(state->check, hold); INITBITS(); state->mode = EXLEN; - /* FALLTHROUGH */ + ZFALLTHROUGH; case EXLEN: if (state->flags & 0x0400) { NEEDBITS(16); @@ -754,7 +754,7 @@ int flush; else if (state->head != Z_NULL) state->head->extra = Z_NULL; state->mode = EXTRA; - /* FALLTHROUGH */ + ZFALLTHROUGH; case EXTRA: if (state->flags & 0x0400) { copy = state->length; @@ -777,7 +777,7 @@ int flush; } state->length = 0; state->mode = NAME; - /* FALLTHROUGH */ + ZFALLTHROUGH; case NAME: if (state->flags & 0x0800) { if (have == 0) goto inf_leave; @@ -799,7 +799,7 @@ int flush; state->head->name = Z_NULL; state->length = 0; state->mode = COMMENT; - /* FALLTHROUGH */ + ZFALLTHROUGH; case COMMENT: if (state->flags & 0x1000) { if (have == 0) goto inf_leave; @@ -820,7 +820,7 @@ int flush; else if (state->head != Z_NULL) state->head->comment = Z_NULL; state->mode = HCRC; - /* FALLTHROUGH */ + ZFALLTHROUGH; case HCRC: if (state->flags & 0x0200) { NEEDBITS(16); @@ -844,7 +844,7 @@ int flush; strm->adler = state->check = ZSWAP32(hold); INITBITS(); state->mode = DICT; - /* FALLTHROUGH */ + ZFALLTHROUGH; case DICT: if (state->havedict == 0) { RESTORE(); @@ -852,10 +852,10 @@ int flush; } strm->adler = state->check = adler32(0L, Z_NULL, 0); state->mode = TYPE; - /* FALLTHROUGH */ + ZFALLTHROUGH; case TYPE: if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave; - /* FALLTHROUGH */ + ZFALLTHROUGH; case TYPEDO: if (state->last) { BYTEBITS(); @@ -906,10 +906,10 @@ int flush; INITBITS(); state->mode = COPY_; if (flush == Z_TREES) goto inf_leave; - /* FALLTHROUGH */ + ZFALLTHROUGH; case COPY_: state->mode = COPY; - /* FALLTHROUGH */ + ZFALLTHROUGH; case COPY: copy = state->length; if (copy) { @@ -1049,10 +1049,10 @@ int flush; Tracev((stderr, "inflate: codes ok\n")); state->mode = LEN_; if (flush == Z_TREES) goto inf_leave; - /* FALLTHROUGH */ + ZFALLTHROUGH; case LEN_: state->mode = LEN; - /* FALLTHROUGH */ + ZFALLTHROUGH; case LEN: if (have >= 6 && left >= 258) { RESTORE(); @@ -1102,7 +1102,7 @@ int flush; } state->extra = (unsigned)(here.op) & 15; state->mode = LENEXT; - /* FALLTHROUGH */ + ZFALLTHROUGH; case LENEXT: if (state->extra) { NEEDBITS(state->extra); @@ -1113,7 +1113,7 @@ int flush; Tracevv((stderr, "inflate: length %u\n", state->length)); state->was = state->length; state->mode = DIST; - /* FALLTHROUGH */ + ZFALLTHROUGH; case DIST: for (;;) { here = state->distcode[BITS(state->distbits)]; @@ -1141,7 +1141,7 @@ int flush; state->offset = (unsigned)here.val; state->extra = (unsigned)(here.op) & 15; state->mode = DISTEXT; - /* FALLTHROUGH */ + ZFALLTHROUGH; case DISTEXT: if (state->extra) { NEEDBITS(state->extra); @@ -1158,7 +1158,7 @@ int flush; #endif Tracevv((stderr, "inflate: distance %u\n", state->offset)); state->mode = MATCH; - /* FALLTHROUGH */ + ZFALLTHROUGH; case MATCH: if (left == 0) goto inf_leave; copy = out - left; @@ -1234,7 +1234,7 @@ int flush; } #ifdef GUNZIP state->mode = LENGTH; - /* FALLTHROUGH */ + ZFALLTHROUGH; case LENGTH: if (state->wrap && state->flags) { NEEDBITS(32); @@ -1248,7 +1248,7 @@ int flush; } #endif state->mode = DONE; - /* FALLTHROUGH */ + ZFALLTHROUGH; case DONE: ret = Z_STREAM_END; goto inf_leave; diff --git a/lib/zlib/zconf.h.in b/lib/zlib/zconf.h.in index 5e6c4a2e8..0b6bd5360 100644 --- a/lib/zlib/zconf.h.in +++ b/lib/zlib/zconf.h.in @@ -9,6 +9,7 @@ #define ZCONF_H /* The following four defines are enabled by sudo's configure script. */ +#undef HAVE_FALLTHROUGH_ATTRIBUTE #undef HAVE_DSO_VISIBILITY #undef HAVE_MEMCPY #undef HAVE_UNISTD_H @@ -30,6 +31,12 @@ # endif #endif +#ifdef HAVE_FALLTHROUGH_ATTRIBUTE +# define ZFALLTHROUGH __attribute__((__fallthrough__)) +#else +# define ZFALLTHROUGH do { } while (0) +#endif + /* * If you *really* need a unique prefix for all types and library functions, * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.