gas/arc: Make member of arc_flags const
authorAndrew Burgess <andrew.burgess@embecosm.com>
Fri, 6 May 2016 12:59:03 +0000 (13:59 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Wed, 18 May 2016 21:24:51 +0000 (22:24 +0100)
By making the flgp field of struct arc_flags constant we can remove a
place where we cast away the const-ness of a variable.  Also, given that
the value assigned to this field almost always comes from compile-time
constant data, having the field non-constant is probably a bad thing.

gas/ChangeLog:

* config/tc-arc.c (find_opcode_match): Remove casting away of
const.
* config/tc-arc.h (struct arc_flags): Make flgp field const.

gas/ChangeLog
gas/config/tc-arc.c
gas/config/tc-arc.h

index d1d23fe23d20db2ae4db67dbaeb85b4957423c3d..fba1ab9de13957515fc2740eaea7c20e1d3a4a49 100644 (file)
@@ -1,3 +1,9 @@
+2016-05-18  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * config/tc-arc.c (find_opcode_match): Remove casting away of
+       const.
+       * config/tc-arc.h (struct arc_flags): Make flgp field const.
+
 2016-05-18  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * config/tc-arc.c (md_pcrel_from_section): Use BFD_VMA_FMT where
index 5a5e8531f7ec48f7e4029cacba8fee2f289244d5..c9d772f1503883fdb94206fce68f4ce1c635c1e6 100644 (file)
@@ -1883,7 +1883,7 @@ find_opcode_match (const struct arc_opcode_hash_entry *entry,
                      if (pflag->flgp != NULL)
                        goto match_failed;
                      cl_matches++;
-                     pflag->flgp = (struct arc_flag_operand *) flg_operand;
+                     pflag->flgp = flg_operand;
                      lnflg--;
                      break; /* goto next flag class and parsed flag.  */
                    }
index 16f6a0686f45c665aed67fb75792abdde282c810..b61342bc110bd3dfee282aac43dce4d9c4f3f16a 100644 (file)
@@ -225,7 +225,7 @@ struct arc_flags
   char name[MAX_FLAG_NAME_LENGTH + 1];
 
   /* Pointer to arc flags.  */
-  struct arc_flag_operand *flgp;
+  const struct arc_flag_operand *flgp;
 };
 
 extern const relax_typeS md_relax_table[];