[binutils-gdb/binutils-2_46-branch] sim: fix a few -Wdiscarded-qualifiers errors

Sam James via Gdb-cvs <[email protected]> Tue, 2 Jun 2026 17:32:29 +0000 (GMT)
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4bcbe5932ae4ed08a97621e12418d75ac3cab3a5

commit 4bcbe5932ae4ed08a97621e12418d75ac3cab3a5
Author: Simon Marchi <[email protected]>
Date:   Mon Feb 23 08:26:38 2026 -0500

    sim: fix a few -Wdiscarded-qualifiers errors
    
    Change-Id: I5caaf741a6d3835d593e62c3a567171c09d6241c
    (cherry picked from commit 38e9187d24b6e14bfadafb6d6feda5770f74ff07)

Diff:
---
 sim/common/sim-options.c | 2 +-
 sim/cr16/simops.c        | 2 +-
 sim/d10v/simops.c        | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c
index c0ad4c79083..8c72b2bc378 100644
--- a/sim/common/sim-options.c
+++ b/sim/common/sim-options.c
@@ -207,7 +207,7 @@ static SIM_RC
 env_set (SIM_DESC sd, const char *arg)
 {
   int i, varlen;
-  char *eq;
+  const char *eq;
   char **envp;
 
   if (STATE_PROG_ENVP (sd) == NULL)
diff --git a/sim/cr16/simops.c b/sim/cr16/simops.c
index f26bccf870d..8e180840154 100644
--- a/sim/cr16/simops.c
+++ b/sim/cr16/simops.c
@@ -296,7 +296,7 @@ trace_input_func (SIM_DESC sd, const char *name, enum op_types in1, enum op_type
 		}
 	      else if (filename)
 		{
-		  char *q = strrchr (filename, '/');
+		  const char *q = strrchr (filename, '/');
 		  sprintf (p, "%s ", (q) ? q+1 : filename);
 		  p += strlen (p);
 		}
diff --git a/sim/d10v/simops.c b/sim/d10v/simops.c
index bc7806cc278..0ad85879bad 100644
--- a/sim/d10v/simops.c
+++ b/sim/d10v/simops.c
@@ -232,7 +232,7 @@ trace_input_func (SIM_DESC sd, const char *name, enum op_types in1, enum op_type
 		}
 	      else if (filename)
 		{
-		  char *q = strrchr (filename, '/');
+		  const char *q = strrchr (filename, '/');
 		  sprintf (p, "%s ", (q) ? q+1 : filename);
 		  p += strlen (p);
 		}