aboutsummaryrefslogtreecommitdiff
path: root/sim/arm
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2017-02-13 00:12:35 -0500
committerMike Frysinger <vapier@gentoo.org>2017-02-13 01:26:21 -0500
commit13a590ca65f744c8fa55d6e0748cb12f443493f0 (patch)
tree0aaec23ac3d6682a00d7af03dbef8e790c47b681 /sim/arm
parentb1499fc214c2877ba76d7dffd4c41e33f3ec37f6 (diff)
downloadgdb-13a590ca65f744c8fa55d6e0748cb12f443493f0.zip
gdb-13a590ca65f744c8fa55d6e0748cb12f443493f0.tar.gz
gdb-13a590ca65f744c8fa55d6e0748cb12f443493f0.tar.bz2
sim: use ARRAY_SIZE instead of ad-hoc sizeof calculations
Diffstat (limited to 'sim/arm')
-rw-r--r--sim/arm/ChangeLog8
-rw-r--r--sim/arm/armos.c3
-rw-r--r--sim/arm/armsupp.c3
-rw-r--r--sim/arm/wrapper.c2
4 files changed, 13 insertions, 3 deletions
diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog
index 2ce9429..488178a 100644
--- a/sim/arm/ChangeLog
+++ b/sim/arm/ChangeLog
@@ -1,3 +1,11 @@
+2017-02-13 Mike Frysinger <vapier@gentoo.org>
+
+ * armos.c: Include libiberty.h.
+ (SWIopen): Use ARRAY_SIZE.
+ * armsupp.c: Include libiberty.h.
+ (ModeToBank): Use ARRAY_SIZE.
+ * wrapper.c (sim_target_parse_command_line): Likewise.
+
2016-07-14 Nick Clifton <nickc@redhat.com>
* armemu.c (Multiply64): Only issue error messages about invalid
diff --git a/sim/arm/armos.c b/sim/arm/armos.c
index ea3d229..76c449b 100644
--- a/sim/arm/armos.c
+++ b/sim/arm/armos.c
@@ -23,6 +23,7 @@
#include "config.h"
#include "ansidecl.h"
+#include "libiberty.h"
#include <time.h>
#include <errno.h>
@@ -260,7 +261,7 @@ SWIopen (ARMul_State * state, ARMword name, ARMword SWIflags)
return;
/* Now we need to decode the Demon open mode. */
- if (SWIflags >= sizeof (translate_open_mode) / sizeof (translate_open_mode[0]))
+ if (SWIflags >= ARRAY_SIZE (translate_open_mode))
flags = 0;
else
flags = translate_open_mode[SWIflags];
diff --git a/sim/arm/armsupp.c b/sim/arm/armsupp.c
index 3ff4bf9..11bb53c 100644
--- a/sim/arm/armsupp.c
+++ b/sim/arm/armsupp.c
@@ -17,6 +17,7 @@
#include "armdefs.h"
#include "armemu.h"
#include "ansidecl.h"
+#include "libiberty.h"
#include <math.h>
/* Definitions for the support routines. */
@@ -373,7 +374,7 @@ ModeToBank (ARMword mode)
DUMMYBANK, DUMMYBANK, DUMMYBANK, SYSTEMBANK
};
- if (mode >= (sizeof (bankofmode) / sizeof (bankofmode[0])))
+ if (mode >= ARRAY_SIZE (bankofmode))
return DUMMYBANK;
return bankofmode[mode];
diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c
index efbeef9..01f88d1 100644
--- a/sim/arm/wrapper.c
+++ b/sim/arm/wrapper.c
@@ -740,7 +740,7 @@ sim_target_parse_command_line (int argc, char ** argv)
{
int i;
- for (i = sizeof options / sizeof options[0]; i--;)
+ for (i = ARRAY_SIZE (options); i--;)
if (strncmp (ptr, options[i].swi_option,
strlen (options[i].swi_option)) == 0)
{