Fix even more -Wdiscarded-qualifers issues

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.

(cherry picked from commit 36974d77e9)
This commit is contained in:
Keith Seitz 2026-02-25 06:24:53 -08:00 committed by Sam James
parent 3e4fd1a57e
commit 66bf5c4dd9
No known key found for this signature in database
GPG key ID: 738409F520DF9190
7 changed files with 9 additions and 9 deletions

View file

@ -94,7 +94,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;

View file

@ -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, '.');

View file

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

View file

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

View file

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

View file

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

View file

@ -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;
@ -10131,7 +10131,7 @@ get_tilepro_spr_name (int num)
return NULL;
{
struct tilepro_spr *result_ptr = (struct tilepro_spr *) result;
const struct tilepro_spr *result_ptr = (const struct tilepro_spr *) result;
return result_ptr->name;
}