Concurrency primitives, safe memory reclamation mechanisms and non-blocking (including lock-free) data structures designed to aid in the research, design and implementation of high performance concurrent systems developed in C99+.
ck_ht_hash.h contains a few switch() statements with implicit fall through logic. Which triggers GCC warnings with the -Wimplicit-fallthrough option introduced in GCC 7.
Code:
switch(len & 3)
{
case 3: k1 ^= tail[2] << 16;
case 2: k1 ^= tail[1] << 8;
case 1: k1 ^= tail[0];
k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
};
...
switch(len & 7)
{
case 7: h ^= (uint64_t)(data2[6]) << 48;
case 6: h ^= (uint64_t)(data2[5]) << 40;
case 5: h ^= (uint64_t)(data2[4]) << 32;
case 4: h ^= (uint64_t)(data2[3]) << 24;
case 3: h ^= (uint64_t)(data2[2]) << 16;
case 2: h ^= (uint64_t)(data2[1]) << 8;
case 1: h ^= (uint64_t)(data2[0]);
h *= m;
};
...
switch(len)
{
case 3: h2 ^= ((const unsigned char*)data)[2] << 16;
case 2: h2 ^= ((const unsigned char*)data)[1] << 8;
case 1: h2 ^= ((const unsigned char*)data)[0];
h2 *= m;
};
Compiler warnings:
In file included from /build/sysbench-1.0.10.13/third_party/concurrency_kit/tmp/ck/src/ck_ht.c:44:0:
/build/sysbench-1.0.10.13/third_party/concurrency_kit/tmp/ck/src/ck_ht_hash.h: In function ‘MurmurHash64A’:
/build/sysbench-1.0.10.13/third_party/concurrency_kit/tmp/ck/src/ck_ht_hash.h:198:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
case 7: h ^= (uint64_t)(data2[6]) << 48;
~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/sysbench-1.0.10.13/third_party/concurrency_kit/tmp/ck/src/ck_ht_hash.h:199:3: note: here
case 6: h ^= (uint64_t)(data2[5]) << 40;
^~~~
/build/sysbench-1.0.10.13/third_party/concurrency_kit/tmp/ck/src/ck_ht_hash.h:199:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
case 6: h ^= (uint64_t)(data2[5]) << 40;
~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/sysbench-1.0.10.13/third_party/concurrency_kit/tmp/ck/src/ck_ht_hash.h:200:3: note: here
case 5: h ^= (uint64_t)(data2[4]) << 32;
^~~~
/build/sysbench-1.0.10.13/third_party/concurrency_kit/tmp/ck/src/ck_ht_hash.h:200:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
case 5: h ^= (uint64_t)(data2[4]) << 32;
~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/sysbench-1.0.10.13/third_party/concurrency_kit/tmp/ck/src/ck_ht_hash.h:201:3: note: here
case 4: h ^= (uint64_t)(data2[3]) << 24;
^~~~
/build/sysbench-1.0.10.13/third_party/concurrency_kit/tmp/ck/src/ck_ht_hash.h:201:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
case 4: h ^= (uint64_t)(data2[3]) << 24;
~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/sysbench-1.0.10.13/third_party/concurrency_kit/tmp/ck/src/ck_ht_hash.h:202:3: note: here
case 3: h ^= (uint64_t)(data2[2]) << 16;
^~~~
/build/sysbench-1.0.10.13/third_party/concurrency_kit/tmp/ck/src/ck_ht_hash.h:202:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
case 3: h ^= (uint64_t)(data2[2]) << 16;
~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/sysbench-1.0.10.13/third_party/concurrency_kit/tmp/ck/src/ck_ht_hash.h:203:3: note: here
case 2: h ^= (uint64_t)(data2[1]) << 8;
^~~~
/build/sysbench-1.0.10.13/third_party/concurrency_kit/tmp/ck/src/ck_ht_hash.h:203:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
case 2: h ^= (uint64_t)(data2[1]) << 8;
~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/sysbench-1.0.10.13/third_party/concurrency_kit/tmp/ck/src/ck_ht_hash.h:204:3: note: here
case 1: h ^= (uint64_t)(data2[0]);
^~~~
The manual lists a number of options to silence the warnings, which I guess is the right thing to do here. The most portable way seems to be adding /* fall through */ comments, which are also supported by Clang.
ck_ht_hash.h
contains a fewswitch()
statements with implicit fall through logic. Which triggers GCC warnings with the-Wimplicit-fallthrough
option introduced in GCC 7.Code:
Compiler warnings:
The manual lists a number of options to silence the warnings, which I guess is the right thing to do here. The most portable way seems to be adding
/* fall through */
comments, which are also supported by Clang.