qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 4f02d4: disas/libvixl: Fix fall-through annot


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 4f02d4: disas/libvixl: Fix fall-through annotation for GCC...
Date: Thu, 31 Dec 2020 07:13:05 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 4f02d49a80fdb3c5898dd32b5879289425ee158f
      
https://github.com/qemu/qemu/commit/4f02d49a80fdb3c5898dd32b5879289425ee158f
  Author: Thomas Huth <thuth@redhat.com>
  Date:   2020-12-18 (Fri, 18 Dec 2020)

  Changed paths:
    M disas/libvixl/vixl/a64/disasm-a64.cc
    M disas/libvixl/vixl/globals.h

  Log Message:
  -----------
  disas/libvixl: Fix fall-through annotation for GCC >= 7

For compiling with -Wimplicit-fallthrough we need to fix the
fallthrough annotations in the libvixl code. This is based on
the following upstream vixl commit by Martyn Capewell:

 https://git.linaro.org/arm/vixl.git/commit/?id=de326f850f736c3a337

 "GCC 7 enables switch/case fallthrough checking, but this fails in
  VIXL, because the annotation we use is Clang specific.

  Also, fix a missing annotation in the disassembler."

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20201211152426.350966-2-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>


  Commit: 51c915674d8cf9de596d96ac31226c4a374fcb95
      
https://github.com/qemu/qemu/commit/51c915674d8cf9de596d96ac31226c4a374fcb95
  Author: Thomas Huth <thuth@redhat.com>
  Date:   2020-12-18 (Fri, 18 Dec 2020)

  Changed paths:
    M target/unicore32/translate.c

  Log Message:
  -----------
  target/unicore32/translate: Add missing fallthrough annotations

Looking at the way the code is formatted here (there is an empty line
after break statements, but none where the break is missing), and the
instruction set overview at https://en.wikipedia.org/wiki/Unicore the
fallthrough is very likely intended here. So add a fallthrough comment
to make the it compilable with -Werror=implicit-fallthrough.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20201211152426.350966-3-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>


  Commit: 216776099b087edfdf8cca3cb3cbfee1edbb12e2
      
https://github.com/qemu/qemu/commit/216776099b087edfdf8cca3cb3cbfee1edbb12e2
  Author: Thomas Huth <thuth@redhat.com>
  Date:   2020-12-18 (Fri, 18 Dec 2020)

  Changed paths:
    M hw/rtc/twl92230.c

  Log Message:
  -----------
  hw/rtc/twl92230: Silence warnings about missing fallthrough statements

When compiling with -Werror=implicit-fallthrough, gcc complains about
missing fallthrough annotations in this file. Looking at the code,
the fallthrough is indeed wanted here, but instead of adding the
annotations, it can be done more efficiently by simply calculating
the offset with a subtraction instead of increasing a local variable
one by one.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20201211152426.350966-4-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>


  Commit: 30982862b2d81e7b4a58bac319075d343c36e06a
      
