2017-06-28 10:21:25 +02:00
|
|
|
GCC 7 introduces new warnings, including implicit fallthrough in switch blocks;
|
|
|
|
see https://gcc.gnu.org/gcc-7/changes.html#c-family. This warnings are turned
|
|
|
|
into errors in our case (-Werror).
|
|
|
|
|
|
|
|
This patch adds comments to make fallthroughs explicit and thus avoids compiler
|
|
|
|
warnings.
|
|
|
|
|
|
|
|
Note that most of these warnings are located in lib/libvgz, which will be
|
|
|
|
upgraded in a future release (see commit 5fae561 on master branch at
|
|
|
|
https://github.com/varnishcache/varnish-cache/commit/5fae561).
|
|
|
|
|
|
|
|
--
|
2018-03-19 23:26:28 +01:00
|
|
|
---
|
|
|
|
bin/varnishadm/varnishadm.c | 1 +
|
|
|
|
lib/libvgz/infback.c | 1 +
|
|
|
|
lib/libvgz/inflate.c | 18 ++++++++++++++++++
|
|
|
|
3 files changed, 20 insertions(+)
|
|
|
|
|
|
|
|
Index: varnish-6.0.0/bin/varnishadm/varnishadm.c
|
|
|
|
===================================================================
|
|
|
|
--- varnish-6.0.0.orig/bin/varnishadm/varnishadm.c
|
|
|
|
+++ varnish-6.0.0/bin/varnishadm/varnishadm.c
|
|
|
|
@@ -452,6 +452,7 @@ main(int argc, char * const *argv)
|
|
|
|
case 'h':
|
|
|
|
/* Usage help */
|
|
|
|
usage(0);
|
|
|
|
+ break;
|
|
|
|
case 'n':
|
|
|
|
n_arg = optarg;
|
|
|
|
break;
|
|
|
|
Index: varnish-6.0.0/lib/libvgz/infback.c
|
|
|
|
===================================================================
|
|
|
|
--- varnish-6.0.0.orig/lib/libvgz/infback.c
|
|
|
|
+++ varnish-6.0.0/lib/libvgz/infback.c
|
2017-06-28 10:21:25 +02:00
|
|
|
@@ -477,6 +477,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 */
|
2018-03-19 23:26:28 +01:00
|
|
|
Index: varnish-6.0.0/lib/libvgz/inflate.c
|
|
|
|
===================================================================
|
|
|
|
--- varnish-6.0.0.orig/lib/libvgz/inflate.c
|
|
|
|
+++ varnish-6.0.0/lib/libvgz/inflate.c
|
|
|
|
@@ -747,6 +747,7 @@ int flush;
|
|
|
|
CRC2(state->check, hold);
|
2017-06-28 10:21:25 +02:00
|
|
|
INITBITS();
|
|
|
|
state->mode = EXLEN;
|
|
|
|
+ /* FALLTHROUGH */
|
|
|
|
case EXLEN:
|
|
|
|
if (state->flags & 0x0400) {
|
|
|
|
NEEDBITS(16);
|
2018-03-19 23:26:28 +01:00
|
|
|
@@ -760,6 +761,7 @@ int flush;
|
2017-06-28 10:21:25 +02:00
|
|
|
else if (state->head != Z_NULL)
|
|
|
|
state->head->extra = Z_NULL;
|
|
|
|
state->mode = EXTRA;
|
|
|
|
+ /* FALLTHROUGH */
|
|
|
|
case EXTRA:
|
|
|
|
if (state->flags & 0x0400) {
|
|
|
|
copy = state->length;
|
2018-03-19 23:26:28 +01:00
|
|
|
@@ -782,6 +784,7 @@ int flush;
|
2017-06-28 10:21:25 +02:00
|
|
|
}
|
|
|
|
state->length = 0;
|
|
|
|
state->mode = NAME;
|
|
|
|
+ /* FALLTHROUGH */
|
|
|
|
case NAME:
|
|
|
|
if (state->flags & 0x0800) {
|
|
|
|
if (have == 0) goto inf_leave;
|
2018-03-19 23:26:28 +01:00
|
|
|
@@ -803,6 +806,7 @@ int flush;
|
2017-06-28 10:21:25 +02:00
|
|
|
state->head->name = Z_NULL;
|
|
|
|
state->length = 0;
|
|
|
|
state->mode = COMMENT;
|
|
|
|
+ /* FALLTHROUGH */
|
|
|
|
case COMMENT:
|
|
|
|
if (state->flags & 0x1000) {
|
|
|
|
if (have == 0) goto inf_leave;
|
2018-03-19 23:26:28 +01:00
|
|
|
@@ -823,6 +827,7 @@ int flush;
|
2017-06-28 10:21:25 +02:00
|
|
|
else if (state->head != Z_NULL)
|
|
|
|
state->head->comment = Z_NULL;
|
|
|
|
state->mode = HCRC;
|
|
|
|
+ /* FALLTHROUGH */
|
|
|
|
case HCRC:
|
|
|
|
if (state->flags & 0x0200) {
|
|
|
|
NEEDBITS(16);
|
2018-03-19 23:26:28 +01:00
|
|
|
@@ -846,6 +851,7 @@ int flush;
|
2017-06-28 10:21:25 +02:00
|
|
|
strm->adler = state->check = ZSWAP32(hold);
|
|
|
|
INITBITS();
|
|
|
|
state->mode = DICT;
|
|
|
|
+ /* FALLTHROUGH */
|
|
|
|
case DICT:
|
|
|
|
if (state->havedict == 0) {
|
|
|
|
RESTORE();
|
2018-03-19 23:26:28 +01:00
|
|
|
@@ -853,8 +859,10 @@ int flush;
|
2017-06-28 10:21:25 +02:00
|
|
|
}
|
|
|
|
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 (strm->start_bit == 0)
|
|
|
|
strm->start_bit = 8 * (strm->total_in + in - have) - bits;
|
2018-03-19 23:26:28 +01:00
|
|
|
@@ -910,8 +918,10 @@ int flush;
|
2017-06-28 10:21:25 +02:00
|
|
|
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) {
|
2018-03-19 23:26:28 +01:00
|
|
|
@@ -1051,8 +1061,10 @@ int flush;
|
2017-06-28 10:21:25 +02:00
|
|
|
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();
|
2018-03-19 23:26:28 +01:00
|
|
|
@@ -1102,6 +1114,7 @@ int flush;
|
2017-06-28 10:21:25 +02:00
|
|
|
}
|
|
|
|
state->extra = (unsigned)(here.op) & 15;
|
|
|
|
state->mode = LENEXT;
|
|
|
|
+ /* FALLTHROUGH */
|
|
|
|
case LENEXT:
|
|
|
|
if (state->extra) {
|
|
|
|
NEEDBITS(state->extra);
|
2018-03-19 23:26:28 +01:00
|
|
|
@@ -1112,6 +1125,7 @@ int flush;
|
2017-06-28 10:21:25 +02:00
|
|
|
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)];
|
2018-03-19 23:26:28 +01:00
|
|
|
@@ -1139,6 +1153,7 @@ int flush;
|
2017-06-28 10:21:25 +02:00
|
|
|
state->offset = (unsigned)here.val;
|
|
|
|
state->extra = (unsigned)(here.op) & 15;
|
|
|
|
state->mode = DISTEXT;
|
|
|
|
+ /* FALLTHROUGH */
|
|
|
|
case DISTEXT:
|
|
|
|
if (state->extra) {
|
|
|
|
NEEDBITS(state->extra);
|
2018-03-19 23:26:28 +01:00
|
|
|
@@ -1155,6 +1170,7 @@ int flush;
|
2017-06-28 10:21:25 +02:00
|
|
|
#endif
|
|
|
|
Tracevv((stderr, "inflate: distance %u\n", state->offset));
|
|
|
|
state->mode = MATCH;
|
|
|
|
+ /* FALLTHROUGH */
|
|
|
|
case MATCH:
|
|
|
|
if (left == 0) goto inf_leave;
|
|
|
|
copy = out - left;
|
2018-03-19 23:26:28 +01:00
|
|
|
@@ -1230,6 +1246,7 @@ int flush;
|
2017-06-28 10:21:25 +02:00
|
|
|
}
|
|
|
|
#ifdef GUNZIP
|
|
|
|
state->mode = LENGTH;
|
|
|
|
+ /* FALLTHROUGH */
|
|
|
|
case LENGTH:
|
|
|
|
if (state->wrap && state->flags) {
|
|
|
|
NEEDBITS(32);
|
2018-03-19 23:26:28 +01:00
|
|
|
@@ -1243,6 +1260,7 @@ int flush;
|
2017-06-28 10:21:25 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
state->mode = DONE;
|
|
|
|
+ /* FALLTHROUGH */
|
|
|
|
case DONE:
|
|
|
|
ret = Z_STREAM_END;
|
|
|
|
goto inf_leave;
|