* [PATCH 1/3] bfd: fix 2 more -Wdiscarded-qualifiers errors
2026-02-23 13:26 [PATCH 0/3] Fix some more -Wdiscarded-qualifiers errors simon.marchi
@ 2026-02-23 13:26 ` simon.marchi
2026-02-23 14:20 ` Jan Beulich
2026-02-23 13:26 ` [PATCH 2/3] opcodes: fix a few " simon.marchi
2026-02-23 13:26 ` [PATCH 3/3] sim: " simon.marchi
2 siblings, 1 reply; 14+ messages in thread
From: simon.marchi @ 2026-02-23 13:26 UTC (permalink / raw)
To: gdb-patches, binutils; +Cc: Simon Marchi
From: Simon Marchi <simon.marchi@polymtl.ca>
Change-Id: I047cd848506fc4d3dafdb901e300fe22430dddde
---
bfd/elf32-arc.c | 2 +-
bfd/vms-misc.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index bdf96de7668f..7753872e198f 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -556,7 +556,7 @@ arc_extract_features (const char *p)
for (i = 0; i < ARRAY_SIZE (bfd_feature_list); i++)
{
- char *t = strstr (p, bfd_feature_list[i].attr);
+ const char *t = strstr (p, bfd_feature_list[i].attr);
unsigned l = strlen (bfd_feature_list[i].attr);
if ((t != NULL)
&& (t[l] == ','
diff --git a/bfd/vms-misc.c b/bfd/vms-misc.c
index 63f627b18ed2..a3e9ad9bb136 100644
--- a/bfd/vms-misc.c
+++ b/bfd/vms-misc.c
@@ -499,7 +499,7 @@ char *
vms_get_module_name (const char *filename, bool upcase)
{
char *fname, *fptr;
- const char *fout;
+ const char *fout, *fslash;
/* Strip VMS path. */
fout = strrchr (filename, ']');
@@ -511,9 +511,9 @@ vms_get_module_name (const char *filename, bool upcase)
fout = filename;
/* Strip UNIX path. */
- fptr = strrchr (fout, '/');
- if (fptr != NULL)
- fout = fptr + 1;
+ fslash = strrchr (fout, '/');
+ if (fslash != NULL)
+ fout = fslash + 1;
fname = strdup (fout);
--
2.53.0
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH 1/3] bfd: fix 2 more -Wdiscarded-qualifiers errors
2026-02-23 13:26 ` [PATCH 1/3] bfd: fix 2 " simon.marchi
@ 2026-02-23 14:20 ` Jan Beulich
2026-02-24 15:36 ` Simon Marchi
0 siblings, 1 reply; 14+ messages in thread
From: Jan Beulich @ 2026-02-23 14:20 UTC (permalink / raw)
To: simon.marchi; +Cc: gdb-patches, binutils
On 23.02.2026 14:26, simon.marchi@polymtl.ca wrote:
> From: Simon Marchi <simon.marchi@polymtl.ca>
>
> Change-Id: I047cd848506fc4d3dafdb901e300fe22430dddde
> ---
> bfd/elf32-arc.c | 2 +-
> bfd/vms-misc.c | 8 ++++----
> 2 files changed, 5 insertions(+), 5 deletions(-)
Okay (just in case, pretty close to obvious).
Jan
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] bfd: fix 2 more -Wdiscarded-qualifiers errors
2026-02-23 14:20 ` Jan Beulich
@ 2026-02-24 15:36 ` Simon Marchi
0 siblings, 0 replies; 14+ messages in thread
From: Simon Marchi @ 2026-02-24 15:36 UTC (permalink / raw)
To: Jan Beulich; +Cc: gdb-patches, binutils
On 2026-02-23 09:20, Jan Beulich wrote:
> On 23.02.2026 14:26, simon.marchi@polymtl.ca wrote:
>> From: Simon Marchi <simon.marchi@polymtl.ca>
>>
>> Change-Id: I047cd848506fc4d3dafdb901e300fe22430dddde
>> ---
>> bfd/elf32-arc.c | 2 +-
>> bfd/vms-misc.c | 8 ++++----
>> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> Okay (just in case, pretty close to obvious).
>
> Jan
Ok, thanks, I pushed this one.
Simon
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/3] opcodes: fix a few -Wdiscarded-qualifiers errors
2026-02-23 13:26 [PATCH 0/3] Fix some more -Wdiscarded-qualifiers errors simon.marchi
2026-02-23 13:26 ` [PATCH 1/3] bfd: fix 2 " simon.marchi
@ 2026-02-23 13:26 ` simon.marchi
2026-02-23 14:27 ` Jan Beulich
2026-02-24 14:58 ` Keith Seitz
2026-02-23 13:26 ` [PATCH 3/3] sim: " simon.marchi
2 siblings, 2 replies; 14+ messages in thread
From: simon.marchi @ 2026-02-23 13:26 UTC (permalink / raw)
To: gdb-patches, binutils; +Cc: Simon Marchi
From: Simon Marchi <simon.marchi@polymtl.ca>
Change-Id: Ifd43eb7ceee3bebc8be690a7fba94fc8651ffcd6
---
opcodes/aarch64-dis.c | 2 +-
opcodes/ia64-opc.c | 2 +-
opcodes/ip2k-asm.c | 2 +-
opcodes/riscv-dis.c | 4 ++--
opcodes/tilegx-opc.c | 2 +-
opcodes/tilepro-opc.c | 2 +-
6 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/opcodes/aarch64-dis.c b/opcodes/aarch64-dis.c
index 8cc2eb3f3c20..f09307847e64 100644
--- a/opcodes/aarch64-dis.c
+++ b/opcodes/aarch64-dis.c
@@ -4087,7 +4087,7 @@ print_operands (bfd_vma pc, const aarch64_opcode *opcode,
static void
remove_dot_suffix (char *name, const aarch64_inst *inst)
{
- char *ptr;
+ const char *ptr;
size_t len;
ptr = strchr (inst->opcode->name, '.');
diff --git a/opcodes/ia64-opc.c b/opcodes/ia64-opc.c
index 5d79cf3d041a..79c12a840a74 100644
--- a/opcodes/ia64-opc.c
+++ b/opcodes/ia64-opc.c
@@ -66,7 +66,7 @@ const struct ia64_templ_desc ia64_templ_desc[16] =
static void
get_opc_prefix (const char **ptr, char *dest)
{
- char *c = strchr (*ptr, '.');
+ const char *c = strchr (*ptr, '.');
if (c != NULL)
{
memcpy (dest, *ptr, c - *ptr);
diff --git a/opcodes/ip2k-asm.c b/opcodes/ip2k-asm.c
index 18bd98a28463..3adbd1546a38 100644
--- a/opcodes/ip2k-asm.c
+++ b/opcodes/ip2k-asm.c
@@ -59,7 +59,7 @@ parse_fr (CGEN_CPU_DESC cd,
{
const char *errmsg;
const char *old_strp;
- char *afteroffset;
+ const char *afteroffset;
enum cgen_parse_operand_result result_type;
bfd_vma value;
extern CGEN_KEYWORD ip2k_cgen_opval_register_names;
diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c
index 03c8cf1e344c..eda802ff4202 100644
--- a/opcodes/riscv-dis.c
+++ b/opcodes/riscv-dis.c
@@ -110,7 +110,7 @@ parse_riscv_dis_option_without_args (const char *option,
/* Parse RISC-V disassembler option (possibly with arguments). */
static void
-parse_riscv_dis_option (const char *option, struct disassemble_info *info)
+parse_riscv_dis_option (char *option, struct disassemble_info *info)
{
char *equal, *value;
@@ -1140,7 +1140,7 @@ riscv_update_map_state (int n,
/* ISA mapping string may be numbered, suffixed with '.n'. Do not
consider this as part of the ISA string. */
- char *suffix = strchr (name, '.');
+ const char *suffix = strchr (name, '.');
if (suffix)
{
int suffix_index = (int)(suffix - name);
diff --git a/opcodes/tilegx-opc.c b/opcodes/tilegx-opc.c
index db762e224932..a1d42d6e18d0 100644
--- a/opcodes/tilegx-opc.c
+++ b/opcodes/tilegx-opc.c
@@ -8003,7 +8003,7 @@ tilegx_spr_compare (const void *a_ptr, const void *b_ptr)
const char *
get_tilegx_spr_name (int num)
{
- void *result;
+ const void *result;
struct tilegx_spr key;
key.number = num;
diff --git a/opcodes/tilepro-opc.c b/opcodes/tilepro-opc.c
index 664122b05d51..a96388836953 100644
--- a/opcodes/tilepro-opc.c
+++ b/opcodes/tilepro-opc.c
@@ -10119,7 +10119,7 @@ tilepro_spr_compare (const void *a_ptr, const void *b_ptr)
const char *
get_tilepro_spr_name (int num)
{
- void *result;
+ const void *result;
struct tilepro_spr key;
key.number = num;
--
2.53.0
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH 2/3] opcodes: fix a few -Wdiscarded-qualifiers errors
2026-02-23 13:26 ` [PATCH 2/3] opcodes: fix a few " simon.marchi
@ 2026-02-23 14:27 ` Jan Beulich
2026-02-24 1:14 ` Alan Modra
2026-02-24 14:58 ` Keith Seitz
1 sibling, 1 reply; 14+ messages in thread
From: Jan Beulich @ 2026-02-23 14:27 UTC (permalink / raw)
To: simon.marchi; +Cc: gdb-patches, binutils
On 23.02.2026 14:26, simon.marchi@polymtl.ca wrote:
> From: Simon Marchi <simon.marchi@polymtl.ca>
>
> Change-Id: Ifd43eb7ceee3bebc8be690a7fba94fc8651ffcd6
> ---
> opcodes/aarch64-dis.c | 2 +-
> opcodes/ia64-opc.c | 2 +-
> opcodes/ip2k-asm.c | 2 +-
> opcodes/riscv-dis.c | 4 ++--
> opcodes/tilegx-opc.c | 2 +-
> opcodes/tilepro-opc.c | 2 +-
> 6 files changed, 7 insertions(+), 7 deletions(-)
Okay, but please allow target maintainers (who you may have wanted to Cc) some
time to chime in. In particular ...
> --- a/opcodes/riscv-dis.c
> +++ b/opcodes/riscv-dis.c
> @@ -110,7 +110,7 @@ parse_riscv_dis_option_without_args (const char *option,
> /* Parse RISC-V disassembler option (possibly with arguments). */
>
> static void
> -parse_riscv_dis_option (const char *option, struct disassemble_info *info)
> +parse_riscv_dis_option (char *option, struct disassemble_info *info)
> {
> char *equal, *value;
>
... this change, while apparently correct, isn't very nice.
Jan
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH 2/3] opcodes: fix a few -Wdiscarded-qualifiers errors
2026-02-23 14:27 ` Jan Beulich
@ 2026-02-24 1:14 ` Alan Modra
0 siblings, 0 replies; 14+ messages in thread
From: Alan Modra @ 2026-02-24 1:14 UTC (permalink / raw)
To: Jan Beulich; +Cc: simon.marchi, gdb-patches, binutils
On Mon, Feb 23, 2026 at 03:27:38PM +0100, Jan Beulich wrote:
> On 23.02.2026 14:26, simon.marchi@polymtl.ca wrote:
> > From: Simon Marchi <simon.marchi@polymtl.ca>
> > --- a/opcodes/riscv-dis.c
> > +++ b/opcodes/riscv-dis.c
> > @@ -110,7 +110,7 @@ parse_riscv_dis_option_without_args (const char *option,
> > /* Parse RISC-V disassembler option (possibly with arguments). */
> >
> > static void
> > -parse_riscv_dis_option (const char *option, struct disassemble_info *info)
> > +parse_riscv_dis_option (char *option, struct disassemble_info *info)
> > {
> > char *equal, *value;
> >
> ... this change, while apparently correct, isn't very nice.
I think it both correct and nice. Nice because it removes the lie
that the "option" string is not changed by the function.
--
Alan Modra
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/3] opcodes: fix a few -Wdiscarded-qualifiers errors
2026-02-23 13:26 ` [PATCH 2/3] opcodes: fix a few " simon.marchi
2026-02-23 14:27 ` Jan Beulich
@ 2026-02-24 14:58 ` Keith Seitz
2026-02-24 15:46 ` Simon Marchi
1 sibling, 1 reply; 14+ messages in thread
From: Keith Seitz @ 2026-02-24 14:58 UTC (permalink / raw)
To: simon.marchi, gdb-patches, binutils
On 2/23/26 5:26 AM, simon.marchi@polymtl.ca wrote:
> From: Simon Marchi <simon.marchi@polymtl.ca>
>
> diff --git a/opcodes/ip2k-asm.c b/opcodes/ip2k-asm.c
> index 18bd98a28463..3adbd1546a38 100644
> --- a/opcodes/ip2k-asm.c
> +++ b/opcodes/ip2k-asm.c
> @@ -59,7 +59,7 @@ parse_fr (CGEN_CPU_DESC cd,
> {
> const char *errmsg;
> const char *old_strp;
> - char *afteroffset;
> + const char *afteroffset;
> enum cgen_parse_operand_result result_type;
> bfd_vma value;
> extern CGEN_KEYWORD ip2k_cgen_opval_register_names;
The top of this file says:
"""
/* DO NOT EDIT! -*- buffer-read-only: t -*- vi:set ro: */
/* Assembler interface for targets using CGEN. -*- C -*-
CGEN: Cpu tools GENerator
THIS FILE IS MACHINE GENERATED WITH CGEN.
- the resultant file is machine generated, cgen-asm.in isn't
[...]
"""
Is this no longer the case? I was able to regenerate it by modifying
cpu/ip2k.opc[1].
Keith
[1]
https://inbox.sourceware.org/binutils/c797abce4ebbaa4e86d404f9fca17b197ceb6b17.1767807388.git.keiths@redhat.com/T/
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH 2/3] opcodes: fix a few -Wdiscarded-qualifiers errors
2026-02-24 14:58 ` Keith Seitz
@ 2026-02-24 15:46 ` Simon Marchi
2026-02-24 17:17 ` Keith Seitz
0 siblings, 1 reply; 14+ messages in thread
From: Simon Marchi @ 2026-02-24 15:46 UTC (permalink / raw)
To: Keith Seitz, gdb-patches, binutils
On 2026-02-24 09:58, Keith Seitz wrote:
> On 2/23/26 5:26 AM, simon.marchi@polymtl.ca wrote:
>> From: Simon Marchi <simon.marchi@polymtl.ca>
>>
>> diff --git a/opcodes/ip2k-asm.c b/opcodes/ip2k-asm.c
>> index 18bd98a28463..3adbd1546a38 100644
>> --- a/opcodes/ip2k-asm.c
>> +++ b/opcodes/ip2k-asm.c
>> @@ -59,7 +59,7 @@ parse_fr (CGEN_CPU_DESC cd,
>> {
>> const char *errmsg;
>> const char *old_strp;
>> - char *afteroffset;
>> + const char *afteroffset;
>> enum cgen_parse_operand_result result_type;
>> bfd_vma value;
>> extern CGEN_KEYWORD ip2k_cgen_opval_register_names;
>
> The top of this file says:
>
> """
> /* DO NOT EDIT! -*- buffer-read-only: t -*- vi:set ro: */
> /* Assembler interface for targets using CGEN. -*- C -*-
> CGEN: Cpu tools GENerator
>
> THIS FILE IS MACHINE GENERATED WITH CGEN.
> - the resultant file is machine generated, cgen-asm.in isn't
> [...]
> """
>
> Is this no longer the case? I was able to regenerate it by modifying
> cpu/ip2k.opc[1].
>
> Keith
>
> [1] https://inbox.sourceware.org/binutils/c797abce4ebbaa4e86d404f9fca17b197ceb6b17.1767807388.git.keiths@redhat.com/T/
>
Oh, good catch. But wait... why is your patch not merged yet?
Simon
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH 2/3] opcodes: fix a few -Wdiscarded-qualifiers errors
2026-02-24 15:46 ` Simon Marchi
@ 2026-02-24 17:17 ` Keith Seitz
2026-02-24 22:57 ` Alan Modra
0 siblings, 1 reply; 14+ messages in thread
From: Keith Seitz @ 2026-02-24 17:17 UTC (permalink / raw)
To: Simon Marchi, gdb-patches, binutils
On 2/24/26 7:46 AM, Simon Marchi wrote:
>
> Oh, good catch. But wait... why is your patch not merged yet?
It was neither approved nor received any feedback from target
maintainers. I was meaning to ping it, but it fell off my radar.
Mea culpa,
Keith
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/3] opcodes: fix a few -Wdiscarded-qualifiers errors
2026-02-24 17:17 ` Keith Seitz
@ 2026-02-24 22:57 ` Alan Modra
2026-02-25 14:50 ` Keith Seitz
0 siblings, 1 reply; 14+ messages in thread
From: Alan Modra @ 2026-02-24 22:57 UTC (permalink / raw)
To: Keith Seitz; +Cc: Simon Marchi, gdb-patches, binutils
On Tue, Feb 24, 2026 at 09:17:10AM -0800, Keith Seitz wrote:
> On 2/24/26 7:46 AM, Simon Marchi wrote:
> >
> > Oh, good catch. But wait... why is your patch not merged yet?
>
> It was neither approved nor received any feedback from target
> maintainers. I was meaning to ping it, but it fell off my radar.
Approved. Please apply.
--
Alan Modra
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/3] opcodes: fix a few -Wdiscarded-qualifiers errors
2026-02-24 22:57 ` Alan Modra
@ 2026-02-25 14:50 ` Keith Seitz
0 siblings, 0 replies; 14+ messages in thread
From: Keith Seitz @ 2026-02-25 14:50 UTC (permalink / raw)
To: gdb-patches, binutils; +Cc: Simon Marchi
On 2/24/26 2:57 PM, Alan Modra wrote:
> On Tue, Feb 24, 2026 at 09:17:10AM -0800, Keith Seitz wrote:
>> On 2/24/26 7:46 AM, Simon Marchi wrote:
>>>
>>> Oh, good catch. But wait... why is your patch not merged yet?
>>
>> It was neither approved nor received any feedback from target
>> maintainers. I was meaning to ping it, but it fell off my radar.
>
> Approved. Please apply.
>
Thank you, I've pushed this.
Keith
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 3/3] sim: fix a few -Wdiscarded-qualifiers errors
2026-02-23 13:26 [PATCH 0/3] Fix some more -Wdiscarded-qualifiers errors simon.marchi
2026-02-23 13:26 ` [PATCH 1/3] bfd: fix 2 " simon.marchi
2026-02-23 13:26 ` [PATCH 2/3] opcodes: fix a few " simon.marchi
@ 2026-02-23 13:26 ` simon.marchi
2026-02-26 18:21 ` Simon Marchi
2 siblings, 1 reply; 14+ messages in thread
From: simon.marchi @ 2026-02-23 13:26 UTC (permalink / raw)
To: gdb-patches, binutils; +Cc: Simon Marchi
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
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH 3/3] sim: fix a few -Wdiscarded-qualifiers errors
2026-02-23 13:26 ` [PATCH 3/3] sim: " simon.marchi
@ 2026-02-26 18:21 ` Simon Marchi
0 siblings, 0 replies; 14+ messages in thread
From: Simon Marchi @ 2026-02-26 18:21 UTC (permalink / raw)
To: gdb-patches, binutils
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
^ permalink raw reply [flat|nested] 14+ messages in thread