[v3,174/206] Remove use of op_string

Message ID 20210220201609.838264-175-tom@tromey.com
State New
Headers show
Series
  • Refactor expressions
Related show

Commit Message

Tom Tromey Feb. 20, 2021, 8:15 p.m.
After switching to the new expression implementation, there will no
need for op_string.  Before deleting it, the one call outside of the
expression-printing code must be removed.  That is what this patch
does.

gdb/ChangeLog
2021-02-20  Tom Tromey  <tom@tromey.com>

	* ada-lang.c (ada_value_binop): Do not use op_string.
---
 gdb/ChangeLog  |  4 ++++
 gdb/ada-lang.c | 15 ++++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

-- 
2.26.2

Patch

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 43ebcd29848..a3c928a5091 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -9469,7 +9469,20 @@  ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
 
   v2 = value_as_long (arg2);
   if (v2 == 0)
-    error (_("second operand of %s must not be zero."), op_string (op));
+    {
+      const char *name;
+      if (op == BINOP_MOD)
+	name = "mod";
+      else if (op == BINOP_DIV)
+	name = "/";
+      else
+	{
+	  gdb_assert (op == BINOP_REM);
+	  name = "rem";
+	}
+
+      error (_("second operand of %s must not be zero."), name);
+    }
 
   if (type1->is_unsigned () || op == BINOP_MOD)
     return value_binop (arg1, arg2, op);