[1/2] Use bool in continue_1

Message ID 20260513-remove-for-each-v1-1-8793bd79f781@adacore.com
State New
Headers
Series Remove for_each_thread |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_check--master-arm fail Patch failed to apply

Commit Message

Tom Tromey May 13, 2026, 5:32 p.m. UTC
  This changes continue_1 to use 'bool' and renames its parameter.  The
renaming is important to avoid shadowing the 'all_threads' function.
---
 gdb/infcmd.c     | 4 ++--
 gdb/inferior.h   | 2 +-
 gdb/mi/mi-main.c | 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)
  

Comments

Simon Marchi May 14, 2026, 2 p.m. UTC | #1
> diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
> index 52e642e1464..53821e69042 100644
> --- a/gdb/mi/mi-main.c
> +++ b/gdb/mi/mi-main.c
> @@ -286,7 +286,7 @@ exec_continue (const char *const *argv, int argc)
>  	}
>        else
>  	{
> -	  continue_1 (0);
> +	  continue_1 (false);
>  	}

Could you please remove the braces here at the same time?

Otherwise LGTM.

Approved-By: Simon Marchi <simon.marchi@efficios.com>

Simon
  

Patch

diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index f3f15c9ae1d..d4cd2c7d5cd 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -746,12 +746,12 @@  ensure_not_running (void)
 }
 
 void
-continue_1 (int all_threads)
+continue_1 (bool all_threads_p)
 {
   ERROR_NO_INFERIOR;
   ensure_not_tfind_mode ();
 
-  if (non_stop && all_threads)
+  if (non_stop && all_threads_p)
     {
       /* Don't error out if the current thread is running, because
 	 there may be other stopped threads.  */
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 9c031035a23..d141aacba8a 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -225,7 +225,7 @@  extern void attach_command (const char *, int);
 
 extern void registers_info (const char *, bool);
 
-extern void continue_1 (int all_threads);
+extern void continue_1 (bool all_threads_p);
 
 extern void interrupt_target_1 (bool all_threads);
 
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 52e642e1464..53821e69042 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -286,7 +286,7 @@  exec_continue (const char *const *argv, int argc)
 	}
       else
 	{
-	  continue_1 (0);
+	  continue_1 (false);
 	}
     }
   else
@@ -296,7 +296,7 @@  exec_continue (const char *const *argv, int argc)
       if (current_context->all)
 	{
 	  sched_multi = 1;
-	  continue_1 (0);
+	  continue_1 (false);
 	}
       else
 	{
@@ -304,7 +304,7 @@  exec_continue (const char *const *argv, int argc)
 	     either all threads, or one thread, depending on the
 	     'scheduler-locking' variable.  Let's continue to do the
 	     same.  */
-	  continue_1 (1);
+	  continue_1 (true);
 	}
     }
 }