aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorTrevor Saunders <tbsaunde+binutils@tbsaunde.org>2016-05-23 00:35:40 -0400
committerTrevor Saunders <tbsaunde+binutils@tbsaunde.org>2016-06-27 05:07:30 -0400
commite066bf5f74fd776657accf02dececb7df120412f (patch)
tree9ad4741dd49f86d2d8db46c87f39f8f3afb30feb /gas
parent0708347f66e1d8e01b215fb1fe71f634249c5fc9 (diff)
downloadgdb-e066bf5f74fd776657accf02dececb7df120412f.zip
gdb-e066bf5f74fd776657accf02dececb7df120412f.tar.gz
gdb-e066bf5f74fd776657accf02dececb7df120412f.tar.bz2
xtensa: remove a sentinal
gas/ChangeLog: 2016-06-27 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/tc-xtensa.c (xtensa_elf_suffix): Use ARRAY_SIZE instead of a sentinal element. (map_suffix_reloc_to_operator): Likewise. (map_operator_to_reloc): Likewise.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog7
-rw-r--r--gas/config/tc-xtensa.c29
2 files changed, 21 insertions, 15 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 5f85ad5..131782c 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,12 @@
2016-06-27 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
+ * config/tc-xtensa.c (xtensa_elf_suffix): Use ARRAY_SIZE instead of a
+ sentinal element.
+ (map_suffix_reloc_to_operator): Likewise.
+ (map_operator_to_reloc): Likewise.
+
+2016-06-27 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
+
* config/tc-nds32.c (md_begin): Use ARRAY_SIZE instead of a sentinal
element in relax_table.
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index 5840135..d062044 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -377,7 +377,6 @@ static struct suffix_reloc_map suffix_relocs[] =
SUFFIX_MAP ("tlscall", BFD_RELOC_XTENSA_TLS_CALL, O_tlscall),
SUFFIX_MAP ("tpoff", BFD_RELOC_XTENSA_TLS_TPOFF, O_tpoff),
SUFFIX_MAP ("dtpoff", BFD_RELOC_XTENSA_TLS_DTPOFF, O_dtpoff),
- { (char *) 0, 0, BFD_RELOC_UNUSED, 0 }
};
@@ -1717,7 +1716,7 @@ xtensa_elf_suffix (char **str_p, expressionS *exp_p)
char *str2;
int ch;
int len;
- struct suffix_reloc_map *ptr;
+ unsigned int i;
if (*str++ != '@')
return BFD_RELOC_NONE;
@@ -1734,10 +1733,10 @@ xtensa_elf_suffix (char **str_p, expressionS *exp_p)
len = str2 - ident;
ch = ident[0];
- for (ptr = &suffix_relocs[0]; ptr->length > 0; ptr++)
- if (ch == ptr->suffix[0]
- && len == ptr->length
- && memcmp (ident, ptr->suffix, ptr->length) == 0)
+ for (i = 0; i < ARRAY_SIZE (suffix_relocs); i++)
+ if (ch == suffix_relocs[i].suffix[0]
+ && len == suffix_relocs[i].length
+ && memcmp (ident, suffix_relocs[i].suffix, suffix_relocs[i].length) == 0)
{
/* Now check for "identifier@suffix+constant". */
if (*str == '-' || *str == '+')
@@ -1758,7 +1757,7 @@ xtensa_elf_suffix (char **str_p, expressionS *exp_p)
}
*str_p = str;
- return ptr->reloc;
+ return suffix_relocs[i].reloc;
}
return BFD_RELOC_UNUSED;
@@ -1769,14 +1768,14 @@ xtensa_elf_suffix (char **str_p, expressionS *exp_p)
static operatorT
map_suffix_reloc_to_operator (bfd_reloc_code_real_type reloc)
{
- struct suffix_reloc_map *sfx;
operatorT operator = O_illegal;
+ unsigned int i;
- for (sfx = &suffix_relocs[0]; sfx->suffix; sfx++)
+ for (i = 0; i < ARRAY_SIZE (suffix_relocs); i++)
{
- if (sfx->reloc == reloc)
+ if (suffix_relocs[i].reloc == reloc)
{
- operator = sfx->operator;
+ operator = suffix_relocs[i].operator;
break;
}
}
@@ -1789,14 +1788,14 @@ map_suffix_reloc_to_operator (bfd_reloc_code_real_type reloc)
static bfd_reloc_code_real_type
map_operator_to_reloc (unsigned char operator, bfd_boolean is_literal)
{
- struct suffix_reloc_map *sfx;
+ unsigned int i;
bfd_reloc_code_real_type reloc = BFD_RELOC_UNUSED;
- for (sfx = &suffix_relocs[0]; sfx->suffix; sfx++)
+ for (i = 0; i < ARRAY_SIZE (suffix_relocs); i++)
{
- if (sfx->operator == operator)
+ if (suffix_relocs[i].operator == operator)
{
- reloc = sfx->reloc;
+ reloc = suffix_relocs[i].reloc;
break;
}
}