]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gas d30v_insn plus other non-const pointers
authorAlan Modra <amodra@gmail.com>
Tue, 8 Jul 2025 23:32:43 +0000 (09:02 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 9 Jul 2025 00:05:07 +0000 (09:35 +0930)
d30v has a bunch of casts that are only needed due to various types
missing a const.  Fix that.

gas/config/tc-d30v.c
include/opcode/d30v.h

index 4b4e73d9656bf6276de742542a7eec989c8d3143..bfa4adf9ce2e3f0f369b4f9c5ac6cf373e0a9469 100644 (file)
@@ -306,11 +306,11 @@ md_section_align (asection *seg, valueT addr)
 void
 md_begin (void)
 {
-  struct d30v_opcode *opcode;
+  const struct d30v_opcode *opcode;
   d30v_hash = str_htab_create ();
 
   /* Insert opcode names into a hash table.  */
-  for (opcode = (struct d30v_opcode *) d30v_opcode_table; opcode->name; opcode++)
+  for (opcode = d30v_opcode_table; opcode->name; opcode++)
       str_hash_insert (d30v_hash, opcode->name, opcode, 0);
 
   fixups = &FixUps[0];
@@ -484,8 +484,8 @@ build_insn (struct d30v_insn *opcode, expressionS *opers)
   int i, bits, shift, flags;
   unsigned long number, id = 0;
   long long insn;
-  struct d30v_opcode *op = opcode->op;
-  struct d30v_format *form = opcode->form;
+  const struct d30v_opcode *op = opcode->op;
+  const struct d30v_format *form = opcode->form;
 
   insn =
     opcode->ecc << 28 | op->op1 << 25 | op->op2 << 20 | form->modifier << 18;
@@ -682,8 +682,8 @@ parallel_ok (struct d30v_insn *op1,
   int i, j, shift, regno, bits, ecc;
   unsigned long flags, mask, flags_set1, flags_set2, flags_used1, flags_used2;
   unsigned long ins, mod_reg[2][3], used_reg[2][3], flag_reg[2];
-  struct d30v_format *f;
-  struct d30v_opcode *op;
+  const struct d30v_format *f;
+  const struct d30v_opcode *op;
 
   /* Section 4.3: Both instructions must not be IU or MU only.  */
   if ((op1->op->unit == IU && op2->op->unit == IU)
@@ -1122,14 +1122,14 @@ write_2_short (struct d30v_insn *opcode1,
    It must look at all formats for an opcode and use the operands
    to choose the correct one.  Return NULL on error.  */
 
-static struct d30v_format *
-find_format (struct d30v_opcode *opcode,
+static const struct d30v_format *
+find_format (const struct d30v_opcode *opcode,
             expressionS myops[],
             int fsize,
             int cmp_hack)
 {
   int match, opcode_index, i = 0, j, k;
-  struct d30v_format *fm;
+  const struct d30v_format *fm;
 
   if (opcode == NULL)
     return NULL;
@@ -1145,7 +1145,7 @@ find_format (struct d30v_opcode *opcode,
       if (fsize == FORCE_LONG && opcode_index < LONG)
        continue;
 
-      fm = (struct d30v_format *) &d30v_format_table[opcode_index];
+      fm = &d30v_format_table[opcode_index];
       k = opcode_index;
       while (fm->form == opcode_index)
        {
@@ -1266,7 +1266,7 @@ find_format (struct d30v_opcode *opcode,
 
              return fm;
            }
-         fm = (struct d30v_format *) &d30v_format_table[++k];
+         fm = &d30v_format_table[++k];
        }
     }
   return NULL;
@@ -1339,7 +1339,7 @@ do_assemble (char *str,
   if (startswith (name, "cmp"))
     {
       int p, i;
-      char **d30v_str = (char **) d30v_cc_names;
+      const char **d30v_str = d30v_cc_names;
 
       if (name[3] == 'u')
        p = 4;
index 82b76128027e95296582c0a7c1f3688acba900c2..a8db13ef76edf6cc419e8b6a0f8da23d0be67caa 100644 (file)
@@ -279,8 +279,8 @@ extern const struct d30v_format d30v_format_table[];
 /* formats, 2 SHORT_A forms and a LONG form. */
 struct d30v_insn
 {
-  struct d30v_opcode *op;      /* pointer to an entry in the opcode table */
-  struct d30v_format *form;    /* pointer to an entry in the format table */
+  const struct d30v_opcode *op;        /* pointer to an entry in the opcode table */
+  const struct d30v_format *form; /* pointer to an entry in the format table */
   int ecc;                     /* execution condition code */
 };