Skip to content

Commit 76f70ab

Browse files
committed
Add fallthrough comments for gcc.
Note intentional switch case fall throughs to avoid gcc warnings.
1 parent 2014a99 commit 76f70ab

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

infback.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ void FAR *out_desc;
477477
}
478478
Tracev((stderr, "inflate: codes ok\n"));
479479
state->mode = LEN;
480+
/* fallthrough */
480481

481482
case LEN:
482483
/* use inflate_fast() if we have enough input and output */

inflate.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,7 @@ int flush;
723723
CRC2(state->check, hold);
724724
INITBITS();
725725
state->mode = TIME;
726+
/* fallthrough */
726727
case TIME:
727728
NEEDBITS(32);
728729
if (state->head != Z_NULL)
@@ -731,6 +732,7 @@ int flush;
731732
CRC4(state->check, hold);
732733
INITBITS();
733734
state->mode = OS;
735+
/* fallthrough */
734736
case OS:
735737
NEEDBITS(16);
736738
if (state->head != Z_NULL) {
@@ -741,6 +743,7 @@ int flush;
741743
CRC2(state->check, hold);
742744
INITBITS();
743745
state->mode = EXLEN;
746+
/* fallthrough */
744747
case EXLEN:
745748
if (state->flags & 0x0400) {
746749
NEEDBITS(16);
@@ -754,6 +757,7 @@ int flush;
754757
else if (state->head != Z_NULL)
755758
state->head->extra = Z_NULL;
756759
state->mode = EXTRA;
760+
/* fallthrough */
757761
case EXTRA:
758762
if (state->flags & 0x0400) {
759763
copy = state->length;
@@ -776,6 +780,7 @@ int flush;
776780
}
777781
state->length = 0;
778782
state->mode = NAME;
783+
/* fallthrough */
779784
case NAME:
780785
if (state->flags & 0x0800) {
781786
if (have == 0) goto inf_leave;
@@ -797,6 +802,7 @@ int flush;
797802
state->head->name = Z_NULL;
798803
state->length = 0;
799804
state->mode = COMMENT;
805+
/* fallthrough */
800806
case COMMENT:
801807
if (state->flags & 0x1000) {
802808
if (have == 0) goto inf_leave;
@@ -817,6 +823,7 @@ int flush;
817823
else if (state->head != Z_NULL)
818824
state->head->comment = Z_NULL;
819825
state->mode = HCRC;
826+
/* fallthrough */
820827
case HCRC:
821828
if (state->flags & 0x0200) {
822829
NEEDBITS(16);
@@ -840,15 +847,18 @@ int flush;
840847
strm->adler = state->check = ZSWAP32(hold);
841848
INITBITS();
842849
state->mode = DICT;
850+
/* fallthrough */
843851
case DICT:
844852
if (state->havedict == 0) {
845853
RESTORE();
846854
return Z_NEED_DICT;
847855
}
848856
strm->adler = state->check = adler32(0L, Z_NULL, 0);
849857
state->mode = TYPE;
858+
/* fallthrough */
850859
case TYPE:
851860
if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
861+
/* fallthrough */
852862
case TYPEDO:
853863
if (state->last) {
854864
BYTEBITS();
@@ -899,8 +909,10 @@ int flush;
899909
INITBITS();
900910
state->mode = COPY_;
901911
if (flush == Z_TREES) goto inf_leave;
912+
/* fallthrough */
902913
case COPY_:
903914
state->mode = COPY;
915+
/* fallthrough */
904916
case COPY:
905917
copy = state->length;
906918
if (copy) {
@@ -936,6 +948,7 @@ int flush;
936948
Tracev((stderr, "inflate: table sizes ok\n"));
937949
state->have = 0;
938950
state->mode = LENLENS;
951+
/* fallthrough */
939952
case LENLENS:
940953
while (state->have < state->ncode) {
941954
NEEDBITS(3);
@@ -957,6 +970,7 @@ int flush;
957970
Tracev((stderr, "inflate: code lengths ok\n"));
958971
state->have = 0;
959972
state->mode = CODELENS;
973+
/* fallthrough */
960974
case CODELENS:
961975
while (state->have < state->nlen + state->ndist) {
962976
for (;;) {
@@ -1040,8 +1054,10 @@ int flush;
10401054
Tracev((stderr, "inflate: codes ok\n"));
10411055
state->mode = LEN_;
10421056
if (flush == Z_TREES) goto inf_leave;
1057+
/* fallthrough */
10431058
case LEN_:
10441059
state->mode = LEN;
1060+
/* fallthrough */
10451061
case LEN:
10461062
if (have >= 6 && left >= 258) {
10471063
RESTORE();
@@ -1091,6 +1107,7 @@ int flush;
10911107
}
10921108
state->extra = (unsigned)(here.op) & 15;
10931109
state->mode = LENEXT;
1110+
/* fallthrough */
10941111
case LENEXT:
10951112
if (state->extra) {
10961113
NEEDBITS(state->extra);
@@ -1101,6 +1118,7 @@ int flush;
11011118
Tracevv((stderr, "inflate: length %u\n", state->length));
11021119
state->was = state->length;
11031120
state->mode = DIST;
1121+
/* fallthrough */
11041122
case DIST:
11051123
for (;;) {
11061124
here = state->distcode[BITS(state->distbits)];
@@ -1128,6 +1146,7 @@ int flush;
11281146
state->offset = (unsigned)here.val;
11291147
state->extra = (unsigned)(here.op) & 15;
11301148
state->mode = DISTEXT;
1149+
/* fallthrough */
11311150
case DISTEXT:
11321151
if (state->extra) {
11331152
NEEDBITS(state->extra);
@@ -1144,6 +1163,7 @@ int flush;
11441163
#endif
11451164
Tracevv((stderr, "inflate: distance %u\n", state->offset));
11461165
state->mode = MATCH;
1166+
/* fallthrough */
11471167
case MATCH:
11481168
if (left == 0) goto inf_leave;
11491169
copy = out - left;
@@ -1219,6 +1239,7 @@ int flush;
12191239
}
12201240
#ifdef GUNZIP
12211241
state->mode = LENGTH;
1242+
/* fallthrough */
12221243
case LENGTH:
12231244
if (state->wrap && state->flags) {
12241245
NEEDBITS(32);
@@ -1232,6 +1253,7 @@ int flush;
12321253
}
12331254
#endif
12341255
state->mode = DONE;
1256+
/* fallthrough */
12351257
case DONE:
12361258
ret = Z_STREAM_END;
12371259
goto inf_leave;
@@ -1241,6 +1263,7 @@ int flush;
12411263
case MEM:
12421264
return Z_MEM_ERROR;
12431265
case SYNC:
1266+
/* fallthrough */
12441267
default:
12451268
return Z_STREAM_ERROR;
12461269
}

0 commit comments

Comments
 (0)