qemu-commits
[Top][All Lists]
Advanced

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

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


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 496066: disas/libvixl: Fix fall-through annotation for GCC...
Date: Wed, 16 Dec 2020 11:19:13 -0800

  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: 49606664ff1d38ea000bb278a26fba06fc3fdd12
      
https://github.com/qemu/qemu/commit/49606664ff1d38ea000bb278a26fba06fc3fdd12
  Author: Thomas Huth <thuth@redhat.com>
  Date:   2020-12-16 (Wed, 16 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: 73598380e582cf03197cb32f991ee7792b3a6373
      
https://github.com/qemu/qemu/commit/73598380e582cf03197cb32f991ee7792b3a6373
  Author: Thomas Huth <thuth@redhat.com>
  Date:   2020-12-16 (Wed, 16 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: 550d9dde8cff354460b4cdf3ba125cd5246bb747
      
https://github.com/qemu/qemu/commit/550d9dde8cff354460b4cdf3ba125cd5246bb747
  Author: Thomas Huth <thuth@redhat.com>
  Date:   2020-12-16 (Wed, 16 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: 1ee3e492ffeed8ecc38962c2f0de8520a2db5ef5
      
https://github.com/qemu/qemu/commit/1ee3e492ffeed8ecc38962c2f0de8520a2db5ef5
  Author: Chen Qun <kuhn.chenqun@huawei.com>
  Date:   2020-12-16 (Wed, 16 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: 7bafe3f795412cd27e80888b41ee9254f02afdda
      
https://github.com/qemu/qemu/commit/7bafe3f795412cd27e80888b41ee9254f02afdda
  Author: Chen Qun <kuhn.chenqun@huawei.com>
  Date:   2020-12-16 (Wed, 16 Dec 2020)

  Changed paths:
    M target/i386/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: bf0d935ff3c2efd359a6637ac432118e3a29fcdb
      
https://github.com/qemu/qemu/commit/bf0d935ff3c2efd359a6637ac432118e3a29fcdb
  Author: Chen Qun <kuhn.chenqun@huawei.com>
  Date:   2020-12-16 (Wed, 16 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: 3d6b3ea7603402d1095c3b27a285a5fae131ef77
      
https://github.com/qemu/qemu/commit/3d6b3ea7603402d1095c3b27a285a5fae131ef77
  Author: Chen Qun <kuhn.chenqun@huawei.com>
  Date:   2020-12-16 (Wed, 16 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: cfb75bfac8acc89e692ebb026460dee536ac5fd4
      
https://github.com/qemu/qemu/commit/cfb75bfac8acc89e692ebb026460dee536ac5fd4
  Author: Chen Qun <kuhn.chenqun@huawei.com>
  Date:   2020-12-16 (Wed, 16 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: f4292b4834f0aff5a5018b9c25406c209712c60a
      
https://github.com/qemu/qemu/commit/f4292b4834f0aff5a5018b9c25406c209712c60a
  Author: Chen Qun <kuhn.chenqun@huawei.com>
  Date:   2020-12-16 (Wed, 16 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: bfc99ade6ec6f71923d0c9905c59edd1be2afc1f
      
https://github.com/qemu/qemu/commit/bfc99ade6ec6f71923d0c9905c59edd1be2afc1f
  Author: Thomas Huth <thuth@redhat.com>
  Date:   2020-12-16 (Wed, 16 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: 0f87ba4c83688e5c3c53519032cc45d2b495fc17
      
https://github.com/qemu/qemu/commit/0f87ba4c83688e5c3c53519032cc45d2b495fc17
  Author: Thomas Huth <thuth@redhat.com>
  Date:   2020-12-16 (Wed, 16 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: cbbedfeeb77e25b065f8a2b0c33e81403edaf728
      
https://github.com/qemu/qemu/commit/cbbedfeeb77e25b065f8a2b0c33e81403edaf728
  Author: Thomas Huth <thuth@redhat.com>
  Date:   2020-12-16 (Wed, 16 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: 908ae6ed8a2ba6cfcfe0cdf43fafb84677494fe8
      
https://github.com/qemu/qemu/commit/908ae6ed8a2ba6cfcfe0cdf43fafb84677494fe8
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2020-12-16 (Wed, 16 Dec 2020)

  Changed paths:
    M accel/tcg/user-exec.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/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-16' into staging

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

# gpg: Signature made Wed 16 Dec 2020 17:18:23 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-16:
  configure: Compile with -Wimplicit-fallthrough=2
  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/87dab3125789...908ae6ed8a2b



reply via email to

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