diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2020-12-09 13:51:57 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2020-12-09 13:51:57 -0500 |
commit | 1f8d2881175920d389078852bb1ff0799d744599 (patch) | |
tree | 983b6e53db1f95649e8f90c94fe01f7f15b4c443 /gdb/ada-lang.c | |
parent | 6244c1196a49a5732ac3667b4df0f157cf681d7b (diff) | |
download | fsf-binutils-gdb-1f8d2881175920d389078852bb1ff0799d744599.zip fsf-binutils-gdb-1f8d2881175920d389078852bb1ff0799d744599.tar.gz fsf-binutils-gdb-1f8d2881175920d389078852bb1ff0799d744599.tar.bz2 |
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
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r-- | gdb/ada-lang.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 5813ecd..5e2f1ec 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -2112,7 +2112,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; @@ -2182,7 +2182,7 @@ recursively_update_array_bitsize (struct type *type) gdb_assert (type->code () == TYPE_CODE_ARRAY); LONGEST low, high; - if (get_discrete_bounds (type->index_type (), &low, &high) < 0 + if (!get_discrete_bounds (type->index_type (), &low, &high) || low > high) return 0; LONGEST our_len = high - low + 1; @@ -2299,7 +2299,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; |