Mirror of the gdb-patches mailing list
 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 ada-lang.c:eval_ternop_in_range
Date: Fri, 29 May 2026 11:15:00 -0600	[thread overview]
Message-ID: <20260529171500.2854619-1-tromey@adacore.com> (raw)

ada-lang.c:eval_ternop_in_range is only used in a single spot.  This
patch merges it into its sole caller.  Helper functions like this are
still sometimes left over from the big expression rewrite.

I'm checking this in as obvious.
---
 gdb/ada-lang.c | 33 +++++++++++----------------------
 1 file changed, 11 insertions(+), 22 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 0ecc6712677..cb741647d47 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -10056,24 +10056,6 @@ ada_value_cast (struct type *type, struct value *arg2)
     entity.  Results in this case are unpredictable, as we usually read
     past the buffer containing the data =:-o.  */
 
-/* A helper function for TERNOP_IN_RANGE.  */
-
-static value *
-eval_ternop_in_range (struct type *expect_type, struct expression *exp,
-		      enum noside noside,
-		      value *arg1, value *arg2, value *arg3)
-{
-  binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
-  binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg3);
-  struct type *type = language_bool_type (exp->language_defn, exp->gdbarch);
-  return
-    value_from_longest (type,
-			(value_less (arg1, arg3)
-			 || value_equal (arg1, arg3))
-			&& (value_less (arg2, arg1)
-			    || value_equal (arg2, arg1)));
-}
-
 /* A helper function for UNOP_NEG.  */
 
 value *
@@ -10659,10 +10641,17 @@ ada_ternop_range_operation::evaluate (struct type *expect_type,
 				      struct expression *exp,
 				      enum noside noside)
 {
-  value *arg0 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
-  value *arg1 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
-  value *arg2 = std::get<2> (m_storage)->evaluate (nullptr, exp, noside);
-  return eval_ternop_in_range (expect_type, exp, noside, arg0, arg1, arg2);
+  value *arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
+  value *arg2 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
+  value *arg3 = std::get<2> (m_storage)->evaluate (nullptr, exp, noside);
+  binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
+  binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg3);
+  struct type *type = language_bool_type (exp->language_defn, exp->gdbarch);
+  return value_from_longest (type,
+			     (value_less (arg1, arg3)
+			      || value_equal (arg1, arg3))
+			     && (value_less (arg2, arg1)
+				 || value_equal (arg2, arg1)));
 }
 
 value *

base-commit: b083976272bd663ed036692e54796870b3bf6c89
-- 
2.54.0


                 reply	other threads:[~2026-05-29 17:15 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=20260529171500.2854619-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