From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [pushed] Remove some unnecessary casts from ada-lang.c
Date: Mon, 17 Apr 2023 13:43:24 -0600 [thread overview]
Message-ID: <20230417194324.1606586-1-tromey@adacore.com> (raw)
I noticed some unnecessary casts to LONGEST in ada-lang.c. This patch
removes the ones I think are very clearly not needed. I'm checking
this in as obvious.
---
gdb/ada-lang.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index a3fc88a3488..97e03f78d5d 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -3286,7 +3286,7 @@ ada_array_bound_from_type (struct type *arr_type, int n, int which)
arr_type = decode_constrained_packed_array_type (arr_type);
if (arr_type == NULL || !ada_is_simple_array_type (arr_type))
- return (LONGEST) - which;
+ return - which;
if (arr_type->code () == TYPE_CODE_PTR)
type = arr_type->target_type ();
@@ -3319,10 +3319,9 @@ ada_array_bound_from_type (struct type *arr_type, int n, int which)
index_type = elt_type->index_type ();
}
- return
- (LONGEST) (which == 0
- ? ada_discrete_type_low_bound (index_type)
- : ada_discrete_type_high_bound (index_type));
+ return (which == 0
+ ? ada_discrete_type_low_bound (index_type)
+ : ada_discrete_type_high_bound (index_type));
}
/* Given that arr is an array value, returns the lower bound of the
@@ -10113,7 +10112,7 @@ ada_unop_in_range (struct type *expect_type,
lim_warning (_("Membership test incompletely implemented; "
"always returns true"));
type = language_bool_type (exp->language_defn, exp->gdbarch);
- return value_from_longest (type, (LONGEST) 1);
+ return value_from_longest (type, 1);
case TYPE_CODE_RANGE:
arg2 = value_from_longest (type,
@@ -10223,7 +10222,7 @@ ada_equal_binop (struct type *expect_type,
if (op == BINOP_NOTEQUAL)
tem = !tem;
struct type *type = language_bool_type (exp->language_defn, exp->gdbarch);
- return value_from_longest (type, (LONGEST) tem);
+ return value_from_longest (type, tem);
}
/* A helper function for TERNOP_SLICE. */
--
2.39.1
reply other threads:[~2023-04-17 19:43 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=20230417194324.1606586-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).