https://github.com/qemu/qemu/commit/30982862b2d81e7b4a58bac319075d343c36e06a
  Author: Chen Qun <kuhn.chenqun@huawei.com>
  Date:   2020-12-18 (Fri, 18 Dec 2020)

  Changed paths:
    M hw/timer/renesas_tmr.c

  Log Message:
  -----------
  hw/timer/renesas_tmr: silence the compiler warnings

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
../hw/timer/renesas_tmr.c: In function ‘tmr_read’:
../hw/timer/renesas_tmr.c:221:19: warning: this statement may fall through 
[-Wimplicit-fallthrough=]
  221 |         } else if (ch == 0) {i
      |                   ^
../hw/timer/renesas_tmr.c:224:5: note: here
  224 |     case A_TCORB:
      |     ^~~~

Add the corresponding "fall through" comment to fix it.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20201211152426.350966-5-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>


  Commit: bdddc1c425e8e39031bf726b54a6e7388337a7f0
      
https://github.com/qemu/qemu/commit/bdddc1c425e8e39031bf726b54a6e7388337a7f0
  Author: Chen Qun <kuhn.chenqun@huawei.com>
  Date:   2020-12-18 (Fri, 18 Dec 2020)

  Changed paths:
    M target/i386/tcg/translate.c

  Log Message:
  -----------
  target/i386: silence the compiler warnings in gen_shiftd_rm_T1

The current "#ifdef TARGET_X86_64" statement affects
the compiler's determination of fall through.

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
target/i386/translate.c: In function ‘gen_shiftd_rm_T1’:
target/i386/translate.c:1773:12: warning: this statement may fall through 
[-Wimplicit-fallthrough=]
         if (is_right) {
            ^
target/i386/translate.c:1782:5: note: here
     case MO_32:
     ^~~~

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20201211152426.350966-6-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>


  Commit: d85afd1eb5764722b8d46806d2d6acccc2b9d044
      
https://github.com/qemu/qemu/commit/d85afd1eb5764722b8d46806d2d6acccc2b9d044
  Author: Chen Qun <kuhn.chenqun@huawei.com>
  Date:   2020-12-18 (Fri, 18 Dec 2020)

  Changed paths:
    M hw/intc/arm_gicv3_kvm.c

  Log Message:
  -----------
  hw/intc/arm_gicv3_kvm: silence the compiler warnings

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
hw/intc/arm_gicv3_kvm.c: In function ‘kvm_arm_gicv3_put’:
hw/intc/arm_gicv3_kvm.c:484:13: warning: this statement may fall through 
[-Wimplicit-fallthrough=]
             kvm_gicc_access(s, ICC_AP0R_EL1(1), ncpu, &reg64, true);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hw/intc/arm_gicv3_kvm.c:485:9: note: here
         default:
         ^~~~~~~
hw/intc/arm_gicv3_kvm.c:495:13: warning: this statement may fall through 
[-Wimplicit-fallthrough=]
             kvm_gicc_access(s, ICC_AP1R_EL1(2), ncpu, &reg64, true);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hw/intc/arm_gicv3_kvm.c:496:9: note: here
         case 6:
         ^~~~
hw/intc/arm_gicv3_kvm.c:498:13: warning: this statement may fall through 
[-Wimplicit-fallthrough=]
             kvm_gicc_access(s, ICC_AP1R_EL1(1), ncpu, &reg64, true);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hw/intc/arm_gicv3_kvm.c:499:9: note: here
         default:
         ^~~~~~~

hw/intc/arm_gicv3_kvm.c: In function ‘kvm_arm_gicv3_get’:
hw/intc/arm_gicv3_kvm.c:634:37: warning: this statement may fall through 
[-Wimplicit-fallthrough=]
             c->icc_apr[GICV3_G0][2] = reg64;
             ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
hw/intc/arm_gicv3_kvm.c:635:9: note: here
         case 6:
         ^~~~
hw/intc/arm_gicv3_kvm.c:637:37: warning: this statement may fall through 
[-Wimplicit-fallthrough=]
             c->icc_apr[GICV3_G0][1] = reg64;
             ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
hw/intc/arm_gicv3_kvm.c:638:9: note: here
         default:
         ^~~~~~~
hw/intc/arm_gicv3_kvm.c:648:39: warning: this statement may fall through 
[-Wimplicit-fallthrough=]
             c->icc_apr[GICV3_G1NS][2] = reg64;
             ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
hw/intc/arm_gicv3_kvm.c:649:9: note: here
         case 6:
         ^~~~
hw/intc/arm_gicv3_kvm.c:651:39: warning: this statement may fall through 
[-Wimplicit-fallthrough=]
             c->icc_apr[GICV3_G1NS][1] = reg64;
             ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
hw/intc/arm_gicv3_kvm.c:652:9: note: here
         default:
         ^~~~~~~

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20201211152426.350966-7-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>


  Commit: f190bf05f83c378958da84fe85c4df91c3941ce8
      
https://github.com/qemu/qemu/commit/f190bf05f83c378958da84fe85c4df91c3941ce8
  Author: Chen Qun <kuhn.chenqun@huawei.com>
  Date:   2020-12-18 (Fri, 18 Dec 2020)

  Changed paths:
    M accel/tcg/user-exec.c

  Log Message:
  -----------
  accel/tcg/user-exec: silence the compiler warnings

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
../accel/tcg/user-exec.c: In function ‘handle_cpu_signal’:
../accel/tcg/user-exec.c:169:13: warning: this statement may fall through 
[-Wimplicit-fallthrough=]
  169 |             cpu_exit_tb_from_sighandler(cpu, old_set);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../accel/tcg/user-exec.c:172:9: note: here
  172 |         default:

Mark the cpu_exit_tb_from_sighandler() function with QEMU_NORETURN to fix it.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20201211152426.350966-8-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>


  Commit: fc0cd867819a5cff9dd49b2fca4d927d765aa7ae
      
https://github.com/qemu/qemu/commit/fc0cd867819a5cff9dd49b2fca4d927d765aa7ae
  Author: Chen Qun <kuhn.chenqun@huawei.com>
  Date:   2020-12-18 (Fri, 18 Dec 2020)

  Changed paths:
    M target/sparc/translate.c

  Log Message:
  -----------
  target/sparc/translate: silence the compiler warnings

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
target/sparc/translate.c: In function ‘gen_st_asi’:
target/sparc/translate.c:2320:12: warning: this statement may fall through 
[-Wimplicit-fallthrough=]
 2320 |         if (!(dc->def->features & CPU_FEATURE_HYPV)) {
      |            ^
target/sparc/translate.c:2329:5: note: here
 2329 |     case GET_ASI_DIRECT:
      |     ^~~~

The "fall through" statement place is not correctly identified by the compiler.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Artyom Tarasenko <atar4qemu@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20201211152426.350966-9-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>


  Commit: 9cf5a9cf60a3c5271dee05b6a81a05fb45bee622
      
https://github.com/qemu/qemu/commit/9cf5a9cf60a3c5271dee05b6a81a05fb45bee622
  Author: Chen Qun <kuhn.chenqun@huawei.com>
  Date:   2020-12-18 (Fri, 18 Dec 2020)

  Changed paths:
    M target/sparc/win_helper.c

  Log Message:
  -----------
  target/sparc/win_helper: silence the compiler warnings

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
target/sparc/win_helper.c: In function ‘get_gregset’:
target/sparc/win_helper.c:304:9: warning: this statement may fall through 
[-Wimplicit-fallthrough=]
  304 |         trace_win_helper_gregset_error(pstate);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
target/sparc/win_helper.c:306:5: note: here
  306 |     case 0:
      |     ^~~~

Add the corresponding "fall through" comment to fix it.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Artyom Tarasenko <atar4qemu@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20201211152426.350966-10-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>


  Commit: d84568b773fe1fc469c4d8419c3545be52eec82c
      
https://github.com/qemu/qemu/commit/d84568b773fe1fc469c4d8419c3545be52eec82c
  Author: Thomas Huth <thuth@redhat.com>
  Date:   2020-12-18 (Fri, 18 Dec 2020)

  Changed paths:
    M include/qemu/compiler.h
    M tcg/optimize.c

  Log Message:
  -----------
  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>


  Commit: 4f07e71bad905acc40771b81759ff10850325d99
      
https://github.com/qemu/qemu/commit/4f07e71bad905acc40771b81759ff10850325d99
  Author: Thomas Huth <thuth@redhat.com>
  Date:   2020-12-18 (Fri, 18 Dec 2020)

  Changed paths:
    M tests/fp/meson.build

  Log Message:
  -----------
  tests/fp: Do not emit implicit-fallthrough warnings in the softfloat tests

The softfloat tests are external repositories, so we do not care
about implicit fallthrough warnings in this code.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Chen Qun <kuhn.chenqun@huawei.com>
Message-Id: <20201211152426.350966-12-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>


  Commit: 484bed05748d572a851e08412e4fb6bca8814342
      
https://github.com/qemu/qemu/commit/484bed05748d572a851e08412e4fb6bca8814342
  Author: Thomas Huth <thuth@redhat.com>
  Date:   2020-12-18 (Fri, 18 Dec 2020)

  Changed paths:
    M bsd-user/main.c

  Log Message:
  -----------
  bsd-user: Silence warnings about missing fallthrough statement

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>


  Commit: 61e21b05de63e044dcc24b37ecec7514e326f62c
      
https://github.com/qemu/qemu/commit/61e21b05de63e044dcc24b37ecec7514e326f62c
  Author: Philippe Mathieu-Daudé <f4bug@amsat.org>
  Date:   2020-12-18 (Fri, 18 Dec 2020)

  Changed paths:
    M hw/rtc/twl92230.c

  Log Message:
  -----------
  hw/rtc/twl92230: Add missing 'break'

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>


  Commit: 0a2ebce92a3f10a89843e4a7a8e2f2eba4f7b109
      
https://github.com/qemu/qemu/commit/0a2ebce92a3f10a89843e4a7a8e2f2eba4f7b109
  Author: Thomas Huth <thuth@redhat.com>
  Date:   2020-12-18 (Fri, 18 Dec 2020)

  Changed paths:
    M configure

  Log Message:
  -----------
  configure: Compile with -Wimplicit-fallthrough=2

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>


  Commit: 65a3c5984074313602fb5f61cc5f464abfb020c7
      
https://github.com/qemu/qemu/commit/65a3c5984074313602fb5f61cc5f464abfb020c7
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2020-12-30 (Wed, 30 Dec 2020)

  Changed paths:
    M accel/tcg/user-exec.c
    M bsd-user/main.c
    M configure
    M disas/libvixl/vixl/a64/disasm-a64.cc
    M disas/libvixl/vixl/globals.h
    M hw/intc/arm_gicv3_kvm.c
    M hw/rtc/twl92230.c
    M hw/timer/renesas_tmr.c
    M include/qemu/compiler.h
    M target/i386/tcg/translate.c
    M target/sparc/translate.c
    M target/sparc/win_helper.c
    M target/unicore32/translate.c
    M tcg/optimize.c
    M tests/fp/meson.build

  Log Message:
  -----------
  Merge remote-tracking branch 
'remotes/huth-gitlab/tags/pull-request-2020-12-18' into staging

* Compile QEMU with -Wimplicit-fallthrough=2 to avoid bugs in
  switch-case statements

# gpg: Signature made Fri 18 Dec 2020 08:19:04 GMT
# gpg:                using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg:                issuer "thuth@redhat.com"
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [full]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* remotes/huth-gitlab/tags/pull-request-2020-12-18:
  configure: Compile with -Wimplicit-fallthrough=2
  hw/rtc/twl92230: Add missing 'break'
  bsd-user: Silence warnings about missing fallthrough statement
  tests/fp: Do not emit implicit-fallthrough warnings in the softfloat tests
  tcg/optimize: Add fallthrough annotations
  target/sparc/win_helper: silence the compiler warnings
  target/sparc/translate: silence the compiler warnings
  accel/tcg/user-exec: silence the compiler warnings
  hw/intc/arm_gicv3_kvm: silence the compiler warnings
  target/i386: silence the compiler warnings in gen_shiftd_rm_T1
  hw/timer/renesas_tmr: silence the compiler warnings
  hw/rtc/twl92230: Silence warnings about missing fallthrough statements
  target/unicore32/translate: Add missing fallthrough annotations
  disas/libvixl: Fix fall-through annotation for GCC >= 7

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/a05f8ecd88f1...65a3c5984074



reply via email to

[Prev in Thread] Current Thread [Next in Thread]