public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFA] Use false/true for some inferior class members instead of 0/1
@ 2022-11-27 17:00 Philippe Waroquiers
  2022-11-27 18:43 ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Waroquiers @ 2022-11-27 17:00 UTC (permalink / raw)
  To: gdb-patches; +Cc: Philippe Waroquiers

Some class members were changed to bool, but there was
still some assignments or comparisons using 0/1.
---
 gdb/auxv.c       |  2 +-
 gdb/darwin-nat.c |  2 +-
 gdb/gnu-nat.c    |  2 +-
 gdb/inf-ptrace.c |  2 +-
 gdb/infcmd.c     |  4 ++--
 gdb/inferior.c   |  4 ++--
 gdb/infrun.c     | 18 +++++++++---------
 gdb/nto-procfs.c |  4 ++--
 gdb/procfs.c     |  2 +-
 gdb/remote.c     |  2 +-
 gdb/target.c     |  2 +-
 11 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/gdb/auxv.c b/gdb/auxv.c
index 51723f9b17c..0ac74826aeb 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -234,7 +234,7 @@ memory_xfer_auxv (struct target_ops *ops,
       this function only when attaching to a process.
       */
 
-  if (current_inferior ()->attach_flag != 0)
+  if (current_inferior ()->attach_flag)
     {
       enum target_xfer_status ret;
 
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index eca97c9bde9..66b3a152374 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -2037,7 +2037,7 @@ darwin_nat_target::attach (const char *args, int from_tty)
 
   inf = current_inferior ();
   inferior_appeared (inf, pid);
-  inf->attach_flag = 1;
+  inf->attach_flag = true;
 
   darwin_attach_pid (inf);
 
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index ae049cab3de..abbf4523de6 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2183,7 +2183,7 @@ gnu_nat_target::attach (const char *args, int from_tty)
   inferior->push_target (this);
 
   inferior_appeared (inferior, pid);
-  inferior->attach_flag = 1;
+  inferior->attach_flag = true;
 
   inf_update_procs (inf);
 
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index 8995ef517dd..ab669a7acc2 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -163,7 +163,7 @@ inf_ptrace_target::attach (const char *args, int from_tty)
 #endif
 
   inferior_appeared (inf, pid);
-  inf->attach_flag = 1;
+  inf->attach_flag = true;
 
   /* Always add a main thread.  If some target extends the ptrace
      target, it should decorate the ptid later with more info.  */
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index f7bce0d0399..a27d3577b3a 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -2494,7 +2494,7 @@ setup_inferior (int from_tty)
   struct inferior *inferior;
 
   inferior = current_inferior ();
-  inferior->needs_setup = 0;
+  inferior->needs_setup = false;
 
   /* If no exec file is yet known, try to determine it from the
      process itself.  */
@@ -2677,7 +2677,7 @@ attach_command (const char *args, int from_tty)
      wait_for_inferior as soon as the target reports a stop.  */
   init_wait_for_inferior ();
 
-  inferior->needs_setup = 1;
+  inferior->needs_setup = true;
 
   if (target_is_non_stop_p ())
     {
diff --git a/gdb/inferior.c b/gdb/inferior.c
index 7eb2bd97907..23cbfd63bde 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -223,7 +223,7 @@ exit_inferior_1 (struct inferior *inf, int silent)
       inf->vfork_child = NULL;
     }
 
-  inf->pending_detach = 0;
+  inf->pending_detach = false;
   /* Reset it.  */
   inf->control = inferior_control_state (NO_STOP_QUIETLY);
 
@@ -270,7 +270,7 @@ inferior_appeared (struct inferior *inf, int pid)
     init_thread_list ();
 
   inf->pid = pid;
-  inf->has_exit_code = 0;
+  inf->has_exit_code = false;
   inf->exit_code = 0;
 
   gdb::observers::inferior_appeared.notify (inf);
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 96346e1f25b..3613a4af79b 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -495,15 +495,15 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
 		 with the shared region.  Keep track of the
 		 parent.  */
 	      child_inf->vfork_parent = parent_inf;
-	      child_inf->pending_detach = 0;
+	      child_inf->pending_detach = false;
 	      parent_inf->vfork_child = child_inf;
-	      parent_inf->pending_detach = 0;
+	      parent_inf->pending_detach = false;
 	    }
 	  else
 	    {
 	      child_inf->aspace = new address_space ();
 	      child_inf->pspace = new program_space (child_inf->aspace);
-	      child_inf->removable = 1;
+	      child_inf->removable = true;
 	      clone_program_space (child_inf->pspace, parent_inf->pspace);
 	    }
 	}
@@ -585,7 +585,7 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
 	{
 	  child_inf->aspace = new address_space ();
 	  child_inf->pspace = new program_space (child_inf->aspace);
-	  child_inf->removable = 1;
+	  child_inf->removable = true;
 	  child_inf->symfile_flags = SYMFILE_NO_READ;
 	  clone_program_space (child_inf->pspace, parent_inf->pspace);
 	}
@@ -647,7 +647,7 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
 	  gdb_assert (child_inf->vfork_parent == nullptr);
 	  gdb_assert (parent_inf->vfork_child == nullptr);
 	  child_inf->vfork_parent = parent_inf;
-	  child_inf->pending_detach = 0;
+	  child_inf->pending_detach = false;
 	  parent_inf->vfork_child = child_inf;
 	  parent_inf->pending_detach = detach_fork;
 	}
