From d137b254d9aa4c91d5d2e7865d971bbdaa40e769 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 21 Dec 2023 00:38:31 -0500 Subject: sim: signal: mark signal callback funcs as noreturn since they don't return All funcs already call other funcs that don't return. The mips port is the only exception because its generic exception handler can return in the case of normal exceptions. So while the exceptions its signal handler triggers doesn't return, we can't express that conditional logic. So add some useless abort calls to make the compiler happy. --- sim/common/sim-core.h | 2 +- sim/cris/sim-main.h | 2 +- sim/frv/sim-main.h | 2 +- sim/iq2000/sim-main.h | 2 +- sim/lm32/sim-main.h | 2 +- sim/m32r/sim-main.h | 2 +- sim/m4/sim_ac_option_warnings.m4 | 1 + sim/mips/interp.c | 6 ++++-- sim/mips/sim-main.h | 2 +- sim/mn10300/mn10300-sim.h | 3 ++- sim/mn10300/sim-main.h | 2 +- 11 files changed, 15 insertions(+), 11 deletions(-) diff --git a/sim/common/sim-core.h b/sim/common/sim-core.h index 34826f7..bad6987 100644 --- a/sim/common/sim-core.h +++ b/sim/common/sim-core.h @@ -40,7 +40,7 @@ typedef void (SIM_CORE_SIGNAL_FN) (SIM_DESC sd, sim_cpu *cpu, sim_cia cia, unsigned map, int nr_bytes, address_word addr, transfer_type transfer, sim_core_signals sig); -extern SIM_CORE_SIGNAL_FN sim_core_signal; +extern SIM_CORE_SIGNAL_FN sim_core_signal ATTRIBUTE_NORETURN; /* basic types */ diff --git a/sim/cris/sim-main.h b/sim/cris/sim-main.h index abebe2b..8fa6ff5 100644 --- a/sim/cris/sim-main.h +++ b/sim/cris/sim-main.h @@ -201,7 +201,7 @@ struct cris_sim_cpu { /* Misc. */ /* Catch address exceptions. */ -extern SIM_CORE_SIGNAL_FN cris_core_signal; +extern SIM_CORE_SIGNAL_FN cris_core_signal ATTRIBUTE_NORETURN; #define SIM_CORE_SIGNAL(SD,CPU,CIA,MAP,NR_BYTES,ADDR,TRANSFER,ERROR) \ cris_core_signal ((SD), (CPU), (CIA), (MAP), (NR_BYTES), (ADDR), \ (TRANSFER), (ERROR)) diff --git a/sim/frv/sim-main.h b/sim/frv/sim-main.h index f2fbcce..b9f99fb 100644 --- a/sim/frv/sim-main.h +++ b/sim/frv/sim-main.h @@ -102,7 +102,7 @@ struct frv_sim_cpu { /* Misc. */ /* Catch address exceptions. */ -extern SIM_CORE_SIGNAL_FN frv_core_signal; +extern SIM_CORE_SIGNAL_FN frv_core_signal ATTRIBUTE_NORETURN; #define SIM_CORE_SIGNAL(SD,CPU,CIA,MAP,NR_BYTES,ADDR,TRANSFER,ERROR) \ frv_core_signal ((SD), (CPU), (CIA), (MAP), (NR_BYTES), (ADDR), \ (TRANSFER), (ERROR)) diff --git a/sim/iq2000/sim-main.h b/sim/iq2000/sim-main.h index dcd7ed4..8286594 100644 --- a/sim/iq2000/sim-main.h +++ b/sim/iq2000/sim-main.h @@ -37,7 +37,7 @@ struct iq2000_sim_cpu { /* Misc. */ /* Catch address exceptions. */ -extern SIM_CORE_SIGNAL_FN iq2000_core_signal; +extern SIM_CORE_SIGNAL_FN iq2000_core_signal ATTRIBUTE_NORETURN; #define SIM_CORE_SIGNAL(SD,CPU,CIA,MAP,NR_BYTES,ADDR,TRANSFER,ERROR) \ iq2000_core_signal ((SD), (CPU), (CIA), (MAP), (NR_BYTES), (ADDR), \ (TRANSFER), (ERROR)) diff --git a/sim/lm32/sim-main.h b/sim/lm32/sim-main.h index e0e967c..c252dc8 100644 --- a/sim/lm32/sim-main.h +++ b/sim/lm32/sim-main.h @@ -51,7 +51,7 @@ struct lm32_sim_cpu /* Misc. */ /* Catch address exceptions. */ -extern SIM_CORE_SIGNAL_FN lm32_core_signal; +extern SIM_CORE_SIGNAL_FN lm32_core_signal ATTRIBUTE_NORETURN; #define SIM_CORE_SIGNAL(SD,CPU,CIA,MAP,NR_BYTES,ADDR,TRANSFER,ERROR) \ lm32_core_signal ((SD), (CPU), (CIA), (MAP), (NR_BYTES), (ADDR), \ (TRANSFER), (ERROR)) diff --git a/sim/m32r/sim-main.h b/sim/m32r/sim-main.h index 89502f2..31758a1 100644 --- a/sim/m32r/sim-main.h +++ b/sim/m32r/sim-main.h @@ -21,7 +21,7 @@ /* Misc. */ /* Catch address exceptions. */ -extern SIM_CORE_SIGNAL_FN m32r_core_signal; +extern SIM_CORE_SIGNAL_FN m32r_core_signal ATTRIBUTE_NORETURN; #define SIM_CORE_SIGNAL(SD,CPU,CIA,MAP,NR_BYTES,ADDR,TRANSFER,ERROR) \ m32r_core_signal ((SD), (CPU), (CIA), (MAP), (NR_BYTES), (ADDR), \ (TRANSFER), (ERROR)) diff --git a/sim/m4/sim_ac_option_warnings.m4 b/sim/m4/sim_ac_option_warnings.m4 index 9f1487f..3da1c6a 100644 --- a/sim/m4/sim_ac_option_warnings.m4 +++ b/sim/m4/sim_ac_option_warnings.m4 @@ -45,6 +45,7 @@ dnl C++ -Wno-mismatched-tags -Wno-error=deprecated-register dnl C++ -Wsuggest-override -Wduplicated-cond +dnl -Wshadow=local dnl C++ -Wdeprecated-copy dnl C++ -Wdeprecated-copy-dtor dnl C++ -Wredundant-move diff --git a/sim/mips/interp.c b/sim/mips/interp.c index cb650a5..255807f 100644 --- a/sim/mips/interp.c +++ b/sim/mips/interp.c @@ -2498,7 +2498,8 @@ mips_core_signal (SIM_DESC sd, (unsigned long) addr, (unsigned long) ip); COP0_BADVADDR = addr; SignalExceptionDataReference(); - break; + /* Shouldn't actually be reached. */ + abort (); case sim_core_unaligned_signal: sim_io_eprintf (sd, "mips-core: %d byte %s to unaligned address 0x%lx at 0x%lx\n", @@ -2509,7 +2510,8 @@ mips_core_signal (SIM_DESC sd, SignalExceptionAddressLoad(); else SignalExceptionAddressStore(); - break; + /* Shouldn't actually be reached. */ + abort (); default: sim_engine_abort (sd, cpu, cia, diff --git a/sim/mips/sim-main.h b/sim/mips/sim-main.h index d5a0dc8..5d35856 100644 --- a/sim/mips/sim-main.h +++ b/sim/mips/sim-main.h @@ -1038,7 +1038,7 @@ extern int DSPLO_REGNUM[4]; extern int DSPHI_REGNUM[4]; INLINE_SIM_MAIN (void) pending_tick (SIM_DESC sd, sim_cpu *cpu, address_word cia); -extern SIM_CORE_SIGNAL_FN mips_core_signal; +extern SIM_CORE_SIGNAL_FN mips_core_signal ATTRIBUTE_NORETURN; char* pr_addr (address_word addr); char* pr_uword64 (uword64 addr); diff --git a/sim/mn10300/mn10300-sim.h b/sim/mn10300/mn10300-sim.h index 3eadc0f..493df38 100644 --- a/sim/mn10300/mn10300-sim.h +++ b/sim/mn10300/mn10300-sim.h @@ -196,7 +196,8 @@ INLINE_SIM_MAIN (void) genericOr (uint32_t source, uint32_t destReg); INLINE_SIM_MAIN (void) genericXor (uint32_t source, uint32_t destReg); INLINE_SIM_MAIN (void) genericBtst (uint32_t leftOpnd, uint32_t rightOpnd); INLINE_SIM_MAIN (void) do_syscall (SIM_DESC sd); -void program_interrupt (SIM_DESC sd, sim_cpu *cpu, sim_cia cia, SIM_SIGNAL sig); +void program_interrupt (SIM_DESC sd, sim_cpu *cpu, sim_cia cia, SIM_SIGNAL sig) + ATTRIBUTE_NORETURN; void mn10300_cpu_exception_trigger(SIM_DESC sd, sim_cpu* cpu, address_word pc); void mn10300_cpu_exception_suspend(SIM_DESC sd, sim_cpu* cpu, int exception); diff --git a/sim/mn10300/sim-main.h b/sim/mn10300/sim-main.h index d08b13d..b0f0d12 100644 --- a/sim/mn10300/sim-main.h +++ b/sim/mn10300/sim-main.h @@ -48,6 +48,6 @@ mn10300_core_signal ((SD), (CPU), (CIA), (MAP), (NR_BYTES), (ADDR), (TRANSFER), #include "mn10300-sim.h" #endif -extern SIM_CORE_SIGNAL_FN mn10300_core_signal; +extern SIM_CORE_SIGNAL_FN mn10300_core_signal ATTRIBUTE_NORETURN; #endif -- cgit v1.1