This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[COMMIT PATCH] Make GDB -Wpointer-sign clean on MinGW too.


This is the remaining issue impeding GDB to build with "-Wpointer-sign
-Werror" with Fedora 17's i686-w64-mingw32 cross toolchain.

../../src/gdb/ser-tcp.c: In function 'net_read_prim':
../../src/gdb/ser-tcp.c:341:3: error: pointer targets in passing argument 2 of 'recv' differ in signedness [-Werror=pointer-sign]
In file included from ../../src/gdb/serial.h:23:0,
                 from ../../src/gdb/ser-tcp.c:21:
/usr/i686-w64-mingw32/sys-root/mingw/include/winsock2.h:983:34: note: expected 'char *' but argument is of type 'unsigned char *'

gdb/
2013-04-19  Pedro Alves  <palves@redhat.com>

	* ser-tcp.c (net_read_prim): Cast second argument to recv to
	'void *'.
---
 gdb/ser-tcp.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
index e4fbf26..75c8b76 100644
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -338,7 +338,10 @@ net_close (struct serial *scb)
 int
 net_read_prim (struct serial *scb, size_t count)
 {
-  return recv (scb->fd, scb->buf, count, 0);
+  /* Need to cast to silence -Wpointer-sign on MinGW, as Winsock's
+     'recv' takes 'char *' as second argument, while 'scb->buf' is
+     'unsigned char *'.  */
+  return recv (scb->fd, (void *) scb->buf, count, 0);
 }
 
 int


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]