[RFA,2/3] Use bool in pv_area

Message ID 20171008170741.23151-3-tom@tromey.com
State New, archived
Headers

Commit Message

Tom Tromey Oct. 8, 2017, 5:07 p.m. UTC
  This updates a couple of member functions in pv_area to return bool.

gdb/ChangeLog
2017-10-07  Tom Tromey  <tom@tromey.com>

	* prologue-value.h (pv_area::store_would_trash): Return bool.
	(pv_area::find_reg): Likewise.
	* prologue-value.c (pv_area::store_would_trash): Return bool.
	(pv_area::find_reg): Likewise.
---
 gdb/ChangeLog        | 7 +++++++
 gdb/prologue-value.c | 8 ++++----
 gdb/prologue-value.h | 4 ++--
 3 files changed, 13 insertions(+), 6 deletions(-)
  

Comments

Simon Marchi Oct. 9, 2017, 3:12 a.m. UTC | #1
On 2017-10-08 01:07 PM, Tom Tromey wrote:
> This updates a couple of member functions in pv_area to return bool.

LGTM.
  

Patch

diff --git a/gdb/prologue-value.c b/gdb/prologue-value.c
index b830b8f50d..2b2e5a8b65 100644
--- a/gdb/prologue-value.c
+++ b/gdb/prologue-value.c
@@ -335,7 +335,7 @@  pv_area::~pv_area ()
 }
 
 
-int
+bool
 pv_area::store_would_trash (pv_t addr)
 {
   /* It may seem odd that pvk_constant appears here --- after all,
@@ -478,7 +478,7 @@  pv_area::fetch (pv_t addr, CORE_ADDR size)
 }
 
 
-int
+bool
 pv_area::find_reg (struct gdbarch *gdbarch, int reg, CORE_ADDR *offset_p)
 {
   struct area_entry *e = m_entry;
@@ -493,14 +493,14 @@  pv_area::find_reg (struct gdbarch *gdbarch, int reg, CORE_ADDR *offset_p)
           {
             if (offset_p)
               *offset_p = e->offset;
-            return 1;
+            return true;
           }
 
         e = e->next;
       }
     while (e != m_entry);
 
-  return 0;
+  return false;
 }
 
 
diff --git a/gdb/prologue-value.h b/gdb/prologue-value.h
index e3004aa6ad..c6fd34bdab 100644
--- a/gdb/prologue-value.h
+++ b/gdb/prologue-value.h
@@ -269,7 +269,7 @@  public:
      prologue analysis, and return the information you've gathered,
      instead of losing all that information, most of which is probably
      okay.  */
-  int store_would_trash (pv_t addr);
+  bool store_would_trash (pv_t addr);
 
   /* Search AREA for the original value of REGISTER.  If we can't find
      it, return zero; if we can find it, return a non-zero value, and if
@@ -280,7 +280,7 @@  public:
      items stored in AREA.  If you plan to gather a lot of information
      about registers saved in AREA, consider calling pv_area::scan
      instead, and collecting all your information in one pass.  */
-  int find_reg (struct gdbarch *gdbarch, int reg, CORE_ADDR *offset_p);
+  bool find_reg (struct gdbarch *gdbarch, int reg, CORE_ADDR *offset_p);
 
 
   /* For every part of AREA whose value we know, apply FUNC to CLOSURE,