diff options
author | Pedro Alves <palves@redhat.com> | 2013-04-19 15:26:17 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2013-04-19 15:26:17 +0000 |
commit | c628b528e091211bd746e5c9b18b5bc7298d01f3 (patch) | |
tree | 6c324664ccf9646b04e3e56162d4b3f6d3b69ff6 /gdb/ser-base.h | |
parent | 51a5cd9059b96a2ac33cf149d369db12b891fd96 (diff) | |
download | gdb-c628b528e091211bd746e5c9b18b5bc7298d01f3.zip gdb-c628b528e091211bd746e5c9b18b5bc7298d01f3.tar.gz gdb-c628b528e091211bd746e5c9b18b5bc7298d01f3.tar.bz2 |
serial_write: change prototype to take a void-pointer buffer.
While remote.c works with "char *" buffers most of the time, other
remote targets have binary-ish-er protocols, and choose to use
"unsigned char" throughout, like e.g., remote-mips.c or
remote-m32r-sdi.c. That results in -Wpointer-sign warnings in those
targets, unless we add casts in calls to serial_write. Since
serial_write is only concerned about sending raw host bytes out, and
serial_ops->write_prim already works with "void *"/"size_t", a similar
interface to the "write" or "send" system calls, I find it natural to
change serial_write's prototype accordingly, avoiding the need for
casts.
Tested on x86_64 Fedora 17, and also by building x86_64-mingw32
and DJGPP/go32 -hosted gdbs.
gdb/
2013-04-19 Pedro Alves <palves@redhat.com>
* ser-base.c (ser_base_write): Change prototype -- take 'void *'
buffer and size_t size. Adjust.
* ser-base.h (ser_base_write): Adjust.
* ser-go32.c (cnts): Change type to size_t.
(dos_write): Change prototype -- take 'void *'
buffer and size_t size. Adjust.
(dos_info): Print elements of 'cnts' as unsigned long.
* serial.c (serial_write): Likewise.
* serial.h (serial_write): Adjust.
(struct serial_ops) <write>: Change prototype -- take 'void *'
buffer and size_t size. Adjust.
Diffstat (limited to 'gdb/ser-base.h')
-rw-r--r-- | gdb/ser-base.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/ser-base.h b/gdb/ser-base.h index 175bf20..e5fe9e1 100644 --- a/gdb/ser-base.h +++ b/gdb/ser-base.h @@ -45,7 +45,7 @@ extern int ser_base_setbaudrate (struct serial *scb, int rate); extern int ser_base_setstopbits (struct serial *scb, int rate); extern int ser_base_drain_output (struct serial *scb); -extern int ser_base_write (struct serial *scb, const char *str, int len); +extern int ser_base_write (struct serial *scb, const void *buf, size_t count); extern void ser_base_async (struct serial *scb, int async_p); extern int ser_base_readchar (struct serial *scb, int timeout); |