[binutils-gdb] gas/arc: Make member of arc_flags const
Andrew Burgess
aburgess@sourceware.org
Wed May 18 21:37:00 GMT 2016
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=38cd8a0de838966a045ddef4ad31c715ef720a42
commit 38cd8a0de838966a045ddef4ad31c715ef720a42
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date: Fri May 6 13:59:03 2016 +0100
gas/arc: Make member of arc_flags const
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.
Diff:
---
gas/ChangeLog | 6 ++++++
gas/config/tc-arc.c | 2 +-
gas/config/tc-arc.h | 2 +-
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/gas/ChangeLog b/gas/ChangeLog
index d1d23fe..fba1ab9 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,11 @@
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
appropriate.
(md_convert_frag): Likewise.
diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c
index 5a5e853..c9d772f 100644
--- a/gas/config/tc-arc.c
+++ b/gas/config/tc-arc.c
@@ -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. */
}
diff --git a/gas/config/tc-arc.h b/gas/config/tc-arc.h
index 16f6a06..b61342b 100644
--- a/gas/config/tc-arc.h
+++ b/gas/config/tc-arc.h
@@ -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[];
More information about the Binutils-cvs
mailing list