[PATCH/committed,01/21] sim: common: fix -Wunused-variable warnings

Message ID 20231219105155.10433-1-vapier@gentoo.org
State New
Headers
Series [PATCH/committed,01/21] sim: common: fix -Wunused-variable warnings |

Commit Message

Mike Frysinger Dec. 19, 2023, 10:51 a.m. UTC
  ---
 sim/common/cgen-run.c    |  3 +--
 sim/common/cgen-scache.c | 12 ++++++++----
 sim/common/sim-module.c  |  2 --
 sim/common/sim-options.c |  1 -
 sim/common/sim-watch.c   |  2 --
 sim/common/syscall.c     |  4 +---
 6 files changed, 10 insertions(+), 14 deletions(-)
  

Patch

diff --git a/sim/common/cgen-run.c b/sim/common/cgen-run.c
index 29578b0c57f2..b0b7cf1ed365 100644
--- a/sim/common/cgen-run.c
+++ b/sim/common/cgen-run.c
@@ -56,8 +56,7 @@  static void engine_run_n (SIM_DESC, int, int, int, int);
 static int
 cgen_get_fast_p (SIM_DESC sd)
 {
-  int i, c;
-  int run_fast_p = 1;
+  int c;
 
   for (c = 0; c < MAX_NR_PROCESSORS; ++c)
     {
diff --git a/sim/common/cgen-scache.c b/sim/common/cgen-scache.c
index c6de30e16575..46dada7e2564 100644
--- a/sim/common/cgen-scache.c
+++ b/sim/common/cgen-scache.c
@@ -276,7 +276,10 @@  scache_flush (SIM_DESC sd)
 void
 scache_flush_cpu (SIM_CPU *cpu)
 {
-  int i,n;
+  int i;
+#if WITH_SCACHE_PBB
+  int n;
+#endif
 
   /* Don't bother if cache not in use.  */
   if (CPU_SCACHE_SIZE (cpu) == 0)
@@ -426,9 +429,6 @@  scache_print_profile (SIM_CPU *cpu, bool verbose)
   unsigned long hits = CPU_SCACHE_HITS (cpu);
   unsigned long misses = CPU_SCACHE_MISSES (cpu);
   char buf[20];
-  unsigned long max_val;
-  unsigned long *lengths;
-  int i;
 
   if (CPU_SCACHE_SIZE (cpu) == 0)
     return;
@@ -460,6 +460,10 @@  scache_print_profile (SIM_CPU *cpu, bool verbose)
 
   if (verbose)
     {
+      unsigned long max_val;
+      unsigned long *lengths;
+      int i;
+
       sim_io_printf (sd, "  Insn chain lengths:\n\n");
       max_val = 0;
       lengths = CPU_SCACHE_CHAIN_LENGTHS (cpu);
diff --git a/sim/common/sim-module.c b/sim/common/sim-module.c
index f03e4b774b75..ac8c9782f440 100644
--- a/sim/common/sim-module.c
+++ b/sim/common/sim-module.c
@@ -133,8 +133,6 @@  sim_module_install_list (SIM_DESC sd, MODULE_INSTALL_FN * const *modules,
 SIM_RC
 sim_module_install (SIM_DESC sd)
 {
-  MODULE_INSTALL_FN * const *modp;
-
   SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
   SIM_ASSERT (STATE_MODULES (sd) == NULL);
 
diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c
index a6cd0037d2aa..9f238339fb8f 100644
--- a/sim/common/sim-options.c
+++ b/sim/common/sim-options.c
@@ -1078,7 +1078,6 @@  complete_option_list (char **ret, size_t *cnt, const struct option_list *ol,
 		      const char *text, const char *word)
 {
   const OPTION *opt = NULL;
-  int argi;
   size_t len = strlen (word);
 
   for ( ; ol != NULL; ol = ol->next)
diff --git a/sim/common/sim-watch.c b/sim/common/sim-watch.c
index 6f9a53ac3b19..3366257d3c1a 100644
--- a/sim/common/sim-watch.c
+++ b/sim/common/sim-watch.c
@@ -169,8 +169,6 @@  static SIM_RC
 schedule_watchpoint (SIM_DESC sd,
 		     sim_watch_point *point)
 {
-  sim_watchpoints *watch = STATE_WATCHPOINTS (sd);
-
   switch (point->type)
     {
     case pc_watchpoint:
diff --git a/sim/common/syscall.c b/sim/common/syscall.c
index 96033db84c3b..9d08730fc739 100644
--- a/sim/common/syscall.c
+++ b/sim/common/syscall.c
@@ -213,9 +213,7 @@  cb_syscall (host_callback *cb, CB_SYSCALL *sc)
 	/* Buffer size.  */
 	int bufsize = sc->arg2;
 	int written = 0;
-	/* Q is the target address of where all the strings go.  */
-	TADDR q;
-	int i, argc, envc, len, ret;
+	int argc, envc, len, ret;
 	char **argv = cb->argv;
 	char **envp = cb->envp;