gdb: make get_discrete_bounds return bool

get_discrete_bounds currently has three possible return values (see its
current doc for details).  It appears that for all callers, it would be
sufficient to have a boolean "worked" / "didn't work" return value.

Change the return type of get_discrete_bounds to bool and adjust all
callers.  Doing so simplifies the following patch.

gdb/ChangeLog:

	* gdbtypes.h (get_discrete_bounds): Return bool, adjust all
	callers.
	* gdbtypes.c (get_discrete_bounds): Return bool.

Change-Id: Ie51feee23c75f0cd7939742604282d745db59172
This commit is contained in:
Simon Marchi
2020-12-09 13:51:57 -05:00
committed by Simon Marchi
parent f5fca0ec15
commit f47d1c255d
12 changed files with 54 additions and 46 deletions

View File

@@ -2097,7 +2097,7 @@ constrained_packed_array_type (struct type *type, long *elt_bits)
if ((check_typedef (index_type)->code () == TYPE_CODE_RANGE
&& is_dynamic_type (check_typedef (index_type)))
|| get_discrete_bounds (index_type, &low_bound, &high_bound) < 0)
|| !get_discrete_bounds (index_type, &low_bound, &high_bound))
low_bound = high_bound = 0;
if (high_bound < low_bound)
*elt_bits = TYPE_LENGTH (new_type) = 0;
@@ -2243,7 +2243,7 @@ value_subscript_packed (struct value *arr, int arity, struct value **ind)
LONGEST lowerbound, upperbound;
LONGEST idx;
if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0)
if (!get_discrete_bounds (range_type, &lowerbound, &upperbound))
{
lim_warning (_("don't know bounds of array"));
lowerbound = upperbound = 0;