diff options
author | Thomas Huth <thuth@redhat.com> | 2020-12-11 16:24:24 +0100 |
---|---|---|
committer | Thomas Huth <thuth@redhat.com> | 2020-12-18 09:14:23 +0100 |
commit | d84568b773fe1fc469c4d8419c3545be52eec82c (patch) | |
tree | 852e4d7439e40e2609041c5fb00746225c549db2 /tcg | |
parent | 9cf5a9cf60a3c5271dee05b6a81a05fb45bee622 (diff) |
tcg/optimize: Add fallthrough annotations
To be able to compile this file with -Werror=implicit-fallthrough,
we need to add some fallthrough annotations to the case statements
that might fall through. Unfortunately, the typical "/* fallthrough */"
comments do not work here as expected since some case labels are
wrapped in macros and the compiler fails to match the comments in
this case. But using __attribute__((fallthrough)) seems to work fine,
so let's use that instead (by introducing a new QEMU_FALLTHROUGH
macro in our compiler.h header file).
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20201211152426.350966-11-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tcg')
-rw-r--r-- | tcg/optimize.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tcg/optimize.c b/tcg/optimize.c index 220f4601d5..7ca71de956 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -855,6 +855,7 @@ void tcg_optimize(TCGContext *s) if ((arg_info(op->args[1])->mask & 0x80) != 0) { break; } + QEMU_FALLTHROUGH; CASE_OP_32_64(ext8u): mask = 0xff; goto and_const; @@ -862,6 +863,7 @@ void tcg_optimize(TCGContext *s) if ((arg_info(op->args[1])->mask & 0x8000) != 0) { break; } + QEMU_FALLTHROUGH; CASE_OP_32_64(ext16u): mask = 0xffff; goto and_const; @@ -869,6 +871,7 @@ void tcg_optimize(TCGContext *s) if ((arg_info(op->args[1])->mask & 0x80000000) != 0) { break; } + QEMU_FALLTHROUGH; case INDEX_op_ext32u_i64: mask = 0xffffffffU; goto and_const; @@ -886,6 +889,7 @@ void tcg_optimize(TCGContext *s) if ((arg_info(op->args[1])->mask & 0x80000000) != 0) { break; } + QEMU_FALLTHROUGH; case INDEX_op_extu_i32_i64: /* We do not compute affected as it is a size changing op. */ mask = (uint32_t)arg_info(op->args[1])->mask; |