Skip to contentSkip to conversation

Strict disable implicit fallthrough

RFC PATCH In review Emmanouil Pitsidianakis 18 participants 104 messages Oct 13, 2023 – Nov 15, 2023

Subsystems (9)
lore
Share & tools
lore
#0 lore raw

v3 cover Strict disable implicit fallthrough

--
Resending because --function-context was accidentally used in the previous version. Sincere apologies for the noise.
--

Hello,

This RFC is inspired by the kernel's move to -Wimplicit-fallthrough=3 back in 2019.[0]
We take one step (or two) further by increasing it to 5 which rejects fall through comments and requires an attribute statement.

[0]:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a035d552a93b

The line differences are not many, but they spread all over different subsystems, architectures and devices. An attempt has been made to split them in cohesive patches to aid post-RFC review. Part of the RFC is to determine whether these patch divisions needs improvement.

Main questions this RFC poses
=============================

- Is this change desirable and net-positive.
- Should the fallthrough; pseudo-keyword be defined like in the Linux kernel, or use glib's G_GNUC_FALLTHROUGH, or keep the already existing QEMU_FALLTHROUGH macro.
- Should fallthrough comments be removed if they do not include extra information.

Some external resources
=======================

See the RFC discussion in the kernel:

https://lore.kernel.org/lkml/1d2830aadbe9d8151728a7df5b88528fc72a0095.1564549413.git.joe@perches.com/

The fallthrough; pseudo-keyword in the kernel source code:

https://elixir.bootlin.com/linux/latest/C/ident/fallthrough

In summary, I quote the doc comment and definition:

/*
* Add the pseudo keyword 'fallthrough' so case statement blocks
* must end with any of these keywords:
* break;
* fallthrough;
* continue;
* goto <label>;
* return [expression];
*
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#Statement-Attributes
*/
#if __has_attribute(__fallthrough__)
# define fallthrough __attribute__((__fallthrough__))
#else
# define fallthrough do {} while (0) /* fallthrough */
#endif

Background - Motivation
=======================

The C switch statement allows you to conditionally goto different labels depending on a value. A break; statement conveniently goto's the end of the switch. If a "case" does not end in a break, we say that the control flow falls through the next case label, if any, implicitly. This can lead to bugs and QEMU uses the GCC warning -Wimplicit-fallthrough to prevent this.

Currently, QEMU is built with -Wimplicit-fallthrough=2. This makes GCC's static analyzer check for a case-insensitive matches of the .*falls?[ \t-]*thr(ough|u).* regular expression. This means the following list of comments taken from QEMU all disable the implicit fallthrough warning:

- /* FALLTHRU */
- /* fall through */
- /* Fall through. */
- /* Fall through... */
- /* fall through if hEventTimeout is signaled */
- /* FALL THROUGH */

To keep a constistent code style, this commit adds a macro fallthrough that looks like a C keyword but expands to an attribute statement in supported compilers (GCC at the moment).

Note: there was already such a macro, QEMU_FALLTHROUGH, and it was used only around 7 times in the code base. The first commit replaces it.

Emmanouil Pitsidianakis (78):
include/qemu/compiler.h: replace QEMU_FALLTHROUGH with fallthrough
block: add fallthrough pseudo-keyword
fpu/softfloat: add fallthrough pseudo-keyword qapi/opts-visitor: add fallthrough pseudo-keyword qobject/json: add fallthrough pseudo-keyword
tcg: add fallthrough pseudo-keyword hw/virtio/virtio-balloon.c: add fallthrough pseudo-keyword hw/block: add fallthrough pseudo-keyword hw/acpi/aml-build.c: add fallthrough pseudo-keyword hw/ide/atapi.c: add fallthrough pseudo-keyword hw/timer: add fallthrough pseudo-keyword
hw/usb: add fallthrough pseudo-keyword
hw/adc: add fallthrough pseudo-keyword util/error-report.c: add fallthrough pseudo-keyword accel/tcg: add fallthrough pseudo-keyword
audio: add fallthrough pseudo-keyword
ui/sdl2.c: add fallthrough pseudo-keyword ui/win32-kbd-hook.c: add fallthrough pseudo-keyword target/hppa: add fallthrough pseudo-keyword target/mips: add fallthrough pseudo-keyword target/sparc: add fallthrough pseudo-keyword target/ppc: add fallthrough pseudo-keyword
target/arm: add fallthrough pseudo-keyword target/alpha: add fallthrough pseudo-keyword target/i386: add fallthrough pseudo-keyword target/s390x: add fallthrough pseudo-keyword target/riscv: add fallthrough pseudo-keyword target/avr: add fallthrough pseudo-keyword
target/cris: add fallthrough pseudo-keyword target/nios2: add fallthrough pseudo-keyword target/xtensa: add fallthrough pseudo-keyword target/m68k: add fallthrough pseudo-keyword
target/rx: add fallthrough pseudo-keyword target/tricore: add fallthrough pseudo-keyword target/sh4: add fallthrough pseudo-keyword target/openrisc: add fallthrough pseudo-keyword target/hexagon: add fallthrough pseudo-keyword system/rtc.c: add fallthrough pseudo-keyword
hw/scsi: add fallthrough pseudo-keyword
hw/sd/sdhci.c: add fallthrough pseudo-keyword
linux-user: add fallthrough pseudo-keyword
hw/i386: add fallthrough pseudo-keyword
hw/misc: add fallthrough pseudo-keyword hw/m68k/mcf_intc.c: add fallthrough pseudo-keyword hw/dma: add fallthrough pseudo-keyword
disas: add fallthrough pseudo-keyword contrib/rdmacm-mux: add fallthrough pseudo-keyword contrib/vhost-user-scsi: add fallthrough pseudo-keyword hw/arm: add fallthrough pseudo-keyword
hw/audio: add fallthrough pseudo-keyword
chardev: add fallthrough pseudo-keyword
hw/char: add fallthrough pseudo-keyword
nbd: add fallthrough pseudo-keyword
hw/core: add fallthrough pseudo-keyword
hw/display: add fallthrough pseudo-keyword
hw/input: add fallthrough pseudo-keyword
hw/net: add fallthrough pseudo-keyword
hw/ppc: add fallthrough pseudo-keyword
hw/intc: add fallthrough pseudo-keyword
qga: add fallthrough pseudo-keyword
semihosting: add fallthrough pseudo-keyword
hw/gpio: add fallthrough pseudo-keyword
hw/ipmi: add fallthrough pseudo-keyword
hw/mips: add fallthrough pseudo-keyword
hw/nvme: add fallthrough pseudo-keyword hw/nvram/eeprom_at24c.c: add fallthrough pseudo-keyword hw/pci-host/pnv_phb3.c: add fallthrough pseudo-keyword hw/pci: add fallthrough pseudo-keyword hw/rdma/rdma_backend.c: add fallthrough pseudo-keyword hw/rtc: add fallthrough pseudo-keyword
hw/s390x: add fallthrough pseudo-keyword
hw/ssi: add fallthrough pseudo-keyword hw/watchdog/wdt_diag288.c: add fallthrough pseudo-keyword hw/cxl/cxl-device-utils.c: add fallthrough pseudo-keyword
migration: add fallthrough pseudo-keyword
qemu-img.c: add fallthrough pseudo-keyword tests/unit/test-char.c: add fallthrough pseudo-keyword meson.build: increase -Wimplicit-fallthrough to 5

 accel/tcg/cputlb.c                          |  4 +-
 accel/tcg/ldst_atomicity.c.inc              |  2 +-
 accel/tcg/plugin-gen.c                      |  2 +-
 audio/audio.c                               | 16 ++--
 audio/jackaudio.c                           |  4 +-
 audio/pwaudio.c                             | 12 +--
 block/block-copy.c                          |  1 +
 block/file-posix.c                          |  1 +
 block/io.c                                  |  1 +
 block/iscsi.c                               |  1 +
 block/qcow2-cluster.c                       |  5 +-
 block/vhdx.c                                | 17 +++-
 chardev/char-socket.c                       |  2 +-
 contrib/rdmacm-mux/main.c                   | 10 +--
 contrib/vhost-user-scsi/vhost-user-scsi.c   |  3 +-
 disas/hppa.c                                |  4 +-
 disas/m68k.c                                |  2 +-
 disas/sh4.c                                 |  6 +-
 disas/sparc.c                               |  2 +-
 docs/devel/style.rst                        | 23 +++++
 fpu/softfloat-parts.c.inc                   |  8 +-
 fpu/softfloat.c                             |  7 +-
 hw/acpi/aml-build.c                         |  6 +-
 hw/adc/aspeed_adc.c                         | 12 +--
 hw/adc/zynq-xadc.c                          |  2 +-
 hw/arm/omap1.c                              |  8 +-
 hw/arm/pxa2xx.c                             |  6 +-
 hw/arm/smmuv3.c                             |  2 +-
 hw/arm/stellaris.c                          |  1 +
 hw/audio/asc.c                              |  2 +-
 hw/audio/cs4231a.c                          |  2 +-
 hw/audio/gusemu_hal.c                       |  2 +-
 hw/block/dataplane/xen-block.c              |  4 +-
 hw/block/m25p80.c                           |  2 +-
 hw/block/onenand.c                          |  2 +-
 hw/block/pflash_cfi01.c                     |  1 +
 hw/block/pflash_cfi02.c                     |  6 +-
 hw/char/nrf51_uart.c                        |  4 +-
 hw/core/loader.c                            |  2 +-
 hw/cxl/cxl-device-utils.c                   |  4 +-
 hw/display/cg3.c                            |  2 +-
 hw/display/cirrus_vga.c                     |  2 +-
 hw/display/tcx.c                            |  4 +-
 hw/dma/omap_dma.c                           | 32 +++----
 hw/dma/pxa2xx_dma.c                         |  4 +-
 hw/dma/sparc32_dma.c                        |  2 +-
 hw/gpio/omap_gpio.c                         |  2 +-
 hw/i2c/bitbang_i2c.c                        |  2 +-
 hw/i386/intel_iommu.c                       |  4 +-
 hw/i386/kvm/xen_evtchn.c                    |  2 +-
 hw/i386/x86.c                               |  2 +-
 hw/ide/atapi.c                              |  1 +
 hw/input/hid.c                              |  3 +-
 hw/input/tsc2005.c                          |  4 +-
 hw/input/tsc210x.c                          |  2 +-
 hw/intc/apic.c                              |  2 +-
 hw/intc/arm_gicv3_kvm.c                     | 16 ++--
 hw/intc/armv7m_nvic.c                       | 12 +--
 hw/intc/xilinx_intc.c                       |  2 +-
 hw/ipmi/ipmi_bmc_extern.c                   |  2 +-
 hw/ipmi/smbus_ipmi.c                        |  4 +-
 hw/m68k/mcf_intc.c                          |  2 +-
 hw/mips/boston.c                            | 12 +--
 hw/misc/a9scu.c                             |  2 +
 hw/misc/aspeed_scu.c                        |  2 +-
 hw/misc/bcm2835_property.c                  | 12 +--
 hw/misc/mos6522.c                           |  4 +-
 hw/net/cadence_gem.c                        |  4 +-
 hw/net/can/can_sja1000.c                    |  4 +-
 hw/net/igb_core.c                           |  2 +-
 hw/net/igbvf.c                              |  2 +-
 hw/net/imx_fec.c                            |  2 +-
 hw/net/net_rx_pkt.c                         |  2 +-
 hw/net/pcnet.c                              |  2 +-
 hw/net/rtl8139.c                            |  6 +-
 hw/net/xilinx_ethlite.c                     |  2 +-
 hw/nvme/ctrl.c                              | 24 +++---
 hw/nvme/dif.c                               |  4 +-
 hw/nvram/eeprom_at24c.c                     |  2 +-
 hw/pci-host/pnv_phb3.c                      |  2 +-
 hw/pci/pcie_aer.c                           |  3 +-
 hw/pci/pcie_doe.c                           |  2 +-
 hw/ppc/pnv_bmc.c                            |  2 +-
 hw/ppc/spapr_events.c                       |  1 +
 hw/rdma/rdma_backend.c                      |  2 +-
 hw/rtc/aspeed_rtc.c                         |  4 +-
 hw/rtc/mc146818rtc.c                        |  4 +-
 hw/s390x/ipl.c                              |  1 +
 hw/s390x/s390-pci-inst.c                    |  4 +-
 hw/s390x/sclp.c                             |  4 +-
 hw/scsi/esp.c                               |  2 +-
 hw/scsi/megasas.c                           |  2 +-
 hw/scsi/scsi-bus.c                          |  4 +-
 hw/scsi/scsi-disk.c                         |  2 +-
 hw/sd/sdhci.c                               |  8 +-
 hw/ssi/npcm7xx_fiu.c                        | 14 +--
 hw/ssi/omap_spi.c                           | 48 +++++------
 hw/timer/a9gtimer.c                         |  8 +-
 hw/timer/aspeed_timer.c                     |  1 +
 hw/timer/pxa2xx_timer.c                     | 94 ++++++++++-----------
 hw/timer/renesas_tmr.c                      |  2 +-
 hw/timer/sh_timer.c                         |  8 +-
 hw/usb/dev-mtp.c                            |  2 +-
 hw/usb/dev-wacom.c                          |  2 +-
 hw/usb/hcd-ehci.c                           |  4 +-
 hw/usb/hcd-xhci.c                           |  4 +-
 hw/usb/redirect.c                           |  4 +-
 hw/usb/tusb6010.c                           |  2 +-
 hw/virtio/virtio-balloon.c                  |  1 +
 hw/watchdog/wdt_diag288.c                   |  2 +-
 include/qemu/compiler.h                     | 30 +++++--
 include/qemu/osdep.h                        |  4 +-
 linux-user/mips/cpu_loop.c                  |  8 +-
 linux-user/mmap.c                           |  2 +-
 linux-user/syscall.c                        |  2 +-
 meson.build                                 |  2 +-
 migration/migration.c                       |  2 +-
 nbd/client.c                                |  4 +-
 nbd/common.c                                |  2 +-
 qapi/opts-visitor.c                         |  1 +
 qapi/string-input-visitor.c                 |  4 +-
 qemu-img.c                                  |  2 +-
 qemu-nbd.c                                  |  4 +-
 qga/main.c                                  |  2 +-
 qga/vss-win32/requester.cpp                 |  1 +
 qobject/json-lexer.c                        |  4 +-
 qobject/json-parser.c                       |  5 +-
 semihosting/arm-compat-semi.c               |  2 +-
 system/rtc.c                                |  2 +-
 target/alpha/helper.c                       |  6 +-
 target/alpha/translate.c                    |  4 +-
 target/arm/helper.c                         | 34 ++++----
 target/arm/ptw.c                            | 10 +--
 target/arm/tcg/psci.c                       |  2 +-
 target/arm/tcg/translate-a64.c              | 76 ++++++++---------
 target/arm/tcg/translate-m-nocp.c           |  2 +-
 target/arm/tcg/translate-vfp.c              |  2 +-
 target/arm/tcg/translate.c                  |  8 +-
 target/avr/translate.c                      |  4 +-
 target/cris/translate.c                     |  4 +-
 target/hexagon/idef-parser/parser-helpers.c |  5 +-
 target/hppa/translate.c                     | 10 +--
 target/i386/cpu.c                           |  2 +-
 target/i386/hvf/x86_decode.c                |  1 +
 target/i386/kvm/kvm.c                       |  4 +-
 target/i386/tcg/decode-new.c.inc            |  6 +-
 target/i386/tcg/emit.c.inc                  |  2 +-
 target/i386/tcg/translate.c                 | 11 +--
 target/loongarch/cpu.c                      |  4 +-
 target/loongarch/translate.c                |  2 +-
 target/m68k/op_helper.c                     |  3 +-
 target/m68k/translate.c                     | 10 +--
 target/mips/sysemu/physaddr.c               |  2 +-
 target/mips/tcg/micromips_translate.c.inc   |  4 +-
 target/mips/tcg/mips16e_translate.c.inc     | 30 +++----
 target/mips/tcg/mxu_translate.c             |  8 +-
 target/mips/tcg/nanomips_translate.c.inc    |  4 +-
 target/mips/tcg/op_helper.c                 |  2 +-
 target/mips/tcg/translate.c                 | 79 ++++++++---------
 target/nios2/helper.c                       |  6 +-
 target/nios2/translate.c                    |  2 +-
 target/openrisc/mmu.c                       |  2 +-
 target/openrisc/translate.c                 |  2 +-
 target/ppc/cpu_init.c                       |  8 +-
 target/ppc/excp_helper.c                    |  6 +-
 target/ppc/mmu-radix64.c                    |  6 +-
 target/ppc/mmu_common.c                     | 12 +--
 target/ppc/translate.c                      |  6 +-
 target/riscv/insn_trans/trans_rvi.c.inc     |  2 +-
 target/riscv/insn_trans/trans_rvzce.c.inc   | 22 ++---
 target/riscv/translate.c                    |  4 +-
 target/rx/translate.c                       |  2 +-
 target/s390x/cpu.c                          |  4 +-
 target/s390x/kvm/kvm.c                      |  2 +-
 target/s390x/mmu_helper.c                   |  6 +-
 target/s390x/tcg/translate.c                | 18 ++--
 target/s390x/tcg/translate_vx.c.inc         |  2 +-
 target/sh4/helper.c                         |  2 +-
 target/sparc/ldst_helper.c                  |  4 +-
 target/sparc/mmu_helper.c                   |  6 +-
 target/sparc/translate.c                    |  3 +-
 target/sparc/win_helper.c                   |  1 +
 target/tricore/translate.c                  |  4 +-
 target/xtensa/op_helper.c                   |  8 +-
 target/xtensa/translate.c                   |  2 +-
 tcg/aarch64/tcg-target.c.inc                | 15 +++-
 tcg/arm/tcg-target.c.inc                    |  5 +-
 tcg/i386/tcg-target.c.inc                   | 20 +++--
 tcg/loongarch64/tcg-target.c.inc            |  4 +-
 tcg/mips/tcg-target.c.inc                   |  8 +-
 tcg/optimize.c                              |  8 +-
 tcg/ppc/tcg-target.c.inc                    | 19 +++--
 tcg/riscv/tcg-target.c.inc                  |  5 +-
 tcg/s390x/tcg-target.c.inc                  |  8 +-
 tcg/tcg-op-gvec.c                           | 24 +++---
 tcg/tcg-op-ldst.c                           |  2 +-
 tcg/tcg.c                                   | 24 +++---
 tcg/tci.c                                   |  2 +-
 tcg/tci/tcg-target.c.inc                    |  2 +-
 tests/unit/test-char.c                      |  2 +-
 ui/sdl2.c                                   |  2 +-
 ui/win32-kbd-hook.c                         |  7 --
 util/error-report.c                         |  2 +-
 203 files changed, 747 insertions(+), 618 deletions(-)

base-commit: cea3ea670fe265421131aad90c36fbb87bc4d206

Signature · 1 line
2.39.2
#1 lore raw

RFC PATCH v3 1/78 include/qemu/compiler.h: replace QEMU_FALLTHROUGH with fallthrough

---
 audio/pwaudio.c              |  8 ++++----
 hw/arm/smmuv3.c              |  2 +-
 include/qemu/compiler.h      | 30 +++++++++++++++++++++++-------
 include/qemu/osdep.h         |  4 ++--
 target/loongarch/cpu.c       |  4 ++--
 target/loongarch/translate.c |  2 +-
 tcg/optimize.c               |  8 ++++----
 7 files changed, 37 insertions(+), 21 deletions(-)
audio/pwaudio.c +4 -4
index 3ce5f6507b..bf26fadb06 100644
@@ -8,16 +8,16 @@
  * SPDX-License-Identifier: GPL-2.0-or-later
  */
 
+#include <spa/param/audio/format-utils.h>
+#include <spa/utils/ringbuffer.h>
+#include <spa/utils/result.h>
+#include <spa/param/props.h>
 #include "qemu/osdep.h"
 #include "qemu/module.h"
 #include "audio.h"
 #include <errno.h>
 #include "qemu/error-report.h"
 #include "qapi/error.h"
-#include <spa/param/audio/format-utils.h>
-#include <spa/utils/ringbuffer.h>
-#include <spa/utils/result.h>
-#include <spa/param/props.h>
 
 #include <pipewire/pipewire.h>
 #include "trace.h"
hw/arm/smmuv3.c +1 -1
index 6f2b2bd45f..545d82ff04 100644
@@ -1291,7 +1291,7 @@ static int smmuv3_cmdq_consume(SMMUv3State *s)
                 cmd_error = SMMU_CERROR_ILL;
                 break;
             }
-            QEMU_FALLTHROUGH;
+            fallthrough;
         case SMMU_CMD_TLBI_NSNH_ALL:
             trace_smmuv3_cmdq_tlbi_nh();
             smmu_inv_notifiers_all(&s->smmu_state);
include/qemu/compiler.h +23 -7
index 1109482a00..959982805d 100644
@@ -165,15 +165,31 @@
 #define QEMU_ALWAYS_INLINE
 #endif
 
-/**
- * In most cases, normal "fallthrough" comments are good enough for
- * switch-case statements, but sometimes the compiler has problems
- * with those. In that case you can use QEMU_FALLTHROUGH instead.
+/*
+ * Add the pseudo keyword 'fallthrough' so case statement blocks
+ * must end with any of these keywords:
+ *   break;
+ *   fallthrough;
+ *   continue;
+ *   goto <label>;
+ *   return [expression];
+ *
+ *  gcc: https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#Statement-Attributes
  */
-#if __has_attribute(fallthrough)
-# define QEMU_FALLTHROUGH __attribute__((fallthrough))
+
+/*
+ * glib_macros.h contains its own definition of fallthrough, so if we define
+ * the pseudokeyword here it will expand when the glib header checks for the
+ * attribute. glib headers must be #included after this header.
+ */
+#ifdef fallthrough
+#undef fallthrough
+#endif
+
+#if __has_attribute(__fallthrough__)
+# define fallthrough                    __attribute__((__fallthrough__))
 #else
-# define QEMU_FALLTHROUGH do {} while (0) /* fallthrough */
+# define fallthrough                    do {} while (0)  /* fallthrough */
 #endif
 
 #ifdef CONFIG_CFI
include/qemu/osdep.h +2 -2
index 475a1c62ff..8f790f0deb 100644
@@ -50,8 +50,6 @@
  */
 #pragma GCC poison TARGET_WORDS_BIGENDIAN
 
-#include "qemu/compiler.h"
-
 /* Older versions of C++ don't get definitions of various macros from
  * stdlib.h unless we define these macros before first inclusion of
  * that system header.
@@ -160,6 +158,8 @@ QEMU_EXTERN_C int daemon(int, int);
  */
 #include "glib-compat.h"
 
+#include "qemu/compiler.h"
+
 #ifdef _WIN32
 #include "sysemu/os-win32.h"
 #endif
target/loongarch/cpu.c +2 -2
index 2bea7ca5d5..e01d626b15 100644
@@ -178,7 +178,7 @@ static void loongarch_cpu_do_interrupt(CPUState *cs)
             env->CSR_DBG = FIELD_DP64(env->CSR_DBG, CSR_DBG, DEI, 1);
             goto set_DERA;
         }
-        QEMU_FALLTHROUGH;
+        fallthrough;
     case EXCCODE_PIF:
     case EXCCODE_ADEF:
         cause = cs->exception_index;
@@ -193,7 +193,7 @@ static void loongarch_cpu_do_interrupt(CPUState *cs)
     case EXCCODE_SXD:
     case EXCCODE_ASXD:
         env->CSR_BADV = env->pc;
-        QEMU_FALLTHROUGH;
+        fallthrough;
     case EXCCODE_BCE:
     case EXCCODE_ADEM:
     case EXCCODE_PIL:
target/loongarch/translate.c +1 -1
index 21f4db6fbd..36fceb1beb 100644
@@ -317,7 +317,7 @@ static void loongarch_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
         break;
     case DISAS_EXIT_UPDATE:
         tcg_gen_movi_tl(cpu_pc, ctx->base.pc_next);
-        QEMU_FALLTHROUGH;
+        fallthrough;
     case DISAS_EXIT:
         tcg_gen_exit_tb(NULL, 0);
         break;
tcg/optimize.c +4 -4
index 3013eb04e6..3da135a353 100644
@@ -1089,7 +1089,7 @@ static bool fold_brcond2(OptContext *ctx, TCGOp *op)
 
     case TCG_COND_NE:
         inv = 1;
-        QEMU_FALLTHROUGH;
+        fallthrough;
     case TCG_COND_EQ:
         /*
          * Simplify EQ/NE comparisons where one of the pairs
@@ -1445,7 +1445,7 @@ static bool fold_exts(OptContext *ctx, TCGOp *op)
         break;
     case INDEX_op_ext_i32_i64:
         type_change = true;
-        QEMU_FALLTHROUGH;
+        fallthrough;
     case INDEX_op_ext32s_i64:
         sign = INT32_MIN;
         z_mask = (uint32_t)z_mask;
@@ -1489,7 +1489,7 @@ static bool fold_extu(OptContext *ctx, TCGOp *op)
     case INDEX_op_extrl_i64_i32:
     case INDEX_op_extu_i32_i64:
         type_change = true;
-        QEMU_FALLTHROUGH;
+        fallthrough;
     case INDEX_op_ext32u_i64:
         z_mask = (uint32_t)z_mask;
         break;
@@ -1861,7 +1861,7 @@ static bool fold_setcond2(OptContext *ctx, TCGOp *op)
 
     case TCG_COND_NE:
         inv = 1;
-        QEMU_FALLTHROUGH;
+        fallthrough;
     case TCG_COND_EQ:
         /*
          * Simplify EQ/NE comparisons where one of the pairs
Signature · 1 line
2.39.2
Reviewed-by on v3 1/78
#2 lore raw

Re: [RFC PATCH v3 01/78] include/qemu/compiler.h: replace QEMU_FALLTHROUGH with fallthrough

Quoted 10 lines · Emmanouil Pitsidianakis
---
  audio/pwaudio.c              |  8 ++++----
  hw/arm/smmuv3.c              |  2 +-
  include/qemu/compiler.h      | 30 +++++++++++++++++++++++-------
  include/qemu/osdep.h         |  4 ++--
  target/loongarch/cpu.c       |  4 ++--
  target/loongarch/translate.c |  2 +-
  tcg/optimize.c               |  8 ++++----
  7 files changed, 37 insertions(+), 21 deletions(-)

For LoongArch:

Thanks.
Song Gao.

Quoted 178 lines
audio/pwaudio.c +4 -4
index 3ce5f6507b..bf26fadb06 100644
@@ -8,16 +8,16 @@
   * SPDX-License-Identifier: GPL-2.0-or-later
   */
 
+#include <spa/param/audio/format-utils.h>
+#include <spa/utils/ringbuffer.h>
+#include <spa/utils/result.h>
+#include <spa/param/props.h>
  #include "qemu/osdep.h"
  #include "qemu/module.h"
  #include "audio.h"
  #include <errno.h>
  #include "qemu/error-report.h"
  #include "qapi/error.h"
-#include <spa/param/audio/format-utils.h>
-#include <spa/utils/ringbuffer.h>
-#include <spa/utils/result.h>
-#include <spa/param/props.h>
 
  #include <pipewire/pipewire.h>
  #include "trace.h"
hw/arm/smmuv3.c +1 -1
index 6f2b2bd45f..545d82ff04 100644
@@ -1291,7 +1291,7 @@ static int smmuv3_cmdq_consume(SMMUv3State *s)
                  cmd_error = SMMU_CERROR_ILL;
                  break;
              }
-            QEMU_FALLTHROUGH;
+            fallthrough;
          case SMMU_CMD_TLBI_NSNH_ALL:
              trace_smmuv3_cmdq_tlbi_nh();
              smmu_inv_notifiers_all(&s->smmu_state);
include/qemu/compiler.h +23 -7
index 1109482a00..959982805d 100644
@@ -165,15 +165,31 @@
  #define QEMU_ALWAYS_INLINE
  #endif
 
-/**
- * In most cases, normal "fallthrough" comments are good enough for
- * switch-case statements, but sometimes the compiler has problems
- * with those. In that case you can use QEMU_FALLTHROUGH instead.
+/*
+ * Add the pseudo keyword 'fallthrough' so case statement blocks
+ * must end with any of these keywords:
+ *   break;
+ *   fallthrough;
+ *   continue;
+ *   goto <label>;
+ *   return [expression];
+ *
+ *  gcc: https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#Statement-Attributes
   */
-#if __has_attribute(fallthrough)
-# define QEMU_FALLTHROUGH __attribute__((fallthrough))
+
+/*
+ * glib_macros.h contains its own definition of fallthrough, so if we define
+ * the pseudokeyword here it will expand when the glib header checks for the
+ * attribute. glib headers must be #included after this header.
+ */
+#ifdef fallthrough
+#undef fallthrough
+#endif
+
+#if __has_attribute(__fallthrough__)
+# define fallthrough                    __attribute__((__fallthrough__))
  #else
-# define QEMU_FALLTHROUGH do {} while (0) /* fallthrough */
+# define fallthrough                    do {} while (0)  /* fallthrough */
  #endif
 
  #ifdef CONFIG_CFI
include/qemu/osdep.h +2 -2
index 475a1c62ff..8f790f0deb 100644
@@ -50,8 +50,6 @@
   */
  #pragma GCC poison TARGET_WORDS_BIGENDIAN
 
-#include "qemu/compiler.h"
-
  /* Older versions of C++ don't get definitions of various macros from
   * stdlib.h unless we define these macros before first inclusion of
   * that system header.
@@ -160,6 +158,8 @@ QEMU_EXTERN_C int daemon(int, int);
   */
  #include "glib-compat.h"
 
+#include "qemu/compiler.h"
+
  #ifdef _WIN32
  #include "sysemu/os-win32.h"
  #endif
target/loongarch/cpu.c +2 -2
index 2bea7ca5d5..e01d626b15 100644
@@ -178,7 +178,7 @@ static void loongarch_cpu_do_interrupt(CPUState *cs)
              env->CSR_DBG = FIELD_DP64(env->CSR_DBG, CSR_DBG, DEI, 1);
              goto set_DERA;
          }
-        QEMU_FALLTHROUGH;
+        fallthrough;
      case EXCCODE_PIF:
      case EXCCODE_ADEF:
          cause = cs->exception_index;
@@ -193,7 +193,7 @@ static void loongarch_cpu_do_interrupt(CPUState *cs)
      case EXCCODE_SXD:
      case EXCCODE_ASXD:
          env->CSR_BADV = env->pc;
-        QEMU_FALLTHROUGH;
+        fallthrough;
      case EXCCODE_BCE:
      case EXCCODE_ADEM:
      case EXCCODE_PIL:
target/loongarch/translate.c +1 -1
index 21f4db6fbd..36fceb1beb 100644
@@ -317,7 +317,7 @@ static void loongarch_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
          break;
      case DISAS_EXIT_UPDATE:
          tcg_gen_movi_tl(cpu_pc, ctx->base.pc_next);
-        QEMU_FALLTHROUGH;
+        fallthrough;
      case DISAS_EXIT:
          tcg_gen_exit_tb(NULL, 0);
          break;
tcg/optimize.c +4 -4
index 3013eb04e6..3da135a353 100644
@@ -1089,7 +1089,7 @@ static bool fold_brcond2(OptContext *ctx, TCGOp *op)
 
      case TCG_COND_NE:
          inv = 1;
-        QEMU_FALLTHROUGH;
+        fallthrough;
      case TCG_COND_EQ:
          /*
           * Simplify EQ/NE comparisons where one of the pairs
@@ -1445,7 +1445,7 @@ static bool fold_exts(OptContext *ctx, TCGOp *op)
          break;
      case INDEX_op_ext_i32_i64:
          type_change = true;
-        QEMU_FALLTHROUGH;
+        fallthrough;
      case INDEX_op_ext32s_i64:
          sign = INT32_MIN;
          z_mask = (uint32_t)z_mask;
@@ -1489,7 +1489,7 @@ static bool fold_extu(OptContext *ctx, TCGOp *op)
      case INDEX_op_extrl_i64_i32:
      case INDEX_op_extu_i32_i64:
          type_change = true;
-        QEMU_FALLTHROUGH;
+        fallthrough;
      case INDEX_op_ext32u_i64:
          z_mask = (uint32_t)z_mask;
          break;
@@ -1861,7 +1861,7 @@ static bool fold_setcond2(OptContext *ctx, TCGOp *op)
 
      case TCG_COND_NE:
          inv = 1;
-        QEMU_FALLTHROUGH;
+        fallthrough;
      case TCG_COND_EQ:
          /*
           * Simplify EQ/NE comparisons where one of the pairs
#3 lore raw

RFC PATCH v3 2/78 block: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 block/block-copy.c    |  1 +
 block/file-posix.c    |  1 +
 block/io.c            |  1 +
 block/iscsi.c         |  1 +
 block/qcow2-cluster.c |  5 ++++-
 block/vhdx.c          | 17 +++++++++++++----
 6 files changed, 21 insertions(+), 5 deletions(-)
block/block-copy.c +1 -0
index 1c60368d72..b4ceb6a079 100644
@@ -508,6 +508,7 @@ block_copy_do_copy(BlockCopyState *s, int64_t offset, int64_t bytes,
         trace_block_copy_copy_range_fail(s, offset, ret);
         *method = COPY_READ_WRITE;
         /* Fall through to read+write with allocated buffer */
+        fallthrough;
 
     case COPY_READ_WRITE_CLUSTER:
     case COPY_READ_WRITE:
block/file-posix.c +1 -0
index 50e2b20d5c..31c7719da5 100644
@@ -1013,6 +1013,7 @@ static int raw_handle_perm_lock(BlockDriverState *bs,
                               bs->filename);
         }
         /* fall through to unlock bytes. */
+        fallthrough;
     case RAW_PL_ABORT:
         raw_apply_lock_bytes(s, s->fd, s->perm, ~s->shared_perm,
                              true, &local_err);
block/io.c +1 -0
index e7f9448d5a..cc05457d02 100644
@@ -2034,6 +2034,7 @@ bdrv_co_write_req_finish(BdrvChild *child, int64_t offset, int64_t bytes,
         case BDRV_TRACKED_WRITE:
             stat64_max(&bs->wr_highest_offset, offset + bytes);
             /* fall through, to set dirty bits */
+            fallthrough;
         case BDRV_TRACKED_DISCARD:
             bdrv_set_dirty(bs, offset, bytes);
             break;
block/iscsi.c +1 -0
index 5640c8b565..2fb7037748 100644
@@ -1461,6 +1461,7 @@ static void iscsi_readcapacity_sync(IscsiLun *iscsilun, Error **errp)
                 break;
             }
             /* Fall through and try READ CAPACITY(10) instead.  */
+            fallthrough;
         case TYPE_ROM:
             task = iscsi_readcapacity10_sync(iscsilun->iscsi, iscsilun->lun, 0, 0);
             if (task != NULL && task->status == SCSI_STATUS_GOOD) {
block/qcow2-cluster.c +4 -1
index f4f6cd6ad0..c50143d493 100644
@@ -1333,13 +1333,16 @@ static bool cluster_needs_new_alloc(BlockDriverState *bs, uint64_t l2_entry)
 {
     switch (qcow2_get_cluster_type(bs, l2_entry)) {
     case QCOW2_CLUSTER_NORMAL:
+        fallthrough;
     case QCOW2_CLUSTER_ZERO_ALLOC:
         if (l2_entry & QCOW_OFLAG_COPIED) {
             return false;
         }
-        /* fallthrough */
+        fallthrough;
     case QCOW2_CLUSTER_UNALLOCATED:
+        fallthrough;
     case QCOW2_CLUSTER_COMPRESSED:
+        fallthrough;
     case QCOW2_CLUSTER_ZERO_PLAIN:
         return true;
     default:
block/vhdx.c +13 -4
index a67edcc03e..9000b3fcea 100644
@@ -1201,10 +1201,14 @@ vhdx_co_readv(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
 
             /* check the payload block state */
             switch (s->bat[sinfo.bat_idx] & VHDX_BAT_STATE_BIT_MASK) {
-            case PAYLOAD_BLOCK_NOT_PRESENT: /* fall through */
+            case PAYLOAD_BLOCK_NOT_PRESENT:
+                fallthrough;
             case PAYLOAD_BLOCK_UNDEFINED:
+                fallthrough;
             case PAYLOAD_BLOCK_UNMAPPED:
+                fallthrough;
             case PAYLOAD_BLOCK_UNMAPPED_v095:
+                fallthrough;
             case PAYLOAD_BLOCK_ZERO:
                 /* return zero */
                 qemu_iovec_memset(&hd_qiov, 0, 0, sinfo.bytes_avail);
@@ -1222,6 +1226,7 @@ vhdx_co_readv(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
             case PAYLOAD_BLOCK_PARTIALLY_PRESENT:
                 /* we don't yet support difference files, fall through
                  * to error */
+                fallthrough;
             default:
                 ret = -EIO;
                 goto exit;
@@ -1373,10 +1378,13 @@ vhdx_co_writev(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
                  * data that is not part of this write, so we must pad
                  * the rest of the buffer to zeroes */
                 use_zero_buffers = true;
-                /* fall through */
-            case PAYLOAD_BLOCK_NOT_PRESENT: /* fall through */
+                fallthrough;
+            case PAYLOAD_BLOCK_NOT_PRESENT:
+                fallthrough;
             case PAYLOAD_BLOCK_UNMAPPED:
+                fallthrough;
             case PAYLOAD_BLOCK_UNMAPPED_v095:
+                fallthrough;
             case PAYLOAD_BLOCK_UNDEFINED:
                 bat_prior_offset = sinfo.file_offset;
                 ret = vhdx_allocate_block(bs, s, &sinfo.file_offset,
@@ -1431,7 +1439,7 @@ vhdx_co_writev(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
                     }
                 }
 
-                /* fall through */
+                fallthrough;
             case PAYLOAD_BLOCK_FULLY_PRESENT:
                 /* if the file offset address is in the header zone,
                  * there is a problem */
@@ -1457,6 +1465,7 @@ vhdx_co_writev(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
             case PAYLOAD_BLOCK_PARTIALLY_PRESENT:
                 /* we don't yet support difference files, fall through
                  * to error */
+                fallthrough;
             default:
                 ret = -EIO;
                 goto exit;
Signature · 1 line
2.39.2
Reviewed-by on v3 2/78
#4 lore raw

Re: [RFC PATCH v3 02/78] block: add fallthrough pseudo-keyword

Quoted 4 lines · Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

Quoted 8 lines
---
 block/block-copy.c    |  1 +
 block/file-posix.c    |  1 +
 block/io.c            |  1 +
 block/iscsi.c         |  1 +
 block/qcow2-cluster.c |  5 ++++-
 block/vhdx.c          | 17 +++++++++++++----
 6 files changed, 21 insertions(+), 5 deletions(-)
#5 lore raw

RFC PATCH v3 3/78 fpu/softfloat: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 fpu/softfloat-parts.c.inc | 8 ++++----
 fpu/softfloat.c           | 7 ++++---
 2 files changed, 8 insertions(+), 7 deletions(-)
fpu/softfloat-parts.c.inc +4 -4
index a44649f4f4..df64cc7a29 100644
@@ -181,7 +181,7 @@ static void partsN(uncanon_normal)(FloatPartsN *p, float_status *s,
         break;
     case float_round_to_odd:
         overflow_norm = true;
-        /* fall through */
+        fallthrough;
     case float_round_to_odd_inf:
         if (N > 64 && frac_lsb == 0) {
             inc = p->frac_hi & 1 ? 0 : round_mask;
@@ -1068,7 +1068,7 @@ static int64_t partsN(float_to_sint)(FloatPartsN *p, FloatRoundMode rmode,
     switch (p->cls) {
     case float_class_snan:
         flags |= float_flag_invalid_snan;
-        /* fall through */
+        fallthrough;
     case float_class_qnan:
         flags |= float_flag_invalid;
         r = max;
@@ -1135,7 +1135,7 @@ static uint64_t partsN(float_to_uint)(FloatPartsN *p, FloatRoundMode rmode,
     switch (p->cls) {
     case float_class_snan:
         flags |= float_flag_invalid_snan;
-        /* fall through */
+        fallthrough;
     case float_class_qnan:
         flags |= float_flag_invalid;
         r = max;
@@ -1198,7 +1198,7 @@ static int64_t partsN(float_to_sint_modulo)(FloatPartsN *p,
     switch (p->cls) {
     case float_class_snan:
         flags |= float_flag_invalid_snan;
-        /* fall through */
+        fallthrough;
     case float_class_qnan:
         flags |= float_flag_invalid;
         r = 0;
fpu/softfloat.c +4 -3
index 027a8e576d..e16e1896ee 100644
@@ -1835,6 +1835,7 @@ static floatx80 floatx80_round_pack_canonical(FloatParts128 *p,
             break;
         }
         /* rounded to inf -- fall through to set frac correctly */
+        fallthrough;
 
     case float_class_inf:
         /* x86 and m68k differ in the setting of the integer bit. */
@@ -2670,7 +2671,7 @@ static void parts_float_to_ahp(FloatParts64 *a, float_status *s)
     switch (a->cls) {
     case float_class_snan:
         float_raise(float_flag_invalid_snan, s);
-        /* fall through */
+        fallthrough;
     case float_class_qnan:
         /*
          * There is no NaN in the destination format.  Raise Invalid
@@ -3199,7 +3200,7 @@ static Int128 float128_to_int128_scalbn(float128 a, FloatRoundMode rmode,
     switch (p.cls) {
     case float_class_snan:
         flags |= float_flag_invalid_snan;
-        /* fall through */
+        fallthrough;
     case float_class_qnan:
         flags |= float_flag_invalid;
         r = UINT128_MAX;
@@ -3626,7 +3627,7 @@ static Int128 float128_to_uint128_scalbn(float128 a, FloatRoundMode rmode,
     switch (p.cls) {
     case float_class_snan:
         flags |= float_flag_invalid_snan;
-        /* fall through */
+        fallthrough;
     case float_class_qnan:
         flags |= float_flag_invalid;
         r = UINT128_MAX;
Signature · 1 line
2.39.2
Acked-by on v3 3/78
#6 lore raw

Re: [RFC PATCH v3 03/78] fpu/softfloat: add fallthrough pseudo-keyword

Quoted 5 lines · Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

Signed-off-by: Emmanouil Pitsidianakis
<[email protected]>

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
#7 lore raw

RFC PATCH v3 4/78 qapi/opts-visitor: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 qapi/opts-visitor.c         | 1 +
 qapi/string-input-visitor.c | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
qapi/opts-visitor.c +1 -0
index 8f1efab8b9..d7376bf239 100644
@@ -266,6 +266,7 @@ opts_next_list(Visitor *v, GenericList *tail, size_t size)
         }
         ov->list_mode = LM_IN_PROGRESS;
         /* range has been completed, fall through in order to pop option */
+        fallthrough;
 
     case LM_IN_PROGRESS: {
         const QemuOpt *opt;
qapi/string-input-visitor.c +2 -2
index 197139c1c0..1ce43da20b 100644
@@ -202,7 +202,7 @@ static bool parse_type_int64(Visitor *v, const char *name, int64_t *obj,
             return false;
         }
         assert(siv->lm == LM_INT64_RANGE);
-        /* fall through */
+        fallthrough;
     case LM_INT64_RANGE:
         /* return the next element in the range */
         assert(siv->rangeNext.i64 <= siv->rangeEnd.i64);
@@ -292,7 +292,7 @@ static bool parse_type_uint64(Visitor *v, const char *name, uint64_t *obj,
             return false;
         }
         assert(siv->lm == LM_UINT64_RANGE);
-        /* fall through */
+        fallthrough;
     case LM_UINT64_RANGE:
         /* return the next element in the range */
         assert(siv->rangeNext.u64 <= siv->rangeEnd.u64);
Signature · 1 line
2.39.2
#8 lore raw

RFC PATCH v3 5/78 qobject/json: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 qobject/json-lexer.c  | 4 ++--
 qobject/json-parser.c | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)
qobject/json-lexer.c +2 -2
index 51341d96e4..ab74470ac6 100644
@@ -312,7 +312,7 @@ static void json_lexer_feed_char(JSONLexer *lexer, char ch, bool flush)
         case JSON_STRING:
             json_message_process_token(lexer, lexer->token, new_state,
                                        lexer->x, lexer->y);
-            /* fall through */
+            fallthrough;
         case IN_START:
             g_string_truncate(lexer->token, 0);
             new_state = lexer->start_state;
@@ -321,7 +321,7 @@ static void json_lexer_feed_char(JSONLexer *lexer, char ch, bool flush)
             json_message_process_token(lexer, lexer->token, JSON_ERROR,
                                        lexer->x, lexer->y);
             new_state = IN_RECOVERY;
-            /* fall through */
+            fallthrough;
         case IN_RECOVERY:
             g_string_truncate(lexer->token, 0);
             break;
qobject/json-parser.c +3 -2
index d498db6e70..4dc622dcc9 100644
@@ -214,7 +214,7 @@ static QString *parse_string(JSONParserContext *ctxt, JSONToken *token)
                 }
                 ptr++;
             }
-            /* fall through */
+            fallthrough;
         default:
             cp = mod_utf8_codepoint(ptr, 6, &end);
             if (cp < 0) {
@@ -518,8 +518,9 @@ static QObject *parse_literal(JSONParserContext *ctxt)
             }
             assert(ret == -ERANGE);
         }
+        /* fall through to JSON_FLOAT */
+        fallthrough;
     }
-    /* fall through to JSON_FLOAT */
     case JSON_FLOAT:
         /* FIXME dependent on locale; a pervasive issue in QEMU */
         /* FIXME our lexer matches RFC 8259 in forbidding Inf or NaN,
Signature · 1 line
2.39.2
#9 lore raw

RFC PATCH v3 6/78 tcg: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 target/i386/tcg/translate.c      |  3 +++
 tcg/aarch64/tcg-target.c.inc     | 15 ++++++++++++++-
 tcg/arm/tcg-target.c.inc         |  5 +++--
 tcg/i386/tcg-target.c.inc        | 20 ++++++++++++++------
 tcg/loongarch64/tcg-target.c.inc |  4 ++--
 tcg/mips/tcg-target.c.inc        |  8 ++++++--
 tcg/ppc/tcg-target.c.inc         | 19 ++++++++++++++-----
 tcg/riscv/tcg-target.c.inc       |  5 +++--
 tcg/s390x/tcg-target.c.inc       |  8 ++++++--
 tcg/tcg-op-gvec.c                | 24 ++++++++++++------------
 tcg/tcg-op-ldst.c                |  2 +-
 tcg/tcg.c                        | 24 +++++++++++++-----------
 tcg/tci.c                        |  2 +-
 tcg/tci/tcg-target.c.inc         |  2 +-
 14 files changed, 93 insertions(+), 48 deletions(-)
target/i386/tcg/translate.c +3 -0
index d2061ec44a..e42e3dd653 100644
@@ -1996,6 +1996,7 @@ static void gen_shiftd_rm_T1(DisasContext *s, MemOp ot, int op1,
          * If TARGET_X86_64 defined then fall through into MO_32 case,
          * otherwise fall through default case.
          */
+        fallthrough;
     case MO_32:
 #ifdef TARGET_X86_64
         /* Concatenate the two 32-bit values and use a 64-bit shift.  */
@@ -3298,6 +3299,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
         if (CODE64(s))
             goto illegal_op;
         /* fall through */
+        fallthrough;
     case 0x80: /* GRP1 */
     case 0x81:
     case 0x83:
@@ -7046,6 +7048,7 @@ static void i386_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
         gen_update_cc_op(dc);
         gen_update_eip_cur(dc);
         /* fall through */
+        fallthrough;
     case DISAS_EOB_ONLY:
         gen_eob(dc);
         break;
tcg/aarch64/tcg-target.c.inc +14 -1
index 3afb896a3a..1af7640aab 100644
@@ -298,7 +298,7 @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct, int vece)
         break;
     case TCG_CT_CONST_ANDI:
         val = ~val;
-        /* fallthru */
+        fallthrough;
     case TCG_CT_CONST_ORRI:
         if (val == deposit64(val, 32, 32, val)) {
             int cmode, imm8;
@@ -1190,6 +1190,7 @@ static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg)
             break;
         }
         /* FALLTHRU */
+        fallthrough;
 
     case TCG_TYPE_V64:
         tcg_debug_assert(ret >= 32 && arg >= 32);
@@ -2090,6 +2091,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
     case INDEX_op_add_i32:
         a2 = (int32_t)a2;
         /* FALLTHRU */
+        fallthrough;
     case INDEX_op_add_i64:
         if (c2) {
             tcg_out_addsubi(s, ext, a0, a1, a2);
@@ -2101,6 +2103,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
     case INDEX_op_sub_i32:
         a2 = (int32_t)a2;
         /* FALLTHRU */
+        fallthrough;
     case INDEX_op_sub_i64:
         if (c2) {
             tcg_out_addsubi(s, ext, a0, a1, -a2);
@@ -2117,6 +2120,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
     case INDEX_op_and_i32:
         a2 = (int32_t)a2;
         /* FALLTHRU */
+        fallthrough;
     case INDEX_op_and_i64:
         if (c2) {
             tcg_out_logicali(s, I3404_ANDI, ext, a0, a1, a2);
@@ -2128,6 +2132,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
     case INDEX_op_andc_i32:
         a2 = (int32_t)a2;
         /* FALLTHRU */
+        fallthrough;
     case INDEX_op_andc_i64:
         if (c2) {
             tcg_out_logicali(s, I3404_ANDI, ext, a0, a1, ~a2);
@@ -2139,6 +2144,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
     case INDEX_op_or_i32:
         a2 = (int32_t)a2;
         /* FALLTHRU */
+        fallthrough;
     case INDEX_op_or_i64:
         if (c2) {
             tcg_out_logicali(s, I3404_ORRI, ext, a0, a1, a2);
@@ -2150,6 +2156,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
     case INDEX_op_orc_i32:
         a2 = (int32_t)a2;
         /* FALLTHRU */
+        fallthrough;
     case INDEX_op_orc_i64:
         if (c2) {
             tcg_out_logicali(s, I3404_ORRI, ext, a0, a1, ~a2);
@@ -2161,6 +2168,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
     case INDEX_op_xor_i32:
         a2 = (int32_t)a2;
         /* FALLTHRU */
+        fallthrough;
     case INDEX_op_xor_i64:
         if (c2) {
             tcg_out_logicali(s, I3404_EORI, ext, a0, a1, a2);
@@ -2172,6 +2180,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
     case INDEX_op_eqv_i32:
         a2 = (int32_t)a2;
         /* FALLTHRU */
+        fallthrough;
     case INDEX_op_eqv_i64:
         if (c2) {
             tcg_out_logicali(s, I3404_EORI, ext, a0, a1, ~a2);
@@ -2268,6 +2277,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
     case INDEX_op_brcond_i32:
         a1 = (int32_t)a1;
         /* FALLTHRU */
+        fallthrough;
     case INDEX_op_brcond_i64:
         tcg_out_brcond(s, ext, a2, a0, a1, const_args[1], arg_label(args[3]));
         break;
@@ -2275,6 +2285,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
     case INDEX_op_setcond_i32:
         a2 = (int32_t)a2;
         /* FALLTHRU */
+        fallthrough;
     case INDEX_op_setcond_i64:
         tcg_out_cmp(s, ext, a1, a2, c2);
         /* Use CSET alias of CSINC Wd, WZR, WZR, invert(cond).  */
@@ -2285,6 +2296,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
     case INDEX_op_negsetcond_i32:
         a2 = (int32_t)a2;
         /* FALLTHRU */
+        fallthrough;
     case INDEX_op_negsetcond_i64:
         tcg_out_cmp(s, ext, a1, a2, c2);
         /* Use CSETM alias of CSINV Wd, WZR, WZR, invert(cond).  */
@@ -2295,6 +2307,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
     case INDEX_op_movcond_i32:
         a2 = (int32_t)a2;
         /* FALLTHRU */
+        fallthrough;
     case INDEX_op_movcond_i64:
         tcg_out_cmp(s, ext, a1, a2, c2);
         tcg_out_insn(s, 3506, CSEL, ext, a0, REG0(3), REG0(4), args[5]);
tcg/arm/tcg-target.c.inc +3 -2
index 0d9c2d157b..ceb747183d 100644
@@ -529,6 +529,7 @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct, int vece)
     case TCG_CT_CONST_ANDI:
         val = ~val;
         /* fallthru */
+        fallthrough;
     case TCG_CT_CONST_ORRI:
         if (val == deposit64(val, 32, 32, val)) {
             int cmode, imm8;
@@ -2677,7 +2678,7 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc,
             return;
         }
         a2 = ~a2;
-        /* fall through */
+        fallthrough;
     case INDEX_op_and_vec:
         if (const_args[2]) {
             is_shimm1632(~a2, &cmode, &imm8);
@@ -2697,7 +2698,7 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc,
             return;
         }
         a2 = ~a2;
-        /* fall through */
+        fallthrough;
     case INDEX_op_or_vec:
         if (const_args[2]) {
             is_shimm1632(a2, &cmode, &imm8);
tcg/i386/tcg-target.c.inc +14 -6
index 788d608150..8f0764156e 100644
@@ -181,6 +181,7 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int type,
             return false;
         }
         /* FALLTHRU */
+        fallthrough;
     case R_386_32:
         tcg_patch32(code_ptr, value);
         break;
@@ -845,6 +846,7 @@ static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg)
     case TCG_TYPE_I64:
         rexw = P_REXW;
         /* fallthru */
+        fallthrough;
     case TCG_TYPE_I32:
         if (ret < 16) {
             if (arg < 16) {
@@ -898,10 +900,12 @@ static bool tcg_out_dup_vec(TCGContext *s, TCGType type, unsigned vece,
             tcg_out_vex_modrm(s, OPC_PUNPCKLBW, r, a, a);
             a = r;
             /* FALLTHRU */
+            fallthrough;
         case MO_16:
             tcg_out_vex_modrm(s, OPC_PUNPCKLWD, r, a, a);
             a = r;
             /* FALLTHRU */
+            fallthrough;
         case MO_32:
             tcg_out_vex_modrm(s, OPC_PSHUFD, r, 0, a);
             /* imm8 operand: all output lanes selected from input lane 0.  */
@@ -1126,6 +1130,7 @@ static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg ret,
             break;
         }
         /* FALLTHRU */
+        fallthrough;
     case TCG_TYPE_V64:
         /* There is no instruction that can validate 8-byte alignment.  */
         tcg_debug_assert(ret >= 16);
@@ -1171,6 +1176,7 @@ static void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg,
             break;
         }
         /* FALLTHRU */
+        fallthrough;
     case TCG_TYPE_V64:
         /* There is no instruction that can validate 8-byte alignment.  */
         tcg_debug_assert(arg >= 16);
@@ -1537,7 +1543,7 @@ static void tcg_out_setcond(TCGContext *s, int rexw, TCGCond cond,
     switch (cond) {
     case TCG_COND_NE:
         inv = true;
-        /* fall through */
+        fallthrough;
     case TCG_COND_EQ:
         /* If arg2 is 0, convert to LTU/GEU vs 1. */
         if (const_arg2 && arg2 == 0) {
@@ -1548,7 +1554,7 @@ static void tcg_out_setcond(TCGContext *s, int rexw, TCGCond cond,
 
     case TCG_COND_LEU:
         inv = true;
-        /* fall through */
+        fallthrough;
     case TCG_COND_GTU:
         /* If arg2 is a register, swap for LTU/GEU. */
         if (!const_arg2) {
@@ -1561,7 +1567,7 @@ static void tcg_out_setcond(TCGContext *s, int rexw, TCGCond cond,
 
     case TCG_COND_GEU:
         inv = true;
-        /* fall through */
+        fallthrough;
     case TCG_COND_LTU:
     do_ltu:
         /*
@@ -1587,7 +1593,7 @@ static void tcg_out_setcond(TCGContext *s, int rexw, TCGCond cond,
 
     case TCG_COND_GE:
         inv = true;
-        /* fall through */
+        fallthrough;
     case TCG_COND_LT:
         /* If arg2 is 0, extract the sign bit. */
         if (const_arg2 && arg2 == 0) {
@@ -2443,6 +2449,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
 # define OP_32_64(x) \
         case glue(glue(INDEX_op_, x), _i64): \
             rexw = P_REXW; /* FALLTHRU */    \
+            fallthrough;                     \
         case glue(glue(INDEX_op_, x), _i32)
 #else
 # define OP_32_64(x) \
@@ -2689,7 +2696,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
             tcg_out_qemu_ld(s, a0, -1, a1, a2, args[3], TCG_TYPE_I32);
             break;
         }
-        /* fall through */
+        fallthrough;
     case INDEX_op_qemu_ld_a32_i32:
         tcg_out_qemu_ld(s, a0, -1, a1, -1, a2, TCG_TYPE_I32);
         break;
@@ -2719,7 +2726,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
             tcg_out_qemu_st(s, a0, -1, a1, a2, args[3], TCG_TYPE_I32);
             break;
         }
-        /* fall through */
+        fallthrough;
     case INDEX_op_qemu_st_a32_i32:
     case INDEX_op_qemu_st8_a32_i32:
         tcg_out_qemu_st(s, a0, -1, a1, -1, a2, TCG_TYPE_I32);
@@ -2846,6 +2853,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
             break;
         }
         /* FALLTHRU */
+        fallthrough;
     case INDEX_op_extract_i32:
         /* On the off-chance that we can use the high-byte registers.
            Otherwise we emit the same ext16 + shift pattern that we
tcg/loongarch64/tcg-target.c.inc +2 -2
index 801302d85d..728384ce51 100644
@@ -1013,7 +1013,7 @@ static void tcg_out_qemu_ld_indexed(TCGContext *s, MemOp opc, TCGType type,
             tcg_out_opc_ldx_wu(s, rd, h.base, h.index);
             break;
         }
-        /* fallthrough */
+        fallthrough;
     case MO_SL:
         tcg_out_opc_ldx_w(s, rd, h.base, h.index);
         break;
@@ -1303,7 +1303,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
     case INDEX_op_bswap32_i32:
         /* All 32-bit values are computed sign-extended in the register.  */
         a2 = TCG_BSWAP_OS;
-        /* fallthrough */
+        fallthrough;
     case INDEX_op_bswap32_i64:
         tcg_out_opc_revb_2w(s, a0, a1);
         if (a2 & TCG_BSWAP_OS) {
tcg/mips/tcg-target.c.inc +6 -2
index e2892edc6a..0effa5320a 100644
@@ -917,6 +917,7 @@ static void tcg_out_setcond(TCGContext *s, TCGCond cond, TCGReg ret,
     case TCG_COND_GT:
         s_opc = OPC_SLT;
         /* FALLTHRU */
+        fallthrough;
 
     case TCG_COND_LTU:
     case TCG_COND_GEU:
@@ -974,6 +975,7 @@ static void tcg_out_brcond(TCGContext *s, TCGCond cond, TCGReg arg1,
         }
         s_opc = OPC_SLT;
         /* FALLTHRU */
+        fallthrough;
 
     case TCG_COND_LTU:
     case TCG_COND_GTU:
@@ -1109,6 +1111,7 @@ static void tcg_out_movcond(TCGContext *s, TCGCond cond, TCGReg ret,
     case TCG_COND_EQ:
         eqz = true;
         /* FALLTHRU */
+        fallthrough;
     case TCG_COND_NE:
         if (c2 != 0) {
             tcg_out_opc_reg(s, OPC_XOR, TCG_TMP0, c1, c2);
@@ -1430,6 +1433,7 @@ static void tcg_out_qemu_ld_direct(TCGContext *s, TCGReg lo, TCGReg hi,
             break;
         }
         /* FALLTHRU */
+        fallthrough;
     case MO_SL:
         tcg_out_opc_imm(s, OPC_LW, lo, base, 0);
         break;
@@ -2117,7 +2121,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
             tcg_out_qemu_ld(s, a0, 0, a1, a2, args[3], TCG_TYPE_I32);
             break;
         }
-        /* fall through */
+        fallthrough;
     case INDEX_op_qemu_ld_a32_i32:
         tcg_out_qemu_ld(s, a0, 0, a1, 0, a2, TCG_TYPE_I32);
         break;
@@ -2141,7 +2145,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
             tcg_out_qemu_st(s, a0, 0, a1, a2, args[3], TCG_TYPE_I32);
             break;
         }
-        /* fall through */
+        fallthrough;
     case INDEX_op_qemu_st_a32_i32:
         tcg_out_qemu_st(s, a0, 0, a1, 0, a2, TCG_TYPE_I32);
         break;
tcg/ppc/tcg-target.c.inc +14 -5
index 5c873b2161..a438a02045 100644
@@ -724,6 +724,7 @@ static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg)
     case TCG_TYPE_I64:
         tcg_debug_assert(TCG_TARGET_REG_BITS == 64);
         /* fallthru */
+        fallthrough;
     case TCG_TYPE_I32:
         if (ret < TCG_REG_V0) {
             if (arg < TCG_REG_V0) {
@@ -748,6 +749,7 @@ static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg)
             }
         }
         /* fallthru */
+        fallthrough;
     case TCG_TYPE_V64:
     case TCG_TYPE_V128:
         tcg_debug_assert(ret >= TCG_REG_V0 && arg >= TCG_REG_V0);
@@ -1300,6 +1302,7 @@ static void tcg_out_mem_long(TCGContext *s, int opi, int opx, TCGReg rt,
     case LD: case LWA:
         align = 3;
         /* FALLTHRU */
+        fallthrough;
     default:
         if (rt > TCG_REG_R0 && rt < TCG_REG_V0) {
             rs = rt;
@@ -1317,6 +1320,7 @@ static void tcg_out_mem_long(TCGContext *s, int opi, int opx, TCGReg rt,
     case STD:
         align = 3;
         /* FALLTHRU */
+        fallthrough;
     case STB: case STH: case STW:
         is_int_store = true;
         break;
@@ -1389,6 +1393,7 @@ static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg ret,
             break;
         }
         /* fallthru */
+        fallthrough;
     case TCG_TYPE_V64:
         tcg_debug_assert(ret >= TCG_REG_V0);
         if (have_vsx) {
@@ -1444,6 +1449,7 @@ static void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg,
             break;
         }
         /* fallthru */
+        fallthrough;
     case TCG_TYPE_V64:
         tcg_debug_assert(arg >= TCG_REG_V0);
         if (have_vsx) {
@@ -1659,6 +1665,7 @@ static void tcg_out_setcond(TCGContext *s, TCGType type, TCGCond cond,
             tcg_out32(s, NOR | SAB(arg1, arg0, arg1));
             arg1 = arg0;
             /* FALLTHRU */
+            fallthrough;
         case TCG_COND_LT:
             /* Extract the sign bit.  */
             if (type == TCG_TYPE_I32) {
@@ -1719,7 +1726,7 @@ static void tcg_out_setcond(TCGContext *s, TCGType type, TCGCond cond,
     case TCG_COND_LE:
     case TCG_COND_LEU:
         inv = true;
-        /* fall through */
+        fallthrough;
     case TCG_COND_GT:
     case TCG_COND_GTU:
         sh = 30; /* CR7 CR_GT */
@@ -1728,7 +1735,7 @@ static void tcg_out_setcond(TCGContext *s, TCGType type, TCGCond cond,
     case TCG_COND_GE:
     case TCG_COND_GEU:
         inv = true;
-        /* fall through */
+        fallthrough;
     case TCG_COND_LT:
     case TCG_COND_LTU:
         sh = 29; /* CR7 CR_LT */
@@ -2744,6 +2751,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
             break;
         }
         /* FALLTHRU */
+        fallthrough;
     case INDEX_op_orc_i64:
         tcg_out32(s, ORC | SAB(args[1], args[0], args[2]));
         break;
@@ -2753,6 +2761,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
             break;
         }
         /* FALLTHRU */
+        fallthrough;
     case INDEX_op_eqv_i64:
         tcg_out32(s, EQV | SAB(args[1], args[0], args[2]));
         break;
@@ -2968,7 +2977,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
                             args[3], TCG_TYPE_I32);
             break;
         }
-        /* fall through */
+        fallthrough;
     case INDEX_op_qemu_ld_a32_i32:
         tcg_out_qemu_ld(s, args[0], -1, args[1], -1, args[2], TCG_TYPE_I32);
         break;
@@ -3002,7 +3011,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
                             args[3], TCG_TYPE_I32);
             break;
         }
-        /* fall through */
+        fallthrough;
     case INDEX_op_qemu_st_a32_i32:
         tcg_out_qemu_st(s, args[0], -1, args[1], -1, args[2], TCG_TYPE_I32);
         break;
@@ -3591,7 +3600,7 @@ static void expand_vec_cmp(TCGType type, unsigned vece, TCGv_vec v0,
         if (have_isa_3_00 && vece <= MO_32) {
             break;
         }
-        /* fall through */
+        fallthrough;
     case TCG_COND_LE:
     case TCG_COND_LEU:
         need_inv = true;
tcg/riscv/tcg-target.c.inc +3 -2
index d6dbcaf3cb..8b0e7b000c 100644
@@ -948,7 +948,7 @@ static void tcg_out_negsetcond(TCGContext *s, TCGCond cond, TCGReg ret,
         case TCG_COND_GE:
             tcg_out_opc_imm(s, OPC_XORI, ret, arg1, -1);
             arg1 = ret;
-            /* fall through */
+            fallthrough;
         case TCG_COND_LT:
             tcg_out_opc_imm(s, OPC_SRAI, ret, arg1, TCG_TARGET_REG_BITS - 1);
             return;
@@ -1373,6 +1373,7 @@ static void tcg_out_qemu_ld_direct(TCGContext *s, TCGReg val,
             break;
         }
         /* FALLTHRU */
+        fallthrough;
     case MO_SL:
         tcg_out_opc_imm(s, OPC_LW, val, base, 0);
         break;
@@ -1754,7 +1755,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
         break;
     case INDEX_op_bswap32_i32:
         a2 = 0;
-        /* fall through */
+        fallthrough;
     case INDEX_op_bswap32_i64:
         tcg_out_opc_imm(s, OPC_REV8, a0, a1, 0);
         if (a2 & TCG_BSWAP_OZ) {
tcg/s390x/tcg-target.c.inc +6 -2
index 4ef9ac3d5b..3656b8ddf0 100644
@@ -809,7 +809,7 @@ static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg dst, TCGReg src)
             tcg_out_insn(s, RR, LR, dst, src);
             break;
         }
-        /* fallthru */
+        fallthrough;
 
     case TCG_TYPE_I64:
         if (likely(is_general_reg(dst))) {
@@ -823,7 +823,7 @@ static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg dst, TCGReg src)
             tcg_out_insn(s, VRSb, VLVG, dst, 0, 0, src, 3);
             break;
         }
-        /* fallthru */
+        fallthrough;
 
     case TCG_TYPE_V64:
     case TCG_TYPE_V128:
@@ -981,6 +981,7 @@ static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg data,
             break;
         }
         /* fallthru */
+        fallthrough;
 
     case TCG_TYPE_V64:
         tcg_out_vrx_mem(s, VRX_VLLEZ, data, base, TCG_REG_NONE, ofs, MO_64);
@@ -1014,6 +1015,7 @@ static void tcg_out_st(TCGContext *s, TCGType type, TCGReg data,
             break;
         }
         /* fallthru */
+        fallthrough;
 
     case TCG_TYPE_V64:
         tcg_out_vrx_mem(s, VRX_VSTEG, data, base, TCG_REG_NONE, ofs, 0);
@@ -1306,6 +1308,7 @@ static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond,
             break;
         }
         /* fallthru */
+        fallthrough;
 
     case TCG_COND_GTU:
     case TCG_COND_GT:
@@ -1333,6 +1336,7 @@ static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond,
             break;
         }
         /* fallthru */
+        fallthrough;
 
     case TCG_COND_LEU:
     case TCG_COND_LE:
tcg/tcg-op-gvec.c +12 -12
index feb2d3686b..35e47902f1 100644
@@ -496,7 +496,7 @@ static void do_dup_store(TCGType type, uint32_t dofs, uint32_t oprsz,
         for (; i + 32 <= oprsz; i += 32) {
             tcg_gen_stl_vec(t_vec, tcg_env, dofs + i, TCG_TYPE_V256);
         }
-        /* fallthru */
+        fallthrough;
     case TCG_TYPE_V128:
         for (; i + 16 <= oprsz; i += 16) {
             tcg_gen_stl_vec(t_vec, tcg_env, dofs + i, TCG_TYPE_V128);
@@ -1229,7 +1229,7 @@ void tcg_gen_gvec_2(uint32_t dofs, uint32_t aofs,
         aofs += some;
         oprsz -= some;
         maxsz -= some;
-        /* fallthru */
+        fallthrough;
     case TCG_TYPE_V128:
         expand_2_vec(g->vece, dofs, aofs, oprsz, 16, TCG_TYPE_V128,
                      g->load_dest, g->fniv);
@@ -1293,7 +1293,7 @@ void tcg_gen_gvec_2i(uint32_t dofs, uint32_t aofs, uint32_t oprsz,
         aofs += some;
         oprsz -= some;
         maxsz -= some;
-        /* fallthru */
+        fallthrough;
     case TCG_TYPE_V128:
         expand_2i_vec(g->vece, dofs, aofs, oprsz, 16, TCG_TYPE_V128,
                       c, g->load_dest, g->fniv);
@@ -1367,7 +1367,7 @@ void tcg_gen_gvec_2s(uint32_t dofs, uint32_t aofs, uint32_t oprsz,
             aofs += some;
             oprsz -= some;
             maxsz -= some;
-            /* fallthru */
+            fallthrough;
 
         case TCG_TYPE_V128:
             expand_2s_vec(g->vece, dofs, aofs, oprsz, 16, TCG_TYPE_V128,
@@ -1440,7 +1440,7 @@ void tcg_gen_gvec_3(uint32_t dofs, uint32_t aofs, uint32_t bofs,
         bofs += some;
         oprsz -= some;
         maxsz -= some;
-        /* fallthru */
+        fallthrough;
     case TCG_TYPE_V128:
         expand_3_vec(g->vece, dofs, aofs, bofs, oprsz, 16, TCG_TYPE_V128,
                      g->load_dest, g->fniv);
@@ -1508,7 +1508,7 @@ void tcg_gen_gvec_3i(uint32_t dofs, uint32_t aofs, uint32_t bofs,
         bofs += some;
         oprsz -= some;
         maxsz -= some;
-        /* fallthru */
+        fallthrough;
     case TCG_TYPE_V128:
         expand_3i_vec(g->vece, dofs, aofs, bofs, oprsz, 16, TCG_TYPE_V128,
                       c, g->load_dest, g->fniv);
@@ -1574,7 +1574,7 @@ void tcg_gen_gvec_4(uint32_t dofs, uint32_t aofs, uint32_t bofs, uint32_t cofs,
         cofs += some;
         oprsz -= some;
         maxsz -= some;
-        /* fallthru */
+        fallthrough;
     case TCG_TYPE_V128:
         expand_4_vec(g->vece, dofs, aofs, bofs, cofs, oprsz,
                      16, TCG_TYPE_V128, g->write_aofs, g->fniv);
@@ -1645,7 +1645,7 @@ void tcg_gen_gvec_4i(uint32_t dofs, uint32_t aofs, uint32_t bofs, uint32_t cofs,
         cofs += some;
         oprsz -= some;
         maxsz -= some;
-        /* fallthru */
+        fallthrough;
     case TCG_TYPE_V128:
         expand_4i_vec(g->vece, dofs, aofs, bofs, cofs, oprsz,
                        16, TCG_TYPE_V128, c, g->fniv);
@@ -3173,7 +3173,7 @@ do_gvec_shifts(unsigned vece, uint32_t dofs, uint32_t aofs, TCGv_i32 shift,
             aofs += some;
             oprsz -= some;
             maxsz -= some;
-            /* fallthru */
+            fallthrough;
         case TCG_TYPE_V128:
             expand_2sh_vec(vece, dofs, aofs, oprsz, 16,
                            TCG_TYPE_V128, shift, g->fniv_s);
@@ -3216,7 +3216,7 @@ do_gvec_shifts(unsigned vece, uint32_t dofs, uint32_t aofs, TCGv_i32 shift,
             aofs += some;
             oprsz -= some;
             maxsz -= some;
-            /* fallthru */
+            fallthrough;
         case TCG_TYPE_V128:
             expand_2s_vec(vece, dofs, aofs, oprsz, 16, TCG_TYPE_V128,
                           v_shift, false, g->fniv_v);
@@ -3808,7 +3808,7 @@ void tcg_gen_gvec_cmp(TCGCond cond, unsigned vece, uint32_t dofs,
         bofs += some;
         oprsz -= some;
         maxsz -= some;
-        /* fallthru */
+        fallthrough;
     case TCG_TYPE_V128:
         expand_cmp_vec(vece, dofs, aofs, bofs, oprsz, 16, TCG_TYPE_V128, cond);
         break;
@@ -3926,7 +3926,7 @@ void tcg_gen_gvec_cmps(TCGCond cond, unsigned vece, uint32_t dofs,
             dofs += some;
             oprsz -= some;
             maxsz -= some;
-            /* fallthru */
+            fallthrough;
 
         case TCG_TYPE_V128:
             some = QEMU_ALIGN_DOWN(oprsz, 16);
tcg/tcg-op-ldst.c +1 -1
index df4f22c427..5ad51c8cb8 100644
@@ -70,7 +70,7 @@ static MemOp tcg_canonicalize_memop(MemOp op, bool is64, bool st)
             op &= ~MO_SIGN;
             break;
         }
-        /* fall through */
+        fallthrough;
     default:
         g_assert_not_reached();
     }
tcg/tcg.c +13 -11
index 637b9e6870..84e74badcf 100644
@@ -23,6 +23,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/compiler.h"
 
 /* Define to jump the ELF file used to communicate with GDB.  */
 #undef DEBUG_JIT
@@ -1192,7 +1193,7 @@ static void init_call_layout(TCGHelperInfo *info)
             switch (TCG_TARGET_CALL_ARG_I32) {
             case TCG_CALL_ARG_EVEN:
                 layout_arg_even(&cum);
-                /* fall through */
+                fallthrough;
             case TCG_CALL_ARG_NORMAL:
                 layout_arg_1(&cum, info, TCG_CALL_ARG_NORMAL);
                 break;
@@ -1209,7 +1210,7 @@ static void init_call_layout(TCGHelperInfo *info)
             switch (TCG_TARGET_CALL_ARG_I64) {
             case TCG_CALL_ARG_EVEN:
                 layout_arg_even(&cum);
-                /* fall through */
+                fallthrough;
             case TCG_CALL_ARG_NORMAL:
                 if (TCG_TARGET_REG_BITS == 32) {
                     layout_arg_normal_n(&cum, info, 2);
@@ -1226,7 +1227,7 @@ static void init_call_layout(TCGHelperInfo *info)
             switch (TCG_TARGET_CALL_ARG_I128) {
             case TCG_CALL_ARG_EVEN:
                 layout_arg_even(&cum);
-                /* fall through */
+                fallthrough;
             case TCG_CALL_ARG_NORMAL:
                 layout_arg_normal_n(&cum, info, 128 / TCG_TARGET_REG_BITS);
                 break;
@@ -2299,7 +2300,7 @@ static void tcg_reg_alloc_start(TCGContext *s)
             break;
         case TEMP_EBB:
             val = TEMP_VAL_DEAD;
-            /* fall through */
+            fallthrough;
         case TEMP_TB:
             ts->mem_allocated = 0;
             break;
@@ -3556,7 +3557,7 @@ liveness_pass_1(TCGContext *s)
                                 *la_temp_pref(ts) = 0;
                                 break;
                             }
-                            /* fall through */
+                            fallthrough;
                         default:
                             *la_temp_pref(ts) =
                                 tcg_target_available_regs[ts->type];
@@ -4135,7 +4136,7 @@ static void temp_sync(TCGContext *s, TCGTemp *ts, TCGRegSet allocated_regs,
             }
             temp_load(s, ts, tcg_target_available_regs[ts->type],
                       allocated_regs, preferred_regs);
-            /* fallthrough */
+            fallthrough;
 
         case TEMP_VAL_REG:
             tcg_out_st(s, ts->type, ts->reg,
@@ -4622,7 +4623,7 @@ static void tcg_reg_alloc_dup(TCGContext *s, const TCGOp *op)
             /* Sync the temp back to its slot and load from there.  */
             temp_sync(s, its, s->reserved_regs, 0, 0);
         }
-        /* fall through */
+        fallthrough;
 
     case TEMP_VAL_MEM:
         lowpart_ofs = 0;
@@ -5289,6 +5290,7 @@ static void tcg_reg_alloc_call(TCGContext *s, TCGOp *op)
                        ts->mem_base->reg, ts->mem_offset);
         }
         /* fall through to mark all parts in memory */
+        fallthrough;
 
     case TCG_CALL_RET_BY_REF:
         /* The callee has performed a write through the reference. */
@@ -5489,7 +5491,7 @@ static void tcg_out_helper_load_slots(TCGContext *s,
 
         /* No conflicts: perform this move and continue. */
         tcg_out_movext1(s, &mov[3]);
-        /* fall through */
+        fallthrough;
 
     case 3:
         tcg_out_movext3(s, mov, mov + 1, mov + 2,
@@ -5741,7 +5743,7 @@ static void tcg_out_ld_helper_ret(TCGContext *s, const TCGLabelQemuLdst *ldst,
         if (TCG_TARGET_REG_BITS == 32) {
             break;
         }
-        /* fall through */
+        fallthrough;
 
     case TCG_TYPE_I32:
         mov[0].dst = ldst->datalo_reg;
@@ -5781,7 +5783,7 @@ static void tcg_out_ld_helper_ret(TCGContext *s, const TCGLabelQemuLdst *ldst,
             tcg_out_st(s, TCG_TYPE_V128,
                        tcg_target_call_oarg_reg(TCG_CALL_RET_BY_VEC, 0),
                        TCG_REG_CALL_STACK, ofs_slot0);
-            /* fall through */
+            fallthrough;
         case TCG_CALL_RET_BY_REF:
             tcg_out_ld(s, TCG_TYPE_I64, ldst->datalo_reg,
                        TCG_REG_CALL_STACK, ofs_slot0 + 8 * HOST_BIG_ENDIAN);
@@ -6069,7 +6071,7 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb, uint64_t pc_start)
             if (tcg_reg_alloc_dup2(s, op)) {
                 break;
             }
-            /* fall through */
+            fallthrough;
         default:
             /* Sanity check that we've not introduced any unhandled opcodes. */
             tcg_debug_assert(tcg_op_supported(opc));
tcg/tci.c +1 -1
index 4640902c88..3368941953 100644
@@ -1310,7 +1310,7 @@ int print_insn_tci(bfd_vma addr, disassemble_info *info)
             info->fprintf_func(info->stream, "align");
             break;
         }
-        /* fall through */
+        fallthrough;
 
     default:
         info->fprintf_func(info->stream, "illegal opcode %d", op);
tcg/tci/tcg-target.c.inc +1 -1
index 461f4b47ff..f60d0ba037 100644
@@ -524,7 +524,7 @@ static void tcg_out_movi(TCGContext *s, TCGType type,
     case TCG_TYPE_I32:
 #if TCG_TARGET_REG_BITS == 64
         arg = (int32_t)arg;
-        /* fall through */
+        fallthrough;
     case TCG_TYPE_I64:
 #endif
         break;
Signature · 1 line
2.39.2
#10 lore raw

RFC PATCH v3 7/78 hw/virtio/virtio-balloon.c: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/virtio/virtio-balloon.c | 1 +
 1 file changed, 1 insertion(+)
hw/virtio/virtio-balloon.c +1 -0
index d004cf29d2..0f0d94bd94 100644
@@ -673,6 +673,7 @@ virtio_balloon_free_page_hint_notify(NotifierWithReturn *n, void *data)
          * Set S_DONE before migrating the vmstate, so the guest will reuse
          * all hinted pages once running on the destination. Fall through.
          */
+        fallthrough;
     case PRECOPY_NOTIFY_CLEANUP:
         /*
          * Especially, if something goes wrong during precopy or if migration
Signature · 1 line
2.39.2
#11 lore raw

RFC PATCH v3 8/78 hw/block: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/block/dataplane/xen-block.c | 4 ++--
 hw/block/m25p80.c              | 2 +-
 hw/block/onenand.c             | 2 +-
 hw/block/pflash_cfi01.c        | 1 +
 hw/block/pflash_cfi02.c        | 6 ++++--
 5 files changed, 9 insertions(+), 6 deletions(-)
hw/block/dataplane/xen-block.c +2 -2
index 3b6f2b0aa2..1ae25a73b2 100644
@@ -159,7 +159,7 @@ static int xen_block_parse_request(XenBlockRequest *request)
         if (!request->req.nr_segments) {
             return 0;
         }
-        /* fall through */
+        fallthrough;
     case BLKIF_OP_WRITE:
         break;
     case BLKIF_OP_DISCARD:
@@ -299,7 +299,7 @@ static void xen_block_complete_aio(void *opaque, int ret)
         if (!request->req.nr_segments) {
             break;
         }
-        /* fall through */
+        fallthrough;
     case BLKIF_OP_READ:
         if (request->status == BLKIF_RSP_OKAY) {
             block_acct_done(blk_get_stats(dataplane->blk), &request->acct);
hw/block/m25p80.c +1 -1
index afc3fdf4d6..523c34da71 100644
@@ -1462,7 +1462,7 @@ static void decode_new_cmd(Flash *s, uint32_t value)
             s->state = STATE_COLLECTING_DATA;
             break;
         }
-        /* Fallthrough */
+        fallthrough;
 
     default:
         s->pos = 0;
hw/block/onenand.c +1 -1
index 50d3d1c985..87583c48a0 100644
@@ -564,7 +564,7 @@ static void onenand_command(OneNANDState *s)
         break;
     case 0x95:  /* Multi-block erase */
         qemu_irq_pulse(s->intr);
-        /* Fall through.  */
+        fallthrough;
     case 0x94:  /* Block erase */
         sec = ((s->addr[ONEN_BUF_BLOCK] & 0xfff) |
                         (s->addr[ONEN_BUF_BLOCK] >> 15 ? s->density_mask : 0))
hw/block/pflash_cfi01.c +1 -0
index 62056b1d74..cb58f08f53 100644
@@ -276,6 +276,7 @@ static uint32_t pflash_read(PFlashCFI01 *pfl, hwaddr offset,
          */
         pfl->cmd = 0x00;
         /* fall through to read code */
+        fallthrough;
     case 0x00: /* This model reset value for READ_ARRAY (not CFI compliant) */
         /* Flash area read */
         ret = pflash_data_read(pfl, offset, width, be);
hw/block/pflash_cfi02.c +4 -2
index 2a99b286b0..711f978d7c 100644
@@ -328,6 +328,7 @@ static uint64_t pflash_read(void *opaque, hwaddr offset, unsigned int width)
         trace_pflash_read_unknown_state(pfl->name, pfl->cmd);
         pflash_reset_state_machine(pfl);
         /* fall through to the read code */
+        fallthrough;
     case 0x80: /* Erase (unlock) */
         /* We accept reads during second unlock sequence... */
     case 0x00:
@@ -359,6 +360,7 @@ static uint64_t pflash_read(void *opaque, hwaddr offset, unsigned int width)
                 break;
             }
             /* Fall through to data read. */
+            fallthrough;
         default:
             ret = pflash_data_read(pfl, offset, width);
         }
@@ -368,7 +370,7 @@ static uint64_t pflash_read(void *opaque, hwaddr offset, unsigned int width)
     case 0x30: /* Sector Erase */
         /* Toggle bit 2 during erase, but not program. */
         toggle_dq2(pfl);
-        /* fall through */
+        fallthrough;
     case 0xA0: /* Program */
         /* Toggle bit 6 */
         toggle_dq6(pfl);
@@ -582,7 +584,7 @@ static void pflash_write(void *opaque, hwaddr offset, uint64_t value,
                 pfl->cmd = 0x98;
                 return;
             }
-            /* fall through */
+            fallthrough;
         default:
             trace_pflash_write_invalid(pfl->name, pfl->cmd);
             goto reset_flash;
Signature · 1 line
2.39.2
Reviewed-by on v3 8/78
#12 lore raw

Re: [RFC PATCH v3 08/78] hw/block: add fallthrough pseudo-keyword

Quoted 11 lines · Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/block/dataplane/xen-block.c | 4 ++--
 hw/block/m25p80.c              | 2 +-
 hw/block/onenand.c             | 2 +-
 hw/block/pflash_cfi01.c        | 1 +
 hw/block/pflash_cfi02.c        | 6 ++++--
 5 files changed, 9 insertions(+), 6 deletions(-)
#13 lore raw

RFC PATCH v3 9/78 hw/acpi/aml-build.c: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/acpi/aml-build.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/acpi/aml-build.c +3 -3
index af66bde0f5..b0cf0c6073 100644
@@ -326,17 +326,16 @@ build_prepend_package_length(GArray *package, unsigned length, bool incl_self)
         byte = length >> PACKAGE_LENGTH_4BYTE_SHIFT;
         build_prepend_byte(package, byte);
         length &= (1 << PACKAGE_LENGTH_4BYTE_SHIFT) - 1;
-        /* fall through */
+        fallthrough;
     case 3:
         byte = length >> PACKAGE_LENGTH_3BYTE_SHIFT;
         build_prepend_byte(package, byte);
         length &= (1 << PACKAGE_LENGTH_3BYTE_SHIFT) - 1;
-        /* fall through */
+        fallthrough;
     case 2:
         byte = length >> PACKAGE_LENGTH_2BYTE_SHIFT;
         build_prepend_byte(package, byte);
         length &= (1 << PACKAGE_LENGTH_2BYTE_SHIFT) - 1;
-        /* fall through */
     }
     /*
      * Most significant two bits of byte zero indicate how many following bytes
@@ -528,6 +527,7 @@ void aml_append(Aml *parent_ctx, Aml *child)
          */
         build_append_byte(buf, 0);
         /* fall through, to pack resources in buffer */
+        fallthrough;
     case AML_BUFFER:
         build_buffer(buf, child->op);
         break;
Signature · 1 line
2.39.2
Reviewed-by on v3 9/78
#14 lore raw

Re: [RFC PATCH v3 09/78] hw/acpi/aml-build.c: add fallthrough pseudo-keyword

Quoted 8 lines · Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

What was wrong with QEMU_FALLTHROUGH?
https://www.mail-archive.com/[email protected]/msg996916.html does not explain and there is no commit message that justifies the change.

Other than that,

Quoted 39 lines

---
hw/acpi/aml-build.c | 6 +++---

1 file changed, 3 insertions(+), 3 deletions(-)
hw/acpi/aml-build.c +3 -3
index af66bde0f5..b0cf0c6073 100644
@@ -326,17 +326,16 @@ build_prepend_package_length(GArray *package, unsigned length, bool incl_self)
        byte = length >> PACKAGE_LENGTH_4BYTE_SHIFT;
        build_prepend_byte(package, byte);
        length &= (1 << PACKAGE_LENGTH_4BYTE_SHIFT) - 1;
-        /* fall through */
+        fallthrough;
    case 3:
        byte = length >> PACKAGE_LENGTH_3BYTE_SHIFT;
        build_prepend_byte(package, byte);
        length &= (1 << PACKAGE_LENGTH_3BYTE_SHIFT) - 1;
-        /* fall through */
+        fallthrough;
    case 2:
        byte = length >> PACKAGE_LENGTH_2BYTE_SHIFT;
        build_prepend_byte(package, byte);
        length &= (1 << PACKAGE_LENGTH_2BYTE_SHIFT) - 1;
-        /* fall through */
    }
    /*
     * Most significant two bits of byte zero indicate how many following bytes
@@ -528,6 +527,7 @@ void aml_append(Aml *parent_ctx, Aml *child)
         */
        build_append_byte(buf, 0);
        /* fall through, to pack resources in buffer */
+        fallthrough;
    case AML_BUFFER:
        build_buffer(buf, child->op);
        break;
Signature · 1 line
2.39.2
#15 lore raw

RFC PATCH v3 10/78 hw/ide/atapi.c: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/ide/atapi.c | 1 +
 1 file changed, 1 insertion(+)
hw/ide/atapi.c +1 -0
index dcc39df9a4..85c74a5ffe 100644
@@ -1225,6 +1225,7 @@ static void cmd_read_dvd_structure(IDEState *s, uint8_t* buf)
                 break;
             }
             /* TODO: BD support, fall through for now */
+            fallthrough;
 
         /* Generic disk structures */
         case 0x80: /* TODO: AACS volume identifier */
Signature · 1 line
2.39.2
#16 lore raw

RFC PATCH v3 11/78 hw/timer: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/timer/a9gtimer.c     |  8 ++--
 hw/timer/aspeed_timer.c |  1 +
 hw/timer/pxa2xx_timer.c | 94 ++++++++++++++++++++---------------------
 hw/timer/renesas_tmr.c  |  2 +-
 hw/timer/sh_timer.c     |  8 ++--
 5 files changed, 57 insertions(+), 56 deletions(-)
hw/timer/a9gtimer.c +4 -4
index 5e959b6d09..b83d51da96 100644
@@ -143,7 +143,7 @@ static uint64_t a9_gtimer_read(void *opaque, hwaddr addr, unsigned size)
     switch (addr) {
     case R_COUNTER_HI:
         shift = 32;
-        /* fallthrough */
+        fallthrough;
     case R_COUNTER_LO:
         update = a9_gtimer_get_update(s);
         ret = extract64(update.new, shift, 32);
@@ -156,7 +156,7 @@ static uint64_t a9_gtimer_read(void *opaque, hwaddr addr, unsigned size)
         break;
     case R_COMPARATOR_HI:
         shift = 32;
-        /* fallthrough */
+        fallthrough;
     case R_COMPARATOR_LO:
         ret = extract64(gtb->compare, shift, 32);
         break;
@@ -185,7 +185,7 @@ static void a9_gtimer_write(void *opaque, hwaddr addr, uint64_t value,
     switch (addr) {
     case R_COUNTER_HI:
         shift = 32;
-        /* fallthrough */
+        fallthrough;
     case R_COUNTER_LO:
         /*
          * Keep it simple - ARM docco explicitly says to disable timer before
@@ -209,7 +209,7 @@ static void a9_gtimer_write(void *opaque, hwaddr addr, uint64_t value,
         break;
     case R_COMPARATOR_HI:
         shift = 32;
-        /* fallthrough */
+        fallthrough;
     case R_COMPARATOR_LO:
         a9_gtimer_update(s, false);
         gtb->compare = deposit64(gtb->compare, shift, 32, value);
hw/timer/aspeed_timer.c +1 -0
index 72161f07bb..b343b7ab2c 100644
@@ -284,6 +284,7 @@ static void aspeed_timer_set_value(AspeedTimerCtrlState *s, int timer, int reg,
             break;
         }
         /* fall through to re-enable */
+        fallthrough;
     case TIMER_REG_STATUS:
         if (timer_enabled(t)) {
             uint64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
hw/timer/pxa2xx_timer.c +47 -47

182 lines not on this page · raw message

hw/timer/renesas_tmr.c +1 -1
index 43b31213bc..a32521e3c3 100644
@@ -236,7 +236,7 @@ static uint64_t tmr_read(void *opaque, hwaddr addr, unsigned size)
         } else if (ch == 0) {
             return concat_reg(tmr->tcora);
         }
-        /* fall through */
+        fallthrough;
     case A_TCORB:
         if (size == 1) {
             return tmr->tcorb[ch];
hw/timer/sh_timer.c +4 -4
index 7788939766..6dbfc2595b 100644
@@ -131,7 +131,7 @@ static void sh_timer_write(void *opaque, hwaddr offset, uint32_t value)
             if (s->feat & TIMER_FEAT_EXTCLK) {
                 break;
             }
-            /* fallthrough */
+            fallthrough;
         default:
             qemu_log_mask(LOG_GUEST_ERROR,
                           "%s: Reserved TPSC value\n", __func__);
@@ -145,7 +145,7 @@ static void sh_timer_write(void *opaque, hwaddr offset, uint32_t value)
             if (s->feat & TIMER_FEAT_EXTCLK) {
                 break;
             }
-            /* fallthrough */
+            fallthrough;
         default:
             qemu_log_mask(LOG_GUEST_ERROR,
                           "%s: Reserved CKEG value\n", __func__);
@@ -158,7 +158,7 @@ static void sh_timer_write(void *opaque, hwaddr offset, uint32_t value)
             if (s->feat & TIMER_FEAT_CAPT) {
                 break;
             }
-            /* fallthrough */
+            fallthrough;
         default:
             qemu_log_mask(LOG_GUEST_ERROR,
                           "%s: Reserved ICPE value\n", __func__);
@@ -194,7 +194,7 @@ static void sh_timer_write(void *opaque, hwaddr offset, uint32_t value)
             s->tcpr = value;
             break;
         }
-        /* fallthrough */
+        fallthrough;
     default:
         qemu_log_mask(LOG_GUEST_ERROR,
                       "%s: Bad offset 0x%" HWADDR_PRIx "\n", __func__, offset);
Signature · 1 line
2.39.2
#17 lore raw

RFC PATCH v3 12/78 hw/usb: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/usb/dev-mtp.c   | 2 +-
 hw/usb/dev-wacom.c | 2 +-
 hw/usb/hcd-ehci.c  | 4 +++-
 hw/usb/hcd-xhci.c  | 4 ++--
 hw/usb/redirect.c  | 4 ++--
 hw/usb/tusb6010.c  | 2 +-
 6 files changed, 10 insertions(+), 8 deletions(-)
hw/usb/dev-mtp.c +1 -1
index 1cac1cd435..5cbaabd2b2 100644
@@ -1648,7 +1648,7 @@ static void usb_mtp_write_data(MTPState *s, uint32_t handle)
                 d->write_status = WRITE_END;
             }
         }
-        /* fall through */
+        fallthrough;
     case WRITE_CONTINUE:
     case WRITE_END:
         rc = write_retry(d->fd, d->data, d->data_offset,
hw/usb/dev-wacom.c +1 -1
index 7177c17f03..bd2a1bae50 100644
@@ -389,7 +389,7 @@ static void usb_wacom_handle_data(USBDevice *dev, USBPacket *p)
             usb_packet_copy(p, buf, len);
             break;
         }
-        /* Fall through.  */
+        fallthrough;
     case USB_TOKEN_OUT:
     default:
         p->status = USB_RET_STALL;
hw/usb/hcd-ehci.c +3 -1
index 19b4534c20..e29cc21957 100644
@@ -1477,7 +1477,7 @@ static int ehci_process_itd(EHCIState *ehci,
             default:
                 fprintf(stderr, "Unexpected iso usb result: %d\n",
                         ehci->ipacket.status);
-                /* Fall through */
+                fallthrough;
             case USB_RET_IOERROR:
             case USB_RET_NODEV:
                 /* 3.3.2: XACTERR is only allowed on IN transactions */
@@ -2140,6 +2140,7 @@ static void ehci_advance_async_state(EHCIState *ehci)
         }
         ehci_set_state(ehci, async, EST_ACTIVE);
         // No break, fall through to ACTIVE
+        fallthrough;
 
     case EST_ACTIVE:
         if (!ehci_async_enabled(ehci)) {
@@ -2197,6 +2198,7 @@ static void ehci_advance_periodic_state(EHCIState *ehci)
         if (!(ehci->frindex & 7) && ehci_periodic_enabled(ehci)) {
             ehci_set_state(ehci, async, EST_ACTIVE);
             // No break, fall through to ACTIVE
+            fallthrough;
         } else
             break;
 
hw/usb/hcd-xhci.c +2 -2
index 4b60114207..3e9b9c62bd 100644
@@ -1457,7 +1457,7 @@ static int xhci_xfer_create_sgl(XHCITransfer *xfer, int in_xfer)
                 DPRINTF("xhci: data direction mismatch for TR_DATA\n");
                 goto err;
             }
-            /* fallthrough */
+            fallthrough;
         case TR_NORMAL:
         case TR_ISOCH:
             addr = xhci_mask64(trb->parameter);
@@ -2678,7 +2678,7 @@ static void xhci_port_reset(XHCIPort *port, bool warm_reset)
         if (warm_reset) {
             port->portsc |= PORTSC_WRC;
         }
-        /* fall through */
+        fallthrough;
     case USB_SPEED_LOW:
     case USB_SPEED_FULL:
     case USB_SPEED_HIGH:
hw/usb/redirect.c +2 -2
index c9893df867..2531d583ad 100644
@@ -1814,7 +1814,7 @@ static void usbredir_ep_info(void *priv,
         case usb_redir_type_iso:
             usbredir_mark_speed_incompatible(dev, USB_SPEED_FULL);
             usbredir_mark_speed_incompatible(dev, USB_SPEED_HIGH);
-            /* Fall through */
+            fallthrough;
         case usb_redir_type_interrupt:
             if (!usbredirparser_peer_has_cap(dev->parser,
                                      usb_redir_cap_ep_info_max_packet_size) ||
@@ -1831,7 +1831,7 @@ static void usbredir_ep_info(void *priv,
                 usbredir_reject_device(dev);
                 return;
             }
-            /* Fall through */
+            fallthrough;
         case usb_redir_type_control:
         case usb_redir_type_bulk:
             DPRINTF("ep: %02X type: %d interface: %d\n", I2EP(i),
hw/usb/tusb6010.c +1 -1
index 1dd4071e68..88c736fad2 100644
@@ -741,7 +741,7 @@ static void tusb_musb_core_intr(void *opaque, int source, int level)
     case musb_irq_tx:
     case musb_irq_rx:
         s->usbip_intr = musb_core_intr_get(s->musb);
-        /* Fall through.  */
+        fallthrough;
     default:
         if (level)
             s->intr |= 1 << source;
Signature · 1 line
2.39.2
#18 lore raw

RFC PATCH v3 13/78 hw/adc: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

(Cédric Le Goater review is for aspeed_adc.c)

---
 hw/adc/aspeed_adc.c | 12 ++++++------
 hw/adc/zynq-xadc.c  |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)
hw/adc/aspeed_adc.c +6 -6
index 0d29663129..f9f5f7bb17 100644
@@ -119,7 +119,7 @@ static uint64_t aspeed_adc_engine_read(void *opaque, hwaddr addr,
                           __func__, s->engine_id, reg - BOUNDS_CHANNEL_0);
             break;
         }
-        /* fallthrough */
+        fallthrough;
     case HYSTERESIS_CHANNEL_8 ... HYSTERESIS_CHANNEL_15:
         if (s->nr_channels <= 8) {
             qemu_log_mask(LOG_GUEST_ERROR, "%s: engine[%u]: "
@@ -127,7 +127,7 @@ static uint64_t aspeed_adc_engine_read(void *opaque, hwaddr addr,
                           __func__, s->engine_id, reg - HYSTERESIS_CHANNEL_0);
             break;
         }
-        /* fallthrough */
+        fallthrough;
     case BOUNDS_CHANNEL_0 ... BOUNDS_CHANNEL_7:
     case HYSTERESIS_CHANNEL_0 ... HYSTERESIS_CHANNEL_7:
     case ENGINE_CONTROL:
@@ -145,7 +145,7 @@ static uint64_t aspeed_adc_engine_read(void *opaque, hwaddr addr,
                           __func__, s->engine_id, reg - DATA_CHANNEL_1_AND_0);
             break;
         }
-        /* fallthrough */
+        fallthrough;
     case DATA_CHANNEL_1_AND_0 ... DATA_CHANNEL_7_AND_6:
         value = read_channel_sample(s, reg);
         /* Allow 16-bit reads of the data registers */
@@ -194,7 +194,7 @@ static void aspeed_adc_engine_write(void *opaque, hwaddr addr, uint64_t value,
                           __func__, s->engine_id, reg - DATA_CHANNEL_1_AND_0);
             return;
         }
-        /* fallthrough */
+        fallthrough;
     case BOUNDS_CHANNEL_8 ... BOUNDS_CHANNEL_15:
         if (s->nr_channels <= 8) {
             qemu_log_mask(LOG_GUEST_ERROR, "%s: engine[%u]: "
@@ -202,7 +202,7 @@ static void aspeed_adc_engine_write(void *opaque, hwaddr addr, uint64_t value,
                           __func__, s->engine_id, reg - BOUNDS_CHANNEL_0);
             return;
         }
-        /* fallthrough */
+        fallthrough;
     case DATA_CHANNEL_1_AND_0 ... DATA_CHANNEL_7_AND_6:
     case BOUNDS_CHANNEL_0 ... BOUNDS_CHANNEL_7:
         value &= ASPEED_ADC_LH_MASK;
@@ -214,7 +214,7 @@ static void aspeed_adc_engine_write(void *opaque, hwaddr addr, uint64_t value,
                           __func__, s->engine_id, reg - HYSTERESIS_CHANNEL_0);
             return;
         }
-        /* fallthrough */
+        fallthrough;
     case HYSTERESIS_CHANNEL_0 ... HYSTERESIS_CHANNEL_7:
         value &= (ASPEED_ADC_HYST_EN | ASPEED_ADC_LH_MASK);
         break;
hw/adc/zynq-xadc.c +1 -1
index 032e19cbd0..a74de3a4fd 100644
@@ -235,7 +235,7 @@ static void zynq_xadc_write(void *opaque, hwaddr offset, uint64_t val,
             break;
         case CMD_WRITE:
             s->xadc_regs[xadc_reg] = xadc_data;
-            /* fallthrough */
+            fallthrough;
         case CMD_NOP:
             xadc_push_dfifo(s, 0);
             break;
Signature · 1 line
2.39.2
#19 lore raw

RFC PATCH v3 14/78 util/error-report.c: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 util/error-report.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
util/error-report.c +1 -1
index 6e44a55732..acb66420de 100644
@@ -369,7 +369,7 @@ static void qemu_log_func(const gchar *log_domain,
           (log_domain == NULL || !strstr(qemu_glog_domains, log_domain))) {
             break;
         }
-        /* Fall through */
+        fallthrough;
     case G_LOG_LEVEL_MESSAGE:
         info_report("%s%s%s",
                     log_domain ?: "", log_domain ? ": " : "", message);
Signature · 1 line
2.39.2
#20 lore raw

RFC PATCH v3 15/78 accel/tcg: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 accel/tcg/cputlb.c             | 4 ++--
 accel/tcg/ldst_atomicity.c.inc | 2 +-
 accel/tcg/plugin-gen.c         | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
accel/tcg/cputlb.c +2 -2
index b8c5e345b8..92b7ab529a 100644
@@ -2244,7 +2244,7 @@ static uint64_t do_ld_beN(CPUState *cpu, MMULookupPageData *p,
                 return do_ld_whole_be8(cpu, ra, p, ret_be);
             }
         }
-        /* fall through */
+        fallthrough;
 
     case MO_ATOM_IFALIGN:
     case MO_ATOM_WITHIN16:
@@ -2664,7 +2664,7 @@ static uint64_t do_st_leN(CPUState *cpu, MMULookupPageData *p,
                 cpu_loop_exit_atomic(cpu, ra);
             }
         }
-        /* fall through */
+        fallthrough;
 
     case MO_ATOM_IFALIGN:
     case MO_ATOM_WITHIN16:
accel/tcg/ldst_atomicity.c.inc +1 -1
index 1cf5b92166..3752f74214 100644
@@ -41,7 +41,7 @@ static int required_atomicity(CPUState *cpu, uintptr_t p, MemOp memop)
 
     case MO_ATOM_IFALIGN_PAIR:
         size = half;
-        /* fall through */
+        fallthrough;
 
     case MO_ATOM_IFALIGN:
         tmp = (1 << size) - 1;
accel/tcg/plugin-gen.c +1 -1
index d31c9993ea..ba9a8c8789 100644
@@ -190,7 +190,7 @@ static void plugin_gen_empty_callback(enum plugin_gen_from from)
          */
         gen_wrapped(from, PLUGIN_GEN_ENABLE_MEM_HELPER,
                     gen_empty_mem_helper);
-        /* fall through */
+        fallthrough;
     case PLUGIN_GEN_FROM_TB:
         gen_wrapped(from, PLUGIN_GEN_CB_UDATA, gen_empty_udata_cb);
         gen_wrapped(from, PLUGIN_GEN_CB_INLINE, gen_empty_inline_cb);
Signature · 1 line
2.39.2
#21 lore raw

RFC PATCH v3 16/78 audio: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 audio/audio.c     | 16 ++++++++--------
 audio/jackaudio.c |  4 ++--
 audio/pwaudio.c   |  4 ++--
 3 files changed, 12 insertions(+), 12 deletions(-)
audio/audio.c +8 -8
index e9815d6812..ed7c795af7 100644
@@ -250,23 +250,23 @@ static int audio_pcm_info_eq (struct audio_pcm_info *info, struct audsettings *a
     switch (as->fmt) {
     case AUDIO_FORMAT_S8:
         is_signed = true;
-        /* fall through */
+        fallthrough;
     case AUDIO_FORMAT_U8:
         break;
 
     case AUDIO_FORMAT_S16:
         is_signed = true;
-        /* fall through */
+        fallthrough;
     case AUDIO_FORMAT_U16:
         bits = 16;
         break;
 
     case AUDIO_FORMAT_F32:
         is_float = true;
-        /* fall through */
+        fallthrough;
     case AUDIO_FORMAT_S32:
         is_signed = true;
-        /* fall through */
+        fallthrough;
     case AUDIO_FORMAT_U32:
         bits = 32;
         break;
@@ -290,14 +290,14 @@ void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as)
     switch (as->fmt) {
     case AUDIO_FORMAT_S8:
         is_signed = true;
-        /* fall through */
+        fallthrough;
     case AUDIO_FORMAT_U8:
         mul = 1;
         break;
 
     case AUDIO_FORMAT_S16:
         is_signed = true;
-        /* fall through */
+        fallthrough;
     case AUDIO_FORMAT_U16:
         bits = 16;
         mul = 2;
@@ -305,10 +305,10 @@ void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as)
 
     case AUDIO_FORMAT_F32:
         is_float = true;
-        /* fall through */
+        fallthrough;
     case AUDIO_FORMAT_S32:
         is_signed = true;
-        /* fall through */
+        fallthrough;
     case AUDIO_FORMAT_U32:
         bits = 32;
         mul = 4;
audio/jackaudio.c +2 -2
index 974a3caad3..fc602411cd 100644
@@ -576,7 +576,7 @@ static void qjack_client_fini_locked(QJackClient *c)
     switch (c->state) {
     case QJACK_STATE_RUNNING:
         jack_deactivate(c->client);
-        /* fallthrough */
+        fallthrough;
 
     case QJACK_STATE_SHUTDOWN:
         jack_client_close(c->client);
@@ -587,7 +587,7 @@ static void qjack_client_fini_locked(QJackClient *c)
         g_free(c->process_buffers);
 
         c->state = QJACK_STATE_DISCONNECTED;
-        /* fallthrough */
+        fallthrough;
 
     case QJACK_STATE_DISCONNECTED:
         break;
audio/pwaudio.c +2 -2
index bf26fadb06..89b31617a6 100644
@@ -497,13 +497,13 @@ qpw_set_position(uint32_t channels, uint32_t position[SPA_AUDIO_MAX_CHANNELS])
     case 8:
         position[6] = SPA_AUDIO_CHANNEL_SL;
         position[7] = SPA_AUDIO_CHANNEL_SR;
-        /* fallthrough */
+        fallthrough;
     case 6:
         position[2] = SPA_AUDIO_CHANNEL_FC;
         position[3] = SPA_AUDIO_CHANNEL_LFE;
         position[4] = SPA_AUDIO_CHANNEL_RL;
         position[5] = SPA_AUDIO_CHANNEL_RR;
-        /* fallthrough */
+        fallthrough;
     case 2:
         position[0] = SPA_AUDIO_CHANNEL_FL;
         position[1] = SPA_AUDIO_CHANNEL_FR;
Signature · 1 line
2.39.2
#22 lore raw

RFC PATCH v3 17/78 ui/sdl2.c: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 ui/sdl2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ui/sdl2.c +1 -1
index fbfdb64e90..3d157a14aa 100644
@@ -601,7 +601,7 @@ static void handle_windowevent(SDL_Event *ev)
         if (qemu_console_is_graphic(scon->dcl.con)) {
             win32_kbd_set_window(sdl2_win32_get_hwnd(scon));
         }
-        /* fall through */
+        fallthrough;
     case SDL_WINDOWEVENT_ENTER:
         if (!gui_grab && (qemu_input_is_absolute(scon->dcl.con) || absolute_enabled)) {
             absolute_mouse_grab(scon);
Signature · 1 line
2.39.2
#23 lore raw

RFC PATCH v3 18/78 ui/win32-kbd-hook.c: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 ui/win32-kbd-hook.c | 7 -------
 1 file changed, 7 deletions(-)
ui/win32-kbd-hook.c +0 -7
index 1ac237db9e..3c5c3fc597 100644
@@ -26,19 +26,12 @@ static LRESULT CALLBACK keyboard_hook_cb(int code, WPARAM wparam, LPARAM lparam)
 
             switch (hooked->vkCode) {
             case VK_CAPITAL:
-                /* fall through */
             case VK_SCROLL:
-                /* fall through */
             case VK_NUMLOCK:
-                /* fall through */
             case VK_LSHIFT:
-                /* fall through */
             case VK_RSHIFT:
-                /* fall through */
             case VK_RCONTROL:
-                /* fall through */
             case VK_LMENU:
-                /* fall through */
             case VK_RMENU:
                 break;
 
Signature · 1 line
2.39.2
#24 lore raw

RFC PATCH v3 19/78 target/hppa: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 target/hppa/translate.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
target/hppa/translate.c +5 -5
index 9f3ba9f42f..1df81b0fa2 100644
@@ -483,7 +483,7 @@ static void cond_free(DisasCond *cond)
     default:
         cond->a0 = NULL;
         cond->a1 = NULL;
-        /* fallthru */
+        fallthrough;
     case TCG_COND_ALWAYS:
         cond->c = TCG_COND_NEVER;
         break;
@@ -3848,13 +3848,13 @@ static bool trans_ftest(DisasContext *ctx, arg_ftest *a)
             goto done;
         case 2: /* rej */
             inv = true;
-            /* fallthru */
+            fallthrough;
         case 1: /* acc */
             mask = 0x43ff800;
             break;
         case 6: /* rej8 */
             inv = true;
-            /* fallthru */
+            fallthrough;
         case 5: /* acc8 */
             mask = 0x43f8000;
             break;
@@ -4230,13 +4230,13 @@ static void hppa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
         copy_iaoq_entry(cpu_iaoq_f, ctx->iaoq_f, cpu_iaoq_f);
         copy_iaoq_entry(cpu_iaoq_b, ctx->iaoq_b, cpu_iaoq_b);
         nullify_save(ctx);
-        /* FALLTHRU */
+        fallthrough;
     case DISAS_IAQ_N_UPDATED:
         if (is_jmp != DISAS_IAQ_N_STALE_EXIT) {
             tcg_gen_lookup_and_goto_ptr();
             break;
         }
-        /* FALLTHRU */
+        fallthrough;
     case DISAS_EXIT:
         tcg_gen_exit_tb(NULL, 0);
         break;
Signature · 1 line
2.39.2
#25 lore raw

RFC PATCH v3 20/78 target/mips: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 target/mips/sysemu/physaddr.c             |  2 +-
 target/mips/tcg/micromips_translate.c.inc |  4 +-
 target/mips/tcg/mips16e_translate.c.inc   | 30 ++++-----
 target/mips/tcg/mxu_translate.c           |  8 +--
 target/mips/tcg/nanomips_translate.c.inc  |  4 +-
 target/mips/tcg/op_helper.c               |  2 +-
 target/mips/tcg/translate.c               | 79 ++++++++++++-----------
 7 files changed, 66 insertions(+), 63 deletions(-)
target/mips/sysemu/physaddr.c +1 -1
index 05990aa5bb..ebcaeea1bc 100644
@@ -44,7 +44,7 @@ static int is_seg_am_mapped(unsigned int am, bool eu, int mmu_idx)
         if (eu) {
             return 0;
         }
-        /* fall through */
+        fallthrough;
     case MIPS_HFLAG_KM:
         /* Never AdE, TLB mapped if AM={1,2,3} */
         adetlb_mask = 0x70000000;
target/mips/tcg/micromips_translate.c.inc +2 -2
index 7510831701..00e96ce27a 100644
@@ -1845,7 +1845,7 @@ static void decode_micromips32_opc(CPUMIPSState *env, DisasContext *ctx)
             check_insn(ctx, ISA_MIPS3);
             check_mips_64(ctx);
 #endif
-            /* fall through */
+            fallthrough;
         case LWP:
         case SWP:
             gen_ldst_pair(ctx, minor, rt, rs, SIMM(ctx->opcode, 0, 12));
@@ -1856,7 +1856,7 @@ static void decode_micromips32_opc(CPUMIPSState *env, DisasContext *ctx)
             check_insn(ctx, ISA_MIPS3);
             check_mips_64(ctx);
 #endif
-            /* fall through */
+            fallthrough;
         case LWM32:
         case SWM32:
             gen_ldst_multiple(ctx, minor, rt, rs, SIMM(ctx->opcode, 0, 12));
target/mips/tcg/mips16e_translate.c.inc +15 -15
index 5cffe0e412..b8bdd6a7f2 100644
@@ -174,19 +174,19 @@ static void gen_mips16_save(DisasContext *ctx,
         gen_load_gpr(t1, 7);
         tcg_gen_qemu_st_tl(t1, t0, ctx->mem_idx, MO_TEUL |
                            ctx->default_tcg_memop_mask);
-        /* Fall through */
+        fallthrough;
     case 3:
         gen_base_offset_addr(ctx, t0, 29, 8);
         gen_load_gpr(t1, 6);
         tcg_gen_qemu_st_tl(t1, t0, ctx->mem_idx, MO_TEUL |
                            ctx->default_tcg_memop_mask);
-        /* Fall through */
+        fallthrough;
     case 2:
         gen_base_offset_addr(ctx, t0, 29, 4);
         gen_load_gpr(t1, 5);
         tcg_gen_qemu_st_tl(t1, t0, ctx->mem_idx, MO_TEUL |
                            ctx->default_tcg_memop_mask);
-        /* Fall through */
+        fallthrough;
     case 1:
         gen_base_offset_addr(ctx, t0, 29, 0);
         gen_load_gpr(t1, 4);
@@ -211,22 +211,22 @@ static void gen_mips16_save(DisasContext *ctx,
     switch (xsregs) {
     case 7:
         DECR_AND_STORE(30);
-        /* Fall through */
+        fallthrough;
     case 6:
         DECR_AND_STORE(23);
-        /* Fall through */
+        fallthrough;
     case 5:
         DECR_AND_STORE(22);
-        /* Fall through */
+        fallthrough;
     case 4:
         DECR_AND_STORE(21);
-        /* Fall through */
+        fallthrough;
     case 3:
         DECR_AND_STORE(20);
-        /* Fall through */
+        fallthrough;
     case 2:
         DECR_AND_STORE(19);
-        /* Fall through */
+        fallthrough;
     case 1:
         DECR_AND_STORE(18);
     }
@@ -315,22 +315,22 @@ static void gen_mips16_restore(DisasContext *ctx,
     switch (xsregs) {
     case 7:
         DECR_AND_LOAD(30);
-        /* Fall through */
+        fallthrough;
     case 6:
         DECR_AND_LOAD(23);
-        /* Fall through */
+        fallthrough;
     case 5:
         DECR_AND_LOAD(22);
-        /* Fall through */
+        fallthrough;
     case 4:
         DECR_AND_LOAD(21);
-        /* Fall through */
+        fallthrough;
     case 3:
         DECR_AND_LOAD(20);
-        /* Fall through */
+        fallthrough;
     case 2:
         DECR_AND_LOAD(19);
-        /* Fall through */
+        fallthrough;
     case 1:
         DECR_AND_LOAD(18);
     }
target/mips/tcg/mxu_translate.c +4 -4
index c517258ac5..3811ac0d54 100644
@@ -4573,7 +4573,7 @@ static void decode_opc_mxu__pool06(DisasContext *ctx)
             gen_mxu_s32ldxvx(ctx, opcode, false, strd2);
             break;
         }
-        /* fallthrough */
+        fallthrough;
     default:
         MIPS_INVAL("decode_opc_mxu");
         gen_reserved_instruction(ctx);
@@ -4593,7 +4593,7 @@ static void decode_opc_mxu__pool07(DisasContext *ctx)
             gen_mxu_s32stxvx(ctx, opcode, false, strd2);
             break;
         }
-        /* fallthrough */
+        fallthrough;
     default:
         MIPS_INVAL("decode_opc_mxu");
         gen_reserved_instruction(ctx);
@@ -4639,7 +4639,7 @@ static void decode_opc_mxu__pool10(DisasContext *ctx)
             gen_mxu_s32ldxvx(ctx, opcode, true, strd2);
             break;
         }
-        /* fallthrough */
+        fallthrough;
     default:
         MIPS_INVAL("decode_opc_mxu");
         gen_reserved_instruction(ctx);
@@ -4659,7 +4659,7 @@ static void decode_opc_mxu__pool11(DisasContext *ctx)
             gen_mxu_s32stxvx(ctx, opcode, true, strd2);
             break;
         }
-        /* fallthrough */
+        fallthrough;
     default:
         MIPS_INVAL("decode_opc_mxu");
         gen_reserved_instruction(ctx);
target/mips/tcg/nanomips_translate.c.inc +2 -2
index b4b746d418..3e5f4f4e58 100644
@@ -2615,14 +2615,14 @@ static void gen_p_lsx(DisasContext *ctx, int rd, int rs, int rt)
         switch (extract32(ctx->opcode, 7, 4)) {
         case NM_SHXS:
             check_nms(ctx);
-            /* fall through */
+            fallthrough;
         case NM_LHXS:
         case NM_LHUXS:
             tcg_gen_shli_tl(t0, t0, 1);
             break;
         case NM_SWXS:
             check_nms(ctx);
-            /* fall through */
+            fallthrough;
         case NM_LWXS:
         case NM_LWC1XS:
         case NM_SWC1XS:
target/mips/tcg/op_helper.c +1 -1
index 98935b5e64..b53f4fa694 100644
@@ -238,7 +238,7 @@ void helper_pmon(CPUMIPSState *env, int function)
         if (env->active_tc.gpr[4] == 0) {
             env->active_tc.gpr[2] = -1;
         }
-        /* Fall through */
+        fallthrough;
     case 11: /* TODO: char inbyte (void); */
         env->active_tc.gpr[2] = -1;
         break;
target/mips/tcg/translate.c +41 -38

319 lines not on this page · raw message

Signature · 1 line
2.39.2
Reviewed-by on v3 20/78
#26 lore raw

Re: [RFC PATCH v3 20/78] target/mips: add fallthrough pseudo-keyword

Quoted 4 lines · Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

Quoted 9 lines
---
  target/mips/sysemu/physaddr.c             |  2 +-
  target/mips/tcg/micromips_translate.c.inc |  4 +-
  target/mips/tcg/mips16e_translate.c.inc   | 30 ++++-----
  target/mips/tcg/mxu_translate.c           |  8 +--
  target/mips/tcg/nanomips_translate.c.inc  |  4 +-
  target/mips/tcg/op_helper.c               |  2 +-
  target/mips/tcg/translate.c               | 79 ++++++++++++-----------
  7 files changed, 66 insertions(+), 63 deletions(-)
#27 lore raw

RFC PATCH v3 21/78 target/sparc: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 target/sparc/ldst_helper.c | 4 ++--
 target/sparc/mmu_helper.c  | 6 +++---
 target/sparc/translate.c   | 3 ++-
 target/sparc/win_helper.c  | 1 +
 4 files changed, 8 insertions(+), 6 deletions(-)
target/sparc/ldst_helper.c +2 -2
index 78b03308ae..b233e40da5 100644
@@ -1522,7 +1522,7 @@ uint64_t helper_ld_asi(CPUSPARCState *env, target_ulong addr,
             /* Hyperprivileged access only */
             sparc_raise_mmu_fault(cs, addr, false, false, 1, size, GETPC());
         }
-        /* fall through */
+        fallthrough;
     case ASI_HYP_SCRATCHPAD: /* UA2005 hyperprivileged scratchpad */
         {
             unsigned int i = (addr >> 3) & 0x7;
@@ -1865,7 +1865,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val,
             /* Hyperprivileged access only */
             sparc_raise_mmu_fault(cs, addr, true, false, 1, size, GETPC());
         }
-        /* fall through */
+        fallthrough;
     case ASI_HYP_SCRATCHPAD: /* UA2005 hyperprivileged scratchpad */
         {
             unsigned int i = (addr >> 3) & 0x7;
target/sparc/mmu_helper.c +3 -3
index 453498c670..13f0430c5d 100644
@@ -558,13 +558,13 @@ static int get_physical_address_data(CPUSPARCState *env, CPUTLBEntryFull *full,
         g_assert_not_reached();
     case MMU_USER_IDX:
         is_user = true;
-        /* fallthru */
+        fallthrough;
     case MMU_KERNEL_IDX:
         context = env->dmmu.mmu_primary_context & 0x1fff;
         break;
     case MMU_USER_SECONDARY_IDX:
         is_user = true;
-        /* fallthru */
+        fallthrough;
     case MMU_KERNEL_SECONDARY_IDX:
         context = env->dmmu.mmu_secondary_context & 0x1fff;
         break;
@@ -657,7 +657,7 @@ static int get_physical_address_code(CPUSPARCState *env, CPUTLBEntryFull *full,
         g_assert_not_reached();
     case MMU_USER_IDX:
         is_user = true;
-        /* fallthru */
+        fallthrough;
     case MMU_KERNEL_IDX:
         context = env->dmmu.mmu_primary_context & 0x1fff;
         break;
target/sparc/translate.c +2 -1
index f92ff80ac8..4f179473d7 100644
@@ -1123,6 +1123,7 @@ static void gen_compare(DisasCompare *cmp, bool xcc, unsigned int cond,
         gen_helper_compute_psr(tcg_env);
         dc->cc_op = CC_OP_FLAGS;
         /* FALLTHRU */
+        fallthrough;
 
     case CC_OP_FLAGS:
         /* We're going to generate a boolean result.  */
@@ -2204,7 +2205,7 @@ static void gen_st_asi(DisasContext *dc, TCGv src, TCGv addr,
         /* in OpenSPARC T1+ CPUs TWINX ASIs in store instructions
          * are ST_BLKINIT_ ASIs */
 #endif
-        /* fall through */
+        fallthrough;
     case GET_ASI_DIRECT:
         gen_address_mask(dc, addr);
         tcg_gen_qemu_st_tl(src, addr, da.mem_idx, da.memop | MO_ALIGN);
target/sparc/win_helper.c +1 -0
index 3a7c0ff943..0c54b63938 100644
@@ -303,6 +303,7 @@ static inline uint64_t *get_gregset(CPUSPARCState *env, uint32_t pstate)
     default:
         trace_win_helper_gregset_error(pstate);
         /* fall through to normal set of global registers */
+        fallthrough;
     case 0:
         return env->bgregs;
     case PS_AG:
Signature · 1 line
2.39.2
#28 lore raw

RFC PATCH v3 22/78 target/ppc: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 target/ppc/cpu_init.c    |  8 ++++----
 target/ppc/excp_helper.c |  6 +++---
 target/ppc/mmu-radix64.c |  6 +++---
 target/ppc/mmu_common.c  | 12 ++++++------
 target/ppc/translate.c   |  6 +++---
 5 files changed, 19 insertions(+), 19 deletions(-)
target/ppc/cpu_init.c +4 -4
index 40fe14a6c2..7a7bd4d824 100644
@@ -894,25 +894,25 @@ static void register_BookE206_sprs(CPUPPCState *env, uint32_t mas_mask,
                      SPR_NOACCESS, SPR_NOACCESS,
                      &spr_read_generic, SPR_NOACCESS,
                      tlbncfg[3]);
-        /* Fallthru */
+        fallthrough;
     case 3:
         spr_register(env, SPR_BOOKE_TLB2CFG, "TLB2CFG",
                      SPR_NOACCESS, SPR_NOACCESS,
                      &spr_read_generic, SPR_NOACCESS,
                      tlbncfg[2]);
-        /* Fallthru */
+        fallthrough;
     case 2:
         spr_register(env, SPR_BOOKE_TLB1CFG, "TLB1CFG",
                      SPR_NOACCESS, SPR_NOACCESS,
                      &spr_read_generic, SPR_NOACCESS,
                      tlbncfg[1]);
-        /* Fallthru */
+        fallthrough;
     case 1:
         spr_register(env, SPR_BOOKE_TLB0CFG, "TLB0CFG",
                      SPR_NOACCESS, SPR_NOACCESS,
                      &spr_read_generic, SPR_NOACCESS,
                      tlbncfg[0]);
-        /* Fallthru */
+        fallthrough;
     case 0:
     default:
         break;
target/ppc/excp_helper.c +3 -3
index 7926114d5c..b8be34051c 100644
@@ -1334,7 +1334,7 @@ static bool is_prefix_insn_excp(PowerPCCPU *cpu, int excp)
              */
             break;
         }
-        /* fall through */
+        fallthrough;
     case POWERPC_EXCP_MCHECK:
     case POWERPC_EXCP_DSI:
     case POWERPC_EXCP_DSEG:
@@ -1576,7 +1576,7 @@ static void powerpc_excp_books(PowerPCCPU *cpu, int excp)
         break;
     case POWERPC_EXCP_TRACE:     /* Trace exception                          */
         msr |= env->error_code;
-        /* fall through */
+        fallthrough;
     case POWERPC_EXCP_DSEG:      /* Data segment exception                   */
     case POWERPC_EXCP_ISEG:      /* Instruction segment exception            */
     case POWERPC_EXCP_SDOOR:     /* Doorbell interrupt                       */
@@ -1584,7 +1584,7 @@ static void powerpc_excp_books(PowerPCCPU *cpu, int excp)
         break;
     case POWERPC_EXCP_HISI:      /* Hypervisor instruction storage exception */
         msr |= env->error_code;
-        /* fall through */
+        fallthrough;
     case POWERPC_EXCP_HDECR:     /* Hypervisor decrementer exception         */
     case POWERPC_EXCP_HDSI:      /* Hypervisor data storage exception        */
     case POWERPC_EXCP_SDOOR_HV:  /* Hypervisor Doorbell interrupt            */
target/ppc/mmu-radix64.c +3 -3
index 5823e039e6..a85bd614bf 100644
@@ -126,7 +126,7 @@ static void ppc_radix64_raise_si(PowerPCCPU *cpu, MMUAccessType access_type,
         break;
     case MMU_DATA_STORE:
         cause |= DSISR_ISSTORE;
-        /* fall through */
+        fallthrough;
     case MMU_DATA_LOAD:
         /* Data Storage Interrupt */
         cs->exception_index = POWERPC_EXCP_DSI;
@@ -166,7 +166,7 @@ static void ppc_radix64_raise_hsi(PowerPCCPU *cpu, MMUAccessType access_type,
         break;
     case MMU_DATA_STORE:
         cause |= DSISR_ISSTORE;
-        /* fall through */
+        fallthrough;
     case MMU_DATA_LOAD:
         /* H Data Storage Interrupt */
         cs->exception_index = POWERPC_EXCP_HDSI;
@@ -226,7 +226,7 @@ static int ppc_radix64_check_rc(MMUAccessType access_type, uint64_t pte)
         if (!(pte & R_PTE_C)) {
             break;
         }
-        /* fall through */
+        fallthrough;
     case MMU_INST_FETCH:
     case MMU_DATA_LOAD:
         if (!(pte & R_PTE_R)) {
target/ppc/mmu_common.c +6 -6
index 6ca5d12207..dd44befe6f 100644
@@ -76,7 +76,7 @@ static int pp_check(int key, int pp, int nx)
         case 0x1:
         case 0x2:
             access |= PAGE_WRITE;
-            /* fall through */
+            fallthrough;
         case 0x3:
             access |= PAGE_READ;
             break;
@@ -559,7 +559,7 @@ static int mmu40x_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx,
             if (pr != 0) {
                 goto check_perms;
             }
-            /* fall through */
+            fallthrough;
         case 0x3:
             /* All accesses granted */
             ctx->prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
@@ -573,7 +573,7 @@ static int mmu40x_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx,
                 ret = -2;
                 break;
             }
-            /* fall through */
+            fallthrough;
         case 0x1:
         check_perms:
             /* Check from TLB entry */
@@ -1349,7 +1349,7 @@ static bool ppc_jumbo_xlate(PowerPCCPU *cpu, vaddr eaddr,
                     break;
                 case POWERPC_MMU_BOOKE206:
                     booke206_update_mas_tlb_miss(env, eaddr, 2, mmu_idx);
-                    /* fall through */
+                    fallthrough;
                 case POWERPC_MMU_BOOKE:
                     cs->exception_index = POWERPC_EXCP_ITLB;
                     env->error_code = 0;
@@ -1435,7 +1435,7 @@ static bool ppc_jumbo_xlate(PowerPCCPU *cpu, vaddr eaddr,
                     cpu_abort(cs, "MPC8xx MMU model is not implemented\n");
                 case POWERPC_MMU_BOOKE206:
                     booke206_update_mas_tlb_miss(env, eaddr, access_type, mmu_idx);
-                    /* fall through */
+                    fallthrough;
                 case POWERPC_MMU_BOOKE:
                     cs->exception_index = POWERPC_EXCP_DTLB;
                     env->error_code = 0;
@@ -1530,7 +1530,7 @@ bool ppc_xlate(PowerPCCPU *cpu, vaddr eaddr, MMUAccessType access_type,
             return ppc_radix64_xlate(cpu, eaddr, access_type, raddrp,
                                      psizep, protp, mmu_idx, guest_visible);
         }
-        /* fall through */
+        fallthrough;
     case POWERPC_MMU_64B:
     case POWERPC_MMU_2_03:
     case POWERPC_MMU_2_06:
target/ppc/translate.c +3 -3
index 329da4d518..a67b77258d 100644
@@ -7472,10 +7472,10 @@ static void ppc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
             tcg_gen_exit_tb(ctx->base.tb, 0);
             break;
         }
-        /* fall through */
+        fallthrough;
     case DISAS_CHAIN_UPDATE:
         gen_update_nip(ctx, nip);
-        /* fall through */
+        fallthrough;
     case DISAS_CHAIN:
         /*
          * tcg_gen_lookup_and_goto_ptr will exit the TB if
@@ -7490,7 +7490,7 @@ static void ppc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
 
     case DISAS_EXIT_UPDATE:
         gen_update_nip(ctx, nip);
-        /* fall through */
+        fallthrough;
     case DISAS_EXIT:
         pmu_count_insns(ctx);
         tcg_gen_exit_tb(NULL, 0);
Signature · 1 line
2.39.2
#29 lore raw

RFC PATCH v3 23/78 target/arm: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 target/arm/helper.c               | 34 +++++++-------
 target/arm/ptw.c                  | 10 ++--
 target/arm/tcg/psci.c             |  2 +-
 target/arm/tcg/translate-a64.c    | 76 +++++++++++++++----------------
 target/arm/tcg/translate-m-nocp.c |  2 +-
 target/arm/tcg/translate-vfp.c    |  2 +-
 target/arm/tcg/translate.c        |  8 ++--
 7 files changed, 68 insertions(+), 66 deletions(-)
target/arm/helper.c +18 -16
index 74fbb6e1d7..e2d1426cf4 100644
@@ -2526,7 +2526,7 @@ static CPAccessResult gt_timer_access(CPUARMState *env, int timeridx,
         if (!extract32(env->cp15.c14_cntkctl, 9 - timeridx, 1)) {
             return CP_ACCESS_TRAP;
         }
-        /* fall through */
+        fallthrough;
 
     case 1:
         if (has_el2 && timeridx == GTIMER_PHYS) {
@@ -3588,7 +3588,7 @@ static void ats_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
             break;
         case 2:
             g_assert(ss != ARMSS_Secure);  /* ARMv8.4-SecEL2 is 64-bit only */
-            /* fall through */
+            fallthrough;
         case 1:
             if (ri->crm == 9 && (env->uncached_cpsr & CPSR_PAN)) {
                 mmu_idx = ARMMMUIdx_Stage1_E1_PAN;
@@ -4657,7 +4657,7 @@ static CPAccessResult aa64_cacheop_poc_access(CPUARMState *env,
         if (!(arm_sctlr(env, 0) & SCTLR_UCI)) {
             return CP_ACCESS_TRAP;
         }
-        /* fall through */
+        fallthrough;
     case 1:
         /* ... EL1 must trap to EL2 if HCR_EL2.TPCP is set.  */
         if (arm_hcr_el2_eff(env) & HCR_TPCP) {
@@ -4677,7 +4677,7 @@ static CPAccessResult do_cacheop_pou_access(CPUARMState *env, uint64_t hcrflags)
         if (!(arm_sctlr(env, 0) & SCTLR_UCI)) {
             return CP_ACCESS_TRAP;
         }
-        /* fall through */
+        fallthrough;
     case 1:
         /* ... EL1 must trap to EL2 if relevant HCR_EL2 flags are set.  */
         if (arm_hcr_el2_eff(env) & hcrflags) {
@@ -6757,7 +6757,7 @@ int sve_exception_el(CPUARMState *env, int el)
             if (el != 0) {
                 break;
             }
-            /* fall through */
+            fallthrough;
         case 0:
         case 2:
             return 1;
@@ -6772,7 +6772,7 @@ int sve_exception_el(CPUARMState *env, int el)
                 if (el != 0 || !(env->cp15.hcr_el2 & HCR_TGE)) {
                     break;
                 }
-                /* fall through */
+                fallthrough;
             case 0:
             case 2:
                 return 2;
@@ -6806,7 +6806,7 @@ int sme_exception_el(CPUARMState *env, int el)
             if (el != 0) {
                 break;
             }
-            /* fall through */
+            fallthrough;
         case 0:
         case 2:
             return 1;
@@ -6821,7 +6821,7 @@ int sme_exception_el(CPUARMState *env, int el)
                 if (el != 0 || !(env->cp15.hcr_el2 & HCR_TGE)) {
                     break;
                 }
-                /* fall through */
+                fallthrough;
             case 0:
             case 2:
                 return 2;
@@ -9731,7 +9731,7 @@ void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu,
         if (r->cp == 0) {
             break;
         }
-        /* fall through */
+        fallthrough;
     case ARM_CP_STATE_AA32:
         if (arm_feature(&cpu->env, ARM_FEATURE_V8) &&
             !arm_feature(&cpu->env, ARM_FEATURE_M)) {
@@ -10660,7 +10660,7 @@ static void take_aarch32_exception(CPUARMState *env, int new_mode,
                     break;
                 }
                 /* ... the target is EL3, from secure state ... */
-                /* fall through */
+                fallthrough;
             case 1:
                 /* ... the target is EL1 and SCTLR.SPAN is 0.  */
                 if (!(env->cp15.sctlr_el[new_el] & SCTLR_SPAN)) {
@@ -10712,6 +10712,7 @@ static void arm_cpu_do_interrupt_aarch32_hyp(CPUState *cs)
         break;
     case EXCP_BKPT:
         /* Fall through to prefetch abort.  */
+        fallthrough;
     case EXCP_PREFETCH_ABORT:
         env->cp15.ifar_s = env->exception.vaddress;
         qemu_log_mask(CPU_LOG_INT, "...with HIFAR 0x%x\n",
@@ -10837,6 +10838,7 @@ static void arm_cpu_do_interrupt_aarch32(CPUState *cs)
         break;
     case EXCP_BKPT:
         /* Fall through to prefetch abort.  */
+        fallthrough;
     case EXCP_PREFETCH_ABORT:
         A32_BANKED_CURRENT_REG_SET(env, ifsr, env->exception.fsr);
         A32_BANKED_CURRENT_REG_SET(env, ifar, env->exception.vaddress);
@@ -11091,7 +11093,7 @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs)
                 is_aa64 = (hcr & HCR_RW) != 0;
                 break;
             }
-            /* fall through */
+            fallthrough;
         case 1:
             is_aa64 = is_a64(env);
             break;
@@ -11112,7 +11114,7 @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs)
     case EXCP_GPC:
         qemu_log_mask(CPU_LOG_INT, "...with MFAR 0x%" PRIx64 "\n",
                       env->cp15.mfar_el3);
-        /* fall through */
+        fallthrough;
     case EXCP_PREFETCH_ABORT:
     case EXCP_DATA_ABORT:
         /*
@@ -11126,7 +11128,7 @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs)
         env->cp15.far_el[new_el] = env->exception.vaddress;
         qemu_log_mask(CPU_LOG_INT, "...with FAR 0x%" PRIx64 "\n",
                       env->cp15.far_el[new_el]);
-        /* fall through */
+        fallthrough;
     case EXCP_BKPT:
     case EXCP_UDEF:
     case EXCP_SWI:
@@ -11218,7 +11220,7 @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs)
                 != (HCR_E2H | HCR_TGE)) {
                 break;
             }
-            /* fall through */
+            fallthrough;
         case 1:
             /* ... the target is EL1 ... */
             /* ... and SCTLR_ELx.SPAN == 0, then set to 1.  */
@@ -11956,7 +11958,7 @@ int fp_exception_el(CPUARMState *env, int cur_el)
             if (cur_el != 0) {
                 break;
             }
-            /* fall through */
+            fallthrough;
         case 0:
         case 2:
             /* Trap from Secure PL0 or PL1 to Secure PL1. */
@@ -11995,7 +11997,7 @@ int fp_exception_el(CPUARMState *env, int cur_el)
                 if (cur_el != 0 || !(hcr_el2 & HCR_TGE)) {
                     break;
                 }
-                /* fall through */
+                fallthrough;
             case 0:
             case 2:
                 return 2;
target/arm/ptw.c +5 -5
index 95db9ec4c3..3f6783c100 100644
@@ -2374,7 +2374,7 @@ static bool get_phys_addr_pmsav7(CPUARMState *env,
                     break; /* no access */
                 case 3:
                     result->f.prot |= PAGE_WRITE;
-                    /* fall through */
+                    fallthrough;
                 case 2:
                 case 6:
                     result->f.prot |= PAGE_READ | PAGE_EXEC;
@@ -2385,7 +2385,7 @@ static bool get_phys_addr_pmsav7(CPUARMState *env,
                         result->f.prot |= PAGE_READ | PAGE_EXEC;
                         break;
                     }
-                    /* fall through */
+                    fallthrough;
                 default:
                     qemu_log_mask(LOG_GUEST_ERROR,
                                   "DRACR[%d]: Bad value for AP bits: 0x%"
@@ -2399,7 +2399,7 @@ static bool get_phys_addr_pmsav7(CPUARMState *env,
                 case 2:
                 case 3:
                     result->f.prot |= PAGE_WRITE;
-                    /* fall through */
+                    fallthrough;
                 case 5:
                 case 6:
                     result->f.prot |= PAGE_READ | PAGE_EXEC;
@@ -2410,7 +2410,7 @@ static bool get_phys_addr_pmsav7(CPUARMState *env,
                         result->f.prot |= PAGE_READ | PAGE_EXEC;
                         break;
                     }
-                    /* fall through */
+                    fallthrough;
                 default:
                     qemu_log_mask(LOG_GUEST_ERROR,
                                   "DRACR[%d]: Bad value for AP bits: 0x%"
@@ -3333,7 +3333,7 @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw,
             return get_phys_addr_twostage(env, ptw, address, access_type,
                                           result, fi);
         }
-        /* fall through */
+        fallthrough;
 
     default:
         /* Single stage uses physical for ptw. */
target/arm/tcg/psci.c +1 -1
index 6c1239bb96..dafc39c3d7 100644
@@ -191,7 +191,7 @@ void arm_handle_psci_call(ARMCPU *cpu)
                 ret = 0;
                 break;
             }
-            /* fallthrough */
+            fallthrough;
         case QEMU_PSCI_0_1_FN_MIGRATE:
         case QEMU_PSCI_0_2_FN_MIGRATE:
         default:
target/arm/tcg/translate-a64.c +38 -38

302 lines not on this page · raw message

target/arm/tcg/translate-m-nocp.c +1 -1
index f564d06ccf..42d6f516ba 100644
@@ -374,8 +374,8 @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int regno,
             s->base.is_jmp = DISAS_NEXT;
             break;
         }
+        fallthrough;
     }
-    /* fall through */
     case ARM_VFP_FPCXT_S:
     {
         TCGv_i32 sfpa, control;
target/arm/tcg/translate-vfp.c +1 -1
index b9af03b7c3..57d3c41596 100644
@@ -819,7 +819,7 @@ static bool trans_VMSR_VMRS(DisasContext *s, arg_VMSR_VMRS *a)
                                               tcg_constant_i32(a->rt),
                                               tcg_constant_i32(a->reg));
             }
-            /* fall through */
+            fallthrough;
         case ARM_VFP_FPEXC:
         case ARM_VFP_FPINST:
         case ARM_VFP_FPINST2:
target/arm/tcg/translate.c +4 -4
index 48927fbb8c..595ef02f0d 100644
@@ -1596,7 +1596,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)
             break;
         case ARM_IWMMXT_wCon:
             gen_op_iwmmxt_set_cup();
-            /* Fall through.  */
+            fallthrough;
         case ARM_IWMMXT_wCSSF:
             tmp = iwmmxt_load_creg(wrd);
             tmp2 = load_reg(s, rd);
@@ -9576,7 +9576,7 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
         case DISAS_UPDATE_EXIT:
         case DISAS_UPDATE_NOCHAIN:
             gen_update_pc(dc, curr_insn_len(dc));
-            /* fall through */
+            fallthrough;
         default:
             /* FIXME: Single stepping a WFI insn will not halt the CPU. */
             gen_singlestep_exception(dc);
@@ -9600,13 +9600,13 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
             break;
         case DISAS_UPDATE_NOCHAIN:
             gen_update_pc(dc, curr_insn_len(dc));
-            /* fall through */
+            fallthrough;
         case DISAS_JUMP:
             gen_goto_ptr();
             break;
         case DISAS_UPDATE_EXIT:
             gen_update_pc(dc, curr_insn_len(dc));
-            /* fall through */
+            fallthrough;
         default:
             /* indicate that the hash table must be used to find the next TB */
             tcg_gen_exit_tb(NULL, 0);
Signature · 1 line
2.39.2
#30 lore raw

RFC PATCH v3 24/78 target/alpha: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 target/alpha/helper.c    | 6 +++---
 target/alpha/translate.c | 4 +++-
 2 files changed, 6 insertions(+), 4 deletions(-)
target/alpha/helper.c +3 -3
index 970c869771..1afdc1beec 100644
@@ -452,17 +452,17 @@ bool alpha_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
         if (interrupt_request & CPU_INTERRUPT_HARD) {
             idx = EXCP_DEV_INTERRUPT;
         }
-        /* FALLTHRU */
+        fallthrough;
     case 4:
         if (interrupt_request & CPU_INTERRUPT_TIMER) {
             idx = EXCP_CLK_INTERRUPT;
         }
-        /* FALLTHRU */
+        fallthrough;
     case 5:
         if (interrupt_request & CPU_INTERRUPT_SMP) {
             idx = EXCP_SMP_INTERRUPT;
         }
-        /* FALLTHRU */
+        fallthrough;
     case 6:
         if (interrupt_request & CPU_INTERRUPT_MCHK) {
             idx = EXCP_MCHK;
target/alpha/translate.c +3 -1
index 32333081d8..19e1d2ed86 100644
@@ -1436,7 +1436,7 @@ static DisasJumpType translate_one(DisasContext *ctx, uint32_t insn)
     case 0x09:
         /* LDAH */
         disp16 = (uint32_t)disp16 << 16;
-        /* fall through */
+        fallthrough;
     case 0x08:
         /* LDA */
         va = dest_gpr(ctx, ra);
@@ -2940,9 +2940,11 @@ static void alpha_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
             tcg_gen_exit_tb(ctx->base.tb, 0);
         }
         /* FALLTHRU */
+        fallthrough;
     case DISAS_PC_STALE:
         tcg_gen_movi_i64(cpu_pc, ctx->base.pc_next);
         /* FALLTHRU */
+        fallthrough;
     case DISAS_PC_UPDATED:
         tcg_gen_lookup_and_goto_ptr();
         break;
Signature · 1 line
2.39.2
#31 lore raw

RFC PATCH v3 25/78 target/i386: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 target/i386/cpu.c                | 2 +-
 target/i386/hvf/x86_decode.c     | 1 +
 target/i386/kvm/kvm.c            | 4 ++--
 target/i386/tcg/decode-new.c.inc | 6 +++---
 target/i386/tcg/emit.c.inc       | 2 +-
 target/i386/tcg/translate.c      | 8 +++-----
 6 files changed, 11 insertions(+), 12 deletions(-)
target/i386/cpu.c +1 -1
index cec5d2b7b6..f73784edca 100644
@@ -6133,7 +6133,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
                                         eax, ebx, ecx, edx);
                     break;
                 }
-                /* fall through */
+                fallthrough;
             default: /* end of info */
                 *eax = *ebx = *ecx = *edx = 0;
                 break;
target/i386/hvf/x86_decode.c +1 -0
index 3728d7705e..7c2e3dab8d 100644
@@ -1886,6 +1886,7 @@ static void decode_prefix(CPUX86State *env, struct x86_decode *decode)
                 break;
             }
             /* fall through when not in long mode */
+            fallthrough;
         default:
             decode->len--;
             return;
target/i386/kvm/kvm.c +2 -2
index f6c7f7e268..d283d56aa9 100644
@@ -553,7 +553,7 @@ uint64_t kvm_arch_get_supported_msr_feature(KVMState *s, uint32_t index)
                 value |= (uint64_t)VMX_SECONDARY_EXEC_RDTSCP << 32;
             }
         }
-        /* fall through */
+        fallthrough;
     case MSR_IA32_VMX_TRUE_PINBASED_CTLS:
     case MSR_IA32_VMX_TRUE_PROCBASED_CTLS:
     case MSR_IA32_VMX_TRUE_ENTRY_CTLS:
@@ -1962,7 +1962,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
             if (env->nr_dies < 2) {
                 break;
             }
-            /* fallthrough */
+            fallthrough;
         case 4:
         case 0xb:
         case 0xd:
target/i386/tcg/decode-new.c.inc +3 -3
index 7d76f15275..0e663e9124 100644
@@ -1108,7 +1108,7 @@ static bool decode_op_size(DisasContext *s, X86OpEntry *e, X86OpSize size, MemOp
             *ot = MO_64;
             return true;
         }
-        /* fall through */
+        fallthrough;
     case X86_SIZE_ps: /* SSE/AVX packed single precision */
     case X86_SIZE_pd: /* SSE/AVX packed double precision */
         *ot = s->vex_l ? MO_256 : MO_128;
@@ -1220,7 +1220,7 @@ static bool decode_op(DisasContext *s, CPUX86State *env, X86DecodedInsn *decode,
 
     case X86_TYPE_WM:  /* modrm byte selects an XMM/YMM memory operand */
         op->unit = X86_OP_SSE;
-        /* fall through */
+        fallthrough;
     case X86_TYPE_M:  /* modrm byte selects a memory operand */
         modrm = get_modrm(s, env);
         if ((modrm >> 6) == 3) {
@@ -1538,7 +1538,7 @@ static bool validate_vex(DisasContext *s, X86DecodedInsn *decode)
             (decode->op[2].n == decode->mem.index || decode->op[2].n == decode->op[1].n)) {
             goto illegal;
         }
-        /* fall through */
+        fallthrough;
     case 6:
     case 11:
         if (!(s->prefix & PREFIX_VEX)) {
target/i386/tcg/emit.c.inc +1 -1
index 88793ba988..0e0a2efbf9 100644
@@ -209,7 +209,7 @@ static bool sse_needs_alignment(DisasContext *s, X86DecodedInsn *decode, MemOp o
             /* MOST legacy SSE instructions require aligned memory operands, but not all.  */
             return false;
         }
-        /* fall through */
+        fallthrough;
     case 1:
         return ot >= MO_128;
 
target/i386/tcg/translate.c +3 -5
index e42e3dd653..77a8fcc5e1 100644
@@ -1004,7 +1004,7 @@ static CCPrepare gen_prepare_eflags_s(DisasContext *s, TCGv reg)
     switch (s->cc_op) {
     case CC_OP_DYNAMIC:
         gen_compute_eflags(s);
-        /* FALLTHRU */
+        fallthrough;
     case CC_OP_EFLAGS:
     case CC_OP_ADCX:
     case CC_OP_ADOX:
@@ -1047,7 +1047,7 @@ static CCPrepare gen_prepare_eflags_z(DisasContext *s, TCGv reg)
     switch (s->cc_op) {
     case CC_OP_DYNAMIC:
         gen_compute_eflags(s);
-        /* FALLTHRU */
+        fallthrough;
     case CC_OP_EFLAGS:
     case CC_OP_ADCX:
     case CC_OP_ADOX:
@@ -3298,7 +3298,6 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
     case 0x82:
         if (CODE64(s))
             goto illegal_op;
-        /* fall through */
         fallthrough;
     case 0x80: /* GRP1 */
     case 0x81:
@@ -6733,7 +6732,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
                 }
                 break;
             }
-            /* fallthru */
+            fallthrough;
         case 0xf9 ... 0xff: /* sfence */
             if (!(s->cpuid_features & CPUID_SSE)
                 || (prefixes & PREFIX_LOCK)) {
@@ -7047,7 +7046,6 @@ static void i386_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
     case DISAS_EOB_NEXT:
         gen_update_cc_op(dc);
         gen_update_eip_cur(dc);
-        /* fall through */
         fallthrough;
     case DISAS_EOB_ONLY:
         gen_eob(dc);
Signature · 1 line
2.39.2
Reviewed-by on v3 25/78
#32 lore raw

Re: [RFC PATCH v3 25/78] target/i386: add fallthrough pseudo-keyword

Quoted 9 lines · Emmanouil Pitsidianakis

Date: Fri, 13 Oct 2023 11:45:53 +0300
From: Emmanouil Pitsidianakis <[email protected]>
Subject: [RFC PATCH v3 25/78] target/i386: add fallthrough pseudo-keyword
X-Mailer: git-send-email 2.39.2

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

Quoted 150 lines
---
 target/i386/cpu.c                | 2 +-
 target/i386/hvf/x86_decode.c     | 1 +
 target/i386/kvm/kvm.c            | 4 ++--
 target/i386/tcg/decode-new.c.inc | 6 +++---
 target/i386/tcg/emit.c.inc       | 2 +-
 target/i386/tcg/translate.c      | 8 +++-----
 6 files changed, 11 insertions(+), 12 deletions(-)
target/i386/cpu.c +1 -1
index cec5d2b7b6..f73784edca 100644
@@ -6133,7 +6133,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
                                         eax, ebx, ecx, edx);
                     break;
                 }
-                /* fall through */
+                fallthrough;
             default: /* end of info */
                 *eax = *ebx = *ecx = *edx = 0;
                 break;
target/i386/hvf/x86_decode.c +1 -0
index 3728d7705e..7c2e3dab8d 100644
@@ -1886,6 +1886,7 @@ static void decode_prefix(CPUX86State *env, struct x86_decode *decode)
                 break;
             }
             /* fall through when not in long mode */
+            fallthrough;
         default:
             decode->len--;
             return;
target/i386/kvm/kvm.c +2 -2
index f6c7f7e268..d283d56aa9 100644
@@ -553,7 +553,7 @@ uint64_t kvm_arch_get_supported_msr_feature(KVMState *s, uint32_t index)
                 value |= (uint64_t)VMX_SECONDARY_EXEC_RDTSCP << 32;
             }
         }
-        /* fall through */
+        fallthrough;
     case MSR_IA32_VMX_TRUE_PINBASED_CTLS:
     case MSR_IA32_VMX_TRUE_PROCBASED_CTLS:
     case MSR_IA32_VMX_TRUE_ENTRY_CTLS:
@@ -1962,7 +1962,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
             if (env->nr_dies < 2) {
                 break;
             }
-            /* fallthrough */
+            fallthrough;
         case 4:
         case 0xb:
         case 0xd:
target/i386/tcg/decode-new.c.inc +3 -3
index 7d76f15275..0e663e9124 100644
@@ -1108,7 +1108,7 @@ static bool decode_op_size(DisasContext *s, X86OpEntry *e, X86OpSize size, MemOp
             *ot = MO_64;
             return true;
         }
-        /* fall through */
+        fallthrough;
     case X86_SIZE_ps: /* SSE/AVX packed single precision */
     case X86_SIZE_pd: /* SSE/AVX packed double precision */
         *ot = s->vex_l ? MO_256 : MO_128;
@@ -1220,7 +1220,7 @@ static bool decode_op(DisasContext *s, CPUX86State *env, X86DecodedInsn *decode,
 
     case X86_TYPE_WM:  /* modrm byte selects an XMM/YMM memory operand */
         op->unit = X86_OP_SSE;
-        /* fall through */
+        fallthrough;
     case X86_TYPE_M:  /* modrm byte selects a memory operand */
         modrm = get_modrm(s, env);
         if ((modrm >> 6) == 3) {
@@ -1538,7 +1538,7 @@ static bool validate_vex(DisasContext *s, X86DecodedInsn *decode)
             (decode->op[2].n == decode->mem.index || decode->op[2].n == decode->op[1].n)) {
             goto illegal;
         }
-        /* fall through */
+        fallthrough;
     case 6:
     case 11:
         if (!(s->prefix & PREFIX_VEX)) {
target/i386/tcg/emit.c.inc +1 -1
index 88793ba988..0e0a2efbf9 100644
@@ -209,7 +209,7 @@ static bool sse_needs_alignment(DisasContext *s, X86DecodedInsn *decode, MemOp o
             /* MOST legacy SSE instructions require aligned memory operands, but not all.  */
             return false;
         }
-        /* fall through */
+        fallthrough;
     case 1:
         return ot >= MO_128;
 
target/i386/tcg/translate.c +3 -5
index e42e3dd653..77a8fcc5e1 100644
@@ -1004,7 +1004,7 @@ static CCPrepare gen_prepare_eflags_s(DisasContext *s, TCGv reg)
     switch (s->cc_op) {
     case CC_OP_DYNAMIC:
         gen_compute_eflags(s);
-        /* FALLTHRU */
+        fallthrough;
     case CC_OP_EFLAGS:
     case CC_OP_ADCX:
     case CC_OP_ADOX:
@@ -1047,7 +1047,7 @@ static CCPrepare gen_prepare_eflags_z(DisasContext *s, TCGv reg)
     switch (s->cc_op) {
     case CC_OP_DYNAMIC:
         gen_compute_eflags(s);
-        /* FALLTHRU */
+        fallthrough;
     case CC_OP_EFLAGS:
     case CC_OP_ADCX:
     case CC_OP_ADOX:
@@ -3298,7 +3298,6 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
     case 0x82:
         if (CODE64(s))
             goto illegal_op;
-        /* fall through */
         fallthrough;
     case 0x80: /* GRP1 */
     case 0x81:
@@ -6733,7 +6732,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
                 }
                 break;
             }
-            /* fallthru */
+            fallthrough;
         case 0xf9 ... 0xff: /* sfence */
             if (!(s->cpuid_features & CPUID_SSE)
                 || (prefixes & PREFIX_LOCK)) {
@@ -7047,7 +7046,6 @@ static void i386_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
     case DISAS_EOB_NEXT:
         gen_update_cc_op(dc);
         gen_update_eip_cur(dc);
-        /* fall through */
         fallthrough;
     case DISAS_EOB_ONLY:
         gen_eob(dc);
Signature · 1 line
2.39.2
#33 lore raw

RFC PATCH v3 26/78 target/s390x: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 target/s390x/cpu.c                  |  4 ++--
 target/s390x/kvm/kvm.c              |  2 +-
 target/s390x/mmu_helper.c           |  6 +++---
 target/s390x/tcg/translate.c        | 18 +++++++++++-------
 target/s390x/tcg/translate_vx.c.inc |  2 +-
 5 files changed, 18 insertions(+), 14 deletions(-)
target/s390x/cpu.c +2 -2
index 4f7599d72c..01df983991 100644
@@ -162,7 +162,7 @@ static void s390_cpu_reset(CPUState *s, cpu_reset_type type)
     switch (type) {
     case S390_CPU_RESET_CLEAR:
         memset(env, 0, offsetof(CPUS390XState, start_initial_reset_fields));
-        /* fall through */
+        fallthrough;
     case S390_CPU_RESET_INITIAL:
         /* initial reset does not clear everything! */
         memset(&env->start_initial_reset_fields, 0,
@@ -187,7 +187,7 @@ static void s390_cpu_reset(CPUState *s, cpu_reset_type type)
         /* tininess for underflow is detected before rounding */
         set_float_detect_tininess(float_tininess_before_rounding,
                                   &env->fpu_status);
-       /* fall through */
+        fallthrough;
     case S390_CPU_RESET_NORMAL:
         env->psw.mask &= ~PSW_MASK_RI;
         memset(&env->start_normal_reset_fields, 0,
target/s390x/kvm/kvm.c +1 -1
index bc5c56a305..11b2c05df6 100644
@@ -1086,7 +1086,7 @@ static int s390_kvm_irq_to_interrupt(struct kvm_s390_irq *irq,
     switch (irq->type) {
     case KVM_S390_INT_VIRTIO:
         interrupt->parm = irq->u.ext.ext_params;
-        /* fall through */
+        fallthrough;
     case KVM_S390_INT_PFAULT_INIT:
     case KVM_S390_INT_PFAULT_DONE:
         interrupt->parm64 = irq->u.ext.ext_params2;
target/s390x/mmu_helper.c +3 -3
index fbb2f1b4d4..5833917552 100644
@@ -199,7 +199,7 @@ static int mmu_translate_asce(CPUS390XState *env, target_ulong vaddr,
             *flags &= ~PAGE_WRITE;
         }
         gaddr = (entry & REGION_ENTRY_ORIGIN) + VADDR_REGION2_TX(vaddr) * 8;
-        /* fall through */
+        fallthrough;
     case ASCE_TYPE_REGION2:
         if (!read_table_entry(env, gaddr, &entry)) {
             return PGM_ADDRESSING;
@@ -218,7 +218,7 @@ static int mmu_translate_asce(CPUS390XState *env, target_ulong vaddr,
             *flags &= ~PAGE_WRITE;
         }
         gaddr = (entry & REGION_ENTRY_ORIGIN) + VADDR_REGION3_TX(vaddr) * 8;
-        /* fall through */
+        fallthrough;
     case ASCE_TYPE_REGION3:
         if (!read_table_entry(env, gaddr, &entry)) {
             return PGM_ADDRESSING;
@@ -248,7 +248,7 @@ static int mmu_translate_asce(CPUS390XState *env, target_ulong vaddr,
             return PGM_SEGMENT_TRANS;
         }
         gaddr = (entry & REGION_ENTRY_ORIGIN) + VADDR_SEGMENT_TX(vaddr) * 8;
-        /* fall through */
+        fallthrough;
     case ASCE_TYPE_SEGMENT:
         if (!read_table_entry(env, gaddr, &entry)) {
             return PGM_ADDRESSING;
target/s390x/tcg/translate.c +11 -7
index 4bae1509f5..986d6433d2 100644
@@ -576,6 +576,7 @@ static void gen_op_calc_cc(DisasContext *s)
     default:
         dummy = tcg_constant_i64(0);
         /* FALLTHRU */
+        fallthrough;
     case CC_OP_ADD_64:
     case CC_OP_SUB_64:
     case CC_OP_ADD_32:
@@ -820,6 +821,7 @@ static void disas_jcc(DisasContext *s, DisasCompare *c, uint32_t mask)
         /* Calculate cc value.  */
         gen_op_calc_cc(s);
         /* FALLTHRU */
+        fallthrough;
 
     case CC_OP_STATIC:
         /* Jump based on CC.  We'll load up the real cond below;
@@ -1323,7 +1325,7 @@ static void compute_carry(DisasContext *s)
         break;
     default:
         gen_op_calc_cc(s);
-        /* fall through */
+        fallthrough;
     case CC_OP_STATIC:
         /* The carry flag is the msb of CC; compute into cc_src. */
         tcg_gen_extu_i32_i64(cc_src, cc_op);
@@ -2612,13 +2614,13 @@ static DisasJumpType op_msa(DisasContext *s, DisasOps *o)
             gen_program_exception(s, PGM_SPECIFICATION);
             return DISAS_NORETURN;
         }
-        /* FALL THROUGH */
+        fallthrough;
     case S390_FEAT_TYPE_KMCTR:
         if (r3 & 1 || !r3) {
             gen_program_exception(s, PGM_SPECIFICATION);
             return DISAS_NORETURN;
         }
-        /* FALL THROUGH */
+        fallthrough;
     case S390_FEAT_TYPE_PPNO:
     case S390_FEAT_TYPE_KMF:
     case S390_FEAT_TYPE_KMC:
@@ -2628,7 +2630,7 @@ static DisasJumpType op_msa(DisasContext *s, DisasOps *o)
             gen_program_exception(s, PGM_SPECIFICATION);
             return DISAS_NORETURN;
         }
-        /* FALL THROUGH */
+        fallthrough;
     case S390_FEAT_TYPE_KMAC:
     case S390_FEAT_TYPE_KIMD:
     case S390_FEAT_TYPE_KLMD:
@@ -2636,7 +2638,7 @@ static DisasJumpType op_msa(DisasContext *s, DisasOps *o)
             gen_program_exception(s, PGM_SPECIFICATION);
             return DISAS_NORETURN;
         }
-        /* FALL THROUGH */
+        fallthrough;
     case S390_FEAT_TYPE_PCKMO:
     case S390_FEAT_TYPE_PCC:
         break;
@@ -4585,12 +4587,12 @@ static void compute_borrow(DisasContext *s)
         break;
     default:
         gen_op_calc_cc(s);
-        /* fall through */
+        fallthrough;
     case CC_OP_STATIC:
         /* The carry flag is the msb of CC; compute into cc_src. */
         tcg_gen_extu_i32_i64(cc_src, cc_op);
         tcg_gen_shri_i64(cc_src, cc_src, 1);
-        /* fall through */
+        fallthrough;
     case CC_OP_ADDU:
         /* Convert carry (1,0) to borrow (0,-1). */
         tcg_gen_subi_i64(cc_src, cc_src, 1);
@@ -6486,11 +6488,13 @@ static void s390x_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
     case DISAS_TOO_MANY:
         update_psw_addr(dc);
         /* FALLTHRU */
+        fallthrough;
     case DISAS_PC_UPDATED:
         /* Next TB starts off with CC_OP_DYNAMIC, so make sure the
            cc op type is in env */
         update_cc_op(dc);
         /* FALLTHRU */
+        fallthrough;
     case DISAS_PC_CC_UPDATED:
         /* Exit the TB, either by raising a debug exception or by return.  */
         if (dc->exit_to_mainloop) {
target/s390x/tcg/translate_vx.c.inc +1 -1
index e073e5ad3a..75463b4f5c 100644
@@ -686,7 +686,7 @@ static DisasJumpType op_vllez(DisasContext *s, DisasOps *o)
             enr = 0;
             break;
         }
-        /* fallthrough */
+        fallthrough;
     default:
         gen_program_exception(s, PGM_SPECIFICATION);
         return DISAS_NORETURN;
Signature · 1 line
2.39.2
#34 lore raw

RFC PATCH v3 27/78 target/riscv: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 target/riscv/insn_trans/trans_rvi.c.inc   |  2 +-
 target/riscv/insn_trans/trans_rvzce.c.inc | 22 +++++++++++-----------
 target/riscv/translate.c                  |  4 ++--
 3 files changed, 14 insertions(+), 14 deletions(-)
target/riscv/insn_trans/trans_rvi.c.inc +1 -1
index 25cb60558a..98dd2e3cf6 100644
@@ -122,7 +122,7 @@ static TCGCond gen_compare_i128(bool bz, TCGv rl,
 
     case TCG_COND_LTU:
         invert = true;
-        /* fallthrough */
+        fallthrough;
     case TCG_COND_GEU:
         {
             TCGv tmp = tcg_temp_new();
target/riscv/insn_trans/trans_rvzce.c.inc +11 -11
index 2d992e14c4..f0bcbb4f72 100644
@@ -125,37 +125,37 @@ static uint32_t decode_push_pop_list(DisasContext *ctx, target_ulong rlist)
     case 15:
         reg_bitmap |=  1 << (X_Sn + 11) ;
         reg_bitmap |=  1 << (X_Sn + 10) ;
-        /* FALL THROUGH */
+        fallthrough;
     case 14:
         reg_bitmap |=  1 << (X_Sn + 9) ;
-        /* FALL THROUGH */
+        fallthrough;
     case 13:
         reg_bitmap |=  1 << (X_Sn + 8) ;
-        /* FALL THROUGH */
+        fallthrough;
     case 12:
         reg_bitmap |=  1 << (X_Sn + 7) ;
-        /* FALL THROUGH */
+        fallthrough;
     case 11:
         reg_bitmap |=  1 << (X_Sn + 6) ;
-        /* FALL THROUGH */
+        fallthrough;
     case 10:
         reg_bitmap |=  1 << (X_Sn + 5) ;
-        /* FALL THROUGH */
+        fallthrough;
     case 9:
         reg_bitmap |=  1 << (X_Sn + 4) ;
-        /* FALL THROUGH */
+        fallthrough;
     case 8:
         reg_bitmap |=  1 << (X_Sn + 3) ;
-        /* FALL THROUGH */
+        fallthrough;
     case 7:
         reg_bitmap |=  1 << (X_Sn + 2) ;
-        /* FALL THROUGH */
+        fallthrough;
     case 6:
         reg_bitmap |=  1 << X_S1 ;
-        /* FALL THROUGH */
+        fallthrough;
     case 5:
         reg_bitmap |= 1 << X_S0;
-        /* FALL THROUGH */
+        fallthrough;
     case 4:
         reg_bitmap |= 1 << xRA;
         break;
target/riscv/translate.c +2 -2
index f0be79bb16..c99e513221 100644
@@ -446,7 +446,7 @@ static TCGv_i64 get_fpr_hs(DisasContext *ctx, int reg_num)
         return t;
     }
 #else
-    /* fall through */
+    fallthrough;
     case MXL_RV64:
         return cpu_gpr[reg_num];
 #endif
@@ -516,7 +516,7 @@ static void gen_set_fpr_hs(DisasContext *ctx, int reg_num, TCGv_i64 t)
             tcg_gen_extrl_i64_i32(cpu_gpr[reg_num], t);
             break;
 #else
-        /* fall through */
+        fallthrough;
         case MXL_RV64:
             tcg_gen_mov_i64(cpu_gpr[reg_num], t);
             break;
Signature · 1 line
2.39.2
Reviewed-by on v3 27/78
#35 lore raw

Re: [RFC PATCH v3 27/78] target/riscv: add fallthrough pseudo-keyword

Quoted 5 lines · Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---

Quoted 93 lines
  target/riscv/insn_trans/trans_rvi.c.inc   |  2 +-
  target/riscv/insn_trans/trans_rvzce.c.inc | 22 +++++++++++-----------
  target/riscv/translate.c                  |  4 ++--
  3 files changed, 14 insertions(+), 14 deletions(-)
target/riscv/insn_trans/trans_rvi.c.inc +1 -1
index 25cb60558a..98dd2e3cf6 100644
@@ -122,7 +122,7 @@ static TCGCond gen_compare_i128(bool bz, TCGv rl,
 
      case TCG_COND_LTU:
          invert = true;
-        /* fallthrough */
+        fallthrough;
      case TCG_COND_GEU:
          {
              TCGv tmp = tcg_temp_new();
target/riscv/insn_trans/trans_rvzce.c.inc +11 -11
index 2d992e14c4..f0bcbb4f72 100644
@@ -125,37 +125,37 @@ static uint32_t decode_push_pop_list(DisasContext *ctx, target_ulong rlist)
      case 15:
          reg_bitmap |=  1 << (X_Sn + 11) ;
          reg_bitmap |=  1 << (X_Sn + 10) ;
-        /* FALL THROUGH */
+        fallthrough;
      case 14:
          reg_bitmap |=  1 << (X_Sn + 9) ;
-        /* FALL THROUGH */
+        fallthrough;
      case 13:
          reg_bitmap |=  1 << (X_Sn + 8) ;
-        /* FALL THROUGH */
+        fallthrough;
      case 12:
          reg_bitmap |=  1 << (X_Sn + 7) ;
-        /* FALL THROUGH */
+        fallthrough;
      case 11:
          reg_bitmap |=  1 << (X_Sn + 6) ;
-        /* FALL THROUGH */
+        fallthrough;
      case 10:
          reg_bitmap |=  1 << (X_Sn + 5) ;
-        /* FALL THROUGH */
+        fallthrough;
      case 9:
          reg_bitmap |=  1 << (X_Sn + 4) ;
-        /* FALL THROUGH */
+        fallthrough;
      case 8:
          reg_bitmap |=  1 << (X_Sn + 3) ;
-        /* FALL THROUGH */
+        fallthrough;
      case 7:
          reg_bitmap |=  1 << (X_Sn + 2) ;
-        /* FALL THROUGH */
+        fallthrough;
      case 6:
          reg_bitmap |=  1 << X_S1 ;
-        /* FALL THROUGH */
+        fallthrough;
      case 5:
          reg_bitmap |= 1 << X_S0;
-        /* FALL THROUGH */
+        fallthrough;
      case 4:
          reg_bitmap |= 1 << xRA;
          break;
target/riscv/translate.c +2 -2
index f0be79bb16..c99e513221 100644
@@ -446,7 +446,7 @@ static TCGv_i64 get_fpr_hs(DisasContext *ctx, int reg_num)
          return t;
      }
  #else
-    /* fall through */
+    fallthrough;
      case MXL_RV64:
          return cpu_gpr[reg_num];
  #endif
@@ -516,7 +516,7 @@ static void gen_set_fpr_hs(DisasContext *ctx, int reg_num, TCGv_i64 t)
              tcg_gen_extrl_i64_i32(cpu_gpr[reg_num], t);
              break;
  #else
-        /* fall through */
+        fallthrough;
          case MXL_RV64:
              tcg_gen_mov_i64(cpu_gpr[reg_num], t);
              break;
Acked-by on v3 27/78
#36 lore raw

Re: [RFC PATCH v3 27/78] target/riscv: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis
Quoted 5 lines · Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

Alistair

Quoted 98 lines
---
 target/riscv/insn_trans/trans_rvi.c.inc   |  2 +-
 target/riscv/insn_trans/trans_rvzce.c.inc | 22 +++++++++++-----------
 target/riscv/translate.c                  |  4 ++--
 3 files changed, 14 insertions(+), 14 deletions(-)
target/riscv/insn_trans/trans_rvi.c.inc +1 -1
index 25cb60558a..98dd2e3cf6 100644
@@ -122,7 +122,7 @@ static TCGCond gen_compare_i128(bool bz, TCGv rl,
 
     case TCG_COND_LTU:
         invert = true;
-        /* fallthrough */
+        fallthrough;
     case TCG_COND_GEU:
         {
             TCGv tmp = tcg_temp_new();
target/riscv/insn_trans/trans_rvzce.c.inc +11 -11
index 2d992e14c4..f0bcbb4f72 100644
@@ -125,37 +125,37 @@ static uint32_t decode_push_pop_list(DisasContext *ctx, target_ulong rlist)
     case 15:
         reg_bitmap |=  1 << (X_Sn + 11) ;
         reg_bitmap |=  1 << (X_Sn + 10) ;
-        /* FALL THROUGH */
+        fallthrough;
     case 14:
         reg_bitmap |=  1 << (X_Sn + 9) ;
-        /* FALL THROUGH */
+        fallthrough;
     case 13:
         reg_bitmap |=  1 << (X_Sn + 8) ;
-        /* FALL THROUGH */
+        fallthrough;
     case 12:
         reg_bitmap |=  1 << (X_Sn + 7) ;
-        /* FALL THROUGH */
+        fallthrough;
     case 11:
         reg_bitmap |=  1 << (X_Sn + 6) ;
-        /* FALL THROUGH */
+        fallthrough;
     case 10:
         reg_bitmap |=  1 << (X_Sn + 5) ;
-        /* FALL THROUGH */
+        fallthrough;
     case 9:
         reg_bitmap |=  1 << (X_Sn + 4) ;
-        /* FALL THROUGH */
+        fallthrough;
     case 8:
         reg_bitmap |=  1 << (X_Sn + 3) ;
-        /* FALL THROUGH */
+        fallthrough;
     case 7:
         reg_bitmap |=  1 << (X_Sn + 2) ;
-        /* FALL THROUGH */
+        fallthrough;
     case 6:
         reg_bitmap |=  1 << X_S1 ;
-        /* FALL THROUGH */
+        fallthrough;
     case 5:
         reg_bitmap |= 1 << X_S0;
-        /* FALL THROUGH */
+        fallthrough;
     case 4:
         reg_bitmap |= 1 << xRA;
         break;
target/riscv/translate.c +2 -3
index f0be79bb16..c99e513221 100644
@@ -446,7 +446,7 @@ static TCGv_i64 get_fpr_hs(DisasContext *ctx, int reg_num)
         return t;
     }
 #else
-    /* fall through */
+    fallthrough;
     case MXL_RV64:
         return cpu_gpr[reg_num];
 #endif
@@ -516,7 +516,7 @@ static void gen_set_fpr_hs(DisasContext *ctx, int reg_num, TCGv_i64 t)
             tcg_gen_extrl_i64_i32(cpu_gpr[reg_num], t);
             break;
 #else
-        /* fall through */
+        fallthrough;
         case MXL_RV64:
             tcg_gen_mov_i64(cpu_gpr[reg_num], t);
             break;
--

2.39.2

#37 lore raw

RFC PATCH v3 28/78 target/avr: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 target/avr/translate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target/avr/translate.c +2 -2
index cdffa04519..2043677745 100644
@@ -2773,13 +2773,13 @@ static void avr_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
             break;
         }
         tcg_gen_movi_tl(cpu_pc, ctx->npc);
-        /* fall through */
+        fallthrough;
     case DISAS_LOOKUP:
         if (!force_exit) {
             tcg_gen_lookup_and_goto_ptr();
             break;
         }
-        /* fall through */
+        fallthrough;
     case DISAS_EXIT:
         tcg_gen_exit_tb(NULL, 0);
         break;
Signature · 1 line
2.39.2
#38 lore raw

RFC PATCH v3 29/78 target/cris: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 target/cris/translate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target/cris/translate.c +2 -2
index b3974ba0bb..bdd128db23 100644
@@ -3113,7 +3113,7 @@ static void cris_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
                 break;
             }
             tcg_gen_movi_tl(env_btarget, dc->jmp_pc);
-            /* fall through */
+            fallthrough;
 
         case JMP_INDIRECT:
             tcg_gen_movcond_tl(TCG_COND_NE, env_pc,
@@ -3140,7 +3140,7 @@ static void cris_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
         break;
     case DISAS_UPDATE_NEXT:
         tcg_gen_movi_tl(env_pc, npc);
-        /* fall through */
+        fallthrough;
     case DISAS_JUMP:
         tcg_gen_lookup_and_goto_ptr();
         break;
Signature · 1 line
2.39.2
#39 lore raw

RFC PATCH v3 30/78 target/nios2: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 target/nios2/helper.c    | 6 +++---
 target/nios2/translate.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
target/nios2/helper.c +3 -3
index bb3b09e5a7..b44e73768e 100644
@@ -198,7 +198,7 @@ void nios2_cpu_do_interrupt(CPUState *cs)
 
     case EXCP_TLB_D:
         tlbmisc_set = CR_TLBMISC_D;
-        /* fall through */
+        fallthrough;
     case EXCP_TLB_X:
         if (env->ctrl[CR_STATUS] & CR_STATUS_EH) {
             tlbmisc_set |= CR_TLBMISC_DBL;
@@ -220,7 +220,7 @@ void nios2_cpu_do_interrupt(CPUState *cs)
     case EXCP_PERM_R:
     case EXCP_PERM_W:
         tlbmisc_set = CR_TLBMISC_D;
-        /* fall through */
+        fallthrough;
     case EXCP_PERM_X:
         tlbmisc_set |= CR_TLBMISC_PERM;
         if (!(env->ctrl[CR_STATUS] & CR_STATUS_EH)) {
@@ -232,7 +232,7 @@ void nios2_cpu_do_interrupt(CPUState *cs)
     case EXCP_SUPERA_D:
     case EXCP_UNALIGN:
         tlbmisc_set = CR_TLBMISC_D;
-        /* fall through */
+        fallthrough;
     case EXCP_SUPERA_X:
     case EXCP_UNALIGND:
         tlbmisc_set |= CR_TLBMISC_BAD;
target/nios2/translate.c +1 -1
index e806623594..2cfe77c90a 100644
@@ -649,7 +649,7 @@ static void wrctl(DisasContext *dc, uint32_t code, uint32_t flags)
     case CR_IENABLE:
         /* If interrupts were enabled using WRCTL, trigger them. */
         dc->base.is_jmp = DISAS_UPDATE;
-        /* fall through */
+        fallthrough;
     default:
         if (wr == -1) {
             /* The register is entirely writable. */
Signature · 1 line
2.39.2
#40 lore raw

RFC PATCH v3 31/78 target/xtensa: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 target/xtensa/op_helper.c | 8 ++++----
 target/xtensa/translate.c | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)
target/xtensa/op_helper.c +4 -4
index 7bb8cd6726..69b72f474d 100644
@@ -108,10 +108,10 @@ void HELPER(check_atomctl)(CPUXtensaState *env, uint32_t pc, uint32_t vaddr)
     switch (access & PAGE_CACHE_MASK) {
     case PAGE_CACHE_WB:
         atomctl >>= 2;
-        /* fall through */
+        fallthrough;
     case PAGE_CACHE_WT:
         atomctl >>= 2;
-        /* fall through */
+        fallthrough;
     case PAGE_CACHE_BYPASS:
         if ((atomctl & 0x3) == 0) {
             HELPER(exception_cause_vaddr)(env, pc,
@@ -150,10 +150,10 @@ void HELPER(check_exclusive)(CPUXtensaState *env, uint32_t pc, uint32_t vaddr,
     switch (access & PAGE_CACHE_MASK) {
     case PAGE_CACHE_WB:
         atomctl >>= 2;
-        /* fall through */
+        fallthrough;
     case PAGE_CACHE_WT:
         atomctl >>= 2;
-        /* fall through */
+        fallthrough;
     case PAGE_CACHE_BYPASS:
         if ((atomctl & 0x3) == 0) {
             HELPER(exception_cause_vaddr)(env, pc,
target/xtensa/translate.c +1 -1
index 54bee7ddba..8ef940933c 100644
@@ -803,7 +803,7 @@ static void opcode_add_resource(struct slot_prop *op,
         op->in[op->n_in].resource = resource;
         op->in[op->n_in].index = index;
         ++op->n_in;
-        /* fall through */
+        fallthrough;
     case 'o':
         if (direction == 'm' || direction == 'o') {
             assert(op->n_out < ARRAY_SIZE(op->out));
Signature · 1 line
2.39.2
#41 lore raw

RFC PATCH v3 32/78 target/m68k: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 target/m68k/op_helper.c |  3 ++-
 target/m68k/translate.c | 10 +++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)
target/m68k/op_helper.c +2 -1
index 1ce850bbc5..65058b9e2f 100644
@@ -418,7 +418,7 @@ static void m68k_interrupt_all(CPUM68KState *env, int is_hw)
             do_stack_frame(env, &sp, 1, oldsr, 0, env->pc);
             break;
         }
-        /* fall through */
+        fallthrough;
 
     default:
         do_stack_frame(env, &sp, 0, oldsr, 0, env->pc);
@@ -917,6 +917,7 @@ static struct bf_data bf_prep(uint32_t addr, int32_t ofs, uint32_t len)
             addr -= 1;
         }
         /* fallthru */
+        fallthrough;
     case 3:
         bofs += 32;
         break;
target/m68k/translate.c +5 -5
index 4d0110de95..ce102dc585 100644
@@ -732,7 +732,7 @@ static TCGv gen_lea_mode(CPUM68KState *env, DisasContext *s,
         if (opsize == OS_UNSIZED) {
             return NULL_QREG;
         }
-        /* fallthru */
+        fallthrough;
     case 2: /* Indirect register */
         return get_areg(s, reg0);
     case 4: /* Indirect predecrememnt.  */
@@ -1221,7 +1221,7 @@ static void gen_cc_cond(DisasCompare *c, DisasContext *s, int cond)
             c->v1 = tmp = tcg_temp_new();
             tcg_gen_sub_i32(tmp, QREG_CC_N, QREG_CC_V);
             gen_ext(tmp, tmp, op - CC_OP_CMPB, 1);
-            /* fallthru */
+            fallthrough;
         case 12: /* GE */
         case 13: /* LT */
             tcond = TCG_COND_LT;
@@ -1260,7 +1260,7 @@ static void gen_cc_cond(DisasCompare *c, DisasContext *s, int cond)
         if (op != CC_OP_LOGIC) {
             break;
         }
-        /* fallthru */
+        fallthrough;
     case 10: /* PL (!N) */
     case 11: /* MI (N) */
         /* Several cases represent N normally.  */
@@ -1292,7 +1292,7 @@ static void gen_cc_cond(DisasCompare *c, DisasContext *s, int cond)
             c->v1 = QREG_CC_X;
             goto done;
         }
-        /* fallthru */
+        fallthrough;
     case 8: /* VC (!V) */
     case 9: /* VS (V) */
         /* Logic operations clear V and C.  */
@@ -4234,7 +4234,7 @@ DISAS_INSN(chk)
             opsize = OS_LONG;
             break;
         }
-        /* fallthru */
+        fallthrough;
     default:
         gen_exception(s, s->base.pc_next, EXCP_ILLEGAL);
         return;
Signature · 1 line
2.39.2
#42 lore raw

RFC PATCH v3 33/78 target/rx: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 target/rx/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/rx/translate.c +1 -1
index f8860830ae..b00c0a21fb 100644
@@ -2243,7 +2243,7 @@ static void rx_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
         break;
     case DISAS_UPDATE:
         tcg_gen_movi_i32(cpu_pc, ctx->base.pc_next);
-        /* fall through */
+        fallthrough;
     case DISAS_EXIT:
         tcg_gen_exit_tb(NULL, 0);
         break;
Signature · 1 line
2.39.2
#43 lore raw

RFC PATCH v3 34/78 target/tricore: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 target/tricore/translate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target/tricore/translate.c +2 -2
index dd812ec0f0..4e42f06ec8 100644
@@ -3014,7 +3014,7 @@ static void gen_compute_branch(DisasContext *ctx, uint32_t opc, int r1,
         break;
     case OPC1_32_B_JLA:
         tcg_gen_movi_tl(cpu_gpr_a[11], ctx->pc_succ_insn);
-        /* fall through */
+        fallthrough;
     case OPC1_32_B_JA:
         gen_goto_tb(ctx, 0, EA_B_ABSOLUT(offset));
         break;
@@ -8452,7 +8452,7 @@ static void tricore_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
         break;
     case DISAS_EXIT_UPDATE:
         gen_save_pc(ctx->base.pc_next);
-        /* fall through */
+        fallthrough;
     case DISAS_EXIT:
         tcg_gen_exit_tb(NULL, 0);
         break;
Signature · 1 line
2.39.2
#45 lore raw

RFC PATCH v3 35/78 target/sh4: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 target/sh4/helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/sh4/helper.c +1 -1
index e02e7af607..c1cc5e82f4 100644
@@ -170,7 +170,7 @@ void superh_cpu_do_interrupt(CPUState *cs)
             break;
         case 0x160:
             env->spc += 2; /* special case for TRAPA */
-            /* fall through */
+            fallthrough;
         default:
             env->pc = env->vbr + 0x100;
             break;
Signature · 1 line
2.39.2
#46 lore raw

RFC PATCH v3 36/78 target/openrisc: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 target/openrisc/mmu.c       | 2 +-
 target/openrisc/translate.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
target/openrisc/mmu.c +1 -1
index 603c26715e..7ed744e81b 100644
@@ -168,7 +168,7 @@ hwaddr openrisc_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
         if (!excp) {
             return phys_addr;
         }
-        /* fallthru */
+        fallthrough;
 
     case 0:
         /* The mmu is definitely disabled; lookups never fail.  */
target/openrisc/translate.c +1 -1
index ecff4412b7..de77014d60 100644
@@ -1618,7 +1618,7 @@ static void openrisc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
            However, we will have stored into jmp_pc as well;
            we know now that it wasn't needed.  */
         tcg_gen_discard_tl(jmp_pc);
-        /* fallthru */
+        fallthrough;
 
     case DISAS_TOO_MANY:
         if (translator_use_goto_tb(&dc->base, jmp_dest)) {
Signature · 1 line
2.39.2
#47 lore raw

RFC PATCH v3 37/78 target/hexagon: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 target/hexagon/idef-parser/parser-helpers.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
target/hexagon/idef-parser/parser-helpers.c +3 -2
index 4af020933a..0f1713ae4c 100644
@@ -29,6 +29,7 @@
 #include "parser-helpers.h"
 #include "idef-parser.tab.h"
 #include "idef-parser.yy.h"
+#include "qemu/compiler.h"
 
 void yyerror(YYLTYPE *locp,
              yyscan_t scanner __attribute__((unused)),
@@ -645,7 +646,7 @@ static void gen_asl_op(Context *c, YYLTYPE *locp, unsigned bit_width,
     case IMM_REG:
         op1_m.bit_width = bit_width;
         op1_m = rvalue_materialize(c, locp, &op1_m);
-        /* fallthrough */
+        fallthrough;
     case REG_REG: {
         OUT(c, locp, "tcg_gen_shl_", bit_suffix,
             "(", res, ", ", &op1_m, ", ", op2, ");\n");
@@ -829,7 +830,7 @@ static void gen_minmax_op(Context *c, YYLTYPE *locp, unsigned bit_width,
     case REG_IMM:
         op2_m.bit_width = bit_width;
         op2_m = rvalue_materialize(c, locp, &op2_m);
-        /* Fallthrough */
+        fallthrough;
     case REG_REG:
         OUT(c, locp, mm, "_i", &bit_width, "(");
         OUT(c, locp, res, ", ", op1, ", ", &op2_m, ");\n");
Signature · 1 line
2.39.2
Reviewed-by Anton Johansson on v3 37/78
#48 lore raw

Re: [RFC PATCH v3 37/78] target/hexagon: add fallthrough pseudo-keyword

Quoted 7 lines · Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 target/hexagon/idef-parser/parser-helpers.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
#49 lore raw

RFC PATCH v3 38/78 system/rtc.c: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 system/rtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
system/rtc.c +1 -1
index 4904581abe..bb406542c8 100644
@@ -53,7 +53,7 @@ static time_t qemu_ref_timedate(QEMUClockType clock)
     switch (clock) {
     case QEMU_CLOCK_REALTIME:
         value -= rtc_realtime_clock_offset;
-        /* fall through */
+        fallthrough;
     case QEMU_CLOCK_VIRTUAL:
         value += rtc_ref_start_datetime;
         break;
Signature · 1 line
2.39.2
#50 lore raw

RFC PATCH v3 39/78 hw/scsi: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/scsi/esp.c       | 2 +-
 hw/scsi/megasas.c   | 2 +-
 hw/scsi/scsi-bus.c  | 4 ++--
 hw/scsi/scsi-disk.c | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
hw/scsi/esp.c +1 -1
index 9b11d8c573..d6c8298f51 100644
@@ -1025,7 +1025,7 @@ void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val)
     switch (saddr) {
     case ESP_TCHI:
         s->tchi_written = true;
-        /* fall through */
+        fallthrough;
     case ESP_TCLO:
     case ESP_TCMID:
         s->rregs[ESP_RSTAT] &= ~STAT_TC;
hw/scsi/megasas.c +1 -1
index 32c70c9e99..54e4d7c8b6 100644
@@ -2151,7 +2151,7 @@ static void megasas_mmio_write(void *opaque, hwaddr addr,
     case MFI_IQPL:
         trace_megasas_mmio_writel("MFI_IQPL", val);
         /* Received low 32 bits of a 64 bit MFI frame address */
-        /* Fallthrough */
+        fallthrough;
     case MFI_IQP:
         if (addr == MFI_IQP) {
             trace_megasas_mmio_writel("MFI_IQP", val);
hw/scsi/scsi-bus.c +2 -2
index fc4b77fdb0..a1c298a92c 100644
@@ -1078,7 +1078,7 @@ static int scsi_req_xfer(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf)
         if (cmd->xfer == 0) {
             cmd->xfer = 256;
         }
-        /* fall through */
+        fallthrough;
     case WRITE_10:
     case WRITE_VERIFY_10:
     case WRITE_12:
@@ -1093,7 +1093,7 @@ static int scsi_req_xfer(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf)
         if (cmd->xfer == 0) {
             cmd->xfer = 256;
         }
-        /* fall through */
+        fallthrough;
     case READ_10:
     case READ_12:
     case READ_16:
hw/scsi/scsi-disk.c +1 -1
index 6691f5edb8..6564ca638c 100644
@@ -2302,7 +2302,7 @@ static int32_t scsi_disk_dma_command(SCSIRequest *req, uint8_t *buf)
         trace_scsi_disk_dma_command_WRITE(
                 (command & 0xe) == 0xe ? "And Verify " : "",
                 r->req.cmd.lba, len);
-        /* fall through */
+        fallthrough;
     case VERIFY_10:
     case VERIFY_12:
     case VERIFY_16:
Signature · 1 line
2.39.2
#51 lore raw

RFC PATCH v3 40/78 hw/sd/sdhci.c: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/sd/sdhci.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/sd/sdhci.c +4 -4
index 5564765a9b..5c641d24de 100644
@@ -92,7 +92,7 @@ static void sdhci_check_capareg(SDHCIState *s, Error **errp)
         trace_sdhci_capareg("ADMA3", val);
         msk = FIELD_DP64(msk, SDHC_CAPAB, ADMA3, 0);
 
-    /* fallthrough */
+        fallthrough;
     case 3:
         val = FIELD_EX64(s->capareg, SDHC_CAPAB, ASYNC_INT);
         trace_sdhci_capareg("async interrupt", val);
@@ -136,7 +136,7 @@ static void sdhci_check_capareg(SDHCIState *s, Error **errp)
         trace_sdhci_capareg("clock multiplier", val);
         msk = FIELD_DP64(msk, SDHC_CAPAB, CLOCK_MULT, 0);
 
-    /* fallthrough */
+        fallthrough;
     case 2: /* default version */
         val = FIELD_EX64(s->capareg, SDHC_CAPAB, ADMA2);
         trace_sdhci_capareg("ADMA2", val);
@@ -150,7 +150,7 @@ static void sdhci_check_capareg(SDHCIState *s, Error **errp)
         trace_sdhci_capareg("64-bit system bus (v3)", val);
         msk = FIELD_DP64(msk, SDHC_CAPAB, BUS64BIT, 0);
 
-    /* fallthrough */
+        fallthrough;
     case 1:
         y = FIELD_EX64(s->capareg, SDHC_CAPAB, TOUNIT);
         msk = FIELD_DP64(msk, SDHC_CAPAB, TOUNIT, 0);
@@ -1839,7 +1839,7 @@ usdhc_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)
          * so we artificially set it to that value.
          */
         val |= 0x7 << 12;
-        /* FALLTHROUGH */
+        fallthrough;
     default:
         sdhci_write(opaque, offset, val, size);
         break;
Signature · 1 line
2.39.2
Reviewed-by on v3 40/78
#52 lore raw

Re: [RFC PATCH v3 40/78] hw/sd/sdhci.c: add fallthrough pseudo-keyword

Quoted 7 lines · Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
  hw/sd/sdhci.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
#53 lore raw

RFC PATCH v3 41/78 linux-user: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 linux-user/mips/cpu_loop.c | 8 ++++----
 linux-user/mmap.c          | 2 +-
 linux-user/syscall.c       | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)
linux-user/mips/cpu_loop.c +4 -4
index 8735e58bad..38ddcadfc6 100644
@@ -102,22 +102,22 @@ void cpu_loop(CPUMIPSState *env)
                     if ((ret = get_user_ual(arg8, sp_reg + 28)) != 0) {
                         goto done_syscall;
                     }
-                    /* fall through */
+                    fallthrough;
                 case 7:
                     if ((ret = get_user_ual(arg7, sp_reg + 24)) != 0) {
                         goto done_syscall;
                     }
-                    /* fall through */
+                    fallthrough;
                 case 6:
                     if ((ret = get_user_ual(arg6, sp_reg + 20)) != 0) {
                         goto done_syscall;
                     }
-                    /* fall through */
+                    fallthrough;
                 case 5:
                     if ((ret = get_user_ual(arg5, sp_reg + 16)) != 0) {
                         goto done_syscall;
                     }
-                    /* fall through */
+                    fallthrough;
                 default:
                     break;
                 }
linux-user/mmap.c +1 -1
index 8ccaab7859..ff33b4ccf6 100644
@@ -1012,7 +1012,7 @@ abi_long target_madvise(abi_ulong start, abi_ulong len_in, int advice)
     case MADV_WIPEONFORK:
     case MADV_KEEPONFORK:
         ret = -EINVAL;
-        /* fall through */
+        fallthrough;
     case MADV_DONTNEED:
         if (page_check_range(start, len, PAGE_PASSTHROUGH)) {
             ret = get_errno(madvise(g2h_untagged(start), len, advice));
linux-user/syscall.c +1 -1
index d49cd314a2..d15817846c 100644
@@ -7782,7 +7782,7 @@ static int do_futex(CPUState *cpu, bool time64, target_ulong uaddr,
     case FUTEX_CMP_REQUEUE:
     case FUTEX_CMP_REQUEUE_PI:
         val3 = tswap32(val3);
-        /* fall through */
+        fallthrough;
     case FUTEX_REQUEUE:
     case FUTEX_WAKE_OP:
         /*
Signature · 1 line
2.39.2
#54 lore raw

RFC PATCH v3 42/78 hw/i386: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/i386/intel_iommu.c    | 4 ++--
 hw/i386/kvm/xen_evtchn.c | 2 +-
 hw/i386/x86.c            | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
hw/i386/intel_iommu.c +2 -2
index 2c832ab68b..bdb2ea3ac5 100644
@@ -2108,7 +2108,7 @@ static uint64_t vtd_context_cache_invalidate(IntelIOMMUState *s, uint64_t val)
 
     switch (type) {
     case VTD_CCMD_DOMAIN_INVL:
-        /* Fall through */
+        fallthrough;
     case VTD_CCMD_GLOBAL_INVL:
         caig = VTD_CCMD_GLOBAL_INVL_A;
         vtd_context_global_invalidate(s);
@@ -2525,7 +2525,7 @@ static bool vtd_process_context_cache_desc(IntelIOMMUState *s,
     case VTD_INV_DESC_CC_DOMAIN:
         trace_vtd_inv_desc_cc_domain(
             (uint16_t)VTD_INV_DESC_CC_DID(inv_desc->lo));
-        /* Fall through */
+        fallthrough;
     case VTD_INV_DESC_CC_GLOBAL:
         vtd_context_global_invalidate(s);
         break;
hw/i386/kvm/xen_evtchn.c +1 -1
index a731738411..d15e324f6e 100644
@@ -2068,7 +2068,7 @@ int xen_be_evtchn_bind_interdomain(struct xenevtchn_handle *xc, uint32_t domid,
             }
             break;
         }
-        /* fall through */
+        fallthrough;
 
     case EVTCHNSTAT_unbound:
         be_port = find_be_port(s, xc);
hw/i386/x86.c +1 -1
index b3d054889b..c1fd0a966a 100644
@@ -605,7 +605,7 @@ void gsi_handler(void *opaque, int n, int level)
             /* Under KVM, Kernel will forward to both PIC and IOAPIC */
             qemu_set_irq(s->i8259_irq[n], level);
         }
-        /* fall through */
+        fallthrough;
     case ISA_NUM_IRQS ... IOAPIC_NUM_PINS - 1:
 #ifdef CONFIG_XEN_EMU
         /*
Signature · 1 line
2.39.2
Reviewed-by on v3 42/78
#55 lore raw

Re: [RFC PATCH v3 42/78] hw/i386: add fallthrough pseudo-keyword

Quoted 7 lines · Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
  hw/i386/intel_iommu.c    | 4 ++--
  hw/i386/kvm/xen_evtchn.c | 2 +-
Quoted 3 lines
  hw/i386/x86.c            | 2 +-
  3 files changed, 4 insertions(+), 4 deletions(-)
#56 lore raw

RFC PATCH v3 43/78 hw/misc: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

(Cédric Le Goater review for aspeed_scu.c)

---
 hw/misc/a9scu.c            |  2 ++
 hw/misc/aspeed_scu.c       |  2 +-
 hw/misc/bcm2835_property.c | 12 ++++++------
 hw/misc/mos6522.c          |  4 ++--
 4 files changed, 11 insertions(+), 9 deletions(-)
hw/misc/a9scu.c +2 -0
index a375ebc987..b422bec3c4 100644
@@ -38,6 +38,7 @@ static uint64_t a9_scu_read(void *opaque, hwaddr offset,
     case 0x50: /* SCU Access Control Register */
     case 0x54: /* SCU Non-secure Access Control Register */
         /* unimplemented, fall through */
+        fallthrough;
     default:
         qemu_log_mask(LOG_UNIMP, "%s: Unsupported offset 0x%"HWADDR_PRIx"\n",
                       __func__, offset);
@@ -69,6 +70,7 @@ static void a9_scu_write(void *opaque, hwaddr offset,
     case 0x50: /* SCU Access Control Register */
     case 0x54: /* SCU Non-secure Access Control Register */
         /* unimplemented, fall through */
+        fallthrough;
     default:
         qemu_log_mask(LOG_UNIMP, "%s: Unsupported offset 0x%"HWADDR_PRIx
                                  " value 0x%"PRIx64"\n",
hw/misc/aspeed_scu.c +1 -1
index 8335364906..4a1ea2fa21 100644
@@ -672,7 +672,7 @@ static void aspeed_ast2600_scu_write(void *opaque, hwaddr offset,
         if (s->regs[reg + 2]) {
             return;
         }
-        /* fall through */
+        fallthrough;
     case AST2600_SYS_RST_CTRL:
     case AST2600_SYS_RST_CTRL2:
     case AST2600_CLK_STOP_CTRL:
hw/misc/bcm2835_property.c +6 -6
index 4ed9faa54a..98170f34a6 100644
@@ -182,7 +182,7 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value)
             fbconfig.yres = ldl_le_phys(&s->dma_as, value + 16);
             bcm2835_fb_validate_config(&fbconfig);
             fbconfig_updated = true;
-            /* fall through */
+            fallthrough;
         case RPI_FWREQ_FRAMEBUFFER_GET_PHYSICAL_WIDTH_HEIGHT:
             stl_le_phys(&s->dma_as, value + 12, fbconfig.xres);
             stl_le_phys(&s->dma_as, value + 16, fbconfig.yres);
@@ -193,7 +193,7 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value)
             fbconfig.yres_virtual = ldl_le_phys(&s->dma_as, value + 16);
             bcm2835_fb_validate_config(&fbconfig);
             fbconfig_updated = true;
-            /* fall through */
+            fallthrough;
         case RPI_FWREQ_FRAMEBUFFER_GET_VIRTUAL_WIDTH_HEIGHT:
             stl_le_phys(&s->dma_as, value + 12, fbconfig.xres_virtual);
             stl_le_phys(&s->dma_as, value + 16, fbconfig.yres_virtual);
@@ -206,7 +206,7 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value)
             fbconfig.bpp = ldl_le_phys(&s->dma_as, value + 12);
             bcm2835_fb_validate_config(&fbconfig);
             fbconfig_updated = true;
-            /* fall through */
+            fallthrough;
         case RPI_FWREQ_FRAMEBUFFER_GET_DEPTH:
             stl_le_phys(&s->dma_as, value + 12, fbconfig.bpp);
             resplen = 4;
@@ -218,7 +218,7 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value)
             fbconfig.pixo = ldl_le_phys(&s->dma_as, value + 12);
             bcm2835_fb_validate_config(&fbconfig);
             fbconfig_updated = true;
-            /* fall through */
+            fallthrough;
         case RPI_FWREQ_FRAMEBUFFER_GET_PIXEL_ORDER:
             stl_le_phys(&s->dma_as, value + 12, fbconfig.pixo);
             resplen = 4;
@@ -230,7 +230,7 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value)
             fbconfig.alpha = ldl_le_phys(&s->dma_as, value + 12);
             bcm2835_fb_validate_config(&fbconfig);
             fbconfig_updated = true;
-            /* fall through */
+            fallthrough;
         case RPI_FWREQ_FRAMEBUFFER_GET_ALPHA_MODE:
             stl_le_phys(&s->dma_as, value + 12, fbconfig.alpha);
             resplen = 4;
@@ -248,7 +248,7 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value)
             fbconfig.yoffset = ldl_le_phys(&s->dma_as, value + 16);
             bcm2835_fb_validate_config(&fbconfig);
             fbconfig_updated = true;
-            /* fall through */
+            fallthrough;
         case RPI_FWREQ_FRAMEBUFFER_GET_VIRTUAL_OFFSET:
             stl_le_phys(&s->dma_as, value + 12, fbconfig.xoffset);
             stl_le_phys(&s->dma_as, value + 16, fbconfig.yoffset);
hw/misc/mos6522.c +2 -2
index d6ba47bde9..a62349e6a0 100644
@@ -320,7 +320,7 @@ uint64_t mos6522_read(void *opaque, hwaddr addr, unsigned size)
         break;
     case VIA_REG_A:
        qemu_log_mask(LOG_UNIMP, "Read access to register A with handshake");
-       /* fall through */
+       fallthrough;
     case VIA_REG_ANH:
         val = s->a;
         ctrl = (s->pcr & CA2_CTRL_MASK) >> CA2_CTRL_SHIFT;
@@ -412,7 +412,7 @@ void mos6522_write(void *opaque, hwaddr addr, uint64_t val, unsigned size)
         break;
     case VIA_REG_A:
        qemu_log_mask(LOG_UNIMP, "Write access to register A with handshake");
-       /* fall through */
+       fallthrough;
     case VIA_REG_ANH:
         s->a = (s->a & ~s->dira) | (val & s->dira);
         mdc->portA_write(s);
Signature · 1 line
2.39.2
#57 lore raw

RFC PATCH v3 44/78 hw/m68k/mcf_intc.c: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/m68k/mcf_intc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/m68k/mcf_intc.c +1 -1
index 4cd30188c0..9556a0ccb7 100644
@@ -84,7 +84,7 @@ static uint64_t mcf_intc_read(void *opaque, hwaddr addr,
         /* LnIACK */
         qemu_log_mask(LOG_UNIMP, "%s: LnIACK not implemented (offset 0x%02x)\n",
                       __func__, offset);
-        /* fallthru */
+        fallthrough;
     default:
         return 0;
     }
Signature · 1 line
2.39.2
#58 lore raw

RFC PATCH v3 45/78 hw/dma: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/dma/omap_dma.c    | 32 ++++++++++++++++----------------
 hw/dma/pxa2xx_dma.c  |  4 ++--
 hw/dma/sparc32_dma.c |  2 +-
 3 files changed, 19 insertions(+), 19 deletions(-)
hw/dma/omap_dma.c +16 -16
index 77797a67b5..dd43dbf3d2 100644
@@ -1471,7 +1471,7 @@ static uint64_t omap_dma_read(void *opaque, hwaddr addr, unsigned size)
                 break;
             return ret;
         }
-        /* Fall through. */
+        fallthrough;
     case 0x000 ... 0x2fe:
         reg = addr & 0x3f;
         ch = (addr >> 6) & 0x0f;
@@ -1482,7 +1482,7 @@ static uint64_t omap_dma_read(void *opaque, hwaddr addr, unsigned size)
     case 0x404 ... 0x4fe:
         if (s->model <= omap_dma_3_1)
             break;
-        /* Fall through. */
+        fallthrough;
     case 0x400:
         if (omap_dma_sys_read(s, addr, &ret))
             break;
@@ -1519,7 +1519,7 @@ static void omap_dma_write(void *opaque, hwaddr addr,
                 break;
             return;
         }
-        /* Fall through.  */
+        fallthrough;
     case 0x000 ... 0x2fe:
         reg = addr & 0x3f;
         ch = (addr >> 6) & 0x0f;
@@ -1530,7 +1530,7 @@ static void omap_dma_write(void *opaque, hwaddr addr,
     case 0x404 ... 0x4fe:
         if (s->model <= omap_dma_3_1)
             break;
-        /* fall through */
+        fallthrough;
     case 0x400:
         if (omap_dma_sys_write(s, addr, value))
             break;
@@ -1716,25 +1716,25 @@ static uint64_t omap_dma4_read(void *opaque, hwaddr addr,
 
     case 0x14:	/* DMA4_IRQSTATUS_L3 */
         irqn ++;
-        /* fall through */
+        fallthrough;
     case 0x10:	/* DMA4_IRQSTATUS_L2 */
         irqn ++;
-        /* fall through */
+        fallthrough;
     case 0x0c:	/* DMA4_IRQSTATUS_L1 */
         irqn ++;
-        /* fall through */
+        fallthrough;
     case 0x08:	/* DMA4_IRQSTATUS_L0 */
         return s->irqstat[irqn];
 
     case 0x24:	/* DMA4_IRQENABLE_L3 */
         irqn ++;
-        /* fall through */
+        fallthrough;
     case 0x20:	/* DMA4_IRQENABLE_L2 */
         irqn ++;
-        /* fall through */
+        fallthrough;
     case 0x1c:	/* DMA4_IRQENABLE_L1 */
         irqn ++;
-        /* fall through */
+        fallthrough;
     case 0x18:	/* DMA4_IRQENABLE_L0 */
         return s->irqen[irqn];
 
@@ -1870,13 +1870,13 @@ static void omap_dma4_write(void *opaque, hwaddr addr,
     switch (addr) {
     case 0x14:	/* DMA4_IRQSTATUS_L3 */
         irqn ++;
-        /* fall through */
+        fallthrough;
     case 0x10:	/* DMA4_IRQSTATUS_L2 */
         irqn ++;
-        /* fall through */
+        fallthrough;
     case 0x0c:	/* DMA4_IRQSTATUS_L1 */
         irqn ++;
-        /* fall through */
+        fallthrough;
     case 0x08:	/* DMA4_IRQSTATUS_L0 */
         s->irqstat[irqn] &= ~value;
         if (!s->irqstat[irqn])
@@ -1885,13 +1885,13 @@ static void omap_dma4_write(void *opaque, hwaddr addr,
 
     case 0x24:	/* DMA4_IRQENABLE_L3 */
         irqn ++;
-        /* fall through */
+        fallthrough;
     case 0x20:	/* DMA4_IRQENABLE_L2 */
         irqn ++;
-        /* fall through */
+        fallthrough;
     case 0x1c:	/* DMA4_IRQENABLE_L1 */
         irqn ++;
-        /* fall through */
+        fallthrough;
     case 0x18:	/* DMA4_IRQENABLE_L0 */
         s->irqen[irqn] = value;
         return;
hw/dma/pxa2xx_dma.c +2 -2
index fa896f7edf..ac47256572 100644
@@ -278,7 +278,7 @@ static uint64_t pxa2xx_dma_read(void *opaque, hwaddr offset,
     switch (offset) {
     case DRCMR64 ... DRCMR74:
         offset -= DRCMR64 - DRCMR0 - (64 << 2);
-        /* Fall through */
+        fallthrough;
     case DRCMR0 ... DRCMR63:
         channel = (offset - DRCMR0) >> 2;
         return s->req[channel];
@@ -338,7 +338,7 @@ static void pxa2xx_dma_write(void *opaque, hwaddr offset,
     switch (offset) {
     case DRCMR64 ... DRCMR74:
         offset -= DRCMR64 - DRCMR0 - (64 << 2);
-        /* Fall through */
+        fallthrough;
     case DRCMR0 ... DRCMR63:
         channel = (offset - DRCMR0) >> 2;
 
hw/dma/sparc32_dma.c +1 -1
index 0ef13c5e9a..c68e068cc9 100644
@@ -220,7 +220,7 @@ static void dma_mem_write(void *opaque, hwaddr addr,
         break;
     case 1:
         s->dmaregs[0] |= DMA_LOADED;
-        /* fall through */
+        fallthrough;
     default:
         s->dmaregs[saddr] = val;
         break;
Signature · 1 line
2.39.2
#59 lore raw

RFC PATCH v3 46/78 disas: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 disas/hppa.c  | 4 ++--
 disas/m68k.c  | 2 +-
 disas/sh4.c   | 6 +++---
 disas/sparc.c | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)
disas/hppa.c +2 -2
index dcf9a47f34..1a2bdb8d39 100644
@@ -2027,7 +2027,7 @@ print_insn_hppa (bfd_vma memaddr, disassemble_info *info)
 			 completer.  */
 		    case 'X':
 		      fputs_filtered (" ", info);
-		      /* FALLTHRU */
+		      fallthrough;
 
 		    case 'A':
 		      if (GET_FIELD (insn, 24, 24))
@@ -2104,7 +2104,7 @@ print_insn_hppa (bfd_vma memaddr, disassemble_info *info)
 			 format completer.  */
 		    case 'E':
 		      fputs_filtered (" ", info);
-		      /* FALLTHRU */
+		      fallthrough;
 
 		    case 'e':
 		      if (GET_FIELD (insn, 30, 30))
disas/m68k.c +1 -1
index 1f16e295ab..a755951bb7 100644
@@ -1623,7 +1623,7 @@ print_insn_arg (const char *d,
 
     case 'X':
       place = '8';
-      /* fall through */
+      fallthrough;
     case 'Y':
     case 'Z':
     case 'W':
disas/sh4.c +3 -3
index dcdbdf26d8..f7c95407ca 100644
@@ -1757,7 +1757,7 @@ print_insn_sh (bfd_vma memaddr, struct disassemble_info *info)
 	    case REG_N_D:
 	      if ((nibs[n] & 1) != 0)
 		goto fail;
-	      /* fall through */
+        fallthrough;
 	    case REG_N:
 	      rn = nibs[n];
 	      break;
@@ -1963,7 +1963,7 @@ print_insn_sh (bfd_vma memaddr, struct disassemble_info *info)
 		  fprintf_fn (stream, "xd%d", rn & ~1);
 		  break;
 		}
-	      /* fallthrough */
+        fallthrough;
 	    case D_REG_N:
 	      fprintf_fn (stream, "dr%d", rn);
 	      break;
@@ -1973,7 +1973,7 @@ print_insn_sh (bfd_vma memaddr, struct disassemble_info *info)
 		  fprintf_fn (stream, "xd%d", rm & ~1);
 		  break;
 		}
-	      /* fallthrough */
+        fallthrough;
 	    case D_REG_M:
 	      fprintf_fn (stream, "dr%d", rm);
 	      break;
disas/sparc.c +1 -1
index 5689533ce1..61139256b0 100644
@@ -2803,7 +2803,7 @@ print_insn_sparc (bfd_vma memaddr, disassemble_info *info)
                   {
                   case '+':
                     found_plus = 1;
-                    /* Fall through.  */
+                    fallthrough;
 
                   default:
                     (*info->fprintf_func) (stream, "%c", *s);
Signature · 1 line
2.39.2
#60 lore raw

RFC PATCH v3 47/78 contrib/rdmacm-mux: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 contrib/rdmacm-mux/main.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
contrib/rdmacm-mux/main.c +5 -5
index 771ca01e03..dda6917d58 100644
@@ -342,16 +342,16 @@ static int get_fd(const char *mad, int umad_len, int *fd, __be64 *gid_ifid)
         break;
 
     case UMAD_CM_ATTR_REP:
-        /* Fall through */
+        fallthrough;
     case UMAD_CM_ATTR_REJ:
-        /* Fall through */
+        fallthrough;
     case UMAD_CM_ATTR_DREQ:
-        /* Fall through */
+        fallthrough;
     case UMAD_CM_ATTR_DREP:
-        /* Fall through */
+        fallthrough;
     case UMAD_CM_ATTR_RTU:
         data += sizeof(comm_id);
-        /* Fall through */
+        fallthrough;
     case UMAD_CM_ATTR_SIDR_REP:
         if (unlikely(umad_len < sizeof(*hdr) + sizeof(comm_id))) {
             rc = -EINVAL;
Signature · 1 line
2.39.2
#61 lore raw

RFC PATCH v3 48/78 contrib/vhost-user-scsi: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 contrib/vhost-user-scsi/vhost-user-scsi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
contrib/vhost-user-scsi/vhost-user-scsi.c +2 -1
index 9ef61cf5a7..71076f579b 100644
@@ -112,7 +112,8 @@ static int get_cdb_len(uint8_t *cdb)
 
     switch (cdb[0] >> 5) {
     case 0: return 6;
-    case 1: /* fall through */
+    case 1:
+            fallthrough;
     case 2: return 10;
     case 4: return 16;
     case 5: return 12;
Signature · 1 line
2.39.2
#62 lore raw

RFC PATCH v3 49/78 hw/arm: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/arm/omap1.c     | 8 ++++----
 hw/arm/pxa2xx.c    | 6 +++---
 hw/arm/stellaris.c | 1 +
 3 files changed, 8 insertions(+), 7 deletions(-)
hw/arm/omap1.c +4 -4
index d5438156ee..c54a4ec553 100644
@@ -552,7 +552,7 @@ static uint64_t omap_ulpd_pm_read(void *opaque, hwaddr addr,
     case 0x28:	/* Reserved */
     case 0x2c:	/* Reserved */
         OMAP_BAD_REG(addr);
-        /* fall through */
+        fallthrough;
     case 0x00:	/* COUNTER_32_LSB */
     case 0x04:	/* COUNTER_32_MSB */
     case 0x08:	/* COUNTER_HIGH_FREQ_LSB */
@@ -658,7 +658,7 @@ static void omap_ulpd_pm_write(void *opaque, hwaddr addr,
     case 0x28:	/* Reserved */
     case 0x2c:	/* Reserved */
         OMAP_BAD_REG(addr);
-        /* fall through */
+        fallthrough;
     case 0x24:	/* SETUP_ANALOG_CELL3_ULPD1 */
     case 0x38:	/* COUNTER_32_FIQ */
     case 0x48:	/* LOCL_TIME */
@@ -3181,7 +3181,7 @@ static uint64_t omap_mcbsp_read(void *opaque, hwaddr addr,
     case 0x00:	/* DRR2 */
         if (((s->rcr[0] >> 5) & 7) < 3)			/* RWDLEN1 */
             return 0x0000;
-        /* Fall through.  */
+        fallthrough;
     case 0x02:	/* DRR1 */
         if (s->rx_req < 2) {
             printf("%s: Rx FIFO underrun\n", __func__);
@@ -3279,7 +3279,7 @@ static void omap_mcbsp_writeh(void *opaque, hwaddr addr,
     case 0x04:	/* DXR2 */
         if (((s->xcr[0] >> 5) & 7) < 3)			/* XWDLEN1 */
             return;
-        /* Fall through.  */
+        fallthrough;
     case 0x06:	/* DXR1 */
         if (s->tx_req > 1) {
             s->tx_req -= 2;
hw/arm/pxa2xx.c +3 -3
index 07d5dd8691..eaa6684243 100644
@@ -285,7 +285,7 @@ static void pxa2xx_pwrmode_write(CPUARMState *env, const ARMCPRegInfo *ri,
             cpu_interrupt(CPU(s->cpu), CPU_INTERRUPT_HALT);
             break;
         }
-        /* Fall through.  */
+        fallthrough;
 
     case 2:
         /* Deep-Idle */
@@ -425,7 +425,7 @@ static uint64_t pxa2xx_mm_read(void *opaque, hwaddr addr,
     case MDCNFG ... SA1110:
         if ((addr & 3) == 0)
             return s->mm_regs[addr >> 2];
-        /* fall through */
+        fallthrough;
     default:
         qemu_log_mask(LOG_GUEST_ERROR,
                       "%s: Bad read offset 0x%"HWADDR_PRIx"\n",
@@ -446,7 +446,7 @@ static void pxa2xx_mm_write(void *opaque, hwaddr addr,
             s->mm_regs[addr >> 2] = value;
             break;
         }
-        /* fallthrough */
+        fallthrough;
     default:
         qemu_log_mask(LOG_GUEST_ERROR,
                       "%s: Bad write offset 0x%"HWADDR_PRIx"\n",
hw/arm/stellaris.c +1 -0
index aa5b0ddfaa..d68602ab71 100644
@@ -157,6 +157,7 @@ static int ssys_board_class(const ssys_state *s)
             return did0 & DID0_CLASS_MASK;
         }
         /* for unknown classes, fall through */
+        fallthrough;
     default:
         /* This can only happen if the hardwired constant did0 value
          * in this board's stellaris_board_info struct is wrong.
Signature · 1 line
2.39.2
#63 lore raw

RFC PATCH v3 50/78 hw/audio: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/audio/asc.c        | 2 +-
 hw/audio/cs4231a.c    | 2 +-
 hw/audio/gusemu_hal.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
hw/audio/asc.c +1 -1
index 0f36b4ce9b..336da09509 100644
@@ -229,7 +229,7 @@ static int generate_fifo(ASCState *s, int maxsamples)
                 break;
 
             default:
-                /* fallthrough */
+                fallthrough;
             case 0x80:
                 /* Raw mode */
                 if (fs->cnt) {
hw/audio/cs4231a.c +1 -1
index 3aa105748d..3bf0116c68 100644
@@ -311,7 +311,7 @@ static void cs_reset_voices (CSState *s, uint32_t val)
 
     case 6:
         as.endianness = 1;
-        /* fall through */
+        fallthrough;
     case 2:
         as.fmt = AUDIO_FORMAT_S16;
         s->shift = as.nchannels;
hw/audio/gusemu_hal.c +1 -1
index f159978b49..76dd906ea1 100644
@@ -261,7 +261,7 @@ void gus_write(GUSEmuState * state, int port, int size, unsigned int data)
             GUSregb(IRQStatReg2x6) = 0x10;
             GUS_irqrequest(state, state->gusirq, 1);
         }
-        /* fall through */
+        fallthrough;
     case 0x20D:                /* SB2xCd no IRQ */
         GUSregb(SB2xCd) = (uint8_t) data;
         break;
Signature · 1 line
2.39.2
#64 lore raw

RFC PATCH v3 51/78 chardev: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 chardev/char-socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
chardev/char-socket.c +1 -1
index 73947da188..1562e066a4 100644
@@ -564,7 +564,7 @@ static char *qemu_chr_compute_filename(SocketChardev *s)
     case AF_INET6:
         left  = "[";
         right = "]";
-        /* fall through */
+        fallthrough;
     case AF_INET:
         getnameinfo((struct sockaddr *) ss, ss_len, shost, sizeof(shost),
                     sserv, sizeof(sserv), NI_NUMERICHOST | NI_NUMERICSERV);
Signature · 1 line
2.39.2
#65 lore raw

RFC PATCH v3 52/78 hw/char: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/char/nrf51_uart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/char/nrf51_uart.c +2 -2
index dfe2276d71..3e2b35c7ad 100644
@@ -170,13 +170,13 @@ static void uart_write(void *opaque, hwaddr addr,
         }
         s->enabled = false;
         value = 1;
-        /* fall through */
+        fallthrough;
     case A_UART_SUSPEND:
     case A_UART_STOPTX:
         if (value == 1) {
             s->tx_started = false;
         }
-        /* fall through */
+        fallthrough;
     case A_UART_STOPRX:
         if (addr != A_UART_STOPTX && value == 1) {
             s->rx_started = false;
Signature · 1 line
2.39.2
#66 lore raw

RFC PATCH v3 53/78 nbd: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 nbd/client.c | 4 ++--
 nbd/common.c | 2 +-
 qemu-nbd.c   | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)
nbd/client.c +2 -2
index 29ffc609a4..04507249b2 100644
@@ -1051,7 +1051,7 @@ int nbd_receive_negotiate(QIOChannel *ioc, QCryptoTLSCreds *tlscreds,
             }
             info->base_allocation = result == 1;
         }
-        /* fall through */
+        fallthrough;
     case NBD_MODE_SIMPLE:
         /* Try NBD_OPT_GO first - if it works, we are done (it
          * also gives us a good message if the server requires
@@ -1074,7 +1074,7 @@ int nbd_receive_negotiate(QIOChannel *ioc, QCryptoTLSCreds *tlscreds,
         if (nbd_receive_query_exports(ioc, info->name, errp) < 0) {
             return -EINVAL;
         }
-        /* fall through */
+        fallthrough;
     case NBD_MODE_EXPORT_NAME:
         /* write the export name request */
         if (nbd_send_option_request(ioc, NBD_OPT_EXPORT_NAME, -1, info->name,
nbd/common.c +1 -1
index 3247c1d618..1140ea0888 100644
@@ -249,7 +249,7 @@ int nbd_errno_to_system_errno(int err)
         break;
     default:
         trace_nbd_unknown_error(err);
-        /* fallthrough */
+        fallthrough;
     case NBD_EINVAL:
         ret = EINVAL;
         break;
qemu-nbd.c +2 -2
index 186e6468b1..41e50208a5 100644
@@ -632,7 +632,7 @@ int main(int argc, char **argv)
             break;
         case 'n':
             optarg = (char *) "none";
-            /* fallthrough */
+            fallthrough;
         case QEMU_NBD_OPT_CACHE:
             if (seen_cache) {
                 error_report("-n and --cache can only be specified once");
@@ -708,7 +708,7 @@ int main(int argc, char **argv)
             } else {
                 sn_id_or_name = optarg;
             }
-            /* fall through */
+            fallthrough;
         case 'r':
             readonly = true;
             flags &= ~BDRV_O_RDWR;
Signature · 1 line
2.39.2
#67 lore raw

RFC PATCH v3 54/78 hw/core: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/core/loader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/core/loader.c +1 -1
index 4dd5a71fb7..559d63a1e2 100644
@@ -672,7 +672,7 @@ static ssize_t load_uboot_image(const char *filename, hwaddr *ep,
 
         hdr->ih_load = *loadaddr + sizeof(*hdr);
         hdr->ih_ep += hdr->ih_load;
-        /* fall through */
+        fallthrough;
     case IH_TYPE_KERNEL:
         address = hdr->ih_load;
         if (translate_fn) {
Signature · 1 line
2.39.2
#68 lore raw

RFC PATCH v3 55/78 hw/display: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/display/cg3.c        | 2 +-
 hw/display/cirrus_vga.c | 2 +-
 hw/display/tcx.c        | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
hw/display/cg3.c +1 -1
index 2e9656ae1c..53eb9831b2 100644
@@ -231,7 +231,7 @@ static void cg3_reg_write(void *opaque, hwaddr addr, uint64_t val,
                 s->b[s->dac_index] = regval;
                 /* Index autoincrement */
                 s->dac_index = (s->dac_index + 1) & 0xff;
-                /* fall through */
+                fallthrough;
             default:
                 s->dac_state = 0;
                 break;
hw/display/cirrus_vga.c +1 -1
index b80f98b6c4..f1513a084c 100644
@@ -1360,7 +1360,7 @@ static void cirrus_vga_write_sr(CirrusVGAState * s, uint32_t val)
         break;
     case 0x07:                  // Extended Sequencer Mode
         cirrus_update_memory_access(s);
-        /* fall through */
+        fallthrough;
     case 0x08:                  // EEPROM Control
     case 0x09:                  // Scratch Register 0
     case 0x0a:                  // Scratch Register 1
hw/display/tcx.c +2 -2
index 1b27b64f6d..e21450d726 100644
@@ -396,7 +396,7 @@ static uint64_t tcx_dac_readl(void *opaque, hwaddr addr,
     case 2:
         val = s->b[s->dac_index] << 24;
         s->dac_index = (s->dac_index + 1) & 0xff; /* Index autoincrement */
-        /* fall through */
+        fallthrough;
     default:
         s->dac_state = 0;
         break;
@@ -438,7 +438,7 @@ static void tcx_dac_writel(void *opaque, hwaddr addr, uint64_t val,
             s->b[index] = val >> 24;
             update_palette_entries(s, index, index + 1);
             s->dac_index = (s->dac_index + 1) & 0xff; /* Index autoincrement */
-            /* fall through */
+            fallthrough;
         default:
             s->dac_state = 0;
             break;
Signature · 1 line
2.39.2
#69 lore raw

RFC PATCH v3 56/78 hw/input: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/input/hid.c     | 3 ++-
 hw/input/tsc2005.c | 4 ++--
 hw/input/tsc210x.c | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)
hw/input/hid.c +2 -1
index a9c7dd1ce1..15fffc5dfb 100644
@@ -283,6 +283,7 @@ static void hid_keyboard_process_keycode(HIDState *hs)
             return;
         }
         /* fall through to process Ctrl_L */
+        fallthrough;
     case 0xe1 ... 0xe7:
         /* Ctrl_L/Ctrl_R, Shift_L/Shift_R, Alt_L/Alt_R, Win_L/Win_R.
          * Handle releases here, or fall through to process presses.
@@ -291,7 +292,7 @@ static void hid_keyboard_process_keycode(HIDState *hs)
             hs->kbd.modifiers &= ~(1 << (hid_code & 0x0f));
             return;
         }
-        /* fall through */
+        fallthrough;
     case 0xe8 ... 0xe9:
         /* USB modifiers are just 1 byte long.  Bits 8 and 9 of
          * hs->kbd.modifiers implement a state machine that detects the
hw/input/tsc2005.c +2 -2
index db2b80e35f..4f3f1d9d12 100644
@@ -262,7 +262,7 @@ static void tsc2005_pin_update(TSC2005State *s)
             s->enabled = false;
         if (!s->pressure)
             return;
-        /* Fall through */
+        fallthrough;
     case TSC_MODE_AUX_SCAN:
         break;
 
@@ -271,7 +271,7 @@ static void tsc2005_pin_update(TSC2005State *s)
     case TSC_MODE_Z:
         if (!s->pressure)
             return;
-        /* Fall through */
+        fallthrough;
     case TSC_MODE_AUX:
     case TSC_MODE_TEMP1:
     case TSC_MODE_TEMP2:
hw/input/tsc210x.c +1 -1
index 950506fb38..9ae426e1a6 100644
@@ -809,7 +809,7 @@ static void tsc210x_pin_update(TSC210xState *s)
     case TSC_MODE_Z:
         if (!s->pressure)
             return;
-        /* Fall through */
+        fallthrough;
     case TSC_MODE_BAT1:
     case TSC_MODE_BAT2:
     case TSC_MODE_AUX:
Signature · 1 line
2.39.2
#70 lore raw

RFC PATCH v3 57/78 hw/net: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/net/cadence_gem.c     | 4 ++--
 hw/net/can/can_sja1000.c | 4 ++--
 hw/net/igb_core.c        | 2 +-
 hw/net/igbvf.c           | 2 +-
 hw/net/imx_fec.c         | 2 +-
 hw/net/net_rx_pkt.c      | 2 +-
 hw/net/pcnet.c           | 2 +-
 hw/net/rtl8139.c         | 6 ++++--
 hw/net/xilinx_ethlite.c  | 2 +-
 9 files changed, 14 insertions(+), 12 deletions(-)
hw/net/cadence_gem.c +2 -2
index f445d8bb5e..a59991af5b 100644
@@ -834,10 +834,10 @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr,
                 qemu_log_mask(LOG_UNIMP, "TCP compare offsets"
                               "unimplemented - assuming UDP\n");
                 offset += 8;
-                /* Fallthrough */
+                fallthrough;
             case 2: /* skip the IP header */
                 offset += 20;
-                /* Fallthrough */
+                fallthrough;
             case 1: /* Count from after the ethertype */
                 offset += 14;
                 break;
hw/net/can/can_sja1000.c +2 -2
index 73201f9139..14052b2700 100644
@@ -544,7 +544,7 @@ void can_sja_mem_write(CanSJA1000State *s, hwaddr addr, uint64_t val,
             break;
         case 16: /* RX frame information addr16-28. */
             s->status_pel |= (1 << 5); /* Set transmit status. */
-            /* fallthrough */
+            fallthrough;
         case 17 ... 28:
             if (s->mode & 0x01) { /* Reset mode */
                 if (addr < 24) {
@@ -642,7 +642,7 @@ void can_sja_mem_write(CanSJA1000State *s, hwaddr addr, uint64_t val,
             break;
         case 10:
             s->status_bas |= (1 << 5); /* Set transmit status. */
-            /* fallthrough */
+            fallthrough;
         case 11 ... 19:
             if ((s->control & 0x01) == 0) { /* Operation mode */
                 s->tx_buff[addr - 10] = val; /* Store to TX buffer directly. */
hw/net/igb_core.c +1 -1
index f6a5e2327b..1117f7cb59 100644
@@ -1419,7 +1419,7 @@ igb_build_rx_metadata_common(IGBCore *core,
             if (!csum_valid) {
                 *status_flags |= E1000_RXDEXT_STATERR_TCPE;
             }
-            /* fall through */
+            fallthrough;
         case ETH_L4_HDR_PROTO_TCP:
             *status_flags |= E1000_RXD_STAT_TCPCS;
             break;
hw/net/igbvf.c +1 -1
index d55e1e8a6a..ff68a4f3c5 100644
@@ -188,7 +188,7 @@ static hwaddr vf_to_pf_addr(hwaddr addr, uint16_t vfn, bool write)
         if (write) {
             return HWADDR_MAX;
         }
-        /* fallthrough */
+        fallthrough;
     case 0x34E8: /* PBTWAC */
     case 0x24E8: /* PBRWAC */
         return addr;
hw/net/imx_fec.c +1 -1
index 5d1f1f104c..a7e8b06d48 100644
@@ -918,7 +918,7 @@ static void imx_eth_write(void *opaque, hwaddr offset, uint64_t value,
                           TYPE_IMX_FEC, __func__);
             return;
         }
-        /* fall through */
+        fallthrough;
     case ENET_TDAR:
         if (s->regs[ENET_ECR] & ENET_ECR_ETHEREN) {
             s->regs[index] = ENET_TDAR_TDAR;
hw/net/net_rx_pkt.c +1 -1
index 32e5f3f9cf..52e2432c9b 100644
@@ -605,7 +605,7 @@ bool net_rx_pkt_validate_l4_csum(struct NetRxPkt *pkt, bool *csum_valid)
             trace_net_rx_pkt_l4_csum_validate_udp_with_no_checksum();
             return false;
         }
-        /* fall through */
+        fallthrough;
     case ETH_L4_HDR_PROTO_TCP:
         csum = _net_rx_pkt_calc_l4_csum(pkt);
         *csum_valid = ((csum == 0) || (csum == 0xFFFF));
hw/net/pcnet.c +1 -1
index 02828ae716..a32174ef93 100644
@@ -1502,7 +1502,7 @@ static void pcnet_bcr_writew(PCNetState *s, uint32_t rap, uint32_t val)
 #ifdef PCNET_DEBUG
        printf("BCR_SWS=0x%04x\n", val);
 #endif
-        /* fall through */
+       fallthrough;
     case BCR_LNKST:
     case BCR_LED1:
     case BCR_LED2:
hw/net/rtl8139.c +4 -2
index 4525fda383..42f19618b1 100644
@@ -2447,8 +2447,10 @@ static uint32_t rtl8139_TxStatus_TxAddr_read(RTL8139State *s, uint32_t regs[],
     }
 
     switch (size) {
-    case 1: /* fall through */
-    case 2: /* fall through */
+    case 1:
+        fallthrough;
+    case 2:
+        fallthrough;
     case 4:
         ret = (regs[reg] >> offset * 8) & (((uint64_t)1 << (size * 8)) - 1);
         DPRINTF("TxStatus/TxAddr[%d] read addr=0x%x size=0x%x val=0x%08x\n",
hw/net/xilinx_ethlite.c +1 -1
index 89f4f3b254..5ae4032ec2 100644
@@ -151,7 +151,7 @@ eth_write(void *opaque, hwaddr addr,
             if (!(value & CTRL_S)) {
                 qemu_flush_queued_packets(qemu_get_queue(s->nic));
             }
-            /* fall through */
+            fallthrough;
         case R_TX_LEN0:
         case R_TX_LEN1:
         case R_TX_GIE0:
Signature · 1 line
2.39.2
#71 lore raw

Re: [RFC PATCH v3 57/78] hw/net: add fallthrough pseudo-keyword

Quoted 125 lines · Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
  hw/net/cadence_gem.c     | 4 ++--
  hw/net/can/can_sja1000.c | 4 ++--
  hw/net/igb_core.c        | 2 +-
  hw/net/igbvf.c           | 2 +-
  hw/net/imx_fec.c         | 2 +-
  hw/net/net_rx_pkt.c      | 2 +-
  hw/net/pcnet.c           | 2 +-
  hw/net/rtl8139.c         | 6 ++++--
  hw/net/xilinx_ethlite.c  | 2 +-
  9 files changed, 14 insertions(+), 12 deletions(-)
hw/net/cadence_gem.c +2 -2
index f445d8bb5e..a59991af5b 100644
@@ -834,10 +834,10 @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr,
                  qemu_log_mask(LOG_UNIMP, "TCP compare offsets"
                                "unimplemented - assuming UDP\n");
                  offset += 8;
-                /* Fallthrough */
+                fallthrough;
              case 2: /* skip the IP header */
                  offset += 20;
-                /* Fallthrough */
+                fallthrough;
              case 1: /* Count from after the ethertype */
                  offset += 14;
                  break;
hw/net/can/can_sja1000.c +2 -2
index 73201f9139..14052b2700 100644
@@ -544,7 +544,7 @@ void can_sja_mem_write(CanSJA1000State *s, hwaddr addr, uint64_t val,
              break;
          case 16: /* RX frame information addr16-28. */
              s->status_pel |= (1 << 5); /* Set transmit status. */
-            /* fallthrough */
+            fallthrough;
          case 17 ... 28:
              if (s->mode & 0x01) { /* Reset mode */
                  if (addr < 24) {
@@ -642,7 +642,7 @@ void can_sja_mem_write(CanSJA1000State *s, hwaddr addr, uint64_t val,
              break;
          case 10:
              s->status_bas |= (1 << 5); /* Set transmit status. */
-            /* fallthrough */
+            fallthrough;
          case 11 ... 19:
              if ((s->control & 0x01) == 0) { /* Operation mode */
                  s->tx_buff[addr - 10] = val; /* Store to TX buffer directly. */
hw/net/igb_core.c +1 -1
index f6a5e2327b..1117f7cb59 100644
@@ -1419,7 +1419,7 @@ igb_build_rx_metadata_common(IGBCore *core,
              if (!csum_valid) {
                  *status_flags |= E1000_RXDEXT_STATERR_TCPE;
              }
-            /* fall through */
+            fallthrough;
          case ETH_L4_HDR_PROTO_TCP:
              *status_flags |= E1000_RXD_STAT_TCPCS;
              break;
hw/net/igbvf.c +1 -1
index d55e1e8a6a..ff68a4f3c5 100644
@@ -188,7 +188,7 @@ static hwaddr vf_to_pf_addr(hwaddr addr, uint16_t vfn, bool write)
          if (write) {
              return HWADDR_MAX;
          }
-        /* fallthrough */
+        fallthrough;
      case 0x34E8: /* PBTWAC */
      case 0x24E8: /* PBRWAC */
          return addr;
hw/net/imx_fec.c +1 -1
index 5d1f1f104c..a7e8b06d48 100644
@@ -918,7 +918,7 @@ static void imx_eth_write(void *opaque, hwaddr offset, uint64_t value,
                            TYPE_IMX_FEC, __func__);
              return;
          }
-        /* fall through */
+        fallthrough;
      case ENET_TDAR:
          if (s->regs[ENET_ECR] & ENET_ECR_ETHEREN) {
              s->regs[index] = ENET_TDAR_TDAR;
hw/net/net_rx_pkt.c +1 -1
index 32e5f3f9cf..52e2432c9b 100644
@@ -605,7 +605,7 @@ bool net_rx_pkt_validate_l4_csum(struct NetRxPkt *pkt, bool *csum_valid)
              trace_net_rx_pkt_l4_csum_validate_udp_with_no_checksum();
              return false;
          }
-        /* fall through */
+        fallthrough;
      case ETH_L4_HDR_PROTO_TCP:
          csum = _net_rx_pkt_calc_l4_csum(pkt);
          *csum_valid = ((csum == 0) || (csum == 0xFFFF));
hw/net/pcnet.c +1 -1
index 02828ae716..a32174ef93 100644
@@ -1502,7 +1502,7 @@ static void pcnet_bcr_writew(PCNetState *s, uint32_t rap, uint32_t val)
  #ifdef PCNET_DEBUG
         printf("BCR_SWS=0x%04x\n", val);
  #endif
-        /* fall through */
+       fallthrough;
      case BCR_LNKST:
      case BCR_LED1:
      case BCR_LED2:
hw/net/rtl8139.c +0 -0
index 4525fda383..42f19618b1 100644

hw/net/rtl8139.c static uint32_t rtl8139_TxStatus_TxAddr_read(RTL8139State *s, uint32_t regs[], · line 2454

Quoted 10 lines
hw/net/rtl8139.c +4 -2
@@ -2447,8 +2447,10 @@ static uint32_t rtl8139_TxStatus_TxAddr_read(RTL8139State *s, uint32_t regs[],
      }
 
      switch (size) {
-    case 1: /* fall through */
-    case 2: /* fall through */
+    case 1:
+        fallthrough;
+    case 2:
+        fallthrough;
      case 4:

I don't think you need comments or pseudo-keywords here.

#72 lore raw

Re: [RFC PATCH v3 57/78] hw/net: add fallthrough pseudo-keyword

Quoted 7 lines · Akihiko Odaki
Quoted 7 lines
hw/net/rtl8139.c +0 -0
index 4525fda383..42f19618b1 100644
@@ -2447,8 +2447,10 @@ static uint32_t rtl8139_TxStatus_TxAddr_read(RTL8139State *s, uint32_t regs[],
      }
 
Quoted 10 lines

hw/net/rtl8139.c static uint32_t rtl8139_TxStatus_TxAddr_read(RTL8139State *s, uint32_t regs[], · line 2454

Quoted 8 lines
hw/net/rtl8139.c +4 -2
      switch (size) {
-    case 1: /* fall through */
-    case 2: /* fall through */
+    case 1:
+        fallthrough;
+    case 2:
+        fallthrough;
      case 4:

I don't think you need comments or pseudo-keywords here.

That's correct, it was a stylistic change. I can remove them in the next version. Thank you!

Manos

#73 lore raw

RFC PATCH v3 58/78 hw/ppc: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/ppc/pnv_bmc.c      | 2 +-
 hw/ppc/spapr_events.c | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
hw/ppc/pnv_bmc.c +1 -1
index 99f1e8d7f9..9bff7d03cb 100644
@@ -210,7 +210,7 @@ static void hiomap_cmd(IPMIBmcSim *ibs, uint8_t *cmd, unsigned int cmd_len,
 
     case HIOMAP_C_CREATE_READ_WINDOW:
         readonly = true;
-        /* Fall through */
+        fallthrough;
 
     case HIOMAP_C_CREATE_WRITE_WINDOW:
         memory_region_set_readonly(&pnor->mmio, readonly);
hw/ppc/spapr_events.c +1 -0
index 4508e40814..9d51746daf 100644
@@ -423,6 +423,7 @@ rtas_event_log_to_source(SpaprMachineState *spapr, int log_type)
             break;
         }
         /* fall through back to epow for legacy hotplug interrupt source */
+        fallthrough;
     case RTAS_LOG_TYPE_EPOW:
         source = spapr_event_sources_get_source(spapr->event_sources,
                                                 EVENT_CLASS_EPOW);
Signature · 1 line
2.39.2
#74 lore raw

RFC PATCH v3 59/78 hw/intc: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/intc/apic.c          |  2 +-
 hw/intc/arm_gicv3_kvm.c | 16 ++++++++--------
 hw/intc/armv7m_nvic.c   | 12 ++++++------
 hw/intc/xilinx_intc.c   |  2 +-
 4 files changed, 16 insertions(+), 16 deletions(-)
hw/intc/apic.c +1 -1
index ac3d47d231..30f341c722 100644
@@ -183,7 +183,7 @@ void apic_deliver_pic_intr(DeviceState *dev, int level)
             if (!(lvt & APIC_LVT_LEVEL_TRIGGER))
                 break;
             apic_reset_bit(s->irr, lvt & 0xff);
-            /* fall through */
+            fallthrough;
         case APIC_DM_EXTINT:
             apic_update_irq(s);
             break;
hw/intc/arm_gicv3_kvm.c +8 -8
index 72ad916d3d..782cef3390 100644
@@ -479,11 +479,11 @@ static void kvm_arm_gicv3_put(GICv3State *s)
             kvm_gicc_access(s, ICC_AP0R_EL1(3), ncpu, &reg64, true);
             reg64 = c->icc_apr[GICV3_G0][2];
             kvm_gicc_access(s, ICC_AP0R_EL1(2), ncpu, &reg64, true);
-            /* fall through */
+            fallthrough;
         case 6:
             reg64 = c->icc_apr[GICV3_G0][1];
             kvm_gicc_access(s, ICC_AP0R_EL1(1), ncpu, &reg64, true);
-            /* fall through */
+            fallthrough;
         default:
             reg64 = c->icc_apr[GICV3_G0][0];
             kvm_gicc_access(s, ICC_AP0R_EL1(0), ncpu, &reg64, true);
@@ -495,11 +495,11 @@ static void kvm_arm_gicv3_put(GICv3State *s)
             kvm_gicc_access(s, ICC_AP1R_EL1(3), ncpu, &reg64, true);
             reg64 = c->icc_apr[GICV3_G1NS][2];
             kvm_gicc_access(s, ICC_AP1R_EL1(2), ncpu, &reg64, true);
-            /* fall through */
+            fallthrough;
         case 6:
             reg64 = c->icc_apr[GICV3_G1NS][1];
             kvm_gicc_access(s, ICC_AP1R_EL1(1), ncpu, &reg64, true);
-            /* fall through */
+            fallthrough;
         default:
             reg64 = c->icc_apr[GICV3_G1NS][0];
             kvm_gicc_access(s, ICC_AP1R_EL1(0), ncpu, &reg64, true);
@@ -636,11 +636,11 @@ static void kvm_arm_gicv3_get(GICv3State *s)
             c->icc_apr[GICV3_G0][3] = reg64;
             kvm_gicc_access(s, ICC_AP0R_EL1(2), ncpu, &reg64, false);
             c->icc_apr[GICV3_G0][2] = reg64;
-            /* fall through */
+            fallthrough;
         case 6:
             kvm_gicc_access(s, ICC_AP0R_EL1(1), ncpu, &reg64, false);
             c->icc_apr[GICV3_G0][1] = reg64;
-            /* fall through */
+            fallthrough;
         default:
             kvm_gicc_access(s, ICC_AP0R_EL1(0), ncpu, &reg64, false);
             c->icc_apr[GICV3_G0][0] = reg64;
@@ -652,11 +652,11 @@ static void kvm_arm_gicv3_get(GICv3State *s)
             c->icc_apr[GICV3_G1NS][3] = reg64;
             kvm_gicc_access(s, ICC_AP1R_EL1(2), ncpu, &reg64, false);
             c->icc_apr[GICV3_G1NS][2] = reg64;
-            /* fall through */
+            fallthrough;
         case 6:
             kvm_gicc_access(s, ICC_AP1R_EL1(1), ncpu, &reg64, false);
             c->icc_apr[GICV3_G1NS][1] = reg64;
-            /* fall through */
+            fallthrough;
         default:
             kvm_gicc_access(s, ICC_AP1R_EL1(0), ncpu, &reg64, false);
             c->icc_apr[GICV3_G1NS][0] = reg64;
hw/intc/armv7m_nvic.c +6 -6
index 03b6b8c986..72d3ae985e 100644
@@ -2224,7 +2224,7 @@ static MemTxResult nvic_sysreg_read(void *opaque, hwaddr addr,
     /* reads of set and clear both return the status */
     case 0x100 ... 0x13f: /* NVIC Set enable */
         offset += 0x80;
-        /* fall through */
+        fallthrough;
     case 0x180 ... 0x1bf: /* NVIC Clear enable */
         val = 0;
         startvec = 8 * (offset - 0x180) + NVIC_FIRST_IRQ; /* vector # */
@@ -2238,7 +2238,7 @@ static MemTxResult nvic_sysreg_read(void *opaque, hwaddr addr,
         break;
     case 0x200 ... 0x23f: /* NVIC Set pend */
         offset += 0x80;
-        /* fall through */
+        fallthrough;
     case 0x280 ... 0x2bf: /* NVIC Clear pend */
         val = 0;
         startvec = 8 * (offset - 0x280) + NVIC_FIRST_IRQ; /* vector # */
@@ -2280,7 +2280,7 @@ static MemTxResult nvic_sysreg_read(void *opaque, hwaddr addr,
             val = 0;
             break;
         }
-        /* fall through */
+        fallthrough;
     case 0xd1c ... 0xd23: /* System Handler Priority (SHPR2, SHPR3) */
         val = 0;
         for (i = 0; i < size; i++) {
@@ -2355,7 +2355,7 @@ static MemTxResult nvic_sysreg_write(void *opaque, hwaddr addr,
     case 0x100 ... 0x13f: /* NVIC Set enable */
         offset += 0x80;
         setval = 1;
-        /* fall through */
+        fallthrough;
     case 0x180 ... 0x1bf: /* NVIC Clear enable */
         startvec = 8 * (offset - 0x180) + NVIC_FIRST_IRQ;
 
@@ -2373,7 +2373,7 @@ static MemTxResult nvic_sysreg_write(void *opaque, hwaddr addr,
          */
         offset += 0x80;
         setval = 1;
-        /* fall through */
+        fallthrough;
     case 0x280 ... 0x2bf: /* NVIC Clear pend */
         startvec = 8 * (offset - 0x280) + NVIC_FIRST_IRQ; /* vector # */
 
@@ -2408,7 +2408,7 @@ static MemTxResult nvic_sysreg_write(void *opaque, hwaddr addr,
         if (!arm_feature(&s->cpu->env, ARM_FEATURE_M_MAIN)) {
             goto exit_ok;
         }
-        /* fall through */
+        fallthrough;
     case 0xd1c ... 0xd23: /* System Handler Priority (SHPR2, SHPR3) */
         for (i = 0; i < size; i++) {
             unsigned hdlidx = (offset - 0xd14) + i;
hw/intc/xilinx_intc.c +1 -1
index 6e5012e66e..245f452898 100644
@@ -131,7 +131,7 @@ static void pic_write(void *opaque, hwaddr addr,
             if ((p->regs[R_MER] & 2)) {
                 break;
             }
-            /* fallthrough */
+            fallthrough;
         default:
             if (addr < ARRAY_SIZE(p->regs))
                 p->regs[addr] = value;
Signature · 1 line
2.39.2
#75 lore raw

RFC PATCH v3 60/78 qga: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 qga/main.c                  | 2 +-
 qga/vss-win32/requester.cpp | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
qga/main.c +1 -1
index 8668b9f3d3..40471e8a0b 100644
@@ -663,7 +663,7 @@ static gboolean channel_event_cb(GIOCondition condition, gpointer data)
         if (!s->virtio) {
             return false;
         }
-        /* fall through */
+        fallthrough;
     case G_IO_STATUS_AGAIN:
         /* virtio causes us to spin here when no process is attached to
          * host-side chardev. sleep a bit to mitigate this
qga/vss-win32/requester.cpp +1 -0
index 9884c65e70..36fa4fdf28 100644
@@ -611,6 +611,7 @@ void requester_thaw(int *num_vols, void *mountpints, ErrorSet *errset)
             break;
         }
         /* fall through if hEventTimeout is signaled */
+        fallthrough;
 
     case (HRESULT)VSS_E_HOLD_WRITES_TIMEOUT:
         err_set(errset, hr, "couldn't hold writes: "
Signature · 1 line
2.39.2
Reviewed-by on v3 60/78
#76 lore raw

Re: [RFC PATCH v3 60/78] qga: add fallthrough pseudo-keyword

Quoted 40 lines · Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 qga/main.c                  | 2 +-
 qga/vss-win32/requester.cpp | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
qga/main.c +1 -1
index 8668b9f3d3..40471e8a0b 100644
@@ -663,7 +663,7 @@ static gboolean channel_event_cb(GIOCondition
 condition, gpointer data)
         if (!s->virtio) {
             return false;
         }
-        /* fall through */
+        fallthrough;
     case G_IO_STATUS_AGAIN:
         /* virtio causes us to spin here when no process is attached to

* host-side chardev. sleep a bit to mitigate this

qga/vss-win32/requester.cpp +1 -0
index 9884c65e70..36fa4fdf28 100644
@@ -611,6 +611,7 @@ void requester_thaw(int *num_vols, void *mountpints,
 ErrorSet *errset)
             break;
         }
         /* fall through if hEventTimeout is signaled */
+        fallthrough;
 
     case (HRESULT)VSS_E_HOLD_WRITES_TIMEOUT:

err_set(errset, hr, "couldn't hold writes: "
--
2.39.2

#77 lore raw

RFC PATCH v3 61/78 semihosting: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 semihosting/arm-compat-semi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
semihosting/arm-compat-semi.c +1 -1
index 329ea11260..c7d32cfca0 100644
@@ -786,7 +786,7 @@ void do_common_semihosting(CPUState *cs)
             common_semi_set_ret(cs, 0);
             break;
         }
-        /* fall through */
+        fallthrough;
     default:
         fprintf(stderr, "qemu: Unsupported SemiHosting SWI 0x%02x\n", nr);
         cpu_dump_state(cs, stderr, 0);
Signature · 1 line
2.39.2
#78 lore raw

RFC PATCH v3 62/78 hw/gpio: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/gpio/omap_gpio.c  | 2 +-
 hw/i2c/bitbang_i2c.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
hw/gpio/omap_gpio.c +1 -1
index a3341d70f1..82a9ea4810 100644
@@ -563,7 +563,7 @@ static void omap2_gpio_module_writep(void *opaque, hwaddr addr,
         cur = omap2_gpio_module_read(opaque, addr & ~3) &
                 ~(mask << ((addr & 3) << 3));
 
-        /* Fall through.  */
+        fallthrough;
     case 0x18:	/* GPIO_IRQSTATUS1 */
     case 0x28:	/* GPIO_IRQSTATUS2 */
     case 0x60:	/* GPIO_CLEARIRQENABLE1 */
hw/i2c/bitbang_i2c.c +1 -1
index de5f5aacf5..3d768ae564 100644
@@ -156,7 +156,7 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int line, int level)
     case RECEIVING_BIT7:
         i2c->buffer = i2c_recv(i2c->bus);
         trace_bitbang_i2c_recv(i2c->buffer);
-        /* Fall through... */
+        fallthrough;
     case RECEIVING_BIT6 ... RECEIVING_BIT0:
         data = i2c->buffer >> 7;
         /* will end up in SENDING_ACK */
Signature · 1 line
2.39.2
#79 lore raw

RFC PATCH v3 63/78 hw/ipmi: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/ipmi/ipmi_bmc_extern.c | 2 +-
 hw/ipmi/smbus_ipmi.c      | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
hw/ipmi/ipmi_bmc_extern.c +1 -1
index e232d35ba2..b2ca02b21f 100644
@@ -174,7 +174,7 @@ static void addchar(IPMIBmcExtern *ibe, unsigned char ch)
         ibe->outbuf[ibe->outlen] = VM_ESCAPE_CHAR;
         ibe->outlen++;
         ch |= 0x10;
-        /* fall through */
+        fallthrough;
     default:
         ibe->outbuf[ibe->outlen] = ch;
         ibe->outlen++;
hw/ipmi/smbus_ipmi.c +2 -2
index d0991ab7f9..58f5328a19 100644
@@ -252,7 +252,7 @@ static int ipmi_write_data(SMBusDevice *dev, uint8_t *buf, uint8_t len)
     switch (cmd) {
     case SSIF_IPMI_REQUEST:
         send = true;
-        /* FALLTHRU */
+        fallthrough;
     case SSIF_IPMI_MULTI_PART_REQUEST_START:
         if (len < 2) {
             return -1; /* Bogus. */
@@ -263,7 +263,7 @@ static int ipmi_write_data(SMBusDevice *dev, uint8_t *buf, uint8_t len)
 
     case SSIF_IPMI_MULTI_PART_REQUEST_END:
         send = true;
-        /* FALLTHRU */
+        fallthrough;
     case SSIF_IPMI_MULTI_PART_REQUEST_MIDDLE:
         if (!sid->inlen) {
             return -1; /* Bogus. */
Signature · 1 line
2.39.2
#80 lore raw

RFC PATCH v3 64/78 hw/mips: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/mips/boston.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
hw/mips/boston.c +6 -6
index 4e11ff6cd6..4ca53b790a 100644
@@ -173,14 +173,14 @@ static uint64_t boston_lcd_read(void *opaque, hwaddr addr,
         val |= (uint64_t)s->lcd_content[(addr + 6) & 0x7] << 48;
         val |= (uint64_t)s->lcd_content[(addr + 5) & 0x7] << 40;
         val |= (uint64_t)s->lcd_content[(addr + 4) & 0x7] << 32;
-        /* fall through */
+        fallthrough;
     case 4:
         val |= (uint64_t)s->lcd_content[(addr + 3) & 0x7] << 24;
         val |= (uint64_t)s->lcd_content[(addr + 2) & 0x7] << 16;
-        /* fall through */
+        fallthrough;
     case 2:
         val |= (uint64_t)s->lcd_content[(addr + 1) & 0x7] << 8;
-        /* fall through */
+        fallthrough;
     case 1:
         val |= (uint64_t)s->lcd_content[(addr + 0) & 0x7];
         break;
@@ -200,14 +200,14 @@ static void boston_lcd_write(void *opaque, hwaddr addr,
         s->lcd_content[(addr + 6) & 0x7] = val >> 48;
         s->lcd_content[(addr + 5) & 0x7] = val >> 40;
         s->lcd_content[(addr + 4) & 0x7] = val >> 32;
-        /* fall through */
+        fallthrough;
     case 4:
         s->lcd_content[(addr + 3) & 0x7] = val >> 24;
         s->lcd_content[(addr + 2) & 0x7] = val >> 16;
-        /* fall through */
+        fallthrough;
     case 2:
         s->lcd_content[(addr + 1) & 0x7] = val >> 8;
-        /* fall through */
+        fallthrough;
     case 1:
         s->lcd_content[(addr + 0) & 0x7] = val;
         break;
Signature · 1 line
2.39.2
Reviewed-by on v3 64/78
#81 lore raw

Re: [RFC PATCH v3 64/78] hw/mips: add fallthrough pseudo-keyword

Quoted 7 lines · Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
  hw/mips/boston.c | 12 ++++++------
  1 file changed, 6 insertions(+), 6 deletions(-)
#82 lore raw

RFC PATCH v3 65/78 hw/nvme: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/nvme/ctrl.c | 24 ++++++++++++------------
 hw/nvme/dif.c  |  4 ++--
 2 files changed, 14 insertions(+), 14 deletions(-)
hw/nvme/ctrl.c +12 -12
index f026245d1e..acb2012fb9 100644
@@ -1918,7 +1918,7 @@ static uint16_t nvme_zrm_finish(NvmeNamespace *ns, NvmeZone *zone)
     case NVME_ZONE_STATE_IMPLICITLY_OPEN:
     case NVME_ZONE_STATE_EXPLICITLY_OPEN:
         nvme_aor_dec_open(ns);
-        /* fallthrough */
+        fallthrough;
     case NVME_ZONE_STATE_CLOSED:
         nvme_aor_dec_active(ns);
 
@@ -1929,7 +1929,7 @@ static uint16_t nvme_zrm_finish(NvmeNamespace *ns, NvmeZone *zone)
             }
         }
 
-        /* fallthrough */
+        fallthrough;
     case NVME_ZONE_STATE_EMPTY:
         nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_FULL);
         return NVME_SUCCESS;
@@ -1946,7 +1946,7 @@ static uint16_t nvme_zrm_close(NvmeNamespace *ns, NvmeZone *zone)
     case NVME_ZONE_STATE_IMPLICITLY_OPEN:
         nvme_aor_dec_open(ns);
         nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_CLOSED);
-        /* fall through */
+        fallthrough;
     case NVME_ZONE_STATE_CLOSED:
         return NVME_SUCCESS;
 
@@ -1961,7 +1961,7 @@ static uint16_t nvme_zrm_reset(NvmeNamespace *ns, NvmeZone *zone)
     case NVME_ZONE_STATE_EXPLICITLY_OPEN:
     case NVME_ZONE_STATE_IMPLICITLY_OPEN:
         nvme_aor_dec_open(ns);
-        /* fallthrough */
+        fallthrough;
     case NVME_ZONE_STATE_CLOSED:
         nvme_aor_dec_active(ns);
 
@@ -1971,12 +1971,12 @@ static uint16_t nvme_zrm_reset(NvmeNamespace *ns, NvmeZone *zone)
             }
         }
 
-        /* fallthrough */
+        fallthrough;
     case NVME_ZONE_STATE_FULL:
         zone->w_ptr = zone->d.zslba;
         zone->d.wp = zone->w_ptr;
         nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_EMPTY);
-        /* fallthrough */
+        fallthrough;
     case NVME_ZONE_STATE_EMPTY:
         return NVME_SUCCESS;
 
@@ -2017,7 +2017,7 @@ static uint16_t nvme_zrm_open_flags(NvmeCtrl *n, NvmeNamespace *ns,
     case NVME_ZONE_STATE_EMPTY:
         act = 1;
 
-        /* fallthrough */
+        fallthrough;
 
     case NVME_ZONE_STATE_CLOSED:
         if (n->params.auto_transition_zones) {
@@ -2040,7 +2040,7 @@ static uint16_t nvme_zrm_open_flags(NvmeCtrl *n, NvmeNamespace *ns,
             return NVME_SUCCESS;
         }
 
-        /* fallthrough */
+        fallthrough;
 
     case NVME_ZONE_STATE_IMPLICITLY_OPEN:
         if (flags & NVME_ZRM_AUTO) {
@@ -2049,7 +2049,7 @@ static uint16_t nvme_zrm_open_flags(NvmeCtrl *n, NvmeNamespace *ns,
 
         nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_EXPLICITLY_OPEN);
 
-        /* fallthrough */
+        fallthrough;
 
     case NVME_ZONE_STATE_EXPLICITLY_OPEN:
         if (flags & NVME_ZRM_ZRWA) {
@@ -3582,7 +3582,7 @@ static uint16_t nvme_do_write(NvmeCtrl *n, NvmeRequest *req, bool append,
                     return NVME_INVALID_PROT_INFO | NVME_DNR;
                 }
 
-                /* fallthrough */
+                fallthrough;
 
             case NVME_ID_NS_DPS_TYPE_2:
                 if (piremap) {
@@ -3737,7 +3737,7 @@ static uint16_t nvme_offline_zone(NvmeNamespace *ns, NvmeZone *zone,
     switch (state) {
     case NVME_ZONE_STATE_READ_ONLY:
         nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_OFFLINE);
-        /* fall through */
+        fallthrough;
     case NVME_ZONE_STATE_OFFLINE:
         return NVME_SUCCESS;
     default:
@@ -4914,7 +4914,7 @@ static uint16_t nvme_cmd_effects(NvmeCtrl *n, uint8_t csi, uint32_t buf_len,
     switch (NVME_CC_CSS(ldl_le_p(&n->bar.cc))) {
     case NVME_CC_CSS_NVM:
         src_iocs = nvme_cse_iocs_nvm;
-        /* fall through */
+        fallthrough;
     case NVME_CC_CSS_ADMIN_ONLY:
         break;
     case NVME_CC_CSS_CSI:
hw/nvme/dif.c +2 -2
index 01b19c3373..00dd96bdb3 100644
@@ -161,7 +161,7 @@ static uint16_t nvme_dif_prchk_crc16(NvmeNamespace *ns, NvmeDifTuple *dif,
             break;
         }
 
-        /* fallthrough */
+        fallthrough;
     case NVME_ID_NS_DPS_TYPE_1:
     case NVME_ID_NS_DPS_TYPE_2:
         if (be16_to_cpu(dif->g16.apptag) != 0xffff) {
@@ -229,7 +229,7 @@ static uint16_t nvme_dif_prchk_crc64(NvmeNamespace *ns, NvmeDifTuple *dif,
             break;
         }
 
-        /* fallthrough */
+        fallthrough;
     case NVME_ID_NS_DPS_TYPE_1:
     case NVME_ID_NS_DPS_TYPE_2:
         if (be16_to_cpu(dif->g64.apptag) != 0xffff) {
Signature · 1 line
2.39.2
Reviewed-by on v3 65/78
#83 lore raw

Re: [RFC PATCH v3 65/78] hw/nvme: add fallthrough pseudo-keyword

Quoted 144 lines · Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/nvme/ctrl.c | 24 ++++++++++++------------
 hw/nvme/dif.c  |  4 ++--
 2 files changed, 14 insertions(+), 14 deletions(-)
hw/nvme/ctrl.c +12 -12
index f026245d1e..acb2012fb9 100644
@@ -1918,7 +1918,7 @@ static uint16_t nvme_zrm_finish(NvmeNamespace *ns, NvmeZone *zone)
     case NVME_ZONE_STATE_IMPLICITLY_OPEN:
     case NVME_ZONE_STATE_EXPLICITLY_OPEN:
         nvme_aor_dec_open(ns);
-        /* fallthrough */
+        fallthrough;
     case NVME_ZONE_STATE_CLOSED:
         nvme_aor_dec_active(ns);
 
@@ -1929,7 +1929,7 @@ static uint16_t nvme_zrm_finish(NvmeNamespace *ns, NvmeZone *zone)
             }
         }
 
-        /* fallthrough */
+        fallthrough;
     case NVME_ZONE_STATE_EMPTY:
         nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_FULL);
         return NVME_SUCCESS;
@@ -1946,7 +1946,7 @@ static uint16_t nvme_zrm_close(NvmeNamespace *ns, NvmeZone *zone)
     case NVME_ZONE_STATE_IMPLICITLY_OPEN:
         nvme_aor_dec_open(ns);
         nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_CLOSED);
-        /* fall through */
+        fallthrough;
     case NVME_ZONE_STATE_CLOSED:
         return NVME_SUCCESS;
 
@@ -1961,7 +1961,7 @@ static uint16_t nvme_zrm_reset(NvmeNamespace *ns, NvmeZone *zone)
     case NVME_ZONE_STATE_EXPLICITLY_OPEN:
     case NVME_ZONE_STATE_IMPLICITLY_OPEN:
         nvme_aor_dec_open(ns);
-        /* fallthrough */
+        fallthrough;
     case NVME_ZONE_STATE_CLOSED:
         nvme_aor_dec_active(ns);
 
@@ -1971,12 +1971,12 @@ static uint16_t nvme_zrm_reset(NvmeNamespace *ns, NvmeZone *zone)
             }
         }
 
-        /* fallthrough */
+        fallthrough;
     case NVME_ZONE_STATE_FULL:
         zone->w_ptr = zone->d.zslba;
         zone->d.wp = zone->w_ptr;
         nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_EMPTY);
-        /* fallthrough */
+        fallthrough;
     case NVME_ZONE_STATE_EMPTY:
         return NVME_SUCCESS;
 
@@ -2017,7 +2017,7 @@ static uint16_t nvme_zrm_open_flags(NvmeCtrl *n, NvmeNamespace *ns,
     case NVME_ZONE_STATE_EMPTY:
         act = 1;
 
-        /* fallthrough */
+        fallthrough;
 
     case NVME_ZONE_STATE_CLOSED:
         if (n->params.auto_transition_zones) {
@@ -2040,7 +2040,7 @@ static uint16_t nvme_zrm_open_flags(NvmeCtrl *n, NvmeNamespace *ns,
             return NVME_SUCCESS;
         }
 
-        /* fallthrough */
+        fallthrough;
 
     case NVME_ZONE_STATE_IMPLICITLY_OPEN:
         if (flags & NVME_ZRM_AUTO) {
@@ -2049,7 +2049,7 @@ static uint16_t nvme_zrm_open_flags(NvmeCtrl *n, NvmeNamespace *ns,
 
         nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_EXPLICITLY_OPEN);
 
-        /* fallthrough */
+        fallthrough;
 
     case NVME_ZONE_STATE_EXPLICITLY_OPEN:
         if (flags & NVME_ZRM_ZRWA) {
@@ -3582,7 +3582,7 @@ static uint16_t nvme_do_write(NvmeCtrl *n, NvmeRequest *req, bool append,
                     return NVME_INVALID_PROT_INFO | NVME_DNR;
                 }
 
-                /* fallthrough */
+                fallthrough;
 
             case NVME_ID_NS_DPS_TYPE_2:
                 if (piremap) {
@@ -3737,7 +3737,7 @@ static uint16_t nvme_offline_zone(NvmeNamespace *ns, NvmeZone *zone,
     switch (state) {
     case NVME_ZONE_STATE_READ_ONLY:
         nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_OFFLINE);
-        /* fall through */
+        fallthrough;
     case NVME_ZONE_STATE_OFFLINE:
         return NVME_SUCCESS;
     default:
@@ -4914,7 +4914,7 @@ static uint16_t nvme_cmd_effects(NvmeCtrl *n, uint8_t csi, uint32_t buf_len,
     switch (NVME_CC_CSS(ldl_le_p(&n->bar.cc))) {
     case NVME_CC_CSS_NVM:
         src_iocs = nvme_cse_iocs_nvm;
-        /* fall through */
+        fallthrough;
     case NVME_CC_CSS_ADMIN_ONLY:
         break;
     case NVME_CC_CSS_CSI:
hw/nvme/dif.c +2 -2
index 01b19c3373..00dd96bdb3 100644
@@ -161,7 +161,7 @@ static uint16_t nvme_dif_prchk_crc16(NvmeNamespace *ns, NvmeDifTuple *dif,
             break;
         }
 
-        /* fallthrough */
+        fallthrough;
     case NVME_ID_NS_DPS_TYPE_1:
     case NVME_ID_NS_DPS_TYPE_2:
         if (be16_to_cpu(dif->g16.apptag) != 0xffff) {
@@ -229,7 +229,7 @@ static uint16_t nvme_dif_prchk_crc64(NvmeNamespace *ns, NvmeDifTuple *dif,
             break;
         }
 
-        /* fallthrough */
+        fallthrough;
     case NVME_ID_NS_DPS_TYPE_1:
     case NVME_ID_NS_DPS_TYPE_2:
         if (be16_to_cpu(dif->g64.apptag) != 0xffff) {
Signature · 1 line
2.39.2
#84 lore raw

RFC PATCH v3 66/78 hw/nvram/eeprom_at24c.c: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/nvram/eeprom_at24c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/nvram/eeprom_at24c.c +1 -1
index 3272068663..aa3685db33 100644
@@ -71,7 +71,7 @@ int at24c_eeprom_event(I2CSlave *s, enum i2c_event event)
     case I2C_START_SEND:
     case I2C_FINISH:
         ee->haveaddr = 0;
-        /* fallthrough */
+        fallthrough;
     case I2C_START_RECV:
         DPRINTK("clear\n");
         if (ee->blk && ee->changed) {
Signature · 1 line
2.39.2
#85 lore raw

RFC PATCH v3 67/78 hw/pci-host/pnv_phb3.c: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/pci-host/pnv_phb3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci-host/pnv_phb3.c +1 -1
index c5e58f4086..6a805d3900 100644
@@ -531,7 +531,7 @@ void pnv_phb3_reg_write(void *opaque, hwaddr off, uint64_t val, unsigned size)
         if (changed) {
             pnv_phb3_update_all_msi_regions(phb);
         }
-        /* fall through */
+        fallthrough;
     case PHB_M32_BASE_ADDR:
     case PHB_M32_BASE_MASK:
     case PHB_M32_START_ADDR:
Signature · 1 line
2.39.2
Reviewed-by on v3 67/78
#86 lore raw

Re: [RFC PATCH v3 67/78] hw/pci-host/pnv_phb3.c: add fallthrough pseudo-keyword

Quoted 4 lines · Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

Thanks,

C.

Quoted 17 lines
---
  hw/pci-host/pnv_phb3.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci-host/pnv_phb3.c +1 -1
index c5e58f4086..6a805d3900 100644
@@ -531,7 +531,7 @@ void pnv_phb3_reg_write(void *opaque, hwaddr off, uint64_t val, unsigned size)
          if (changed) {
              pnv_phb3_update_all_msi_regions(phb);
          }
-        /* fall through */
+        fallthrough;
      case PHB_M32_BASE_ADDR:
      case PHB_M32_BASE_MASK:
      case PHB_M32_START_ADDR:
#87 lore raw

RFC PATCH v3 68/78 hw/pci: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/pci/pcie_aer.c | 3 ++-
 hw/pci/pcie_doe.c | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
hw/pci/pcie_aer.c +2 -1
index b68c7ecb49..c99ecce2a1 100644
@@ -151,8 +151,9 @@ int pcie_aer_init(PCIDevice *dev, uint8_t cap_ver, uint16_t offset,
     switch (pcie_cap_get_type(dev)) {
     case PCI_EXP_TYPE_ROOT_PORT:
         /* this case will be set by pcie_aer_root_init() */
-        /* fallthrough */
+        fallthrough;
     case PCI_EXP_TYPE_DOWNSTREAM:
+        fallthrough;
     case PCI_EXP_TYPE_UPSTREAM:
         pci_word_test_and_set_mask(dev->wmask + PCI_BRIDGE_CONTROL,
                                    PCI_BRIDGE_CTL_SERR);
hw/pci/pcie_doe.c +1 -1
index 2210f86968..f04a36e664 100644
@@ -360,7 +360,7 @@ void pcie_doe_write_config(DOECap *doe_cap,
         doe_cap->write_mbox_len++;
         break;
     case PCI_EXP_DOE_CAP:
-        /* fallthrough */
+        fallthrough;
     default:
         break;
     }
Signature · 1 line
2.39.2
#88 lore raw

RFC PATCH v3 69/78 hw/rdma/rdma_backend.c: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/rdma/rdma_backend.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/rdma/rdma_backend.c +1 -1
index 6dcdfbbbe2..09e5ad961e 100644
@@ -812,7 +812,7 @@ int rdma_backend_create_qp(RdmaBackendQP *qp, uint8_t qp_type,
         return 0;
 
     case IBV_QPT_RC:
-        /* fall through */
+        fallthrough;
     case IBV_QPT_UD:
         /* do nothing */
         break;
Signature · 1 line
2.39.2
#89 lore raw

RFC PATCH v3 70/78 hw/rtc: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/rtc/aspeed_rtc.c  | 4 ++--
 hw/rtc/mc146818rtc.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
hw/rtc/aspeed_rtc.c +2 -2
index fa861e2d49..59c64b01b9 100644
@@ -78,7 +78,7 @@ static uint64_t aspeed_rtc_read(void *opaque, hwaddr addr,
         if (rtc->reg[CONTROL] & RTC_ENABLED) {
             rtc->reg[r] = aspeed_rtc_get_counter(rtc, r);
         }
-        /* fall through */
+        fallthrough;
     case CONTROL:
         val = rtc->reg[r];
         break;
@@ -106,7 +106,7 @@ static void aspeed_rtc_write(void *opaque, hwaddr addr,
         if (!(rtc->reg[CONTROL] & RTC_UNLOCKED)) {
             break;
         }
-        /* fall through */
+        fallthrough;
     case CONTROL:
         rtc->reg[r] = val;
         aspeed_rtc_calc_offset(rtc);
hw/rtc/mc146818rtc.c +2 -2
index c27c362db9..6b6eef94fd 100644
@@ -457,7 +457,7 @@ static void cmos_ioport_write(void *opaque, hwaddr addr,
             break;
         case RTC_IBM_PS2_CENTURY_BYTE:
             s->cmos_index = RTC_CENTURY;
-            /* fall through */
+            fallthrough;
         case RTC_CENTURY:
         case RTC_SECONDS:
         case RTC_MINUTES:
@@ -686,7 +686,7 @@ static uint64_t cmos_ioport_read(void *opaque, hwaddr addr,
         switch(s->cmos_index) {
         case RTC_IBM_PS2_CENTURY_BYTE:
             s->cmos_index = RTC_CENTURY;
-            /* fall through */
+            fallthrough;
         case RTC_CENTURY:
         case RTC_SECONDS:
         case RTC_MINUTES:
Signature · 1 line
2.39.2
Reviewed-by on v3 70/78
#90 lore raw

Re: [RFC PATCH v3 70/78] hw/rtc: add fallthrough pseudo-keyword

Quoted 4 lines · Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

Thanks,

C.

Quoted 49 lines
---
  hw/rtc/aspeed_rtc.c  | 4 ++--
  hw/rtc/mc146818rtc.c | 4 ++--
  2 files changed, 4 insertions(+), 4 deletions(-)
hw/rtc/aspeed_rtc.c +2 -2
index fa861e2d49..59c64b01b9 100644
@@ -78,7 +78,7 @@ static uint64_t aspeed_rtc_read(void *opaque, hwaddr addr,
          if (rtc->reg[CONTROL] & RTC_ENABLED) {
              rtc->reg[r] = aspeed_rtc_get_counter(rtc, r);
          }
-        /* fall through */
+        fallthrough;
      case CONTROL:
          val = rtc->reg[r];
          break;
@@ -106,7 +106,7 @@ static void aspeed_rtc_write(void *opaque, hwaddr addr,
          if (!(rtc->reg[CONTROL] & RTC_UNLOCKED)) {
              break;
          }
-        /* fall through */
+        fallthrough;
      case CONTROL:
          rtc->reg[r] = val;
          aspeed_rtc_calc_offset(rtc);
hw/rtc/mc146818rtc.c +2 -2
index c27c362db9..6b6eef94fd 100644
@@ -457,7 +457,7 @@ static void cmos_ioport_write(void *opaque, hwaddr addr,
              break;
          case RTC_IBM_PS2_CENTURY_BYTE:
              s->cmos_index = RTC_CENTURY;
-            /* fall through */
+            fallthrough;
          case RTC_CENTURY:
          case RTC_SECONDS:
          case RTC_MINUTES:
@@ -686,7 +686,7 @@ static uint64_t cmos_ioport_read(void *opaque, hwaddr addr,
          switch(s->cmos_index) {
          case RTC_IBM_PS2_CENTURY_BYTE:
              s->cmos_index = RTC_CENTURY;
-            /* fall through */
+            fallthrough;
          case RTC_CENTURY:
          case RTC_SECONDS:
          case RTC_MINUTES:
#91 lore raw

RFC PATCH v3 71/78 hw/s390x: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/s390x/ipl.c           | 1 +
 hw/s390x/s390-pci-inst.c | 4 ++--
 hw/s390x/sclp.c          | 4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)
hw/s390x/ipl.c +1 -0
index 515dcf51b5..da2333846f 100644
@@ -429,6 +429,7 @@ static bool s390_gen_initial_iplb(S390IPLState *ipl)
         case CCW_DEVTYPE_VIRTIO_NET:
             ipl->netboot = true;
             /* Fall through to CCW_DEVTYPE_VIRTIO case */
+            fallthrough;
         case CCW_DEVTYPE_VIRTIO:
             ipl->iplb.len = cpu_to_be32(S390_IPLB_MIN_CCW_LEN);
             ipl->iplb.blk0_len =
hw/s390x/s390-pci-inst.c +2 -2
index 30149546c0..171320384c 100644
@@ -1380,10 +1380,10 @@ int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar,
      * FH Enabled bit is set to one in states of ENABLED, BLOCKED or ERROR. */
     case ZPCI_FS_ERROR:
         fib.fc |= 0x20;
-        /* fallthrough */
+        fallthrough;
     case ZPCI_FS_BLOCKED:
         fib.fc |= 0x40;
-        /* fallthrough */
+        fallthrough;
     case ZPCI_FS_ENABLED:
         fib.fc |= 0x80;
         if (pbdev->iommu->enabled) {
hw/s390x/sclp.c +2 -2
index eff74479f4..9b8c7ff043 100644
@@ -66,7 +66,7 @@ static bool sccb_verify_boundary(uint64_t sccb_addr, uint16_t sccb_len,
         if (s390_has_feat(S390_FEAT_EXTENDED_LENGTH_SCCB)) {
             return true;
         }
-        /* fallthrough */
+        fallthrough;
     default:
         if (sccb_max_addr < sccb_boundary) {
             return true;
@@ -224,7 +224,7 @@ static void sclp_configure_io_adapter(SCLPDevice *sclp, SCCB *sccb,
             }
             return;
         }
-        /* fallthrough */
+        fallthrough;
     default:
         rc = SCLP_RC_ADAPTER_TYPE_NOT_RECOGNIZED;
     }
Signature · 1 line
2.39.2
#92 lore raw

RFC PATCH v3 72/78 hw/ssi: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/ssi/npcm7xx_fiu.c | 14 ++++++-------
 hw/ssi/omap_spi.c    | 48 ++++++++++++++++++++++----------------------
 2 files changed, 31 insertions(+), 31 deletions(-)
hw/ssi/npcm7xx_fiu.c +7 -7
index 4eedb2927e..fadd66a675 100644
@@ -167,7 +167,7 @@ static uint64_t npcm7xx_fiu_flash_read(void *opaque, hwaddr addr,
     switch (FIU_DRD_CFG_ADDSIZ(drd_cfg)) {
     case FIU_ADDSIZ_4BYTES:
         ssi_transfer(fiu->spi, extract32(addr, 24, 8));
-        /* fall through */
+        fallthrough;
     case FIU_ADDSIZ_3BYTES:
         ssi_transfer(fiu->spi, extract32(addr, 16, 8));
         ssi_transfer(fiu->spi, extract32(addr, 8, 8));
@@ -226,7 +226,7 @@ static void npcm7xx_fiu_flash_write(void *opaque, hwaddr addr, uint64_t v,
     switch (FIU_DWR_CFG_ADDSIZ(dwr_cfg)) {
     case FIU_ADDSIZ_4BYTES:
         ssi_transfer(fiu->spi, extract32(addr, 24, 8));
-        /* fall through */
+        fallthrough;
     case FIU_ADDSIZ_3BYTES:
         ssi_transfer(fiu->spi, extract32(addr, 16, 8));
         ssi_transfer(fiu->spi, extract32(addr, 8, 8));
@@ -285,16 +285,16 @@ static void send_address(SSIBus *spi, unsigned int addsiz, uint32_t addr)
     switch (addsiz) {
     case 4:
         ssi_transfer(spi, extract32(addr, 24, 8));
-        /* fall through */
+        fallthrough;
     case 3:
         ssi_transfer(spi, extract32(addr, 16, 8));
-        /* fall through */
+        fallthrough;
     case 2:
         ssi_transfer(spi, extract32(addr, 8, 8));
-        /* fall through */
+        fallthrough;
     case 1:
         ssi_transfer(spi, extract32(addr, 0, 8));
-        /* fall through */
+        fallthrough;
     case 0:
         break;
     }
@@ -391,7 +391,7 @@ static void npcm7xx_fiu_ctrl_write(void *opaque, hwaddr addr, uint64_t v,
             value &= ~FIU_UMA_CFG_CMMLCK_MASK;
             value |= (s->regs[reg] & FIU_UMA_CFG_CMMLCK_MASK);
         }
-        /* fall through */
+        fallthrough;
     case NPCM7XX_FIU_DRD_CFG:
     case NPCM7XX_FIU_DWR_CFG:
         if (s->regs[reg] & NPCM7XX_FIU_CFG_LCK) {
hw/ssi/omap_spi.c +24 -24

104 lines not on this page · raw message

Signature · 1 line
2.39.2
#93 lore raw

RFC PATCH v3 73/78 hw/watchdog/wdt_diag288.c: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/watchdog/wdt_diag288.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/watchdog/wdt_diag288.c +1 -1
index 76d89fbf78..24fb7fcb62 100644
@@ -69,7 +69,7 @@ static int wdt_diag288_handle_timer(DIAG288State *diag288,
     switch (func) {
     case WDT_DIAG288_INIT:
         diag288->enabled = true;
-        /* fall through */
+        fallthrough;
     case WDT_DIAG288_CHANGE:
         if (!diag288->enabled) {
             return -1;
Signature · 1 line
2.39.2
#94 lore raw

RFC PATCH v3 74/78 hw/cxl/cxl-device-utils.c: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 hw/cxl/cxl-device-utils.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/cxl/cxl-device-utils.c +2 -2
index bd68328032..63f009847e 100644
@@ -80,7 +80,7 @@ static void mailbox_mem_writel(uint32_t *reg_state, hwaddr offset,
 {
     switch (offset) {
     case A_CXL_DEV_MAILBOX_CTRL:
-        /* fallthrough */
+        fallthrough;
     case A_CXL_DEV_MAILBOX_CAP:
         /* RO register */
         break;
@@ -102,7 +102,7 @@ static void mailbox_mem_writeq(uint64_t *reg_state, hwaddr offset,
         break;
     case A_CXL_DEV_BG_CMD_STS:
         /* BG not supported */
-        /* fallthrough */
+        fallthrough;
     case A_CXL_DEV_MAILBOX_STS:
         /* Read only register, will get updated by the state machine */
         return;
Signature · 1 line
2.39.2
Acked-by Jonathan Cameron on v3 74/78
#95 lore raw

Re: [RFC PATCH v3 74/78] hw/cxl/cxl-device-utils.c: add fallthrough pseudo-keyword

Quoted 4 lines · On Fri, 13 Oct 2023 11:46:42 +0300 Emmanouil Pitsidianakis…

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

Looking at this, I think the code in question needs a closer look, cleanup but that has nothing to do with what you are doing here!

Quoted 26 lines
---
 hw/cxl/cxl-device-utils.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/cxl/cxl-device-utils.c +2 -2
index bd68328032..63f009847e 100644
@@ -80,7 +80,7 @@ static void mailbox_mem_writel(uint32_t *reg_state, hwaddr offset,
 {
     switch (offset) {
     case A_CXL_DEV_MAILBOX_CTRL:
-        /* fallthrough */
+        fallthrough;
     case A_CXL_DEV_MAILBOX_CAP:
         /* RO register */
         break;
@@ -102,7 +102,7 @@ static void mailbox_mem_writeq(uint64_t *reg_state, hwaddr offset,
         break;
     case A_CXL_DEV_BG_CMD_STS:
         /* BG not supported */
-        /* fallthrough */
+        fallthrough;
     case A_CXL_DEV_MAILBOX_STS:
         /* Read only register, will get updated by the state machine */
         return;
#96 lore raw

RFC PATCH v3 75/78 migration: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 migration/migration.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
migration/migration.c +1 -1
index 585d3c8f55..fdad37efbb 100644
@@ -2784,7 +2784,7 @@ static void migration_iteration_finish(MigrationState *s)
         assert(migrate_colo());
         migrate_start_colo_process(s);
         s->vm_old_state = RUN_STATE_RUNNING;
-        /* Fallthrough */
+        fallthrough;
     case MIGRATION_STATUS_FAILED:
     case MIGRATION_STATUS_CANCELLED:
     case MIGRATION_STATUS_CANCELLING:
Signature · 1 line
2.39.2
#98 lore raw

RFC PATCH v3 76/78 qemu-img.c: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 qemu-img.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qemu-img.c +1 -1
index 6068ab0d27..df2457a6fe 100644
@@ -1906,7 +1906,7 @@ static int coroutine_fn convert_co_write(ImgConvertState *s, int64_t sector_num,
                 }
                 break;
             }
-            /* fall-through */
+            fallthrough;
 
         case BLK_ZERO:
             if (s->has_zero_init) {
Signature · 1 line
2.39.2
#99 lore raw

RFC PATCH v3 77/78 tests/unit/test-char.c: add fallthrough pseudo-keyword

In reply to Emmanouil Pitsidianakis

In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword.

---
 tests/unit/test-char.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/unit/test-char.c +1 -1
index 649fdf64e1..6f5a2c4108 100644
@@ -70,7 +70,7 @@ static void fe_event(void *opaque, QEMUChrEvent event)
             h->openclose_mismatch = true;
         }
         h->is_open = new_open_state;
-        /* fallthrough */
+        fallthrough;
     default:
         quit = true;
         break;
Signature · 1 line
2.39.2
#100 lore raw

RFC PATCH v3 78/78 meson.build: increase -Wimplicit-fallthrough to 5

In reply to Emmanouil Pitsidianakis

Make GCC's implicit fall-through static analysis stricter by requiring the use of the fallthrough attribute statement instead of comments.

This makes the QEMU code style more consistent.

---
 docs/devel/style.rst | 23 +++++++++++++++++++++++
 meson.build          |  2 +-
 2 files changed, 24 insertions(+), 1 deletion(-)
docs/devel/style.rst +23 -0
index 2f68b50079..f473dd24e9 100644
@@ -634,6 +634,29 @@ are still some caveats to beware of
         return g_steal_pointer(&foo);
     }
 
+Implicit switch case fall-through
+=================================
+
+The C language allows switch cases to "fall-through" when a "break" statement
+is missing at the end of a case. This, however, introduces ambiguity in the
+code, as it's not always clear if the missing break is intentional or a bug.
+
+As this behaviour allows for bugs we do not allow "implicit fall-through".
+
+In order to identify intentional fall-through cases, we have adopted a
+pseudo-keyword macro 'fallthrough' which expands to gcc's extension
+__attribute__((__fallthrough__)).  `Statement Attributes
+<https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html>`_
+
+All switch/case blocks must end in one of:
+
+.. code-block:: c
+
+	  break;
+	  fallthrough;
+	  continue;
+	  goto <label>;
+	  return [expression];
 
 QEMU Specific Idioms
 ********************
meson.build +1 -1
index 79aef19bdc..e8805f0e0c 100644
@@ -452,7 +452,7 @@ warn_flags = [
   '-Wnested-externs',
   '-Wendif-labels',
   '-Wexpansion-to-defined',
-  '-Wimplicit-fallthrough=2',
+  '-Wimplicit-fallthrough=5',
   '-Wmissing-format-attribute',
   '-Wno-initializer-overrides',
   '-Wno-missing-include-dirs',
Signature · 1 line
2.39.2
#101 lore raw
In reply to Emmanouil Pitsidianakis
Quoted 3 lines · Emmanouil Pitsidianakis

--
Resending because --function-context was accidentally used in the previous version. Sincere apologies for the noise.

Thanks. TBH I discarded v1/v2 for that reason.

Quoted 8 lines

--

Hello,

This RFC is inspired by the kernel's move to -Wimplicit-fallthrough=3 back in 2019.[0]
We take one step (or two) further by increasing it to 5 which rejects fall through comments and requires an attribute statement.

#102 lore raw
In reply to Emmanouil Pitsidianakis
Quoted 20 lines · Emmanouil Pitsidianakis

--
Resending because --function-context was accidentally used in the previous version. Sincere apologies for the noise.
--

Hello,

This RFC is inspired by the kernel's move to -Wimplicit-fallthrough=3 back in 2019.[0]
We take one step (or two) further by increasing it to 5 which rejects fall through comments and requires an attribute statement.

[0]:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a035d552a93b

The line differences are not many, but they spread all over different subsystems, architectures and devices. An attempt has been made to split them in cohesive patches to aid post-RFC review. Part of the RFC is to determine whether these patch divisions needs improvement.

Quoted 4 lines

Main questions this RFC poses
=============================

- Is this change desirable and net-positive.

Did this catch any new problems? If not, I really don't see the benefit. The compiler comment matching appears to be sufficient.

r~

#103 lore raw

Hello Richard,

Quoted 2 lines · Richard Henderson

Did this catch any new problems? If not, I really don't see the benefit. The compiler comment matching appears to be sufficient.

As the cover letter states, this is a code style change. See "Background - Motivation" section.

--
Manos