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.
This commit is contained in:
Trevor Saunders 2016-05-23 00:35:40 -04:00
parent 0708347f66
commit e066bf5f74
2 changed files with 21 additions and 15 deletions

View file

@ -1,3 +1,10 @@
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

View file

@ -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;
}
}