public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb: remove unused fetch_inferior_event and inferior_event_handler parameters
@ 2020-07-01  3:54 Simon Marchi
  2020-07-01 19:13 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2020-07-01  3:54 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

I noticed that fetch_inferior_event receives the client_data parameter
from its caller, inferior_event_handler, but doesn't actually need it.
This patch removes it.  In turn, inferior_event_handler doesn't use its
parameter, so remove it too.

The `data` argument used when registering
remote_async_inferior_event_handler is changed to NULL, to avoid
confusion.  It could make people think that the value passed is used
somewhere, when in fact it's not.

gdb/ChangeLog:

        * inf-loop.c (inferior_event_handler): Remove client_data param.
        * inf-loop.h (inferior_event_handler): Likewise.
        * infcmd.c (step_1): Adjust.
        * infrun.c (proceed): Adjust.
        (fetch_inferior_event): Remove client_data param.
        (infrun_async_inferior_event_handler): Adjust.
        * infrun.h (fetch_inferior_event): Remove `void *` param.
        * linux-nat.c (handle_target_event): Adjust.
        * record-btrace.c (record_btrace_handle_async_inferior_event):
	Adjust.
        * record-full.c (record_full_async_inferior_event_handler):
	Adjust.
        * remote.c (remote_async_inferior_event_handler): Adjust.

Change-Id: I3c2aa1eb0ea3e0985df096660d2dcd794674f2ea
---
 gdb/inf-loop.c      | 5 ++---
 gdb/inf-loop.h      | 3 +--
 gdb/infcmd.c        | 2 +-
 gdb/infrun.c        | 8 ++++----
 gdb/infrun.h        | 2 +-
 gdb/linux-nat.c     | 2 +-
 gdb/record-btrace.c | 2 +-
 gdb/record-full.c   | 2 +-
 gdb/remote.c        | 7 +++----
 9 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/gdb/inf-loop.c b/gdb/inf-loop.c
index c40ae239426..cf746b8588c 100644
--- a/gdb/inf-loop.c
+++ b/gdb/inf-loop.c
@@ -34,13 +34,12 @@
 /* General function to handle events in the inferior.  */
 
 void
-inferior_event_handler (enum inferior_event_type event_type, 
-			gdb_client_data client_data)
+inferior_event_handler (enum inferior_event_type event_type)
 {
   switch (event_type)
     {
     case INF_REG_EVENT:
-      fetch_inferior_event (client_data);
+      fetch_inferior_event ();
       break;
 
     case INF_EXEC_COMPLETE:
diff --git a/gdb/inf-loop.h b/gdb/inf-loop.h
index 4ddbcbcc69a..ed27f5279dd 100644
--- a/gdb/inf-loop.h
+++ b/gdb/inf-loop.h
@@ -22,7 +22,6 @@
 
 #include "target.h"             /* For enum inferior_event_type.  */
 
-extern void inferior_event_handler (enum inferior_event_type event_type, 
-				    void* client_data);
+extern void inferior_event_handler (enum inferior_event_type event_type);
 
 #endif /* #ifndef INF_LOOP_H */
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 64eea883cb6..cfc31699925 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -907,7 +907,7 @@ step_1 (int skip_subroutines, int single_inst, const char *count_string)
       thr->thread_fsm->clean_up (thr);
       proceeded = normal_stop ();
       if (!proceeded)
-	inferior_event_handler (INF_EXEC_COMPLETE, NULL);
+	inferior_event_handler (INF_EXEC_COMPLETE);
       all_uis_check_sync_execution_done ();
     }
 }
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 7bc405f1038..6b655d44301 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2968,7 +2968,7 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
       /* The target for some reason decided not to resume.  */
       normal_stop ();
       if (target_can_async_p ())
-	inferior_event_handler (INF_EXEC_COMPLETE, NULL);
+	inferior_event_handler (INF_EXEC_COMPLETE);
       return;
     }
 
@@ -3933,7 +3933,7 @@ all_uis_on_sync_execution_starting (void)
    necessary cleanups.  */
 
 void
-fetch_inferior_event (void *client_data)
+fetch_inferior_event ()
 {
   struct execution_control_state ecss;
   struct execution_control_state *ecs = &ecss;
@@ -4050,7 +4050,7 @@ fetch_inferior_event (void *client_data)
 
 	    if (!proceeded)
 	      {
-		inferior_event_handler (INF_EXEC_COMPLETE, NULL);
+		inferior_event_handler (INF_EXEC_COMPLETE);
 		cmd_done = 1;
 	      }
 
@@ -9422,7 +9422,7 @@ static const struct internalvar_funcs siginfo_funcs =
 static void
 infrun_async_inferior_event_handler (gdb_client_data data)
 {
-  inferior_event_handler (INF_REG_EVENT, NULL);
+  inferior_event_handler (INF_REG_EVENT);
 }
 
 void _initialize_infrun ();
diff --git a/gdb/infrun.h b/gdb/infrun.h
index 98085413519..49b28f01b68 100644
--- a/gdb/infrun.h
+++ b/gdb/infrun.h
@@ -130,7 +130,7 @@ extern void stop_all_threads (void);
 
 extern void prepare_for_detach (void);
 
-extern void fetch_inferior_event (void *);
+extern void fetch_inferior_event ();
 
 extern void init_wait_for_inferior (void);
 
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 0a2bfdc57d4..fde360f5080 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -4232,7 +4232,7 @@ sigchld_handler (int signo)
 static void
 handle_target_event (int error, gdb_client_data client_data)
 {
-  inferior_event_handler (INF_REG_EVENT, NULL);
+  inferior_event_handler (INF_REG_EVENT);
 }
 
 /* Create/destroy the target events pipe.  Returns previous state.  */
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 226d56dfe37..718de62f280 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -325,7 +325,7 @@ record_btrace_auto_disable (void)
 static void
 record_btrace_handle_async_inferior_event (gdb_client_data data)
 {
-  inferior_event_handler (INF_REG_EVENT, NULL);
+  inferior_event_handler (INF_REG_EVENT);
 }
 
 /* See record-btrace.h.  */
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 9d6e403e576..1d8f1930a5b 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -905,7 +905,7 @@ static struct async_event_handler *record_full_async_inferior_event_token;
 static void
 record_full_async_inferior_event_handler (gdb_client_data data)
 {
-  inferior_event_handler (INF_REG_EVENT, NULL);
+  inferior_event_handler (INF_REG_EVENT);
 }
 
 /* Open the process record target for 'core' files.  */
diff --git a/gdb/remote.c b/gdb/remote.c
index d560c69eca4..f7f99dc24fe 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -5605,8 +5605,7 @@ remote_target::open_1 (const char *name, int from_tty, int extended_p)
 
   /* Register extra event sources in the event loop.  */
   rs->remote_async_inferior_event_token
-    = create_async_event_handler (remote_async_inferior_event_handler,
-				  remote);
+    = create_async_event_handler (remote_async_inferior_event_handler, NULL);
   rs->notif_state = remote_notif_state_allocate (remote);
 
   /* Reset the target state; these things will be queried either by
@@ -14158,13 +14157,13 @@ remote_async_serial_handler (struct serial *scb, void *context)
 {
   /* Don't propogate error information up to the client.  Instead let
      the client find out about the error by querying the target.  */
-  inferior_event_handler (INF_REG_EVENT, NULL);
+  inferior_event_handler (INF_REG_EVENT);
 }
 
 static void
 remote_async_inferior_event_handler (gdb_client_data data)
 {
-  inferior_event_handler (INF_REG_EVENT, data);
+  inferior_event_handler (INF_REG_EVENT);
 }
 
 int
-- 
2.27.0


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

* Re: [PATCH] gdb: remove unused fetch_inferior_event and inferior_event_handler parameters
  2020-07-01  3:54 [PATCH] gdb: remove unused fetch_inferior_event and inferior_event_handler parameters Simon Marchi
@ 2020-07-01 19:13 ` Tom Tromey
  2020-07-02 12:43   ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2020-07-01 19:13 UTC (permalink / raw)
  To: Simon Marchi via Gdb-patches; +Cc: Simon Marchi

>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:

Simon> I noticed that fetch_inferior_event receives the client_data parameter
Simon> from its caller, inferior_event_handler, but doesn't actually need it.
Simon> This patch removes it.  In turn, inferior_event_handler doesn't use its
Simon> parameter, so remove it too.

Simon> The `data` argument used when registering
Simon> remote_async_inferior_event_handler is changed to NULL, to avoid
Simon> confusion.  It could make people think that the value passed is used
Simon> somewhere, when in fact it's not.

Looks good to me.  Thanks for doing this.

Tom

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

* Re: [PATCH] gdb: remove unused fetch_inferior_event and inferior_event_handler parameters
  2020-07-01 19:13 ` Tom Tromey
@ 2020-07-02 12:43   ` Simon Marchi
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Marchi @ 2020-07-02 12:43 UTC (permalink / raw)
  To: Tom Tromey, Simon Marchi via Gdb-patches

On 2020-07-01 3:13 p.m., Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
> Simon> I noticed that fetch_inferior_event receives the client_data parameter
> Simon> from its caller, inferior_event_handler, but doesn't actually need it.
> Simon> This patch removes it.  In turn, inferior_event_handler doesn't use its
> Simon> parameter, so remove it too.
> 
> Simon> The `data` argument used when registering
> Simon> remote_async_inferior_event_handler is changed to NULL, to avoid
> Simon> confusion.  It could make people think that the value passed is used
> Simon> somewhere, when in fact it's not.
> 
> Looks good to me.  Thanks for doing this.
> 
> Tom
> 

Thanks, pushed.

Simon

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

end of thread, other threads:[~2020-07-02 12:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-01  3:54 [PATCH] gdb: remove unused fetch_inferior_event and inferior_event_handler parameters Simon Marchi
2020-07-01 19:13 ` Tom Tromey
2020-07-02 12:43   ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).