[PATCH/committed,09/20] sim: erc32: fix -Wimplicit-fallthrough warnings

Message ID 20231221070127.19142-9-vapier@gentoo.org
State New
Headers
Series [PATCH/committed,01/20] sim: signal: mark signal callback funcs as noreturn since they don't return |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 fail Patch failed to apply

Commit Message

Mike Frysinger Dec. 21, 2023, 7:01 a.m. UTC
  Add the attribute where it seems to make sense.
---
 sim/erc32/erc32.c |  1 +
 sim/erc32/exec.c  | 10 ++++++++++
 sim/erc32/sis.c   |  1 +
 3 files changed, 12 insertions(+)
  

Patch

diff --git a/sim/erc32/erc32.c b/sim/erc32/erc32.c
index c4abab2889c5..b37183a26af0 100644
--- a/sim/erc32/erc32.c
+++ b/sim/erc32/erc32.c
@@ -799,6 +799,7 @@  mec_write(uint32_t addr, uint32_t data)
     case MEC_UARTA:
     case MEC_UARTB:
         if (data & 0xFFFFFF00) mecparerror();
+        ATTRIBUTE_FALLTHROUGH;
     case MEC_UART_CTRL:
         if (data & 0xFF00FF00) mecparerror();
 	write_uart(addr, data);
diff --git a/sim/erc32/exec.c b/sim/erc32/exec.c
index 1187bccfec78..10a9dae603c0 100644
--- a/sim/erc32/exec.c
+++ b/sim/erc32/exec.c
@@ -1220,6 +1220,7 @@  dispatch_instruction(struct pstate *sregs)
 	switch (op3) {
 	case LDDA:
 	    if (!chk_asi(sregs, &asi, op3)) break;
+	    ATTRIBUTE_FALLTHROUGH;
 	case LDD:
 	    if (address & 0x7) {
 		sregs->trap = TRAP_UNALI;
@@ -1250,6 +1251,7 @@  dispatch_instruction(struct pstate *sregs)
 
 	case LDA:
 	    if (!chk_asi(sregs, &asi, op3)) break;
+	    ATTRIBUTE_FALLTHROUGH;
 	case LD:
 	    if (address & 0x3) {
 		sregs->trap = TRAP_UNALI;
@@ -1265,6 +1267,7 @@  dispatch_instruction(struct pstate *sregs)
 	    break;
 	case LDSTUBA:
 	    if (!chk_asi(sregs, &asi, op3)) break;
+	    ATTRIBUTE_FALLTHROUGH;
 	case LDSTUB:
 	    mexc = memory_read(asi, address, &data, 0, &ws);
 	    sregs->hold += ws;
@@ -1288,6 +1291,7 @@  dispatch_instruction(struct pstate *sregs)
 	case LDSBA:
 	case LDUBA:
 	    if (!chk_asi(sregs, &asi, op3)) break;
+	    ATTRIBUTE_FALLTHROUGH;
 	case LDSB:
 	case LDUB:
 	    mexc = memory_read(asi, address, &data, 0, &ws);
@@ -1305,6 +1309,7 @@  dispatch_instruction(struct pstate *sregs)
 	case LDSHA:
 	case LDUHA:
 	    if (!chk_asi(sregs, &asi, op3)) break;
+	    ATTRIBUTE_FALLTHROUGH;
 	case LDSH:
 	case LDUH:
 	    if (address & 0x1) {
@@ -1426,6 +1431,7 @@  dispatch_instruction(struct pstate *sregs)
 
 	case STA:
 	    if (!chk_asi(sregs, &asi, op3)) break;
+	    ATTRIBUTE_FALLTHROUGH;
 	case ST:
 	    if (address & 0x3) {
 		sregs->trap = TRAP_UNALI;
@@ -1439,6 +1445,7 @@  dispatch_instruction(struct pstate *sregs)
 	    break;
 	case STBA:
 	    if (!chk_asi(sregs, &asi, op3)) break;
+	    ATTRIBUTE_FALLTHROUGH;
 	case STB:
 	    mexc = memory_write(asi, address, rdd, 0, &ws);
 	    sregs->hold += ws;
@@ -1448,6 +1455,7 @@  dispatch_instruction(struct pstate *sregs)
 	    break;
 	case STDA:
 	    if (!chk_asi(sregs, &asi, op3)) break;
+	    ATTRIBUTE_FALLTHROUGH;
 	case STD:
 	    if (address & 0x7) {
 		sregs->trap = TRAP_UNALI;
@@ -1505,6 +1513,7 @@  dispatch_instruction(struct pstate *sregs)
 	    break;
 	case STHA:
 	    if (!chk_asi(sregs, &asi, op3)) break;
+	    ATTRIBUTE_FALLTHROUGH;
 	case STH:
 	    if (address & 0x1) {
 		sregs->trap = TRAP_UNALI;
@@ -1561,6 +1570,7 @@  dispatch_instruction(struct pstate *sregs)
 	    break;
 	case SWAPA:
 	    if (!chk_asi(sregs, &asi, op3)) break;
+	    ATTRIBUTE_FALLTHROUGH;
 	case SWAP:
 	    if (address & 0x3) {
 		sregs->trap = TRAP_UNALI;
diff --git a/sim/erc32/sis.c b/sim/erc32/sis.c
index 7445c7b1a4bb..2de493a3528e 100644
--- a/sim/erc32/sis.c
+++ b/sim/erc32/sis.c
@@ -281,6 +281,7 @@  main(int argc, char **argv)
 	    break;
 	case CTRL_C:
 	    printf("\b\bInterrupt!\n");
+	    ATTRIBUTE_FALLTHROUGH;
 	case TIME_OUT:
 	    printf(" Stopped at time %" PRIu64 " (%.3f ms)\n", ebase.simtime,
 	      ((double) ebase.simtime / (double) sregs.freq) / 1000.0);