[PATCH 00/12] Compile QEMU with -Wimplicit-fallthrough

Thomas Huth posted 12 patches 3 years, 4 months ago
Test checkpatch failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20201211152426.350966-1-thuth@redhat.com
Maintainers: Aurelien Jarno <aurelien@aurel32.net>, "Alex Bennée" <alex.bennee@linaro.org>, Peter Maydell <peter.maydell@linaro.org>, Richard Henderson <richard.henderson@linaro.org>, Guan Xuetao <gxt@mprc.pku.edu.cn>, Andrzej Zaborowski <balrogg@gmail.com>
There is a newer version of this series
accel/tcg/user-exec.c                |  3 +-
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                    | 43 +++++++++-------------------
hw/timer/renesas_tmr.c               |  1 +
include/qemu/compiler.h              | 11 +++++++
target/i386/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 ++
14 files changed, 59 insertions(+), 37 deletions(-)
[PATCH 00/12] Compile QEMU with -Wimplicit-fallthrough
Posted by Thomas Huth 3 years, 4 months ago
Coverity is already reporting switch-case statements where code
can fall through from one case to another without a proper comment
(since this could indicate a missing "break" and thus a bug).
However, it's cumbersome to fix these issues after they have been
merged already, it would be better if the author of the code would
already take care of this when writing the patch. Fortunately,
GCC and Clang can already warn about those code spots, too.
So let's fix our remaining statements that fall through without
a proper comment, so we can finally turn on -Wimplicit-fallthrough
for all compilation runs.

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

Thomas Huth (6):
  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
  configure: Compile with -Wimplicit-fallthrough=2

 accel/tcg/user-exec.c                |  3 +-
 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                    | 43 +++++++++-------------------
 hw/timer/renesas_tmr.c               |  1 +
 include/qemu/compiler.h              | 11 +++++++
 target/i386/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 ++
 14 files changed, 59 insertions(+), 37 deletions(-)

-- 
2.27.0


Re: [PATCH 00/12] Compile QEMU with -Wimplicit-fallthrough
Posted by no-reply@patchew.org 3 years, 4 months ago
Patchew URL: https://patchew.org/QEMU/20201211152426.350966-1-thuth@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20201211152426.350966-1-thuth@redhat.com
Subject: [PATCH 00/12] Compile QEMU with -Wimplicit-fallthrough

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 - [tag update]      patchew/20201204220758.2879-1-vsementsov@virtuozzo.com -> patchew/20201204220758.2879-1-vsementsov@virtuozzo.com
 * [new tag]         patchew/20201211152426.350966-1-thuth@redhat.com -> patchew/20201211152426.350966-1-thuth@redhat.com
Switched to a new branch 'test'
2daf9e7 configure: Compile with -Wimplicit-fallthrough=2
bf473af tests/fp: Do not emit implicit-fallthrough warnings in the softfloat tests
e7b216b tcg/optimize: Add fallthrough annotations
c1d0232 target/sparc/win_helper: silence the compiler warnings
fc18091 target/sparc/translate: silence the compiler warnings
9610d75 accel/tcg/user-exec: silence the compiler warnings
580a2fc hw/intc/arm_gicv3_kvm: silence the compiler warnings
3f4ee3d target/i386: silence the compiler warnings in gen_shiftd_rm_T1
1343e8c hw/timer/renesas_tmr: silence the compiler warnings
198be4c hw/rtc/twl92230: Silence warnings about missing fallthrough statements
17c473a target/unicore32/translate: Add missing fallthrough annotations
697b282 disas/libvixl: Fix fall-through annotation for GCC >= 7

=== OUTPUT BEGIN ===
1/12 Checking commit 697b282c9a19 (disas/libvixl: Fix fall-through annotation for GCC >= 7)
ERROR: do not use C99 // comments
#46: FILE: disas/libvixl/vixl/globals.h:111:
+// Fallthrough annotation for Clang and C++11(201103L).

ERROR: do not use C99 // comments
#49: FILE: disas/libvixl/vixl/globals.h:114:
+// Fallthrough annotation for GCC >= 7.

total: 2 errors, 0 warnings, 24 lines checked

Patch 1/12 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

2/12 Checking commit 17c473af89a3 (target/unicore32/translate: Add missing fallthrough annotations)
3/12 Checking commit 198be4c4dd79 (hw/rtc/twl92230: Silence warnings about missing fallthrough statements)
4/12 Checking commit 1343e8c24457 (hw/timer/renesas_tmr: silence the compiler warnings)
5/12 Checking commit 3f4ee3deca5a (target/i386: silence the compiler warnings in gen_shiftd_rm_T1)
6/12 Checking commit 580a2fc632d5 (hw/intc/arm_gicv3_kvm: silence the compiler warnings)
7/12 Checking commit 9610d7588b9c (accel/tcg/user-exec: silence the compiler warnings)
8/12 Checking commit fc1809134418 (target/sparc/translate: silence the compiler warnings)
9/12 Checking commit c1d0232b4185 (target/sparc/win_helper: silence the compiler warnings)
10/12 Checking commit e7b216b31c4e (tcg/optimize: Add fallthrough annotations)
WARNING: architecture specific defines should be avoided
#32: FILE: include/qemu/compiler.h:251:
+#if __has_attribute(fallthrough)

total: 0 errors, 1 warnings, 43 lines checked

Patch 10/12 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
11/12 Checking commit bf473af503d5 (tests/fp: Do not emit implicit-fallthrough warnings in the softfloat tests)
12/12 Checking commit 2daf9e78b889 (configure: Compile with -Wimplicit-fallthrough=2)
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20201211152426.350966-1-thuth@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Re: [PATCH 00/12] Compile QEMU with -Wimplicit-fallthrough
Posted by Thomas Huth 3 years, 4 months ago
On 11/12/2020 16.24, Thomas Huth wrote:
> Coverity is already reporting switch-case statements where code
> can fall through from one case to another without a proper comment
> (since this could indicate a missing "break" and thus a bug).
> However, it's cumbersome to fix these issues after they have been
> merged already, it would be better if the author of the code would
> already take care of this when writing the patch. Fortunately,
> GCC and Clang can already warn about those code spots, too.
> So let's fix our remaining statements that fall through without
> a proper comment, so we can finally turn on -Wimplicit-fallthrough
> for all compilation runs.
> 
> 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
> 
> Thomas Huth (6):
>   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
>   configure: Compile with -Wimplicit-fallthrough=2

I forgot to mention: There are two more spots in the ppc code that currently
cause some warnings, but the patches to fix those are already in David
Gibson's ppc pull request, so they should be handled soon.

 Thomas