* [PULL v2 00/14] Compile QEMU with -Wimplicit-fallthrough
@ 2020-12-18 8:27 Thomas Huth
2020-12-18 8:27 ` [PULL 12/14] bsd-user: Silence warnings about missing fallthrough statement Thomas Huth
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Thomas Huth @ 2020-12-18 8:27 UTC (permalink / raw)
To: Peter Maydell, qemu-devel; +Cc: Chen Qun, Alex Bennée
Hi!
The following changes since commit 75ee62ac606bfc9eb59310b9446df3434bf6e8c2:
Merge remote-tracking branch 'remotes/ehabkost-gl/tags/x86-next-pull-request'
into staging (2020-12-17 18:53:36 +0000)
are available in the Git repository at:
https://gitlab.com/huth/qemu.git tags/pull-request-2020-12-18
for you to fetch changes up to 0a2ebce92a3f10a89843e4a7a8e2f2eba4f7b109:
configure: Compile with -Wimplicit-fallthrough=2 (2020-12-18 09:15:47 +0100)
----------------------------------------------------------------
* Compile QEMU with -Wimplicit-fallthrough=2 to avoid bugs in
switch-case statements
----------------------------------------------------------------
v2:
- Added the patch for bsd-user
- Included Philippe's twl92230 break patch
Chen Qun (6):
hw/timer/renesas_tmr: silence the compiler warnings
target/i386: silence the compiler warnings in gen_shiftd_rm_T1
hw/intc/arm_gicv3_kvm: silence the compiler warnings
accel/tcg/user-exec: silence the compiler warnings
target/sparc/translate: silence the compiler warnings
target/sparc/win_helper: silence the compiler warnings
Philippe Mathieu-Daudé (1):
hw/rtc/twl92230: Add missing 'break'
Thomas Huth (7):
disas/libvixl: Fix fall-through annotation for GCC >= 7
target/unicore32/translate: Add missing fallthrough annotations
hw/rtc/twl92230: Silence warnings about missing fallthrough statements
tcg/optimize: Add fallthrough annotations
tests/fp: Do not emit implicit-fallthrough warnings in the softfloat tests
bsd-user: Silence warnings about missing fallthrough statement
configure: Compile with -Wimplicit-fallthrough=2
accel/tcg/user-exec.c | 3 ++-
bsd-user/main.c | 1 +
configure | 1 +
disas/libvixl/vixl/a64/disasm-a64.cc | 4 ++++
disas/libvixl/vixl/globals.h | 6 +++--
hw/intc/arm_gicv3_kvm.c | 8 +++++++
hw/rtc/twl92230.c | 44 ++++++++++++------------------------
hw/timer/renesas_tmr.c | 1 +
include/qemu/compiler.h | 11 +++++++++
target/i386/tcg/translate.c | 7 ++++--
target/sparc/translate.c | 2 +-
target/sparc/win_helper.c | 2 +-
target/unicore32/translate.c | 2 ++
tcg/optimize.c | 4 ++++
tests/fp/meson.build | 2 ++
15 files changed, 61 insertions(+), 37 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PULL 12/14] bsd-user: Silence warnings about missing fallthrough statement
2020-12-18 8:27 [PULL v2 00/14] Compile QEMU with -Wimplicit-fallthrough Thomas Huth
@ 2020-12-18 8:27 ` Thomas Huth
2020-12-18 8:27 ` [PULL 13/14] hw/rtc/twl92230: Add missing 'break' Thomas Huth
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Huth @ 2020-12-18 8:27 UTC (permalink / raw)
To: Peter Maydell, qemu-devel; +Cc: Chen Qun, Alex Bennée
When compiling with -Werror=implicit-fallthrough, the compiler complains
about a missing fallthrough annotation in this file. Looking at the code,
the fallthrough is indeed wanted here, so let's add a proper comment.
Message-Id: <20201217154138.1547274-1-thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
bsd-user/main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 0a918e8f74..9c700c6234 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -512,6 +512,7 @@ void cpu_loop(CPUSPARCState *env)
case 0x141:
if (bsd_type != target_freebsd)
goto badtrap;
+ /* fallthrough */
case 0x100:
#endif
syscall_nr = env->gregs[1];
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PULL 13/14] hw/rtc/twl92230: Add missing 'break'
2020-12-18 8:27 [PULL v2 00/14] Compile QEMU with -Wimplicit-fallthrough Thomas Huth
2020-12-18 8:27 ` [PULL 12/14] bsd-user: Silence warnings about missing fallthrough statement Thomas Huth
@ 2020-12-18 8:27 ` Thomas Huth
2020-12-18 8:27 ` [PULL 14/14] configure: Compile with -Wimplicit-fallthrough=2 Thomas Huth
2020-12-31 14:48 ` [PULL v2 00/14] Compile QEMU with -Wimplicit-fallthrough Peter Maydell
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Huth @ 2020-12-18 8:27 UTC (permalink / raw)
To: Peter Maydell, qemu-devel; +Cc: Chen Qun, Alex Bennée
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
Add missing 'break' to fix:
hw/rtc/twl92230.c: In function ‘menelaus_write’:
hw/rtc/twl92230.c:713:5: error: label at end of compound statement
713 | default:
| ^~~~~~~
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20201211154605.511714-1-f4bug@amsat.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
hw/rtc/twl92230.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/rtc/twl92230.c b/hw/rtc/twl92230.c
index a787bd247d..006d75e174 100644
--- a/hw/rtc/twl92230.c
+++ b/hw/rtc/twl92230.c
@@ -697,6 +697,7 @@ static void menelaus_write(void *opaque, uint8_t addr, uint8_t value)
#ifdef VERBOSE
printf("%s: unknown register %02x\n", __func__, addr);
#endif
+ break;
}
}
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PULL 14/14] configure: Compile with -Wimplicit-fallthrough=2
2020-12-18 8:27 [PULL v2 00/14] Compile QEMU with -Wimplicit-fallthrough Thomas Huth
2020-12-18 8:27 ` [PULL 12/14] bsd-user: Silence warnings about missing fallthrough statement Thomas Huth
2020-12-18 8:27 ` [PULL 13/14] hw/rtc/twl92230: Add missing 'break' Thomas Huth
@ 2020-12-18 8:27 ` Thomas Huth
2020-12-31 14:48 ` [PULL v2 00/14] Compile QEMU with -Wimplicit-fallthrough Peter Maydell
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Huth @ 2020-12-18 8:27 UTC (permalink / raw)
To: Peter Maydell, qemu-devel; +Cc: Chen Qun, Alex Bennée
Coverity always complains about switch-case statements that fall through
the next one when there is no comment in between - which could indicate
a forgotten "break" statement. Instead of handling these issues after
they have been committed, it would be better to avoid them in the build
process already. Thus let's enable the -Wimplicit-fallthrough warning now.
The "=2" level seems to be a good compromise between being too strict and
too generic about the possible comments, so we'll start with "=2" for now.
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Chen Qun <kuhn.chenqun@huawei.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20201211152426.350966-13-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
configure | 1 +
1 file changed, 1 insertion(+)
diff --git a/configure b/configure
index c228f7c21e..881af4b6be 100755
--- a/configure
+++ b/configure
@@ -2023,6 +2023,7 @@ add_to warn_flags -Wempty-body
add_to warn_flags -Wnested-externs
add_to warn_flags -Wendif-labels
add_to warn_flags -Wexpansion-to-defined
+add_to warn_flags -Wimplicit-fallthrough=2
nowarn_flags=
add_to nowarn_flags -Wno-initializer-overrides
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PULL v2 00/14] Compile QEMU with -Wimplicit-fallthrough
2020-12-18 8:27 [PULL v2 00/14] Compile QEMU with -Wimplicit-fallthrough Thomas Huth
` (2 preceding siblings ...)
2020-12-18 8:27 ` [PULL 14/14] configure: Compile with -Wimplicit-fallthrough=2 Thomas Huth
@ 2020-12-31 14:48 ` Peter Maydell
3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2020-12-31 14:48 UTC (permalink / raw)
To: Thomas Huth; +Cc: Chen Qun, Alex Bennée, QEMU Developers
On Fri, 18 Dec 2020 at 08:27, Thomas Huth <thuth@redhat.com> wrote:
>
> Hi!
>
> The following changes since commit 75ee62ac606bfc9eb59310b9446df3434bf6e8c2:
>
> Merge remote-tracking branch 'remotes/ehabkost-gl/tags/x86-next-pull-request'
> into staging (2020-12-17 18:53:36 +0000)
>
> are available in the Git repository at:
>
> https://gitlab.com/huth/qemu.git tags/pull-request-2020-12-18
>
> for you to fetch changes up to 0a2ebce92a3f10a89843e4a7a8e2f2eba4f7b109:
>
> configure: Compile with -Wimplicit-fallthrough=2 (2020-12-18 09:15:47 +0100)
>
> ----------------------------------------------------------------
> * Compile QEMU with -Wimplicit-fallthrough=2 to avoid bugs in
> switch-case statements
> ----------------------------------------------------------------
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/6.0
for any user-visible changes.
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-12-31 14:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-18 8:27 [PULL v2 00/14] Compile QEMU with -Wimplicit-fallthrough Thomas Huth
2020-12-18 8:27 ` [PULL 12/14] bsd-user: Silence warnings about missing fallthrough statement Thomas Huth
2020-12-18 8:27 ` [PULL 13/14] hw/rtc/twl92230: Add missing 'break' Thomas Huth
2020-12-18 8:27 ` [PULL 14/14] configure: Compile with -Wimplicit-fallthrough=2 Thomas Huth
2020-12-31 14:48 ` [PULL v2 00/14] Compile QEMU with -Wimplicit-fallthrough Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).