This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 4/4] gas/arc: Make member of arc_flags const
- From: Andrew Burgess <andrew dot burgess at embecosm dot com>
- To: binutils at sourceware dot org
- Cc: Claudiu dot Zissulescu at synopsys dot com, Cupertino dot Miranda at synopsys dot com, Andrew Burgess <andrew dot burgess at embecosm dot com>
- Date: Wed, 11 May 2016 20:21:26 +0100
- Subject: [PATCH 4/4] gas/arc: Make member of arc_flags const
- Authentication-results: sourceware.org; auth=none
- References: <1462994486-12419-1-git-send-email-andrew dot burgess at embecosm dot com>
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 | 6 ++++++
gas/config/tc-arc.c | 2 +-
gas/config/tc-arc.h | 2 +-
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c
index b217e06..eca6817 100644
--- a/gas/config/tc-arc.c
+++ b/gas/config/tc-arc.c
@@ -1884,7 +1884,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[];
--
2.6.4