]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Remove ada-lang.c:eval_ternop_in_range
authorTom Tromey <tromey@adacore.com>
Fri, 29 May 2026 17:08:50 +0000 (11:08 -0600)
committerTom Tromey <tromey@adacore.com>
Fri, 29 May 2026 17:11:43 +0000 (11:11 -0600)
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

index 0ecc67126777d23e7c3d428658b774693e7f418f..cb741647d47149a6b9f34ddd85f7fd7c346e9f3f 100644 (file)
@@ -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 *