From: Michael Wallner Date: Mon, 6 Jan 2020 11:13:15 +0000 (+0100) Subject: c++: fix -Wimplicit-fallthrough X-Git-Tag: pre_cmake~92 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=7fc1ce1d52601c1ba1d8e7ff0035a7243eaf14c3;p=m6w6%2Flibmemcached c++: fix -Wimplicit-fallthrough --- diff --git a/libhashkit/jenkins.cc b/libhashkit/jenkins.cc index 2001cab4..2197c4cc 100644 --- a/libhashkit/jenkins.cc +++ b/libhashkit/jenkins.cc @@ -227,17 +227,17 @@ uint32_t hashkit_jenkins(const char *key, size_t length, void *) /*-------------------------------- last block: affect all 32 bits of (c) */ switch(length) /* all the case statements fall through */ { - case 12: c+=((uint32_t)k[11])<<24; - case 11: c+=((uint32_t)k[10])<<16; - case 10: c+=((uint32_t)k[9])<<8; - case 9 : c+=k[8]; - case 8 : b+=((uint32_t)k[7])<<24; - case 7 : b+=((uint32_t)k[6])<<16; - case 6 : b+=((uint32_t)k[5])<<8; - case 5 : b+=k[4]; - case 4 : a+=((uint32_t)k[3])<<24; - case 3 : a+=((uint32_t)k[2])<<16; - case 2 : a+=((uint32_t)k[1])<<8; + case 12: c+=((uint32_t)k[11])<<24; /* fall through */ + case 11: c+=((uint32_t)k[10])<<16; /* fall through */ + case 10: c+=((uint32_t)k[9])<<8; /* fall through */ + case 9 : c+=k[8]; /* fall through */ + case 8 : b+=((uint32_t)k[7])<<24; /* fall through */ + case 7 : b+=((uint32_t)k[6])<<16; /* fall through */ + case 6 : b+=((uint32_t)k[5])<<8; /* fall through */ + case 5 : b+=k[4]; /* fall through */ + case 4 : a+=((uint32_t)k[3])<<24; /* fall through */ + case 3 : a+=((uint32_t)k[2])<<16; /* fall through */ + case 2 : a+=((uint32_t)k[1])<<8; /* fall through */ case 1 : a+=k[0]; break; case 0 : return c; diff --git a/libhashkit/murmur.cc b/libhashkit/murmur.cc index e15e5108..3bdacf0e 100644 --- a/libhashkit/murmur.cc +++ b/libhashkit/murmur.cc @@ -96,8 +96,8 @@ uint32_t hashkit_murmur(const char *key, size_t length, void *context) switch(length) { - case 3: h ^= ((uint32_t)data[2]) << 16; - case 2: h ^= ((uint32_t)data[1]) << 8; + case 3: h ^= ((uint32_t)data[2]) << 16; /* fall through */ + case 2: h ^= ((uint32_t)data[1]) << 8; /* fall through */ case 1: h ^= data[0]; h *= m; default: break; diff --git a/libhashkit/murmur3.cc b/libhashkit/murmur3.cc index e5f06ce2..6e2f8ed8 100644 --- a/libhashkit/murmur3.cc +++ b/libhashkit/murmur3.cc @@ -109,8 +109,8 @@ void MurmurHash3_x86_32 ( const void * key, int len, switch(len & 3) { - case 3: k1 ^= tail[2] << 16; - case 2: k1 ^= tail[1] << 8; + case 3: k1 ^= tail[2] << 16; /* fall through */ + case 2: k1 ^= tail[1] << 8; /* fall through */ case 1: k1 ^= tail[0]; k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1; }; @@ -185,27 +185,27 @@ void MurmurHash3_x86_128 ( const void * key, const int len, switch(len & 15) { - case 15: k4 ^= tail[14] << 16; - case 14: k4 ^= tail[13] << 8; + case 15: k4 ^= tail[14] << 16; /* fall through */ + case 14: k4 ^= tail[13] << 8; /* fall through */ case 13: k4 ^= tail[12] << 0; k4 *= c4; k4 = ROTL32(k4,18); k4 *= c1; h4 ^= k4; - - case 12: k3 ^= tail[11] << 24; - case 11: k3 ^= tail[10] << 16; - case 10: k3 ^= tail[ 9] << 8; - case 9: k3 ^= tail[ 8] << 0; + /* fall through */ + case 12: k3 ^= tail[11] << 24; /* fall through */ + case 11: k3 ^= tail[10] << 16; /* fall through */ + case 10: k3 ^= tail[ 9] << 8; /* fall through */ + case 9: k3 ^= tail[ 8] << 0; /* fall through */ k3 *= c3; k3 = ROTL32(k3,17); k3 *= c4; h3 ^= k3; - - case 8: k2 ^= tail[ 7] << 24; - case 7: k2 ^= tail[ 6] << 16; - case 6: k2 ^= tail[ 5] << 8; - case 5: k2 ^= tail[ 4] << 0; + /* fall through */ + case 8: k2 ^= tail[ 7] << 24; /* fall through */ + case 7: k2 ^= tail[ 6] << 16; /* fall through */ + case 6: k2 ^= tail[ 5] << 8; /* fall through */ + case 5: k2 ^= tail[ 4] << 0; /* fall through */ k2 *= c2; k2 = ROTL32(k2,16); k2 *= c3; h2 ^= k2; - - case 4: k1 ^= tail[ 3] << 24; - case 3: k1 ^= tail[ 2] << 16; - case 2: k1 ^= tail[ 1] << 8; - case 1: k1 ^= tail[ 0] << 0; + /* fall through */ + case 4: k1 ^= tail[ 3] << 24; /* fall through */ + case 3: k1 ^= tail[ 2] << 16; /* fall through */ + case 2: k1 ^= tail[ 1] << 8; /* fall through */ + case 1: k1 ^= tail[ 0] << 0; /* fall through */ k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1; }; @@ -275,23 +275,23 @@ void MurmurHash3_x64_128 ( const void * key, const int len, switch(len & 15) { - case 15: k2 ^= (uint64_t)(tail[14]) << 48; - case 14: k2 ^= (uint64_t)(tail[13]) << 40; - case 13: k2 ^= (uint64_t)(tail[12]) << 32; - case 12: k2 ^= (uint64_t)(tail[11]) << 24; - case 11: k2 ^= (uint64_t)(tail[10]) << 16; - case 10: k2 ^= (uint64_t)(tail[ 9]) << 8; - case 9: k2 ^= (uint64_t)(tail[ 8]) << 0; + case 15: k2 ^= (uint64_t)(tail[14]) << 48; /* fall through */ + case 14: k2 ^= (uint64_t)(tail[13]) << 40; /* fall through */ + case 13: k2 ^= (uint64_t)(tail[12]) << 32; /* fall through */ + case 12: k2 ^= (uint64_t)(tail[11]) << 24; /* fall through */ + case 11: k2 ^= (uint64_t)(tail[10]) << 16; /* fall through */ + case 10: k2 ^= (uint64_t)(tail[ 9]) << 8; /* fall through */ + case 9: k2 ^= (uint64_t)(tail[ 8]) << 0; /* fall through */ k2 *= c2; k2 = ROTL64(k2,33); k2 *= c1; h2 ^= k2; - - case 8: k1 ^= (uint64_t)(tail[ 7]) << 56; - case 7: k1 ^= (uint64_t)(tail[ 6]) << 48; - case 6: k1 ^= (uint64_t)(tail[ 5]) << 40; - case 5: k1 ^= (uint64_t)(tail[ 4]) << 32; - case 4: k1 ^= (uint64_t)(tail[ 3]) << 24; - case 3: k1 ^= (uint64_t)(tail[ 2]) << 16; - case 2: k1 ^= (uint64_t)(tail[ 1]) << 8; - case 1: k1 ^= (uint64_t)(tail[ 0]) << 0; + /* fall through */ + case 8: k1 ^= (uint64_t)(tail[ 7]) << 56; /* fall through */ + case 7: k1 ^= (uint64_t)(tail[ 6]) << 48; /* fall through */ + case 6: k1 ^= (uint64_t)(tail[ 5]) << 40; /* fall through */ + case 5: k1 ^= (uint64_t)(tail[ 4]) << 32; /* fall through */ + case 4: k1 ^= (uint64_t)(tail[ 3]) << 24; /* fall through */ + case 3: k1 ^= (uint64_t)(tail[ 2]) << 16; /* fall through */ + case 2: k1 ^= (uint64_t)(tail[ 1]) << 8; /* fall through */ + case 1: k1 ^= (uint64_t)(tail[ 0]) << 0; /* fall through */ k1 *= c1; k1 = ROTL64(k1,31); k1 *= c2; h1 ^= k1; }; diff --git a/libmemcached/behavior.cc b/libmemcached/behavior.cc index b45e8468..f5e1f0ac 100644 --- a/libmemcached/behavior.cc +++ b/libmemcached/behavior.cc @@ -106,6 +106,7 @@ memcached_return_t memcached_behavior_set(memcached_st *shell, case MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS: ptr->flags.auto_eject_hosts= bool(data); + /* fall through */ case MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT: if (data == 0) diff --git a/libmemcached/io.cc b/libmemcached/io.cc index e9d3ad39..e246f3ec 100644 --- a/libmemcached/io.cc +++ b/libmemcached/io.cc @@ -273,9 +273,11 @@ static memcached_return_t io_wait(memcached_instance_st* instance, case EFAULT: case ENOMEM: memcached_set_error(*instance, MEMCACHED_MEMORY_ALLOCATION_FAILURE, MEMCACHED_AT); + break; case EINVAL: memcached_set_error(*instance, MEMCACHED_MEMORY_ALLOCATION_FAILURE, MEMCACHED_AT, memcached_literal_param("RLIMIT_NOFILE exceeded, or if OSX the timeout value was invalid")); + break; default: memcached_set_errno(*instance, local_errno, MEMCACHED_AT, memcached_literal_param("poll")); @@ -458,6 +460,7 @@ static memcached_return_t _io_fill(memcached_instance_st* instance) WATCHPOINT_ASSERT(0); case EBADF: assert_msg(instance->fd != INVALID_SOCKET, "Programmer error, invalid socket"); + /* fall through */ case EINVAL: case EFAULT: case ECONNREFUSED: @@ -592,6 +595,7 @@ memcached_return_t memcached_io_slurp(memcached_instance_st* instance) assert(0); case EBADF: assert_msg(instance->fd != INVALID_SOCKET, "Invalid socket state"); + /* fall through */ case EINVAL: case EFAULT: case ECONNREFUSED: