[pushed] Remove adjust_type_signedness

Message ID 20230419140628.2037051-1-tromey@adacore.com
State New
Headers
Series [pushed] Remove adjust_type_signedness |

Commit Message

Tom Tromey April 19, 2023, 2:06 p.m. UTC
  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(-)
  

Patch

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,