This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[COMMIT PATCH] corefile.c: fix -Wpointer-sign
- From: Pedro Alves <palves at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 07 Mar 2013 23:36:12 +0000
- Subject: [COMMIT PATCH] corefile.c: fix -Wpointer-sign
$ make WERROR_CFLAGS="-Wpointer-sign -Werror" corefile.o -k 2>&1 1>/dev/null
../../src/gdb/corefile.c: In function âread_memory_stringâ:
../../src/gdb/corefile.c:334:7: error: pointer targets in passing argument 2 of âread_memoryâ differ in signedness [-Werror=pointer-sign]
../../src/gdb/corefile.c:217:1: note: expected âgdb_byte *â but argument is of type âchar *â
Functions that take or return ascii-ish string arguments usually use
char* for parameters/return. That means that at points we call into
target methods that work with binary blobs, we need casts to
gdb_byte*.
gdb/
2013-03-07 Pedro Alves <palves@redhat.com>
* corefile.c (read_memory_string): Cast pointer to gdb_byte* in
call.
---
gdb/corefile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/corefile.c b/gdb/corefile.c
index b268d4c..9c795b8 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -331,7 +331,7 @@ read_memory_string (CORE_ADDR memaddr, char *buffer, int max_len)
cnt = max_len - (cp - buffer);
if (cnt > 8)
cnt = 8;
- read_memory (memaddr + (int) (cp - buffer), cp, cnt);
+ read_memory (memaddr + (int) (cp - buffer), (gdb_byte *) cp, cnt);
for (i = 0; i < cnt && *cp; i++, cp++)
; /* null body */