From 9131b2ac2ace2d028f27468b67ecafcd109a398f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 20 Jun 2017 14:52:26 +0200 Subject: tests: Add Q_FALLTHROUGH to unmarked fallthroughs seen by GCC 7 Change-Id: I70c87912476372097517fc20b3740416c24cb819 Reviewed-by: Thiago Macieira --- tests/baselineserver/shared/lookup3.cpp | 143 ++++++++++++++++++++++++-------- 1 file changed, 108 insertions(+), 35 deletions(-) (limited to 'tests/baselineserver') diff --git a/tests/baselineserver/shared/lookup3.cpp b/tests/baselineserver/shared/lookup3.cpp index 03e5f96e22..3d8d763bb7 100644 --- a/tests/baselineserver/shared/lookup3.cpp +++ b/tests/baselineserver/shared/lookup3.cpp @@ -207,9 +207,12 @@ quint32 initval) /* the previous hash, or an arbitrary value */ switch(length) /* all the case statements fall through */ { case 3 : c+=k[2]; + Q_FALLTHROUGH(); case 2 : b+=k[1]; + Q_FALLTHROUGH(); case 1 : a+=k[0]; - final(a,b,c); + final(a,b,c); + Q_FALLTHROUGH(); case 0: /* case 0: nothing left to add */ break; } @@ -253,9 +256,12 @@ quint32 *pb) /* IN: more seed OUT: secondary hash value */ switch(length) /* all the case statements fall through */ { case 3 : c+=k[2]; + Q_FALLTHROUGH(); case 2 : b+=k[1]; + Q_FALLTHROUGH(); case 1 : a+=k[0]; final(a,b,c); + Q_FALLTHROUGH(); case 0: /* case 0: nothing left to add */ break; } @@ -349,16 +355,24 @@ quint32 hashlittle( const void *key, size_t length, quint32 initval) switch(length) { case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; - case 11: c+=((quint32)k8[10])<<16; /* fall through */ - case 10: c+=((quint32)k8[9])<<8; /* fall through */ - case 9 : c+=k8[8]; /* fall through */ + case 11: c+=((quint32)k8[10])<<16; + Q_FALLTHROUGH(); + case 10: c+=((quint32)k8[9])<<8; + Q_FALLTHROUGH(); + case 9 : c+=k8[8]; + Q_FALLTHROUGH(); case 8 : b+=k[1]; a+=k[0]; break; - case 7 : b+=((quint32)k8[6])<<16; /* fall through */ - case 6 : b+=((quint32)k8[5])<<8; /* fall through */ - case 5 : b+=k8[4]; /* fall through */ + case 7 : b+=((quint32)k8[6])<<16; + Q_FALLTHROUGH(); + case 6 : b+=((quint32)k8[5])<<8; + Q_FALLTHROUGH(); + case 5 : b+=k8[4]; + Q_FALLTHROUGH(); case 4 : a+=k[0]; break; - case 3 : a+=((quint32)k8[2])<<16; /* fall through */ - case 2 : a+=((quint32)k8[1])<<8; /* fall through */ + case 3 : a+=((quint32)k8[2])<<16; + Q_FALLTHROUGH(); + case 2 : a+=((quint32)k8[1])<<8; + Q_FALLTHROUGH(); case 1 : a+=k8[0]; break; case 0 : return c; } @@ -388,23 +402,28 @@ quint32 hashlittle( const void *key, size_t length, quint32 initval) b+=k[2]+(((quint32)k[3])<<16); a+=k[0]+(((quint32)k[1])<<16); break; - case 11: c+=((quint32)k8[10])<<16; /* fall through */ + case 11: c+=((quint32)k8[10])<<16; + Q_FALLTHROUGH(); case 10: c+=k[4]; b+=k[2]+(((quint32)k[3])<<16); a+=k[0]+(((quint32)k[1])<<16); break; - case 9 : c+=k8[8]; /* fall through */ + case 9 : c+=k8[8]; + Q_FALLTHROUGH(); case 8 : b+=k[2]+(((quint32)k[3])<<16); a+=k[0]+(((quint32)k[1])<<16); break; - case 7 : b+=((quint32)k8[6])<<16; /* fall through */ + case 7 : b+=((quint32)k8[6])<<16; + Q_FALLTHROUGH(); case 6 : b+=k[2]; a+=k[0]+(((quint32)k[1])<<16); break; - case 5 : b+=k8[4]; /* fall through */ + case 5 : b+=k8[4]; + Q_FALLTHROUGH(); case 4 : a+=k[0]+(((quint32)k[1])<<16); break; - case 3 : a+=((quint32)k8[2])<<16; /* fall through */ + case 3 : a+=((quint32)k8[2])<<16; + Q_FALLTHROUGH(); case 2 : a+=k[0]; break; case 1 : a+=k8[0]; @@ -439,16 +458,27 @@ quint32 hashlittle( const void *key, size_t length, quint32 initval) switch(length) /* all the case statements fall through */ { case 12: c+=((quint32)k[11])<<24; + Q_FALLTHROUGH(); case 11: c+=((quint32)k[10])<<16; + Q_FALLTHROUGH(); case 10: c+=((quint32)k[9])<<8; + Q_FALLTHROUGH(); case 9 : c+=k[8]; + Q_FALLTHROUGH(); case 8 : b+=((quint32)k[7])<<24; + Q_FALLTHROUGH(); case 7 : b+=((quint32)k[6])<<16; + Q_FALLTHROUGH(); case 6 : b+=((quint32)k[5])<<8; + Q_FALLTHROUGH(); case 5 : b+=k[4]; + Q_FALLTHROUGH(); case 4 : a+=((quint32)k[3])<<24; + Q_FALLTHROUGH(); case 3 : a+=((quint32)k[2])<<16; + Q_FALLTHROUGH(); case 2 : a+=((quint32)k[1])<<8; + Q_FALLTHROUGH(); case 1 : a+=k[0]; break; case 0 : return c; @@ -533,16 +563,24 @@ void hashlittle2( switch(length) { case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; - case 11: c+=((quint32)k8[10])<<16; /* fall through */ - case 10: c+=((quint32)k8[9])<<8; /* fall through */ - case 9 : c+=k8[8]; /* fall through */ + case 11: c+=((quint32)k8[10])<<16; + Q_FALLTHROUGH(); + case 10: c+=((quint32)k8[9])<<8; + Q_FALLTHROUGH(); + case 9 : c+=k8[8]; + Q_FALLTHROUGH(); case 8 : b+=k[1]; a+=k[0]; break; - case 7 : b+=((quint32)k8[6])<<16; /* fall through */ - case 6 : b+=((quint32)k8[5])<<8; /* fall through */ - case 5 : b+=k8[4]; /* fall through */ + case 7 : b+=((quint32)k8[6])<<16; + Q_FALLTHROUGH(); + case 6 : b+=((quint32)k8[5])<<8; + Q_FALLTHROUGH(); + case 5 : b+=k8[4]; + Q_FALLTHROUGH(); case 4 : a+=k[0]; break; - case 3 : a+=((quint32)k8[2])<<16; /* fall through */ - case 2 : a+=((quint32)k8[1])<<8; /* fall through */ + case 3 : a+=((quint32)k8[2])<<16; + Q_FALLTHROUGH(); + case 2 : a+=((quint32)k8[1])<<8; + Q_FALLTHROUGH(); case 1 : a+=k8[0]; break; case 0 : *pc=c; *pb=b; return; /* zero length strings require no mixing */ } @@ -572,23 +610,28 @@ void hashlittle2( b+=k[2]+(((quint32)k[3])<<16); a+=k[0]+(((quint32)k[1])<<16); break; - case 11: c+=((quint32)k8[10])<<16; /* fall through */ + case 11: c+=((quint32)k8[10])<<16; + Q_FALLTHROUGH(); case 10: c+=k[4]; b+=k[2]+(((quint32)k[3])<<16); a+=k[0]+(((quint32)k[1])<<16); break; - case 9 : c+=k8[8]; /* fall through */ + case 9 : c+=k8[8]; + Q_FALLTHROUGH(); case 8 : b+=k[2]+(((quint32)k[3])<<16); a+=k[0]+(((quint32)k[1])<<16); break; - case 7 : b+=((quint32)k8[6])<<16; /* fall through */ + case 7 : b+=((quint32)k8[6])<<16; + Q_FALLTHROUGH(); case 6 : b+=k[2]; a+=k[0]+(((quint32)k[1])<<16); break; - case 5 : b+=k8[4]; /* fall through */ + case 5 : b+=k8[4]; + Q_FALLTHROUGH(); case 4 : a+=k[0]+(((quint32)k[1])<<16); break; - case 3 : a+=((quint32)k8[2])<<16; /* fall through */ + case 3 : a+=((quint32)k8[2])<<16; + Q_FALLTHROUGH(); case 2 : a+=k[0]; break; case 1 : a+=k8[0]; @@ -623,16 +666,27 @@ void hashlittle2( switch(length) /* all the case statements fall through */ { case 12: c+=((quint32)k[11])<<24; + Q_FALLTHROUGH(); case 11: c+=((quint32)k[10])<<16; + Q_FALLTHROUGH(); case 10: c+=((quint32)k[9])<<8; + Q_FALLTHROUGH(); case 9 : c+=k[8]; + Q_FALLTHROUGH(); case 8 : b+=((quint32)k[7])<<24; + Q_FALLTHROUGH(); case 7 : b+=((quint32)k[6])<<16; + Q_FALLTHROUGH(); case 6 : b+=((quint32)k[5])<<8; + Q_FALLTHROUGH(); case 5 : b+=k[4]; + Q_FALLTHROUGH(); case 4 : a+=((quint32)k[3])<<24; + Q_FALLTHROUGH(); case 3 : a+=((quint32)k[2])<<16; + Q_FALLTHROUGH(); case 2 : a+=((quint32)k[1])<<8; + Q_FALLTHROUGH(); case 1 : a+=k[0]; break; case 0 : *pc=c; *pb=b; return; /* zero length strings require no mixing */ @@ -709,16 +763,24 @@ quint32 hashbig( const void *key, size_t length, quint32 initval) switch(length) /* all the case statements fall through */ { case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; - case 11: c+=((quint32)k8[10])<<8; /* fall through */ - case 10: c+=((quint32)k8[9])<<16; /* fall through */ - case 9 : c+=((quint32)k8[8])<<24; /* fall through */ + case 11: c+=((quint32)k8[10])<<8; + Q_FALLTHROUGH(); + case 10: c+=((quint32)k8[9])<<16; + Q_FALLTHROUGH(); + case 9 : c+=((quint32)k8[8])<<24; + Q_FALLTHROUGH(); case 8 : b+=k[1]; a+=k[0]; break; - case 7 : b+=((quint32)k8[6])<<8; /* fall through */ - case 6 : b+=((quint32)k8[5])<<16; /* fall through */ - case 5 : b+=((quint32)k8[4])<<24; /* fall through */ + case 7 : b+=((quint32)k8[6])<<8; + Q_FALLTHROUGH(); + case 6 : b+=((quint32)k8[5])<<16; + Q_FALLTHROUGH(); + case 5 : b+=((quint32)k8[4])<<24; + Q_FALLTHROUGH(); case 4 : a+=k[0]; break; - case 3 : a+=((quint32)k8[2])<<8; /* fall through */ - case 2 : a+=((quint32)k8[1])<<16; /* fall through */ + case 3 : a+=((quint32)k8[2])<<8; + Q_FALLTHROUGH(); + case 2 : a+=((quint32)k8[1])<<16; + Q_FALLTHROUGH(); case 1 : a+=((quint32)k8[0])<<24; break; case 0 : return c; } @@ -752,16 +814,27 @@ quint32 hashbig( const void *key, size_t length, quint32 initval) switch(length) /* all the case statements fall through */ { case 12: c+=k[11]; + Q_FALLTHROUGH(); case 11: c+=((quint32)k[10])<<8; + Q_FALLTHROUGH(); case 10: c+=((quint32)k[9])<<16; + Q_FALLTHROUGH(); case 9 : c+=((quint32)k[8])<<24; + Q_FALLTHROUGH(); case 8 : b+=k[7]; + Q_FALLTHROUGH(); case 7 : b+=((quint32)k[6])<<8; + Q_FALLTHROUGH(); case 6 : b+=((quint32)k[5])<<16; + Q_FALLTHROUGH(); case 5 : b+=((quint32)k[4])<<24; + Q_FALLTHROUGH(); case 4 : a+=k[3]; + Q_FALLTHROUGH(); case 3 : a+=((quint32)k[2])<<8; + Q_FALLTHROUGH(); case 2 : a+=((quint32)k[1])<<16; + Q_FALLTHROUGH(); case 1 : a+=((quint32)k[0])<<24; break; case 0 : return c; -- cgit v1.2.3