[PATCH 3/3] sim: fix a few -Wdiscarded-qualifiers errors

Simon Marchi simon.marchi@polymtl.ca
Thu Feb 26 18:21:40 GMT 2026


On 2/23/26 8:26 AM, simon.marchi@polymtl.ca wrote:
> From: Simon Marchi <simon.marchi@polymtl.ca>
> 
> Change-Id: I5caaf741a6d3835d593e62c3a567171c09d6241c
> ---
>  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 c0ad4c790839..8c72b2bc3786 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 f26bccf870d1..8e1808401549 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 bc7806cc278a..0ad85879bade 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);
>  		}
> -- 
> 2.53.0
> 

I went ahead and pushed this one, since the changes are obvious.

Patch 2/3 is no longer necessary, since Keith pushed his version.

Simon


More information about the Binutils mailing list