diff options
| author | Mark Adler <madler@alumni.caltech.edu> | 2022-03-27 00:12:38 -0700 |
|---|---|---|
| committer | Mark Adler <madler@alumni.caltech.edu> | 2022-03-27 01:54:10 -0700 |
| commit | 76f70abbc73f8887ed42b12cf5c895b386595d59 (patch) | |
| tree | 9081af11a6e9b39261632efab3ce43f545bc2f24 | |
| parent | 2014a993addbc8f1b9785d97f55fd189792c2f78 (diff) | |
| download | zlib-76f70abbc73f8887ed42b12cf5c895b386595d59.tar.gz zlib-76f70abbc73f8887ed42b12cf5c895b386595d59.tar.bz2 zlib-76f70abbc73f8887ed42b12cf5c895b386595d59.zip | |
Add fallthrough comments for gcc.
Note intentional switch case fall throughs to avoid gcc warnings.
| -rw-r--r-- | infback.c | 1 | ||||
| -rw-r--r-- | inflate.c | 23 |
2 files changed, 24 insertions, 0 deletions
| @@ -477,6 +477,7 @@ void FAR *out_desc; | |||
| 477 | } | 477 | } |
| 478 | Tracev((stderr, "inflate: codes ok\n")); | 478 | Tracev((stderr, "inflate: codes ok\n")); |
| 479 | state->mode = LEN; | 479 | state->mode = LEN; |
| 480 | /* fallthrough */ | ||
| 480 | 481 | ||
| 481 | case LEN: | 482 | case LEN: |
| 482 | /* use inflate_fast() if we have enough input and output */ | 483 | /* use inflate_fast() if we have enough input and output */ |
| @@ -723,6 +723,7 @@ int flush; | |||
| 723 | CRC2(state->check, hold); | 723 | CRC2(state->check, hold); |
| 724 | INITBITS(); | 724 | INITBITS(); |
| 725 | state->mode = TIME; | 725 | state->mode = TIME; |
| 726 | /* fallthrough */ | ||
| 726 | case TIME: | 727 | case TIME: |
| 727 | NEEDBITS(32); | 728 | NEEDBITS(32); |
| 728 | if (state->head != Z_NULL) | 729 | if (state->head != Z_NULL) |
| @@ -731,6 +732,7 @@ int flush; | |||
| 731 | CRC4(state->check, hold); | 732 | CRC4(state->check, hold); |
| 732 | INITBITS(); | 733 | INITBITS(); |
| 733 | state->mode = OS; | 734 | state->mode = OS; |
| 735 | /* fallthrough */ | ||
| 734 | case OS: | 736 | case OS: |
| 735 | NEEDBITS(16); | 737 | NEEDBITS(16); |
| 736 | if (state->head != Z_NULL) { | 738 | if (state->head != Z_NULL) { |
| @@ -741,6 +743,7 @@ int flush; | |||
| 741 | CRC2(state->check, hold); | 743 | CRC2(state->check, hold); |
| 742 | INITBITS(); | 744 | INITBITS(); |
| 743 | state->mode = EXLEN; | 745 | state->mode = EXLEN; |
| 746 | /* fallthrough */ | ||
| 744 | case EXLEN: | 747 | case EXLEN: |
| 745 | if (state->flags & 0x0400) { | 748 | if (state->flags & 0x0400) { |
| 746 | NEEDBITS(16); | 749 | NEEDBITS(16); |
| @@ -754,6 +757,7 @@ int flush; | |||
| 754 | else if (state->head != Z_NULL) | 757 | else if (state->head != Z_NULL) |
| 755 | state->head->extra = Z_NULL; | 758 | state->head->extra = Z_NULL; |
| 756 | state->mode = EXTRA; | 759 | state->mode = EXTRA; |
| 760 | /* fallthrough */ | ||
| 757 | case EXTRA: | 761 | case EXTRA: |
| 758 | if (state->flags & 0x0400) { | 762 | if (state->flags & 0x0400) { |
| 759 | copy = state->length; | 763 | copy = state->length; |
| @@ -776,6 +780,7 @@ int flush; | |||
| 776 | } | 780 | } |
| 777 | state->length = 0; | 781 | state->length = 0; |
| 778 | state->mode = NAME; | 782 | state->mode = NAME; |
| 783 | /* fallthrough */ | ||
| 779 | case NAME: | 784 | case NAME: |
| 780 | if (state->flags & 0x0800) { | 785 | if (state->flags & 0x0800) { |
| 781 | if (have == 0) goto inf_leave; | 786 | if (have == 0) goto inf_leave; |
| @@ -797,6 +802,7 @@ int flush; | |||
| 797 | state->head->name = Z_NULL; | 802 | state->head->name = Z_NULL; |
| 798 | state->length = 0; | 803 | state->length = 0; |
| 799 | state->mode = COMMENT; | 804 | state->mode = COMMENT; |
| 805 | /* fallthrough */ | ||
| 800 | case COMMENT: | 806 | case COMMENT: |
| 801 | if (state->flags & 0x1000) { | 807 | if (state->flags & 0x1000) { |
| 802 | if (have == 0) goto inf_leave; | 808 | if (have == 0) goto inf_leave; |
| @@ -817,6 +823,7 @@ int flush; | |||
| 817 | else if (state->head != Z_NULL) | 823 | else if (state->head != Z_NULL) |
| 818 | state->head->comment = Z_NULL; | 824 | state->head->comment = Z_NULL; |
| 819 | state->mode = HCRC; | 825 | state->mode = HCRC; |
| 826 | /* fallthrough */ | ||
| 820 | case HCRC: | 827 | case HCRC: |
| 821 | if (state->flags & 0x0200) { | 828 | if (state->flags & 0x0200) { |
| 822 | NEEDBITS(16); | 829 | NEEDBITS(16); |
| @@ -840,6 +847,7 @@ int flush; | |||
| 840 | strm->adler = state->check = ZSWAP32(hold); | 847 | strm->adler = state->check = ZSWAP32(hold); |
| 841 | INITBITS(); | 848 | INITBITS(); |
| 842 | state->mode = DICT; | 849 | state->mode = DICT; |
| 850 | /* fallthrough */ | ||
| 843 | case DICT: | 851 | case DICT: |
| 844 | if (state->havedict == 0) { | 852 | if (state->havedict == 0) { |
| 845 | RESTORE(); | 853 | RESTORE(); |
| @@ -847,8 +855,10 @@ int flush; | |||
| 847 | } | 855 | } |
| 848 | strm->adler = state->check = adler32(0L, Z_NULL, 0); | 856 | strm->adler = state->check = adler32(0L, Z_NULL, 0); |
| 849 | state->mode = TYPE; | 857 | state->mode = TYPE; |
| 858 | /* fallthrough */ | ||
| 850 | case TYPE: | 859 | case TYPE: |
| 851 | if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave; | 860 | if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave; |
| 861 | /* fallthrough */ | ||
| 852 | case TYPEDO: | 862 | case TYPEDO: |
| 853 | if (state->last) { | 863 | if (state->last) { |
| 854 | BYTEBITS(); | 864 | BYTEBITS(); |
| @@ -899,8 +909,10 @@ int flush; | |||
| 899 | INITBITS(); | 909 | INITBITS(); |
| 900 | state->mode = COPY_; | 910 | state->mode = COPY_; |
| 901 | if (flush == Z_TREES) goto inf_leave; | 911 | if (flush == Z_TREES) goto inf_leave; |
| 912 | /* fallthrough */ | ||
| 902 | case COPY_: | 913 | case COPY_: |
| 903 | state->mode = COPY; | 914 | state->mode = COPY; |
| 915 | /* fallthrough */ | ||
| 904 | case COPY: | 916 | case COPY: |
| 905 | copy = state->length; | 917 | copy = state->length; |
| 906 | if (copy) { | 918 | if (copy) { |
| @@ -936,6 +948,7 @@ int flush; | |||
| 936 | Tracev((stderr, "inflate: table sizes ok\n")); | 948 | Tracev((stderr, "inflate: table sizes ok\n")); |
| 937 | state->have = 0; | 949 | state->have = 0; |
| 938 | state->mode = LENLENS; | 950 | state->mode = LENLENS; |
| 951 | /* fallthrough */ | ||
| 939 | case LENLENS: | 952 | case LENLENS: |
| 940 | while (state->have < state->ncode) { | 953 | while (state->have < state->ncode) { |
| 941 | NEEDBITS(3); | 954 | NEEDBITS(3); |
| @@ -957,6 +970,7 @@ int flush; | |||
| 957 | Tracev((stderr, "inflate: code lengths ok\n")); | 970 | Tracev((stderr, "inflate: code lengths ok\n")); |
| 958 | state->have = 0; | 971 | state->have = 0; |
| 959 | state->mode = CODELENS; | 972 | state->mode = CODELENS; |
| 973 | /* fallthrough */ | ||
| 960 | case CODELENS: | 974 | case CODELENS: |
| 961 | while (state->have < state->nlen + state->ndist) { | 975 | while (state->have < state->nlen + state->ndist) { |
| 962 | for (;;) { | 976 | for (;;) { |
| @@ -1040,8 +1054,10 @@ int flush; | |||
| 1040 | Tracev((stderr, "inflate: codes ok\n")); | 1054 | Tracev((stderr, "inflate: codes ok\n")); |
| 1041 | state->mode = LEN_; | 1055 | state->mode = LEN_; |
| 1042 | if (flush == Z_TREES) goto inf_leave; | 1056 | if (flush == Z_TREES) goto inf_leave; |
| 1057 | /* fallthrough */ | ||
| 1043 | case LEN_: | 1058 | case LEN_: |
| 1044 | state->mode = LEN; | 1059 | state->mode = LEN; |
| 1060 | /* fallthrough */ | ||
| 1045 | case LEN: | 1061 | case LEN: |
| 1046 | if (have >= 6 && left >= 258) { | 1062 | if (have >= 6 && left >= 258) { |
| 1047 | RESTORE(); | 1063 | RESTORE(); |
| @@ -1091,6 +1107,7 @@ int flush; | |||
| 1091 | } | 1107 | } |
| 1092 | state->extra = (unsigned)(here.op) & 15; | 1108 | state->extra = (unsigned)(here.op) & 15; |
| 1093 | state->mode = LENEXT; | 1109 | state->mode = LENEXT; |
| 1110 | /* fallthrough */ | ||
| 1094 | case LENEXT: | 1111 | case LENEXT: |
| 1095 | if (state->extra) { | 1112 | if (state->extra) { |
| 1096 | NEEDBITS(state->extra); | 1113 | NEEDBITS(state->extra); |
| @@ -1101,6 +1118,7 @@ int flush; | |||
| 1101 | Tracevv((stderr, "inflate: length %u\n", state->length)); | 1118 | Tracevv((stderr, "inflate: length %u\n", state->length)); |
| 1102 | state->was = state->length; | 1119 | state->was = state->length; |
| 1103 | state->mode = DIST; | 1120 | state->mode = DIST; |
| 1121 | /* fallthrough */ | ||
| 1104 | case DIST: | 1122 | case DIST: |
| 1105 | for (;;) { | 1123 | for (;;) { |
| 1106 | here = state->distcode[BITS(state->distbits)]; | 1124 | here = state->distcode[BITS(state->distbits)]; |
| @@ -1128,6 +1146,7 @@ int flush; | |||
| 1128 | state->offset = (unsigned)here.val; | 1146 | state->offset = (unsigned)here.val; |
| 1129 | state->extra = (unsigned)(here.op) & 15; | 1147 | state->extra = (unsigned)(here.op) & 15; |
| 1130 | state->mode = DISTEXT; | 1148 | state->mode = DISTEXT; |
| 1149 | /* fallthrough */ | ||
| 1131 | case DISTEXT: | 1150 | case DISTEXT: |
| 1132 | if (state->extra) { | 1151 | if (state->extra) { |
| 1133 | NEEDBITS(state->extra); | 1152 | NEEDBITS(state->extra); |
| @@ -1144,6 +1163,7 @@ int flush; | |||
| 1144 | #endif | 1163 | #endif |
| 1145 | Tracevv((stderr, "inflate: distance %u\n", state->offset)); | 1164 | Tracevv((stderr, "inflate: distance %u\n", state->offset)); |
| 1146 | state->mode = MATCH; | 1165 | state->mode = MATCH; |
| 1166 | /* fallthrough */ | ||
| 1147 | case MATCH: | 1167 | case MATCH: |
| 1148 | if (left == 0) goto inf_leave; | 1168 | if (left == 0) goto inf_leave; |
| 1149 | copy = out - left; | 1169 | copy = out - left; |
| @@ -1219,6 +1239,7 @@ int flush; | |||
| 1219 | } | 1239 | } |
| 1220 | #ifdef GUNZIP | 1240 | #ifdef GUNZIP |
| 1221 | state->mode = LENGTH; | 1241 | state->mode = LENGTH; |
| 1242 | /* fallthrough */ | ||
| 1222 | case LENGTH: | 1243 | case LENGTH: |
| 1223 | if (state->wrap && state->flags) { | 1244 | if (state->wrap && state->flags) { |
| 1224 | NEEDBITS(32); | 1245 | NEEDBITS(32); |
| @@ -1232,6 +1253,7 @@ int flush; | |||
| 1232 | } | 1253 | } |
| 1233 | #endif | 1254 | #endif |
| 1234 | state->mode = DONE; | 1255 | state->mode = DONE; |
| 1256 | /* fallthrough */ | ||
| 1235 | case DONE: | 1257 | case DONE: |
| 1236 | ret = Z_STREAM_END; | 1258 | ret = Z_STREAM_END; |
| 1237 | goto inf_leave; | 1259 | goto inf_leave; |
| @@ -1241,6 +1263,7 @@ int flush; | |||
| 1241 | case MEM: | 1263 | case MEM: |
| 1242 | return Z_MEM_ERROR; | 1264 | return Z_MEM_ERROR; |
| 1243 | case SYNC: | 1265 | case SYNC: |
| 1266 | /* fallthrough */ | ||
| 1244 | default: | 1267 | default: |
| 1245 | return Z_STREAM_ERROR; | 1268 | return Z_STREAM_ERROR; |
| 1246 | } | 1269 | } |
