public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 2/6] Change value::m_lazy to bool
Date: Tue, 14 Feb 2023 13:23:32 -0700	[thread overview]
Message-ID: <20230214-submit-more-value-stuff-v1-2-2fb85efbaa72@tromey.com> (raw)
In-Reply-To: <20230214-submit-more-value-stuff-v1-0-2fb85efbaa72@tromey.com>

This changes value::m_lazy to be a bool and updates the various uses.
---
 gdb/dwarf2/loc.c |  2 +-
 gdb/gnu-v2-abi.c |  2 +-
 gdb/valops.c     |  2 +-
 gdb/value.c      |  6 +++---
 gdb/value.h      | 16 ++++++++--------
 5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
index 27c4b7ce31a..0ab54abea9a 100644
--- a/gdb/dwarf2/loc.c
+++ b/gdb/dwarf2/loc.c
@@ -1366,7 +1366,7 @@ value_of_dwarf_reg_entry (struct type *type, frame_info_ptr frame,
   memcpy (val->contents_raw ().data (),
 	  outer_val->contents_raw ().data (),
 	  checked_type->length ());
-  val->set_lazy (0);
+  val->set_lazy (false);
 
   return val;
 }
diff --git a/gdb/gnu-v2-abi.c b/gdb/gnu-v2-abi.c
index fa46d474914..6afa1795ebd 100644
--- a/gdb/gnu-v2-abi.c
+++ b/gdb/gnu-v2-abi.c
@@ -163,7 +163,7 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
 
       if (!arg1->lazy ())
 	{
-	  arg1->set_lazy (1);
+	  arg1->set_lazy (true);
 	  arg1->fetch_lazy ();
 	}
 
diff --git a/gdb/valops.c b/gdb/valops.c
index 3901053c7d5..90f7b8c5532 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1343,7 +1343,7 @@ value_assign (struct value *toval, struct value *fromval)
      information, but its contents are updated from FROMVAL.  This
      implies the returned value is not lazy, even if TOVAL was.  */
   val = toval->copy ();
-  val->set_lazy (0);
+  val->set_lazy (false);
   copy (fromval->contents (), val->contents_raw ());
 
   /* We copy over the enclosing type and pointed-to offset from FROMVAL
diff --git a/gdb/value.c b/gdb/value.c
index b027b63ee48..855354f542f 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -990,7 +990,7 @@ value::allocate_optimized_out (struct type *type)
   struct value *retval = value::allocate_lazy (type);
 
   retval->mark_bytes_optimized_out (0, type->length ());
-  retval->set_lazy (0);
+  retval->set_lazy (false);
   return retval;
 }
 
@@ -3809,7 +3809,7 @@ value::fetch_lazy_register ()
 
   /* Copy the contents and the unavailability/optimized-out
      meta-data from NEW_VAL to VAL.  */
-  set_lazy (0);
+  set_lazy (false);
   new_val->contents_copy (this, embedded_offset (),
 			  new_val->embedded_offset (),
 			  type_length_units (type));
@@ -3893,7 +3893,7 @@ value::fetch_lazy ()
   else
     internal_error (_("Unexpected lazy value type."));
 
-  set_lazy (0);
+  set_lazy (false);
 }
 
 /* Implementation of the convenience function $_isvoid.  */
diff --git a/gdb/value.h b/gdb/value.h
index 92247185cd0..233f42d32a0 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -133,7 +133,7 @@ struct value
   /* Values can only be created via "static constructors".  */
   explicit value (struct type *type_)
     : m_modifiable (true),
-      m_lazy (1),
+      m_lazy (true),
       m_initialized (1),
       m_stack (0),
       m_is_zero (false),
@@ -247,8 +247,8 @@ struct value
   void set_embedded_offset (LONGEST val)
   { m_embedded_offset = val; }
 
-  /* If zero, contents of this value are in the contents field.  If
-     nonzero, contents are in inferior.  If the lval field is lval_memory,
+  /* If false, contents of this value are in the contents field.  If
+     true, contents are in inferior.  If the lval field is lval_memory,
      the contents are in inferior memory at location.address plus offset.
      The lval field may also be lval_register.
 
@@ -262,10 +262,10 @@ struct value
      element.  If you ever change the way lazy flag is set and reset, be
      sure to consider this use as well!  */
 
-  int lazy () const
+  bool lazy () const
   { return m_lazy; }
 
-  void set_lazy (int val)
+  void set_lazy (bool val)
   { m_lazy = val; }
 
   /* If a value represents a C++ object, then the `type' field gives the
@@ -621,8 +621,8 @@ struct value
   /* Is it modifiable?  Only relevant if lval != not_lval.  */
   bool m_modifiable : 1;
 
-  /* If zero, contents of this value are in the contents field.  If
-     nonzero, contents are in inferior.  If the lval field is lval_memory,
+  /* If false, contents of this value are in the contents field.  If
+     true, contents are in inferior.  If the lval field is lval_memory,
      the contents are in inferior memory at location.address plus offset.
      The lval field may also be lval_register.
 
@@ -635,7 +635,7 @@ struct value
      or array when the user wants to watch a single struct member or
      array element.  If you ever change the way lazy flag is set and
      reset, be sure to consider this use as well!  */
-  unsigned int m_lazy : 1;
+  bool m_lazy : 1;
 
   /* If value is a variable, is it initialized or not.  */
   unsigned int m_initialized : 1;

-- 
2.39.1


  parent reply	other threads:[~2023-02-14 20:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-14 20:23 [PATCH 0/6] Use bool in value Tom Tromey
2023-02-14 20:23 ` [PATCH 1/6] Change value::m_modifiable to bool Tom Tromey
2023-02-21 14:36   ` Alexandra Petlanova Hajkova
2023-02-14 20:23 ` Tom Tromey [this message]
2023-02-15 11:53   ` [PATCH 2/6] Change value::m_lazy " Bruno Larsen
2023-02-15 21:52     ` Tom Tromey
2023-02-14 20:23 ` [PATCH 3/6] Change value::m_initialized " Tom Tromey
2023-02-21 15:10   ` Alexandra Petlanova Hajkova
2023-02-14 20:23 ` [PATCH 4/6] Change value::m_stack " Tom Tromey
2023-02-21 15:30   ` Alexandra Petlanova Hajkova
2023-02-14 20:23 ` [PATCH 5/6] Have value::bits_synthetic_pointer return bool Tom Tromey
2023-02-14 20:23 ` [PATCH 6/6] Return bool from more value methods Tom Tromey
2023-02-15 12:22 ` [PATCH 0/6] Use bool in value Bruno Larsen
2023-02-15 21:54   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230214-submit-more-value-stuff-v1-2-2fb85efbaa72@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).