1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Fix many GCC -Wimplicit-fallthrough warnings (#243)

This commit adds '/* FALLTHROUGH */' comments to fix many
GCC warnings when compiling with -Wimplicit-fallthrough.
Additionally, the existing fallthrough comments have been
changed for consistency.
This commit is contained in:
Johnothan King 2021-03-30 13:49:20 -07:00 committed by GitHub
parent f30da49564
commit ed478ab7e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
73 changed files with 271 additions and 158 deletions

View file

@ -864,7 +864,7 @@ substitute(Buf_t* buf, register char* s)
}
if (c != '-')
break;
/*FALLTHROUGH*/
/* FALLTHROUGH */
case 0:
case '=':
case '}':
@ -2118,7 +2118,7 @@ main(int argc, char** argv)
continue;
case 'N':
state.never = 1;
/*FALLTHROUGH*/
/* FALLTHROUGH */
case 'n':
append(state.opt, " -n");
state.exec = 0;
@ -2223,7 +2223,7 @@ main(int argc, char** argv)
continue;
case 'N':
state.never = 1;
/*FALLTHROUGH*/
/* FALLTHROUGH */
case 'n':
append(state.opt, " -n");
state.exec = 0;
@ -2278,6 +2278,7 @@ main(int argc, char** argv)
break;
default:
report(2, "unknown option", s, (unsigned long)0);
/* FALLTHROUGH */
case '?':
usage();
break;

View file

