This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Fix pointer assignment with different signedness
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Tue, 7 Jan 2014 21:55:20 +0800
- Subject: [PATCH] Fix pointer assignment with different signedness
- Authentication-results: sourceware.org; auth=none
This patch fixes these build errors below:
../../binutils-gdb/gdb/spu-linux-nat.c: In function âspu_symbol_file_add_from_memoryâ:
../../binutils-gdb/gdb/spu-linux-nat.c:368:3: error: pointer targets in passing argument 2 of âspu_proc_xfer_spuâ differ in signedness [-Werror=pointer-sign]
../../binutils-gdb/gdb/spu-linux-nat.c:232:1: note: expected âgdb_byte *â but argument is of type âchar *â
../../binutils-gdb/gdb/spu-linux-nat.c: In function âspu_xfer_partialâ:
../../binutils-gdb/gdb/spu-linux-nat.c:598:7: error: pointer targets in passing argument 1 of âstrtoulstâ differ in signedness [-Werror=pointer-sign]
In file included from ../../binutils-gdb/gdb/defs.h:769:0,
from ../../binutils-gdb/gdb/spu-linux-nat.c:21:
../../binutils-gdb/gdb/utils.h:43:15: note: expected âconst char *â but argument is of type âgdb_byte *â
Is it OK?
gdb:
2014-01-07 Yao Qi <yao@codesourcery.com>
* spu-linux-nat.c (spu_symbol_file_add_from_memory): Change
type of 'id' to gdb_byte. Cast 'id' to 'const char *'.
(spu_xfer_partial): Cast 'buf' to 'const char *'.
---
gdb/spu-linux-nat.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c
index cfd5fd9..4c62ec7 100644
--- a/gdb/spu-linux-nat.c
+++ b/gdb/spu-linux-nat.c
@@ -359,7 +359,7 @@ spu_symbol_file_add_from_memory (int inferior_fd)
ULONGEST addr;
struct bfd *nbfd;
- char id[128];
+ gdb_byte id[128];
char annex[32];
int len;
@@ -369,7 +369,7 @@ spu_symbol_file_add_from_memory (int inferior_fd)
if (len <= 0 || len >= sizeof id)
return;
id[len] = 0;
- addr = strtoulst (id, NULL, 16);
+ addr = strtoulst ((const char *) id, NULL, 16);
if (!addr)
return;
@@ -596,7 +596,7 @@ spu_xfer_partial (struct target_ops *ops,
if (spu_proc_xfer_spu (lslr_annex, buf, NULL, 0, sizeof buf) <= 0)
return ret;
- lslr = strtoulst (buf, NULL, 16);
+ lslr = strtoulst ((const char *) buf, NULL, 16);
return spu_proc_xfer_spu (mem_annex, readbuf, writebuf,
offset & lslr, len);
}
--
1.7.7.6