* [PATCH] Minor boolification with interrupt_target_1
@ 2026-11-12 18:58 Tom Tromey
2026-11-13 15:37 ` Tom de Vries
0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2026-11-12 18:58 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
This patch changes the callers of interrupt_target_1 to use bool
rather than relying on int to bool conversions.
---
gdb/infcmd.c | 4 ++--
gdb/mi/mi-main.c | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index a9bceba1087..53a100b314c 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -3176,13 +3176,13 @@ interrupt_command (const char *args, int from_tty)
{
if (target_can_async_p ())
{
- int all_threads = 0;
+ bool all_threads = false;
dont_repeat (); /* Not for the faint of heart. */
if (args != nullptr
&& startswith (args, "-a"))
- all_threads = 1;
+ all_threads = true;
interrupt_target_1 (all_threads);
}
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 42f5dcc3ded..38d61c53102 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -330,14 +330,14 @@ mi_cmd_exec_interrupt (const char *command, const char *const *argv, int argc)
anything specific. */
if (!non_stop)
{
- interrupt_target_1 (0);
+ interrupt_target_1 (false);
return;
}
if (current_context->all)
{
/* This will interrupt all threads in all inferiors. */
- interrupt_target_1 (1);
+ interrupt_target_1 (true);
}
else if (current_context->thread_group != -1)
{
@@ -359,7 +359,7 @@ mi_cmd_exec_interrupt (const char *command, const char *const *argv, int argc)
/* Interrupt just the current thread -- either explicitly
specified via --thread or whatever was current before
MI command was sent. */
- interrupt_target_1 (0);
+ interrupt_target_1 (false);
}
}
base-commit: c79376a262328164cdf81eddfcc5518314b1856a
--
2.56.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] Minor boolification with interrupt_target_1
2026-11-12 18:58 [PATCH] Minor boolification with interrupt_target_1 Tom Tromey
@ 2026-11-13 15:37 ` Tom de Vries
0 siblings, 0 replies; 2+ messages in thread
From: Tom de Vries @ 2026-11-13 15:37 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
On 11/12/26 7:58 PM, Tom Tromey wrote:
> - int all_threads = 0;
> + bool all_threads = false;
>
> dont_repeat (); /* Not for the faint of heart. */
>
> if (args != nullptr
> && startswith (args, "-a"))
> - all_threads = 1;
> + all_threads = true;
>
Hi Tom,
thanks for doing this.
This LGTM.
FWIW, you could consider collapsing this to:
...
dont_repeat (); /* Not for the faint of heart. */
bool all_threads = args != nullptr && startswith (args, "-a");
...
Thanks,
- Tom
Approved-By: Tom de Vries <tdevries@suse.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-13 15:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-12 18:58 [PATCH] Minor boolification with interrupt_target_1 Tom Tromey
2026-11-13 15:37 ` Tom de Vries
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox