public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [pushed] Remove adjust_type_signedness
Date: Wed, 19 Apr 2023 08:06:28 -0600	[thread overview]
Message-ID: <20230419140628.2037051-1-tromey@adacore.com> (raw)

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


                 reply	other threads:[~2023-04-19 14:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230419140628.2037051-1-tromey@adacore.com \
    --to=tromey@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).