public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] sim: signal: mark signal callback funcs as noreturn since they don't return
@ 2023-12-21  7:01 Michael Frysinger
  0 siblings, 0 replies; only message in thread
From: Michael Frysinger @ 2023-12-21  7:01 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d137b254d9aa4c91d5d2e7865d971bbdaa40e769

commit d137b254d9aa4c91d5d2e7865d971bbdaa40e769
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Thu Dec 21 00:38:31 2023 -0500

    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.

Diff:
---
 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 34826f76edb..bad69876e4f 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 abebe2bafc1..8fa6ff522bc 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 f2fbcce2b21..b9f99fb3ded 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 dcd7ed4682f..82865943e3b 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 e0e967c4233..c252dc8f641 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 89502f2240e..31758a153a1 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 9f1487f93d0..3da1c6a2e4a 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 cb650a55248..255807f6790 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 d5a0dc81b62..5d358564f28 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 3eadc0fe178..493df3893e9 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 d08b13dc531..b0f0d12c651 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-12-21  7:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-21  7:01 [binutils-gdb] sim: signal: mark signal callback funcs as noreturn since they don't return Michael Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).