aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrevor Saunders <tbsaunde+binutils@tbsaunde.org>2016-05-13 02:51:41 -0400
committerTrevor Saunders <tbsaunde+binutils@tbsaunde.org>2016-06-01 21:22:31 -0400
commit814f1489e9d1d92a30d94d69a0066addcc564bd2 (patch)
treeb2238aaf40bb24cb152d9b5b0f4b3d7a77c05828
parentd05584d3eeab4cb1c1d85d8dfdfef56827e03b3d (diff)
downloadgdb-814f1489e9d1d92a30d94d69a0066addcc564bd2.zip
gdb-814f1489e9d1d92a30d94d69a0066addcc564bd2.tar.gz
gdb-814f1489e9d1d92a30d94d69a0066addcc564bd2.tar.bz2
avr: replace sentinal with iteration from 0 to ARRAY_SIZE
This seems a little easier to understand than using a sentinal, and will hopefully let the compiler optimize the loop better. It also has the effect that we stop initializing a field of the sentinal that is an enum with zero. gas/ChangeLog: 2016-06-01 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/tc-avr.c (avr_parse_cons_expression): Replace iteration to sentinal with iteration to array size.
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-avr.c7
2 files changed, 8 insertions, 4 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index ff6adf3..62e07cd 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,10 @@
2016-06-01 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
+ * config/tc-avr.c (avr_parse_cons_expression): Replace iteration to
+ sentinal with iteration to array size.
+
+2016-06-01 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
+
* config/xtensa-relax.h: Move typedefs of enums to the enums
definition.
diff --git a/gas/config/tc-avr.c b/gas/config/tc-avr.c
index abcbcc7..ee3140d 100644
--- a/gas/config/tc-avr.c
+++ b/gas/config/tc-avr.c
@@ -1731,8 +1731,6 @@ const exp_mod_data_t exp_mod_data[] =
{ "hi8", 1, BFD_RELOC_AVR_8_HI, "`hi8' " },
{ "hlo8", 1, BFD_RELOC_AVR_8_HLO, "`hlo8' " },
{ "hh8", 1, BFD_RELOC_AVR_8_HLO, "`hh8' " },
- /* End of list. */
- { NULL, 0, 0, NULL }
};
/* Parse special CONS expression: pm (expression) or alternatively
@@ -1742,16 +1740,17 @@ const exp_mod_data_t exp_mod_data[] =
const exp_mod_data_t *
avr_parse_cons_expression (expressionS *exp, int nbytes)
{
- const exp_mod_data_t *pexp = &exp_mod_data[0];
char *tmp;
+ unsigned int i;
tmp = input_line_pointer = skip_space (input_line_pointer);
/* The first entry of exp_mod_data[] contains an entry if no
expression modifier is present. Skip it. */
- for (pexp++; pexp->name; pexp++)
+ for (i = 0; i < ARRAY_SIZE (exp_mod_data); i++)
{
+ const exp_mod_data_t *pexp = &exp_mod_data[i];
int len = strlen (pexp->name);
if (nbytes == pexp->nbytes