Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [pushed] Remove ada-lang.c:eval_ternop_in_range
@ 2026-05-29 17:15 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2026-05-29 17:15 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

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


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

only message in thread, other threads:[~2026-05-29 17:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-29 17:15 [pushed] Remove ada-lang.c:eval_ternop_in_range Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox