Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] Correct the type of sigFOO_token
  2012-10-21  2:59 [obv 0/2] Minor cleanup in event-top.c Yao Qi
@ 2012-10-21  2:59 ` Yao Qi
  2012-10-22 14:21   ` Tom Tromey
  2012-10-21  2:59 ` [PATCH 2/2] Remove mark_async_signal_handler_wrapper Yao Qi
  1 sibling, 1 reply; 5+ messages in thread
From: Yao Qi @ 2012-10-21  2:59 UTC (permalink / raw)
  To: gdb-patches

Hi,
These signal tokens can be defined in type 'struct
async_signal_handler *' instead of 'void *'.  This patch is do this.

gdb:

2012-10-21  Yao Qi  <yao@codesourcery.com>

	* event-top.c (sigint_token, sighup_token): Replace 'void *' with
	'static struct async_signal_handler *'.
	(sighup_token, sigquit_token, sigstp_token): Likewise.
---
 gdb/event-top.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gdb/event-top.c b/gdb/event-top.c
index 4f3363c..1e0626a 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -123,16 +123,16 @@ int input_fd;
    handlers mark these functions as ready to be executed and the event
    loop, in a later iteration, calls them.  See the function
    invoke_async_signal_handler.  */
-void *sigint_token;
+static struct async_signal_handler *sigint_token;
 #ifdef SIGHUP
-void *sighup_token;
+static struct async_signal_handler *sighup_token;
 #endif
 #ifdef SIGQUIT
-void *sigquit_token;
+static struct async_signal_handler *sigquit_token;
 #endif
-void *sigfpe_token;
+static struct async_signal_handler *sigfpe_token;
 #ifdef STOP_SIGNAL
-void *sigtstp_token;
+static struct async_signal_handler *sigtstp_token;
 #endif
 
 /* Structure to save a partially entered command.  This is used when
-- 
1.7.7.6


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] Remove mark_async_signal_handler_wrapper.
  2012-10-21  2:59 [obv 0/2] Minor cleanup in event-top.c Yao Qi
  2012-10-21  2:59 ` [PATCH 1/2] Correct the type of sigFOO_token Yao Qi
@ 2012-10-21  2:59 ` Yao Qi
  2012-10-22 14:23   ` Tom Tromey
  1 sibling, 1 reply; 5+ messages in thread
From: Yao Qi @ 2012-10-21  2:59 UTC (permalink / raw)
  To: gdb-patches

Hi,
Back to year 1999~2000, the type of sigFOO_token is PTR, and
mark_async_signal_handler_wrapper is to cast parameter from type PTR
to 'struct async_signal_handler *'.  After 2001, looks we started to
eliminate PTR from source, and the type of sigFOO_toke is changed to
'void *'.  After previous patch, the type is finally changed to
'struct async_signal_handler *', so the cast is not necessary anymore.

This patch removes function 'mark_async_signal_handler_wrapper', and
use 'mark_async_signal_handler' instead.

gdb:

2012-10-21  Yao Qi  <yao@codesourcery.com>

	* event-top.c (mark_async_signal_handler_wrapper): Remove.
	* event-top.h: Remove its declaration.
	(async_request_quit): Call mark_async_signal_handler instead of
	mark_async_signal_handler_wrapper.
	(async_do_nothing, async_disconnect): Likewise.
	(async_stop_sig): Likewise.
	* remote.c (handle_remote_sigint): Likewise.
	(handle_remote_sigint_twice): Likewise.
---
 gdb/event-top.c |   14 ++++----------
 gdb/event-top.h |    1 -
 gdb/remote.c    |    4 ++--
 3 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/gdb/event-top.c b/gdb/event-top.c
index 1e0626a..5c533e4 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -770,12 +770,6 @@ async_init_signals (void)
 
 }
 
-void
-mark_async_signal_handler_wrapper (void *token)
-{
-  mark_async_signal_handler ((struct async_signal_handler *) token);
-}
-
 /* Tell the event loop what to do if SIGINT is received.
    See event-signal.c.  */
 void
@@ -829,7 +823,7 @@ async_request_quit (gdb_client_data arg)
 static void
 handle_sigquit (int sig)
 {
-  mark_async_signal_handler_wrapper (sigquit_token);
+  mark_async_signal_handler (sigquit_token);
   signal (sig, handle_sigquit);
 }
 #endif
@@ -850,7 +844,7 @@ async_do_nothing (gdb_client_data arg)
 static void
 handle_sighup (int sig)
 {
-  mark_async_signal_handler_wrapper (sighup_token);
+  mark_async_signal_handler (sighup_token);
   signal (sig, handle_sighup);
 }
 
@@ -886,7 +880,7 @@ async_disconnect (gdb_client_data arg)
 void
 handle_stop_sig (int sig)
 {
-  mark_async_signal_handler_wrapper (sigtstp_token);
+  mark_async_signal_handler (sigtstp_token);
   signal (sig, handle_stop_sig);
 }
 
@@ -926,7 +920,7 @@ async_stop_sig (gdb_client_data arg)
 static void
 handle_sigfpe (int sig)
 {
-  mark_async_signal_handler_wrapper (sigfpe_token);
+  mark_async_signal_handler (sigfpe_token);
   signal (sig, handle_sigfpe);
 }
 
diff --git a/gdb/event-top.h b/gdb/event-top.h
index 76a790e..76b24b8 100644
--- a/gdb/event-top.h
+++ b/gdb/event-top.h
@@ -46,7 +46,6 @@ extern void handle_stop_sig (int sig);
 extern void handle_sigint (int sig);
 extern void handle_sigterm (int sig);
 extern void gdb_readline2 (void *client_data);
-extern void mark_async_signal_handler_wrapper (void *token);
 extern void async_request_quit (void *arg);
 extern void stdin_event_handler (int error, void *client_data);
 extern void async_disable_stdin (void);
diff --git a/gdb/remote.c b/gdb/remote.c
index 1409380..3786dff 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -4886,7 +4886,7 @@ static void
 handle_remote_sigint (int sig)
 {
   signal (sig, handle_remote_sigint_twice);
-  mark_async_signal_handler_wrapper (sigint_remote_token);
+  mark_async_signal_handler (sigint_remote_token);
 }
 
 /* Signal handler for SIGINT, installed after SIGINT has already been
@@ -4896,7 +4896,7 @@ static void
 handle_remote_sigint_twice (int sig)
 {
   signal (sig, handle_remote_sigint);
-  mark_async_signal_handler_wrapper (sigint_remote_twice_token);
+  mark_async_signal_handler (sigint_remote_twice_token);
 }
 
 /* Perform the real interruption of the target execution, in response
-- 
1.7.7.6


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [obv 0/2] Minor cleanup in event-top.c
@ 2012-10-21  2:59 Yao Qi
  2012-10-21  2:59 ` [PATCH 1/2] Correct the type of sigFOO_token Yao Qi
  2012-10-21  2:59 ` [PATCH 2/2] Remove mark_async_signal_handler_wrapper Yao Qi
  0 siblings, 2 replies; 5+ messages in thread
From: Yao Qi @ 2012-10-21  2:59 UTC (permalink / raw)
  To: gdb-patches

When working on other task, I find some part of event-top.c can be
cleaned up a little.  Each patch is obvious to me, unless I miss
something.  See details in each of them.

If no comments or objections in three days, I'll check it in.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] Correct the type of sigFOO_token
  2012-10-21  2:59 ` [PATCH 1/2] Correct the type of sigFOO_token Yao Qi
@ 2012-10-22 14:21   ` Tom Tromey
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2012-10-22 14:21 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:

Yao> 2012-10-21  Yao Qi  <yao@codesourcery.com>
Yao> 	* event-top.c (sigint_token, sighup_token): Replace 'void *' with
Yao> 	'static struct async_signal_handler *'.
Yao> 	(sighup_token, sigquit_token, sigstp_token): Likewise.

Thanks for doing this.

Tom


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] Remove mark_async_signal_handler_wrapper.
  2012-10-21  2:59 ` [PATCH 2/2] Remove mark_async_signal_handler_wrapper Yao Qi
@ 2012-10-22 14:23   ` Tom Tromey
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2012-10-22 14:23 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:

Yao> 2012-10-21  Yao Qi  <yao@codesourcery.com>
Yao> 	* event-top.c (mark_async_signal_handler_wrapper): Remove.
Yao> 	* event-top.h: Remove its declaration.
Yao> 	(async_request_quit): Call mark_async_signal_handler instead of
Yao> 	mark_async_signal_handler_wrapper.
Yao> 	(async_do_nothing, async_disconnect): Likewise.
Yao> 	(async_stop_sig): Likewise.
Yao> 	* remote.c (handle_remote_sigint): Likewise.
Yao> 	(handle_remote_sigint_twice): Likewise.

Looks good, thanks again.

Tom


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-10-22 14:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-21  2:59 [obv 0/2] Minor cleanup in event-top.c Yao Qi
2012-10-21  2:59 ` [PATCH 1/2] Correct the type of sigFOO_token Yao Qi
2012-10-22 14:21   ` Tom Tromey
2012-10-21  2:59 ` [PATCH 2/2] Remove mark_async_signal_handler_wrapper Yao Qi
2012-10-22 14:23   ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox