[PATCH 3/6] gdb/continuations: remove the 'err' from 'do_all_inferior_continuations'

Tankut Baris Aktemur via Gdb-patches
2021-04-21T12:58:06Z

The 'err' parameter of 'do_all_inferior_continuations' is effectively
unused. There is only one place where the function is called, and
there the argument is a literal 0. So, remove the parameter.

gdb/ChangeLog:
2021-04-21 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>

* continuations.h (do_all_inferior_continuations): Remove the 'err'
parameter. Update the references below.
* continuations.c (do_my_continuations_1)
(do_my_continuations)
(do_all_inferior_continuations): Update.
* inf-loop.c (inferior_event_handler): Update.
* infcmd.c (attach_command_continuation): Update.
---
gdb/continuations.c | 12 ++++++------
gdb/continuations.h | 12 +++---------
gdb/inf-loop.c | 2 +-
gdb/infcmd.c | 5 +----
4 files changed, 11 insertions(+), 20 deletions(-)

diff --git a/gdb/continuations.c b/gdb/continuations.c
index 78eb53f860d..8fe81a75ba9 100644
--- a/gdb/continuations.c
+++ b/gdb/continuations.c
@@ -49,14 +49,14 @@ make_continuation (struct continuation **pmy_chain,
}

static void
-do_my_continuations_1 (struct continuation **pmy_chain, int err)
+do_my_continuations_1 (struct continuation **pmy_chain)
{
struct continuation *ptr;

while ((ptr = *pmy_chain) != NULL)
{
*pmy_chain = ptr->next; /* Do this first in case of recursion. */
- (*ptr->function) (ptr->arg, err);
+ (*ptr->function) (ptr->arg);
if (ptr->free_arg)
(*ptr->free_arg) (ptr->arg);
xfree (ptr);
@@ -64,7 +64,7 @@ do_my_continuations_1 (struct continuation **pmy_chain, int err)
}

static void
-do_my_continuations (struct continuation **list, int err)
+do_my_continuations (struct continuation **list)
{
struct continuation *continuations;

@@ -80,7 +80,7 @@ do_my_continuations (struct continuation **list, int err)
*list = NULL;

/* Work now on the list we have set aside. */
- do_my_continuations_1 (&continuations, err);
+ do_my_continuations_1 (&continuations);
}

static void
@@ -119,10 +119,10 @@ add_inferior_continuation (continuation_ftype *hook, void *args,
/* Do all continuations of the current inferior. */

void
-do_all_inferior_continuations (int err)
+do_all_inferior_continuations ()
{
struct inferior *inf = current_inferior ();
- do_my_continuations (&inf->continuations, err);
+ do_my_continuations (&inf->continuations);
}

/* Get rid of all the inferior-wide continuations of INF. */
diff --git a/gdb/continuations.h b/gdb/continuations.h
index 73f01ece132..7ebe82af1c5 100644
--- a/gdb/continuations.h
+++ b/gdb/continuations.h
@@ -30,14 +30,8 @@ struct inferior;

/* Prototype of the continuation callback functions. ARG is the
continuation argument registered in the corresponding
- add_*_continuation call. ERR is true when the command should be
- cancelled instead of finished normally. In that case, the
- continuation should clean up whatever state had been set up for the
- command in question (e.g., remove momentary breakpoints). This
- happens e.g., when an error was thrown while handling a target
- event, or when the inferior thread the command was being executed
- on exits. */
-typedef void (continuation_ftype) (void *arg, int err);
+ add_*_continuation call. */
+typedef void (continuation_ftype) (void *arg);

/* Prototype of the function responsible for releasing the argument
passed to the continuation callback functions, either when the
@@ -49,7 +43,7 @@ typedef void (continuation_free_arg_ftype) (void *);
extern void add_inferior_continuation (continuation_ftype *,
void *,
continuation_free_arg_ftype *);
-extern void do_all_inferior_continuations (int err);
+extern void do_all_inferior_continuations ();
extern void discard_all_inferior_continuations (struct inferior *inf);

#endif
diff --git a/gdb/inf-loop.c b/gdb/inf-loop.c
index 9f038b3d85a..b8f66c308d2 100644
--- a/gdb/inf-loop.c
+++ b/gdb/inf-loop.c
@@ -55,7 +55,7 @@ inferior_event_handler (enum inferior_event_type event_type)
/* Do all continuations associated with the whole inferior (not
a particular thread). */
if (inferior_ptid != null_ptid)
- do_all_inferior_continuations (0);
+ do_all_inferior_continuations ();

/* When running a command list (from a user command, say), these
are only run when the command list is all done. */
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 3439568be00..5c3ee02cb9d 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -2547,14 +2547,11 @@ struct attach_command_continuation_args
};

static void
-attach_command_continuation (void *args, int err)
+attach_command_continuation (void *args)
{
struct attach_command_continuation_args *a
= (struct attach_command_continuation_args *) args;

- if (err)
- return;
-
attach_post_wait (a->from_tty, a->mode);
}

--
2.17.1