public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [pushed] Remove adjust_type_signedness
@ 2023-04-19 14:06 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2023-04-19 14:06 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

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 *,
 
 \f
 
-/* 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.39.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-19 14:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-19 14:06 [pushed] Remove adjust_type_signedness Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).