From 146441c9521991f3e9a010e4e6544ca74619943f Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 18 Apr 2023 10:59:53 -0600 Subject: [PATCH] Remove adjust_type_signedness I happened across adjust_type_signedness, which may be used to modify a type when printing an Ada value. Modifying a type like this is a bad idea -- they should normally be considered immutable. Removing this function still passes both the dejagnu and internal AdaCore tests, though, so this patch drops it. As this was reviewed internally, and only affect Ada, I am checking it in. --- gdb/ada-valprint.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index 02ae46bce9e..24a7ea2ba79 100644 --- a/gdb/ada-valprint.c +++ b/gdb/ada-valprint.c @@ -37,15 +37,6 @@ static int print_field_values (struct value *, struct value *, -/* Make TYPE unsigned if its range of values includes no negatives. */ -static void -adjust_type_signedness (struct type *type) -{ - if (type != NULL && type->code () == TYPE_CODE_RANGE - && type->bounds ()->low.const_val () >= 0) - type->set_is_unsigned (true); -} - /* Assuming TYPE is a simple array type, prints its lower bound on STREAM, if non-standard (i.e., other than 1 for numbers, other than lower bound of index type for enumerated type). Returns 1 if something printed, @@ -652,7 +643,6 @@ print_field_values (struct value *value, struct value *outer_value, int bit_size = TYPE_FIELD_BITSIZE (type, i); struct value_print_options opts; - adjust_type_signedness (type->field (i).type ()); v = ada_value_primitive_packed_val (value, nullptr, bit_pos / HOST_CHAR_BIT, -- 2.30.2