From 60864af02c63fdaaf9264b4f14bfbc9f9fba64bd Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Wed, 24 Mar 2021 19:28:52 -0400 Subject: [PATCH] fix: add fallthrough annotations (-Wimplicit-fallthrough) Change-Id: I7d6c1197d6ff126f2c6fe6fb6ad8a0f575fc661d Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- liblttng-ust/jhash.h | 22 +++++++++++----------- liblttng-ust/lttng-bytecode-interpreter.c | 2 +- liblttng-ust/lttng-hash-helper.h | 6 +++--- liblttng-ust/string-utils.c | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/liblttng-ust/jhash.h b/liblttng-ust/jhash.h index 91993e8b..bd34cc59 100644 --- a/liblttng-ust/jhash.h +++ b/liblttng-ust/jhash.h @@ -196,17 +196,17 @@ uint32_t hashlittle(const void *key, size_t length, uint32_t initval) /*-------------------------------- 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/liblttng-ust/lttng-bytecode-interpreter.c b/liblttng-ust/lttng-bytecode-interpreter.c index a384d61f..4ca1338a 100644 --- a/liblttng-ust/lttng-bytecode-interpreter.c +++ b/liblttng-ust/lttng-bytecode-interpreter.c @@ -2098,7 +2098,7 @@ int lttng_bytecode_interpret(struct lttng_ust_bytecode_runtime *ust_bytecode, JUMP_TO(BYTECODE_OP_CAST_DOUBLE_TO_S64); case REG_U64: estack_ax_t = REG_S64; - next_pc += sizeof(struct cast_op); + next_pc += sizeof(struct cast_op); /* Fall-through */ case REG_STRING: /* Fall-through */ case REG_STAR_GLOB_STRING: ret = -EINVAL; diff --git a/liblttng-ust/lttng-hash-helper.h b/liblttng-ust/lttng-hash-helper.h index 6c8008a0..1978fbde 100644 --- a/liblttng-ust/lttng-hash-helper.h +++ b/liblttng-ust/lttng-hash-helper.h @@ -102,10 +102,10 @@ void lttng_hashword2( /*----------------------------------- handle the last 3 uint32_t's */ switch (length) { /* all the case statements fall through */ - case 3: c += k[2]; - case 2: b += k[1]; + case 3: c += k[2]; /* fall through */ + case 2: b += k[1]; /* fall through */ case 1: a += k[0]; - final(a, b, c); + final(a, b, c); /* fall through */ case 0: /* case 0: nothing left to add */ break; } diff --git a/liblttng-ust/string-utils.c b/liblttng-ust/string-utils.c index bf8b78e5..dea2ae3b 100644 --- a/liblttng-ust/string-utils.c +++ b/liblttng-ust/string-utils.c @@ -271,7 +271,7 @@ retry: goto retry; case '\\': /* Go to escaped character. */ - p++; + p++; /* Fallthrough */ /* * Fall through the default case which will -- 2.34.1