[PATCH] Fix some more C23 const-correctness issues

Jan Beulich jbeulich@suse.com
Thu Jan 8 07:29:28 GMT 2026


On 07.01.2026 18:36, Keith Seitz wrote:
> Fedora Rawhide is failing to build due to new glibc header changes
> enforcing const-correctness in functions like strchr and memchr.
> For example:
> 
> ../../opcodes/aarch64-dis.c: In function ‘remove_dot_suffix’:
> ../../opcodes/aarch64-dis.c:4027:7: error: assignment discards ‘const’ qualifier from po
> inter target type [-Werror=discarded-qualifiers]
>  4027 |   ptr = strchr (inst->opcode->name, '.');
>       |       ^
> cc1: all warnings being treated as errors
> 
> This patch addresses all the discovered issues with --enable-targets=all
> and regenerates a few cgen files along the way.

It's actually not all that many, surprisingly. Otoh --enable-targets=all
wouldn't cover most of gas/config/*. Most of the changes are okay (if not
to say "count as obvious"), but ...

> --- 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;

... the removal of const here isn't nice. Imo the code would better be
adjusted to avoid the writing through "equal" (which looks to be possible
without going through hoops), but let's see whether the RISC-V maintainers
(now Cc-ed) take a different position.

Jan


More information about the Binutils mailing list