@@ -942,7 +942,7 @@ handle_vfork_child_exec_or_exit (int exec)
 
 	  /* follow-fork child, detach-on-fork on.  */
 
-	  vfork_parent->pending_detach = 0;
+	  vfork_parent->pending_detach = false;
 
 	  scoped_restore_current_pspace_and_thread restore_thread;
 
@@ -998,7 +998,7 @@ handle_vfork_child_exec_or_exit (int exec)
 	     child a new address space.  */
 	  inf->pspace = new program_space (maybe_new_address_space ());
 	  inf->aspace = inf->pspace->aspace;
-	  inf->removable = 1;
+	  inf->removable = true;
 	  set_current_program_space (inf->pspace);
 
 	  resume_parent = vfork_parent;
@@ -1023,7 +1023,7 @@ handle_vfork_child_exec_or_exit (int exec)
 	  inf->pspace = new program_space (maybe_new_address_space ());
 	  inf->aspace = inf->pspace->aspace;
 	  set_current_program_space (inf->pspace);
-	  inf->removable = 1;
+	  inf->removable = true;
 	  inf->symfile_flags = SYMFILE_NO_READ;
 	  clone_program_space (inf->pspace, vfork_parent->pspace);
 
@@ -5563,7 +5563,7 @@ handle_inferior_event (struct execution_control_state *ecs)
 				   (LONGEST) ecs->ws.exit_status ());
 
 	  /* Also record this in the inferior itself.  */
-	  current_inferior ()->has_exit_code = 1;
+	  current_inferior ()->has_exit_code = true;
 	  current_inferior ()->exit_code = (LONGEST) ecs->ws.exit_status ();
 
 	  /* Support the --return-child-result option.  */
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index ef9e0f05261..4a2968ea179 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -706,7 +706,7 @@ nto_procfs_target::attach (const char *args, int from_tty)
   ptid_t ptid = do_attach (ptid_t (pid));
   inf = current_inferior ();
   inferior_appeared (inf, pid);
-  inf->attach_flag = 1;
+  inf->attach_flag = true;
 
   if (!inf->target_is_pushed (ops))
     inf->push_target (ops);
@@ -1286,7 +1286,7 @@ nto_procfs_target::create_inferior (const char *exec_file,
 
   inf = current_inferior ();
   inferior_appeared (inf, pid);
-  inf->attach_flag = 0;
+  inf->attach_flag = false;
 
   flags = _DEBUG_FLAG_KLC;	/* Kill-on-Last-Close flag.  */
   errn = devctl (ctl_fd, DCMD_PROC_SET_FLAG, &flags, sizeof (flags), 0);
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 141db3dd793..ac3d60ebf1c 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -1849,7 +1849,7 @@ do_attach (ptid_t ptid)
   inf = current_inferior ();
   inferior_appeared (inf, pi->pid);
   /* Let GDB know that the inferior was attached.  */
-  inf->attach_flag = 1;
+  inf->attach_flag = true;
 
   /* Create a procinfo for the current lwp.  */
   lwpid = proc_get_current_thread (pi);
diff --git a/gdb/remote.c b/gdb/remote.c
index 5118ecd0a31..53c4f19c5a4 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -4625,7 +4625,7 @@ remote_target::process_initial_stop_replies (int from_tty)
      registers/memory.  */
   for (inferior *inf : all_non_exited_inferiors (this))
     {
-      inf->needs_setup = 1;
+      inf->needs_setup = true;
 
       if (non_stop)
 	{
diff --git a/gdb/target.c b/gdb/target.c
index 74925e139dc..b88df0f678b 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -2489,7 +2489,7 @@ target_pre_inferior (int from_tty)
 
   /* attach_flag may be set if the previous process associated with
      the inferior was attached to.  */
-  current_inferior ()->attach_flag = 0;
+  current_inferior ()->attach_flag = false;
 
   current_inferior ()->highest_thread_num = 0;
 
-- 
2.30.2


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

* Re: [RFA] Use false/true for some inferior class members instead of 0/1
  2022-11-27 17:00 [RFA] Use false/true for some inferior class members instead of 0/1 Philippe Waroquiers
@ 2022-11-27 18:43 ` Simon Marchi
  2022-11-27 20:17   ` Philippe Waroquiers
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2022-11-27 18:43 UTC (permalink / raw)
  To: Philippe Waroquiers, gdb-patches



On 11/27/22 12:00, Philippe Waroquiers via Gdb-patches wrote:
> Some class members were changed to bool, but there was
> still some assignments or comparisons using 0/1.

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

Simon

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

* Re: [RFA] Use false/true for some inferior class members instead of 0/1
  2022-11-27 18:43 ` Simon Marchi
@ 2022-11-27 20:17   ` Philippe Waroquiers
  0 siblings, 0 replies; 3+ messages in thread
From: Philippe Waroquiers @ 2022-11-27 20:17 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On Sun, 2022-11-27 at 13:43 -0500, Simon Marchi wrote:
> 
> On 11/27/22 12:00, Philippe Waroquiers via Gdb-patches wrote:
> > Some class members were changed to bool, but there was
> > still some assignments or comparisons using 0/1.
> 
> Approved-By: Simon Marchi <simon.marchi@efficios.com>
Thanks for the review, pushed with the approved tag.




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

end of thread, other threads:[~2022-11-27 20:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-27 17:00 [RFA] Use false/true for some inferior class members instead of 0/1 Philippe Waroquiers
2022-11-27 18:43 ` Simon Marchi
2022-11-27 20:17   ` Philippe Waroquiers

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).