From: Tom Tromey Date: Wed, 27 Aug 2025 18:56:02 +0000 (-0600) Subject: Remove some uses of longest_to_int from ada-lang.c X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e68dd763a12b9b86dbc45d36bb4de382fb1645c9;p=thirdparty%2Fbinutils-gdb.git Remove some uses of longest_to_int from ada-lang.c A few spots in ada-lang.c use longest_to_int -- but in a context where the value is immediately passed to a function accepting LONGEST. This patch removes the offending calls. It turned out to be easy to change find_struct_field as well, so I've included that in this patch. --- diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index c9a05388d52..f935365d667 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -182,7 +182,7 @@ static struct value *ada_search_struct_field (const char *, struct value *, int, struct type *); static int find_struct_field (const char *, struct type *, int, - struct type **, int *, int *, int *, int *); + struct type **, int *, int *, int *, LONGEST *); static int ada_resolve_function (std::vector &, struct value **, int, const char *, @@ -2175,8 +2175,8 @@ ada_type_of_array (struct value *arr, int bounds) arity -= 1; struct type *range_type = create_static_range_type (alloc, low->type (), - longest_to_int (value_as_long (low)), - longest_to_int (value_as_long (high))); + value_as_long (low), + value_as_long (high)); elt_type = create_array_type (alloc, elt_type, range_type); INIT_GNAT_SPECIFIC (elt_type); @@ -6932,7 +6932,7 @@ static int find_struct_field (const char *name, struct type *type, int offset, struct type **field_type_p, int *byte_offset_p, int *bit_offset_p, int *bit_size_p, - int *index_p) + LONGEST *index_p) { int i; int parent_offset = -1; @@ -7046,12 +7046,10 @@ find_struct_field (const char *name, struct type *type, int offset, /* Number of user-visible fields in record type TYPE. */ -static int +static LONGEST num_visible_fields (struct type *type) { - int n; - - n = 0; + LONGEST n = 0; find_struct_field (NULL, type, 0, NULL, NULL, NULL, NULL, &n); return n; } @@ -9569,12 +9567,12 @@ void ada_name_association::assign (aggregate_assigner &assigner, operation_up &op) { - int index; + LONGEST index; if (ada_is_direct_array_type (assigner.lhs->type ())) { value *tem = m_val->evaluate (nullptr, assigner.exp, EVAL_NORMAL); - index = longest_to_int (value_as_long (tem)); + index = value_as_long (tem); } else {