From: Mike Frysinger Date: Thu, 21 Dec 2023 06:31:38 +0000 (-0500) Subject: sim: erc32: fix -Wimplicit-fallthrough warnings X-Git-Tag: binutils-2_42~454 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fcad8e6ba7a59c9bfbfa8f69ed25a7a868e3b269;p=thirdparty%2Fbinutils-gdb.git sim: erc32: fix -Wimplicit-fallthrough warnings Add the attribute where it seems to make sense. --- diff --git a/sim/erc32/erc32.c b/sim/erc32/erc32.c index c4abab2889c..b37183a26af 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 1187bccfec7..10a9dae603c 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 7445c7b1a4b..2de493a3528 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);