@ -1013,7 +1013,7 @@ ppfsm __PARAM__((int op, register char* s), (op, s)) __OTORP__(int op; register
case 023:
for (c = 0; c <= 255; c++)
rp[c] = n;
/* FALLTHROUGH */
case 002:
_pp_fsmtab[(0+28)][fp->state+1] = n < 0 ? ~n : n;
@ -2110,7 +2110,7 @@ astlicense __PARAM__((char* p, int size, char* file, char* options, int cc1, int
break;
case -1:
c = 12;
/* FALLTHROUGH */
default:
notice.type = c;
notice.item[1].data = lic[lic[c].quote].data;
@ -2899,7 +2899,7 @@ lex __PARAM__((register Proto_t* proto, register long flags), (proto, flags)) __
if ((n = ip - bp - 1) > 0)
{
ip = bp;
do switch( n) { default : memcopy( op, ip, n); op += n; ip += n; break; case 7 : * op++ = * ip++; case 6 : * op++ = * ip++; case 5 : * op++ = * ip++; case 4 : * op++ = * ip++; case 3 : * op++ = * ip++; case 2 : * op++ = * ip++; case 1 : * op++ = * ip++; case 0 : break; } while (0);
do switch( n) { default : memcopy( op, ip, n); op += n; ip += n; break; case 7 : * op++ = * ip++; /* FALLTHROUGH */ case 6 : * op++ = * ip++; /* FALLTHROUGH */ case 5 : * op++ = * ip++; /* FALLTHROUGH */ case 4 : * op++ = * ip++; /* FALLTHROUGH */ case 3 : * op++ = * ip++; /* FALLTHROUGH */ case 2 : * op++ = * ip++; /* FALLTHROUGH */ case 1 : * op++ = * ip++; /* FALLTHROUGH */ case 0 : break; } while (0);
ip++;
}
state = ~state;
@ -3534,11 +3534,11 @@ lex __PARAM__((register Proto_t* proto, register long flags), (proto, flags)) __
break;
case ((( ((( ((( ((( ((( (( 'i')-('a'-1)))<<5)+(( 'n')-('a'-1))))<<5)+(( 'c')-('a'-1))))<<5)+(( 'l')-('a'-1))))<<5)+(( 'u')-('a'-1))))<<5)+(( 'd')-('a'-1))):
if (*ip == 'e') ip++;
/* FALLTHROUGH */
case ((( ((( ((( ((( ((( (( 'd')-('a'-1)))<<5)+(( 'e')-('a'-1))))<<5)+(( 'f')-('a'-1))))<<5)+(( 'i')-('a'-1))))<<5)+(( 'n')-('a'-1))))<<5)+(( 'e')-('a'-1))):
case ((( ((( ((( ((( ((( (( 'p')-('a'-1)))<<5)+(( 'r')-('a'-1))))<<5)+(( 'a')-('a'-1))))<<5)+(( 'g')-('a'-1))))<<5)+(( 'm')-('a'-1))))<<5)+(( 'a')-('a'-1))):
if (*ip < 'a' || *ip > 'z') break;
/* FALLTHROUGH */
default:
flags |= (1L<<12)|(1L<<15);
im = bp - 1;
@ -4260,7 +4260,7 @@ if !defined(va_start)\n\
call = 0;
break;
}
/* FALLTHROUGH */
case (0401+0):
fsm_id:
@ -5161,7 +5161,7 @@ main __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char**
continue;
default:
proto_error(((char*)0), 2, file, "unknown option");
/* FALLTHROUGH */
case '?':
b = "Usage: proto [-dfhinprstvzP+S] [-C directory] [-e package] [-l file]\n [-o \"name='value' ...\"] [-L file] file ...\n";
write(2, b, sstrlen( b));

View file

@ -2983,6 +2983,7 @@ int flush;
strm->adler = state->check = REVERSE(hold);
INITBITS();
state->mode = DICT;
/* FALLTHROUGH */
case DICT:
if (state->havedict == 0) {
RESTORE();
@ -2990,8 +2991,10 @@ int flush;
}
strm->adler = state->check = adler32(0L, Z_NULL, 0);
state->mode = TYPE;
/* FALLTHROUGH */
case TYPE:
if (flush == Z_BLOCK) goto inf_leave;
/* FALLTHROUGH */
case TYPEDO:
if (state->last) {
BYTEBITS();
@ -3037,6 +3040,7 @@ int flush;
state->length));
INITBITS();
state->mode = COPY;
/* FALLTHROUGH */
case COPY:
copy = state->length;
if (copy) {
@ -3072,6 +3076,7 @@ int flush;
Tracev((stderr, "inflate: table sizes ok\n"));
state->have = 0;
state->mode = LENLENS;
/* FALLTHROUGH */
case LENLENS:
while (state->have < state->ncode) {
NEEDBITS(3);
@ -3093,6 +3098,7 @@ int flush;
Tracev((stderr, "inflate: code lengths ok\n"));
state->have = 0;
state->mode = CODELENS;
/* FALLTHROUGH */
case CODELENS:
while (state->have < state->nlen + state->ndist) {
for (;;) {
@ -3167,6 +3173,7 @@ int flush;
}
Tracev((stderr, "inflate: codes ok\n"));
state->mode = LEN;
/* FALLTHROUGH */
case LEN:
if (have >= 6 && left >= 258) {
RESTORE();
@ -3210,6 +3217,7 @@ int flush;
}
state->extra = (unsigned)(this.op) & 15;
state->mode = LENEXT;
/* FALLTHROUGH */
case LENEXT:
if (state->extra) {
NEEDBITS(state->extra);
@ -3218,6 +3226,7 @@ int flush;
}
Tracevv((stderr, "inflate: length %u\n", state->length));
state->mode = DIST;
/* FALLTHROUGH */
case DIST:
for (;;) {
this = state->distcode[BITS(state->distbits)];
@ -3243,6 +3252,7 @@ int flush;
state->offset = (unsigned)this.val;
state->extra = (unsigned)(this.op) & 15;
state->mode = DISTEXT;
/* FALLTHROUGH */
case DISTEXT:
if (state->extra) {
NEEDBITS(state->extra);
@ -3263,6 +3273,7 @@ int flush;
}
Tracevv((stderr, "inflate: distance %u\n", state->offset));
state->mode = MATCH;
/* FALLTHROUGH */
case MATCH:
if (left == 0) goto inf_leave;
copy = out - left;
@ -3318,6 +3329,7 @@ int flush;
}
#ifdef GUNZIP
state->mode = LENGTH;
/* FALLTHROUGH */
case LENGTH:
if (state->wrap && state->flags) {
NEEDBITS(32);
@ -3331,6 +3343,7 @@ int flush;
}
#endif
state->mode = DONE;
/* FALLTHROUGH */
case DONE:
ret = Z_STREAM_END;
goto inf_leave;
@ -4861,7 +4874,7 @@ char** argv;
return 0;
default:
fprintf(stderr, "%s: -%c: unknown option\n", state.id, c);
/*FALLTHROUGH*/
/* FALLTHROUGH */
case '?':
usage();
break;
@ -5233,7 +5246,7 @@ char** argv;
break;
}
c = 1;
/*FALLTHROUGH*/
/* FALLTHROUGH */
case 1:
for (e = (s = buf) + sizeof(header); s < e; s++)
*s = a2x[*(unsigned char*)s];

View file

@ -308,7 +308,7 @@ main(int argc, char** argv)
return 0;
default:
fprintf(stderr, "release: -%c: unknown option\n", i);
/*FALLTHROUGH*/
/* FALLTHROUGH */
case '?':
usage();
break;