summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Lemberg <wl@gnu.org>2019-05-29 07:45:54 +0200
committerWerner Lemberg <wl@gnu.org>2019-05-29 07:51:59 +0200
commit9159128a9297710071e28b24e3cbd29b7a475ebc (patch)
tree523fe8dc202823779227ccf9467e4c845f522f59
parent86d997e5b1c401db06114b51d44d1bef6c7fe994 (diff)
downloadfreetype2-9159128a9297710071e28b24e3cbd29b7a475ebc.tar.gz
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
-rw-r--r--src/gzip/infblock.c3
-rw-r--r--src/gzip/infcodes.c4
-rw-r--r--src/gzip/inflate.c10
-rw-r--r--src/psaux/afmparse.c3
-rw-r--r--src/sfnt/sfdriver.c14
-rw-r--r--src/smooth/ftgrays.c31
6 files changed, 56 insertions, 9 deletions
diff --git a/src/gzip/infblock.c b/src/gzip/infblock.c
index d6e2dc297..64a7da124 100644
--- a/src/gzip/infblock.c
+++ b/src/gzip/infblock.c
@@ -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
diff --git a/src/gzip/infcodes.c b/src/gzip/infcodes.c
index f7bfd58c4..ba3065499 100644
--- a/src/gzip/infcodes.c
+++ b/src/gzip/infcodes.c
@@ -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
diff --git a/src/gzip/inflate.c b/src/gzip/inflate.c
index 8877fa3eb..95e265366 100644
--- a/src/gzip/inflate.c
+++ b/src/gzip/inflate.c
@@ -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:
diff --git a/src/psaux/afmparse.c b/src/psaux/afmparse.c
index 49225a9f7..f78adbba3 100644
--- a/src/psaux/afmparse.c
+++ b/src/psaux/afmparse.c
@@ -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;
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index 814955529..261168528 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -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;
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index 4efc0d083..bab07a1ce 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -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 );
}