From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 01/11] [C++/mingw] ser-mingw.c casts
Date: Mon, 02 Nov 2015 19:36:00 -0000 [thread overview]
Message-ID: <1446492970-21432-2-git-send-email-palves@redhat.com> (raw)
In-Reply-To: <1446492970-21432-1-git-send-email-palves@redhat.com>
2015-11-01 Pedro Alves <palves@redhat.com>
* ser-mingw.c (CancelIo_ftype): New typedef.
(CancelIo): Use CancelIo_ftype.
(ser_windows_close, ser_windows_wait_handle)
(ser_windows_read_prim, stop_select_thread)
(console_select_thread, pipe_select_thread, file_select_thread)
(ser_console_wait_handle, ser_console_done_wait_handle)
(ser_console_close, cleanup_pipe_state, pipe_windows_close)
(pipe_windows_write, pipe_wait_handle, pipe_done_wait_handle)
(net_windows_socket_check_pending, net_windows_select_thread)
(net_windows_wait_handle, net_windows_done_wait_handle)
(net_windows_close): Add casts.
(_initialize_ser_windows): Cast to CancelIo_ftype* instead of
void*.
---
gdb/ser-mingw.c | 51 ++++++++++++++++++++++++++-------------------------
1 file changed, 26 insertions(+), 25 deletions(-)
diff --git a/gdb/ser-mingw.c b/gdb/ser-mingw.c
index e3a0ec9..3cab520 100644
--- a/gdb/ser-mingw.c
+++ b/gdb/ser-mingw.c
@@ -44,7 +44,8 @@ struct ser_windows_state
/* CancelIo is not available for Windows 95 OS, so we need to use
LoadLibrary/GetProcAddress to avoid a startup failure. */
#define CancelIo dyn_CancelIo
-static BOOL WINAPI (*CancelIo) (HANDLE);
+typedef BOOL WINAPI (CancelIo_ftype) (HANDLE);
+static CancelIo_ftype *CancelIo;
/* Open up a real live device for serial I/O. */
@@ -254,7 +255,7 @@ ser_windows_close (struct serial *scb)
by calling close (scb->fd) below. */
if (CancelIo)
CancelIo ((HANDLE) _get_osfhandle (scb->fd));
- state = scb->state;
+ state = (struct ser_windows_state *) scb->state;
CloseHandle (state->ov.hEvent);
CloseHandle (state->except_event);
@@ -275,7 +276,7 @@ ser_windows_wait_handle (struct serial *scb, HANDLE *read, HANDLE *except)
DWORD errors;
HANDLE h = (HANDLE) _get_osfhandle (scb->fd);
- state = scb->state;
+ state = (struct ser_windows_state *) scb->state;
*except = state->except_event;
*read = state->ov.hEvent;
@@ -328,7 +329,7 @@ ser_windows_read_prim (struct serial *scb, size_t count)
HANDLE h;
gdb_byte *p;
- state = scb->state;
+ state = (struct ser_windows_state *) scb->state;
if (state->in_progress)
{
WaitForSingleObject (state->ov.hEvent, INFINITE);
@@ -532,12 +533,12 @@ stop_select_thread (struct ser_console_state *state)
static DWORD WINAPI
console_select_thread (void *arg)
{
- struct serial *scb = arg;
+ struct serial *scb = (struct serial *) arg;
struct ser_console_state *state;
int event_index;
HANDLE h;
- state = scb->state;
+ state = (struct ser_console_state *) scb->state;
h = (HANDLE) _get_osfhandle (scb->fd);
while (1)
@@ -635,12 +636,12 @@ fd_is_file (int fd)
static DWORD WINAPI
pipe_select_thread (void *arg)
{
- struct serial *scb = arg;
+ struct serial *scb = (struct serial *) arg;
struct ser_console_state *state;
int event_index;
HANDLE h;
- state = scb->state;
+ state = (struct ser_console_state *) scb->state;
h = (HANDLE) _get_osfhandle (scb->fd);
while (1)
@@ -678,12 +679,12 @@ pipe_select_thread (void *arg)
static DWORD WINAPI
file_select_thread (void *arg)
{
- struct serial *scb = arg;
+ struct serial *scb = (struct serial *) arg;
struct ser_console_state *state;
int event_index;
HANDLE h;
- state = scb->state;
+ state = (struct ser_console_state *) scb->state;
h = (HANDLE) _get_osfhandle (scb->fd);
while (1)
@@ -704,7 +705,7 @@ file_select_thread (void *arg)
static void
ser_console_wait_handle (struct serial *scb, HANDLE *read, HANDLE *except)
{
- struct ser_console_state *state = scb->state;
+ struct ser_console_state *state = (struct ser_console_state *) scb->state;
if (state == NULL)
{
@@ -758,7 +759,7 @@ ser_console_wait_handle (struct serial *scb, HANDLE *read, HANDLE *except)
static void
ser_console_done_wait_handle (struct serial *scb)
{
- struct ser_console_state *state = scb->state;
+ struct ser_console_state *state = (struct ser_console_state *) scb->state;
if (state == NULL)
return;
@@ -769,7 +770,7 @@ ser_console_done_wait_handle (struct serial *scb)
static void
ser_console_close (struct serial *scb)
{
- struct ser_console_state *state = scb->state;
+ struct ser_console_state *state = (struct ser_console_state *) scb->state;
if (scb->state)
{
@@ -854,7 +855,7 @@ free_pipe_state (struct pipe_state *ps)
static void
cleanup_pipe_state (void *untyped)
{
- struct pipe_state *ps = untyped;
+ struct pipe_state *ps = (struct pipe_state *) untyped;
free_pipe_state (ps);
}
@@ -957,7 +958,7 @@ pipe_windows_fdopen (struct serial *scb, int fd)
static void
pipe_windows_close (struct serial *scb)
{
- struct pipe_state *ps = scb->state;
+ struct pipe_state *ps = (struct pipe_state *) scb->state;
/* In theory, we should try to kill the subprocess here, but the pex
interface doesn't give us enough information to do that. Usually
@@ -993,7 +994,7 @@ pipe_windows_read (struct serial *scb, size_t count)
static int
pipe_windows_write (struct serial *scb, const void *buf, size_t count)
{
- struct pipe_state *ps = scb->state;
+ struct pipe_state *ps = (struct pipe_state *) scb->state;
HANDLE pipeline_in;
DWORD written;
@@ -1015,7 +1016,7 @@ pipe_windows_write (struct serial *scb, const void *buf, size_t count)
static void
pipe_wait_handle (struct serial *scb, HANDLE *read, HANDLE *except)
{
- struct pipe_state *ps = scb->state;
+ struct pipe_state *ps = (struct pipe_state *) scb->state;
/* Have we allocated our events yet? */
if (ps->wait.read_event == INVALID_HANDLE_VALUE)
@@ -1036,7 +1037,7 @@ pipe_wait_handle (struct serial *scb, HANDLE *read, HANDLE *except)
static void
pipe_done_wait_handle (struct serial *scb)
{
- struct pipe_state *ps = scb->state;
+ struct pipe_state *ps = (struct pipe_state *) scb->state;
/* Have we allocated our events yet? */
if (ps->wait.read_event == INVALID_HANDLE_VALUE)
@@ -1080,7 +1081,7 @@ struct net_windows_state
static int
net_windows_socket_check_pending (struct serial *scb)
{
- struct net_windows_state *state = scb->state;
+ struct net_windows_state *state = (struct net_windows_state *) scb->state;
unsigned long available;
if (ioctlsocket (scb->fd, FIONREAD, &available) != 0)
@@ -1101,11 +1102,11 @@ net_windows_socket_check_pending (struct serial *scb)
static DWORD WINAPI
net_windows_select_thread (void *arg)
{
- struct serial *scb = arg;
+ struct serial *scb = (struct serial *) arg;
struct net_windows_state *state;
int event_index;
- state = scb->state;
+ state = (struct net_windows_state *) scb->state;
while (1)
{
@@ -1170,7 +1171,7 @@ net_windows_select_thread (void *arg)
static void
net_windows_wait_handle (struct serial *scb, HANDLE *read, HANDLE *except)
{
- struct net_windows_state *state = scb->state;
+ struct net_windows_state *state = (struct net_windows_state *) scb->state;
/* Start from a clean slate. */
ResetEvent (state->base.read_event);
@@ -1189,7 +1190,7 @@ net_windows_wait_handle (struct serial *scb, HANDLE *read, HANDLE *except)
static void
net_windows_done_wait_handle (struct serial *scb)
{
- struct net_windows_state *state = scb->state;
+ struct net_windows_state *state = (struct net_windows_state *) scb->state;
stop_select_thread (&state->base);
}
@@ -1222,7 +1223,7 @@ net_windows_open (struct serial *scb, const char *name)
static void
net_windows_close (struct serial *scb)
{
- struct net_windows_state *state = scb->state;
+ struct net_windows_state *state = (struct net_windows_state *) scb->state;
destroy_select_thread (&state->base);
CloseHandle (state->sock_event);
@@ -1370,7 +1371,7 @@ _initialize_ser_windows (void)
hm = LoadLibrary ("kernel32.dll");
if (hm)
{
- CancelIo = (void *) GetProcAddress (hm, "CancelIo");
+ CancelIo = (CancelIo_ftype *) GetProcAddress (hm, "CancelIo");
FreeLibrary (hm);
}
else
--
1.9.3
next prev parent reply other threads:[~2015-11-02 19:36 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-02 19:36 [PATCH 00/11] C++/MinGW patches Pedro Alves
2015-11-02 19:36 ` [PATCH 10/11] [C++/mingw] Fix windows-nat.c::xlate Pedro Alves
2015-11-02 19:36 ` [PATCH 03/11] [C++/mingw] gdb-dlfcn.c casts Pedro Alves
2015-11-02 19:36 ` [PATCH 11/11] [C++/mingw] gdbserver: gdb/host signal mixup Pedro Alves
2015-11-02 19:36 ` [PATCH 04/11] [C++/mingw] windows-nat.c casts Pedro Alves
2015-11-02 19:36 ` Pedro Alves [this message]
2015-11-02 19:36 ` [PATCH 06/11] [C++/mingw] ser-tcp.c casts Pedro Alves
2015-11-02 20:40 ` Simon Marchi
2015-11-02 20:55 ` Pedro Alves
2015-11-02 21:06 ` Pedro Alves
2015-11-02 19:36 ` [PATCH 02/11] [C++/mingw] Misc alloca casts Pedro Alves
2015-11-02 19:43 ` [PATCH 09/11] [C++/mingw] handle_output_debug_string Pedro Alves
2015-11-02 19:44 ` [PATCH 07/11] [C++/mingw] Define __STDC_CONSTANT_MACROS / __STDC_LIMIT_MACROS for stdint.h Pedro Alves
2015-11-02 20:47 ` Simon Marchi
2015-11-03 13:58 ` Simon Marchi
2015-11-03 14:07 ` Pedro Alves
2015-11-03 14:15 ` Simon Marchi
2015-11-03 15:13 ` Pedro Alves
2015-11-02 19:44 ` [PATCH 05/11] [C++/mingw] gdbserver casts Pedro Alves
2015-11-02 19:45 ` [PATCH 08/11] [C++/mingw] Simplify first chance exception handling Pedro Alves
2015-11-02 21:01 ` Simon Marchi
2015-11-02 21:09 ` Pedro Alves
2015-11-02 20:05 ` [PATCH 00/11] C++/MinGW patches Pedro Alves
2015-11-02 20:22 ` Qian Hong
2015-11-02 20:46 ` Pedro Alves
2015-11-02 21:17 ` Qian Hong
2015-11-02 23:31 ` Pedro Alves
2015-11-03 9:06 ` Qian Hong
2015-11-03 10:47 ` Qian Hong
2015-11-03 11:15 ` Qian Hong
2015-11-03 11:26 ` Pedro Alves
2015-11-03 11:41 ` Qian Hong
2015-11-03 12:11 ` Qian Hong
2015-11-03 12:34 ` Pedro Alves
2015-11-03 11:20 ` Pedro Alves
2015-11-03 16:54 ` Pedro Alves
2015-11-03 18:59 ` Qian Hong
2015-11-03 21:03 ` Qian Hong
2015-11-03 22:39 ` Pedro Alves
2015-11-09 9:53 ` Qian Hong
2015-11-17 14:50 ` Pedro Alves
2015-11-30 15:03 ` Qian Hong
2015-11-30 15:48 ` Pedro Alves
2015-11-03 12:24 ` Qian Hong
2015-11-03 12:27 ` Pedro Alves
2015-11-03 12:56 ` Qian Hong
2015-11-03 13:08 ` Pedro Alves
2015-11-03 13:23 ` Qian Hong
2015-11-03 16:52 ` Pedro Alves
2015-11-03 13:10 ` Pedro Alves
2015-11-02 21:04 ` Simon Marchi
2015-11-17 15:28 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1446492970-21432-2-git-send-email-palves@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox