diff options
author | Trevor Saunders <tbsaunde+binutils@tbsaunde.org> | 2016-04-21 09:56:50 -0400 |
---|---|---|
committer | Trevor Saunders <tbsaunde+binutils@tbsaunde.org> | 2016-06-25 11:54:28 -0400 |
commit | 5703197e0421f490c3dc25ecd9ea04ca59750b64 (patch) | |
tree | 8ba800bccc2d7a29fa7910d082af6e94a8057a23 /gas/config/tc-bfin.c | |
parent | 4b92e38839652e05e7cdc86487dd18c3a2048339 (diff) | |
download | gdb-5703197e0421f490c3dc25ecd9ea04ca59750b64.zip gdb-5703197e0421f490c3dc25ecd9ea04ca59750b64.tar.gz gdb-5703197e0421f490c3dc25ecd9ea04ca59750b64.tar.bz2 |
remove a few sentinals
gas/ChangeLog:
2016-06-25 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* config/tc-bfin.c (bfin_cpus): Remove sentinal.
(md_parse_option): Adjust.
* config/tc-aarch64.c (aarch64_parse_abi): Replace use of a sentinal
with iteration from 0 to ARRAY_SIZE.
* config/tc-mcore.c (md_begin): Likewise.
* config/tc-visium.c (visium_parse_arch): Likewise.
opcodes/ChangeLog:
2016-06-25 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* mcore-opc.h: Remove sentinal.
* mcore-dis.c (print_insn_mcore): Adjust.
Diffstat (limited to 'gas/config/tc-bfin.c')
-rw-r--r-- | gas/config/tc-bfin.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/gas/config/tc-bfin.c b/gas/config/tc-bfin.c index 8958c7e..334dce4 100644 --- a/gas/config/tc-bfin.c +++ b/gas/config/tc-bfin.c @@ -324,8 +324,6 @@ struct bfin_cpu bfin_cpus[] = {"bf592", BFIN_CPU_BF592, 0x0001, AC_05000074}, {"bf592", BFIN_CPU_BF592, 0x0000, AC_05000074}, - - {NULL, 0, 0, 0} }; /* Define bfin-specific command-line options (there are none). */ @@ -357,23 +355,22 @@ md_parse_option (int c ATTRIBUTE_UNUSED, const char *arg ATTRIBUTE_UNUSED) case OPTION_MCPU: { - const char *p, *q; - int i; + const char *q; + unsigned int i; - i = 0; - while ((p = bfin_cpus[i].name) != NULL) + for (i = 0; i < ARRAY_SIZE (bfin_cpus); i++) { + const char *p = bfin_cpus[i].name; if (strncmp (arg, p, strlen (p)) == 0) break; - i++; } - if (p == NULL) + if (i == ARRAY_SIZE (bfin_cpus)) as_fatal ("-mcpu=%s is not valid", arg); bfin_cpu_type = bfin_cpus[i].type; - q = arg + strlen (p); + q = arg + strlen (bfin_cpus[i].name); if (*q == '\0') { @@ -385,7 +382,8 @@ md_parse_option (int c ATTRIBUTE_UNUSED, const char *arg ATTRIBUTE_UNUSED) else if (strcmp (q, "-any") == 0) { bfin_si_revision = 0xffff; - while (bfin_cpus[i].type == bfin_cpu_type) + while (i < ARRAY_SIZE (bfin_cpus) + && bfin_cpus[i].type == bfin_cpu_type) { bfin_anomaly_checks |= bfin_cpus[i].anomaly_checks; i++; @@ -408,11 +406,13 @@ md_parse_option (int c ATTRIBUTE_UNUSED, const char *arg ATTRIBUTE_UNUSED) bfin_si_revision = (si_major << 8) | si_minor; - while (bfin_cpus[i].type == bfin_cpu_type + while (i < ARRAY_SIZE (bfin_cpus) + && bfin_cpus[i].type == bfin_cpu_type && bfin_cpus[i].si_revision != bfin_si_revision) i++; - if (bfin_cpus[i].type != bfin_cpu_type) + if (i == ARRAY_SIZE (bfin_cpus) + || bfin_cpus[i].type != bfin_cpu_type) goto invalid_silicon_revision; bfin_anomaly_checks |= bfin_cpus[i].anomaly_checks; |