[2/3] gdb: Convert dwarf2_evaluate_property to return bool
Commit Message
Convert dwarf2_evaluate_property to return a bool, there should be no
user visible change after this commit.
gdb/ChangeLog:
* dwarf2loc.c (dwarf2_evaluate_property): Change return type, and
update return statements.
* dwarf2loc.h (dwarf2_evaluate_property): Update return type on
declaration, and update comment to match.
* gdbtypes.c (resolve_dynamic_array): Update call to
dwarf2_evaluate_property to match new return type.
---
gdb/ChangeLog | 9 +++++++++
gdb/dwarf2loc.c | 14 +++++++-------
gdb/dwarf2loc.h | 12 ++++++------
gdb/gdbtypes.c | 5 +----
4 files changed, 23 insertions(+), 17 deletions(-)
Comments
>>>>> "Andrew" == Andrew Burgess <andrew.burgess@embecosm.com> writes:
Andrew> Convert dwarf2_evaluate_property to return a bool, there should be no
Andrew> user visible change after this commit.
Andrew> gdb/ChangeLog:
Andrew> * dwarf2loc.c (dwarf2_evaluate_property): Change return type, and
Andrew> update return statements.
Andrew> * dwarf2loc.h (dwarf2_evaluate_property): Update return type on
Andrew> declaration, and update comment to match.
Andrew> * gdbtypes.c (resolve_dynamic_array): Update call to
Andrew> dwarf2_evaluate_property to match new return type.
Thanks for the patch. This is ok.
Tom
@@ -2424,14 +2424,14 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton,
/* See dwarf2loc.h. */
-int
+bool
dwarf2_evaluate_property (const struct dynamic_prop *prop,
struct frame_info *frame,
struct property_addr_info *addr_stack,
CORE_ADDR *value)
{
if (prop == NULL)
- return 0;
+ return false;
if (frame == NULL && has_stack_frames ())
frame = get_selected_frame (NULL);
@@ -2453,7 +2453,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop,
*value = value_as_address (val);
}
- return 1;
+ return true;
}
}
break;
@@ -2475,7 +2475,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop,
if (!value_optimized_out (val))
{
*value = value_as_address (val);
- return 1;
+ return true;
}
}
}
@@ -2483,7 +2483,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop,
case PROP_CONST:
*value = prop->data.const_val;
- return 1;
+ return true;
case PROP_ADDR_OFFSET:
{
@@ -2505,11 +2505,11 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop,
val = value_at (baton->offset_info.type,
pinfo->addr + baton->offset_info.offset);
*value = value_as_address (val);
- return 1;
+ return true;
}
}
- return 0;
+ return false;
}
/* See dwarf2loc.h. */
@@ -135,13 +135,13 @@ struct property_addr_info
property. When evaluating a property that is not related to a type, it can
be NULL.
- Returns 1 if PROP could be converted and the static value is passed back
- into VALUE, otherwise returns 0. */
+ Returns true if PROP could be converted and the static value is passed
+ back into VALUE, otherwise returns false. */
-int dwarf2_evaluate_property (const struct dynamic_prop *prop,
- struct frame_info *frame,
- struct property_addr_info *addr_stack,
- CORE_ADDR *value);
+bool dwarf2_evaluate_property (const struct dynamic_prop *prop,
+ struct frame_info *frame,
+ struct property_addr_info *addr_stack,
+ CORE_ADDR *value);
/* A helper for the compiler interface that compiles a single dynamic
property to C code.
@@ -2065,10 +2065,7 @@ resolve_dynamic_array (struct type *type,
prop = get_dyn_prop (DYN_PROP_BYTE_STRIDE, type);
if (prop != NULL)
{
- int prop_eval_ok
- = dwarf2_evaluate_property (prop, NULL, addr_stack, &value);
-
- if (prop_eval_ok)
+ if (dwarf2_evaluate_property (prop, NULL, addr_stack, &value))
{
remove_dyn_prop (DYN_PROP_BYTE_STRIDE, type);
bit_stride = (unsigned int) (value * 8);