Change int -> bool where applicable throughout varobj

This patch changes all the "int" I could find in varobj.{c,h} that are
really boolean values to use bool.  I followed the ramifications
(parameters and return values of exported functions), so the changes
spilled a bit on other, related files (ada-varobj.c and c-varobj.c).

gdb/ChangeLog:

	* ada-varobj.c (ada_value_is_changeable_p): Change int to bool where applicable.
	(ada_value_has_mutated): Likewise.
	* c-varobj.c (varobj_is_anonymous_child): Likewise.
	(c_is_path_expr_parent): Likewise.
	* mi/mi-cmd-var.c (varobj_update_one): Likewise.
	(mi_cmd_var_set_frozen): Likewise.
	(mi_cmd_var_update_iter): Likewise.
	(mi_cmd_var_update): Likewise.
	* varobj.c (pretty_printing): Likewise.
	(varobj_enable_pretty_printing): Likewise.
	(struct varobj_root) <floating, is_valid>: Likewise.
	(struct varobj_dynamic) <children_requested>: Likewise.
	(delete_variable): Likewise.
	(delete_variable_1): Likewise.
	(install_variable): Likewise.
	(update_type_if_necessary): Likewise.
	(install_new_value): Likewise.
	(value_of_root): Likewise.
	(is_root_p): Likewise.
	(varobj_create): Likewise.
	(varobj_delete): Likewise.
	(varobj_has_more): Likewise.
	(varobj_set_frozen): Likewise.
	(varobj_get_frozen): Likewise.
	(install_dynamic_child): Likewise.
	(dynamic_varobj_has_child_method): Likewise.
	(update_dynamic_varobj_children): Likewise.
	(varobj_get_num_children): Likewise.
	(varobj_list_children): Likewise.
	(is_path_expr_parent): Likewise.
	(varobj_default_is_path_expr_parent): Likewise.
	(varobj_is_dynamic_p): Likewise.
	(varobj_set_value): Likewise.
	(varobj_value_has_mutated): Likewise.
	(varobj_update): Likewise.
	(check_scope): Likewise.
	(value_of_root_1): Likewise.
	(varobj_value_get_print_value): Likewise.
	(varobj_editable_p): Likewise.
	(varobj_value_is_changeable_p): Likewise.
	(varobj_floating_p): Likewise.
	(varobj_default_value_is_changeable_p): Likewise.
	(varobj_invalidate_iter): Likewise.
	* varobj.h (struct varobj_update_result) <type_changed,
	children_changed, changed, value_installed>: Likewise.
	(struct varobj) <updated, frozen, not_fetched>: Likewise.
	(struct lang_varobj_ops) <value_is_changeable_p,
	value_has_mutated, is_path_expr_parent>: Likewise.
	(varobj_delete): Likewise.
	(varobj_set_frozen): Likewise.
	(varobj_get_frozen): Likewise.
	(varobj_set_value): Likewise.
	(varobj_update): Likewise.
	(varobj_editable_p): Likewise.
	(varobj_floating_p): Likewise.
	(varobj_has_more): Likewise.
	(varobj_is_dynamic_p): Likewise.
	(varobj_default_value_is_changeable_p): Likewise.
	(varobj_value_is_changeable_p): Likewise.
	(varobj_is_anonymous_child): Likewise.
	(varobj_default_is_path_expr_parent): Likewise.
This commit is contained in:
Simon Marchi
2017-11-23 11:00:56 -05:00
parent eb02c04dc3
commit 4c37490d92
6 changed files with 257 additions and 195 deletions

View File

@@ -929,7 +929,7 @@ ada_value_of_variable (const struct varobj *var,
/* Implement the "value_is_changeable_p" routine for Ada. */
static int
static bool
ada_value_is_changeable_p (const struct varobj *var)
{
struct type *type = var->value ? value_type (var->value) : var->type;
@@ -939,7 +939,7 @@ ada_value_is_changeable_p (const struct varobj *var)
{
/* This is in reality a pointer to an unconstrained array.
its value is changeable. */
return 1;
return true;
}
if (ada_is_string_type (type))
@@ -947,7 +947,7 @@ ada_value_is_changeable_p (const struct varobj *var)
/* We display the contents of the string in the array's
"value" field. The contents can change, so consider
that the array is changeable. */
return 1;
return true;
}
return varobj_default_value_is_changeable_p (var);
@@ -955,7 +955,7 @@ ada_value_is_changeable_p (const struct varobj *var)
/* Implement the "value_has_mutated" routine for Ada. */
static int
static bool
ada_value_has_mutated (const struct varobj *var, struct value *new_val,
struct type *new_type)
{
@@ -966,7 +966,7 @@ ada_value_has_mutated (const struct varobj *var, struct value *new_val,
has mutated. */
if (ada_varobj_get_number_of_children (new_val, new_type)
!= var->num_children)
return 1;
return true;
/* If the number of fields have remained the same, then we need
to check the name of each field. If they remain the same,
@@ -986,9 +986,9 @@ ada_value_has_mutated (const struct varobj *var, struct value *new_val,
if (ada_varobj_get_name_of_child (new_val, new_type,
var->name.c_str (), i)
!= var->children[i]->name)
return 1;
return true;
return 0;
return false;
}
/* varobj operations for ada. */