Silence gcc 7's fall-through warnings in `switch' blocks.

Instead of an intentionally missing `break' statement there must be a
comment line containing `fall through' (and nothing else) right before the
next `case' statement.

See

  https://stackoverflow.com/questions/45129741/gcc-7-wimplicit-fallthrough-warnings-and-portable-way-to-clear-them
This commit is contained in:
Werner Lemberg 2019-05-29 07:45:54 +02:00
parent 86d997e5b1
commit 9159128a92
6 changed files with 56 additions and 9 deletions

View File

@ -335,6 +335,7 @@ int r )
}
ZFREE(z, s->sub.trees.blens);
s->mode = CODES;
/* fall through */
case CODES:
UPDATE
if ((r = inflate_codes(s, z, r)) != Z_STREAM_END)
@ -351,11 +352,13 @@ int r )
break;
}
s->mode = DRY;
/* fall through */
case DRY:
FLUSH
if (s->read != s->write)
LEAVE
s->mode = DONE;
/* fall through */
case DONE:
r = Z_STREAM_END;
LEAVE

View File

@ -117,6 +117,7 @@ int r )
c->sub.code.need = c->lbits;
c->sub.code.tree = c->ltree;
c->mode = LEN;
/* fall through */
case LEN: /* i: get length/literal/eob next */
j = c->sub.code.need;
NEEDBITS(j)
@ -164,6 +165,7 @@ int r )
c->sub.code.tree = c->dtree;
Tracevv((stderr, "inflate: length %u\n", c->len));
c->mode = DIST;
/* fall through */
case DIST: /* i: get distance next */
j = c->sub.code.need;
NEEDBITS(j)
@ -194,6 +196,7 @@ int r )
DUMPBITS(j)
Tracevv((stderr, "inflate: distance %u\n", c->sub.copy.dist));
c->mode = COPY;
/* fall through */
case COPY: /* o: copying bytes in window, waiting for space */
f = q - c->sub.copy.dist;
while (f < s->window) /* modulo window size-"while" instead */
@ -225,6 +228,7 @@ int r )
if (s->read != s->write)
LEAVE
c->mode = END;
/* fall through */
case END:
r = Z_STREAM_END;
LEAVE

View File

@ -174,6 +174,7 @@ int f )
break;
}
z->state->mode = FLAG;
/* fall through */
case FLAG:
NEEDBYTE
b = NEXTBYTE;
@ -191,18 +192,22 @@ int f )
break;
}
z->state->mode = DICT4;
/* fall through */
case DICT4:
NEEDBYTE
z->state->sub.check.need = (uLong)NEXTBYTE << 24;
z->state->mode = DICT3;
/* fall through */
case DICT3:
NEEDBYTE
z->state->sub.check.need += (uLong)NEXTBYTE << 16;
z->state->mode = DICT2;
/* fall through */
case DICT2:
NEEDBYTE
z->state->sub.check.need += (uLong)NEXTBYTE << 8;
z->state->mode = DICT1;
/* fall through */
case DICT1:
NEEDBYTE
z->state->sub.check.need += (uLong)NEXTBYTE;
@ -234,18 +239,22 @@ int f )
break;
}
z->state->mode = CHECK4;
/* fall through */
case CHECK4:
NEEDBYTE
z->state->sub.check.need = (uLong)NEXTBYTE << 24;
z->state->mode = CHECK3;
/* fall through */
case CHECK3:
NEEDBYTE
z->state->sub.check.need += (uLong)NEXTBYTE << 16;
z->state->mode = CHECK2;
/* fall through */
case CHECK2:
NEEDBYTE
z->state->sub.check.need += (uLong)NEXTBYTE << 8;
z->state->mode = CHECK1;
/* fall through */
case CHECK1:
NEEDBYTE
z->state->sub.check.need += (uLong)NEXTBYTE;
@ -259,6 +268,7 @@ int f )
}
Tracev((stderr, "inflate: zlib check ok\n"));
z->state->mode = DONE;
/* fall through */
case DONE:
return Z_STREAM_END;
case BAD:

View File

@ -953,7 +953,8 @@
error = afm_parse_kern_data( parser );
if ( error )
goto Fail;
/* fall through since we only support kern data */
/* we only support kern data, so ... */
/* fall through */
case AFM_TOKEN_ENDFONTMETRICS:
return FT_Err_Ok;

View File

@ -375,47 +375,61 @@
{
case 15:
k4 ^= (FT_UInt32)tail[14] << 16;
/* fall through */
case 14:
k4 ^= (FT_UInt32)tail[13] << 8;
/* fall through */
case 13:
k4 ^= (FT_UInt32)tail[12];
k4 *= c4;
k4 = ROTL32( k4, 18 );
k4 *= c1;
h4 ^= k4;
/* fall through */
case 12:
k3 ^= (FT_UInt32)tail[11] << 24;
/* fall through */
case 11:
k3 ^= (FT_UInt32)tail[10] << 16;
/* fall through */
case 10:
k3 ^= (FT_UInt32)tail[9] << 8;
/* fall through */
case 9:
k3 ^= (FT_UInt32)tail[8];
k3 *= c3;
k3 = ROTL32( k3, 17 );
k3 *= c4;
h3 ^= k3;
/* fall through */
case 8:
k2 ^= (FT_UInt32)tail[7] << 24;
/* fall through */
case 7:
k2 ^= (FT_UInt32)tail[6] << 16;
/* fall through */
case 6:
k2 ^= (FT_UInt32)tail[5] << 8;
/* fall through */
case 5:
k2 ^= (FT_UInt32)tail[4];
k2 *= c2;
k2 = ROTL32( k2, 16 );
k2 *= c3;
h2 ^= k2;
/* fall through */
case 4:
k1 ^= (FT_UInt32)tail[3] << 24;
/* fall through */
case 3:
k1 ^= (FT_UInt32)tail[2] << 16;
/* fall through */
case 2:
k1 ^= (FT_UInt32)tail[1] << 8;
/* fall through */
case 1:
k1 ^= (FT_UInt32)tail[0];
k1 *= c1;

View File

@ -1244,14 +1244,29 @@ typedef ptrdiff_t FT_PtrDist;
*/
switch ( acount )
{
case 7: *q++ = c;
case 6: *q++ = c;
case 5: *q++ = c;
case 4: *q++ = c;
case 3: *q++ = c;
case 2: *q++ = c;
case 1: *q = c;
case 0: break;
case 7:
*q++ = c;
/* fall through */
case 6:
*q++ = c;
/* fall through */
case 5:
*q++ = c;
/* fall through */
case 4:
*q++ = c;
/* fall through */
case 3:
*q++ = c;
/* fall through */
case 2:
*q++ = c;
/* fall through */
case 1:
*q = c;
/* fall through */
case 0:
break;
default:
FT_MEM_SET( q, c, acount );
}