aboutsummaryrefslogtreecommitdiff
path: root/sim/rx
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2021-02-01 11:37:46 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2021-02-08 11:01:07 +0000
commitda9ecd6085aa03f6f671f1e42431642912635820 (patch)
tree29ab615d0271ba45401ada319911f7ee1476a545 /sim/rx
parentfab2b376e305bfb4c55a51a15d8c7a293628d735 (diff)
downloadgdb-da9ecd6085aa03f6f671f1e42431642912635820.zip
gdb-da9ecd6085aa03f6f671f1e42431642912635820.tar.gz
gdb-da9ecd6085aa03f6f671f1e42431642912635820.tar.bz2
sim/rx: avoid pointer arithmetic on void * pointers
Pointer arithmetic on void * pointers results in a GCC warning. Avoid the warning by casting the pointer to its actual type earlier in the function. sim/rx/ChangeLog: * mem.c (mem_put_blk): Rename parameter, add cast from parameter type to local type. Remove cast later in the function. (mem_get_blk): Likewise. * mem.h (mem_put_blk): Rename parameter to match definition. (mem_get_blk): Likewise.
Diffstat (limited to 'sim/rx')
-rw-r--r--sim/rx/ChangeLog8
-rw-r--r--sim/rx/mem.c12
-rw-r--r--sim/rx/mem.h4
3 files changed, 18 insertions, 6 deletions
diff --git a/sim/rx/ChangeLog b/sim/rx/ChangeLog
index d71bb44..b3d76be 100644
--- a/sim/rx/ChangeLog
+++ b/sim/rx/ChangeLog
@@ -1,5 +1,13 @@
2021-02-08 Andrew Burgess <andrew.burgess@embecosm.com>
+ * mem.c (mem_put_blk): Rename parameter, add cast from parameter
+ type to local type. Remove cast later in the function.
+ (mem_get_blk): Likewise.
+ * mem.h (mem_put_blk): Rename parameter to match definition.
+ (mem_get_blk): Likewise.
+
+2021-02-08 Andrew Burgess <andrew.burgess@embecosm.com>
+
* load.c: Replace 'elf/internal.h' and 'elf/common.h' includes
with 'elf-bfd.h' include.
* trace.c: Add 'trace.h' include.
diff --git a/sim/rx/mem.c b/sim/rx/mem.c
index fe8e08d..7e62bfb 100644
--- a/sim/rx/mem.c
+++ b/sim/rx/mem.c
@@ -434,13 +434,15 @@ mem_put_si (int address, unsigned long value)
}
void
-mem_put_blk (int address, void *bufptr, int nbytes)
+mem_put_blk (int address, void *bufptr_void, int nbytes)
{
+ unsigned char *bufptr = (unsigned char *) bufptr_void;
+
S ("<=");
if (enable_counting)
mem_counters[1][1] += nbytes;
while (nbytes--)
- mem_put_byte (address++, *(unsigned char *) bufptr++);
+ mem_put_byte (address++, *bufptr++);
E ();
}
@@ -567,13 +569,15 @@ mem_get_si (int address)
}
void
-mem_get_blk (int address, void *bufptr, int nbytes)
+mem_get_blk (int address, void *bufptr_void, int nbytes)
{
+ char *bufptr = (char *) bufptr_void;
+
S ("=>");
if (enable_counting)
mem_counters[0][1] += nbytes;
while (nbytes--)
- *(char *) bufptr++ = mem_get_byte (address++);
+ *bufptr++ = mem_get_byte (address++);
E ();
}
diff --git a/sim/rx/mem.h b/sim/rx/mem.h
index 21080f6..a4c7455 100644
--- a/sim/rx/mem.h
+++ b/sim/rx/mem.h
@@ -53,7 +53,7 @@ void mem_put_hi (int address, unsigned short value);
void mem_put_psi (int address, unsigned long value);
void mem_put_si (int address, unsigned long value);
-void mem_put_blk (int address, void *bufptr, int nbytes);
+void mem_put_blk (int address, void *bufptr_void, int nbytes);
unsigned char mem_get_pc (int address);
@@ -62,7 +62,7 @@ unsigned short mem_get_hi (int address);
unsigned long mem_get_psi (int address);
unsigned long mem_get_si (int address);
-void mem_get_blk (int address, void *bufptr, int nbytes);
+void mem_get_blk (int address, void *bufptr_void, int nbytes);
int sign_ext (int v, int bits);