Introduce binop_operation
[deliverable/binutils-gdb.git] / gdb / eval.c
index de7863138b355e7ebc4e7365bedb1cc42b8ee66a..6fde03d3522b66bf5980aac9b97a8bf2abbce03e 100644 (file)
@@ -1313,15 +1313,14 @@ eval_op_objc_selector (struct type *expect_type, struct expression *exp,
 
 /* Helper function that implements the body of BINOP_CONCAT.  */
 
-static struct value *
+struct value *
 eval_op_concat (struct type *expect_type, struct expression *exp,
-               enum noside noside,
-               enum exp_opcode op, struct value *arg1, struct value *arg2)
+               enum noside noside, struct value *arg1, struct value *arg2)
 {
   if (noside == EVAL_SKIP)
     return eval_skip_value (exp);
-  if (binop_user_defined_p (op, arg1, arg2))
-    return value_x_binop (arg1, arg2, op, OP_NULL, noside);
+  if (binop_user_defined_p (BINOP_CONCAT, arg1, arg2))
+    return value_x_binop (arg1, arg2, BINOP_CONCAT, OP_NULL, noside);
   else
     return value_concat (arg1, arg2);
 }
@@ -1460,15 +1459,15 @@ eval_op_member (struct type *expect_type, struct expression *exp,
 
 /* A helper function for BINOP_ADD.  */
 
-static struct value *
+struct value *
 eval_op_add (struct type *expect_type, struct expression *exp,
-            enum noside noside, enum exp_opcode op,
+            enum noside noside,
             struct value *arg1, struct value *arg2)
 {
   if (noside == EVAL_SKIP)
     return eval_skip_value (exp);
-  if (binop_user_defined_p (op, arg1, arg2))
-    return value_x_binop (arg1, arg2, op, OP_NULL, noside);
+  if (binop_user_defined_p (BINOP_ADD, arg1, arg2))
+    return value_x_binop (arg1, arg2, BINOP_ADD, OP_NULL, noside);
   else if (ptrmath_type_p (exp->language_defn, value_type (arg1))
           && is_integral_or_integral_reference (value_type (arg2)))
     return value_ptradd (arg1, value_as_long (arg2));
@@ -1484,15 +1483,15 @@ eval_op_add (struct type *expect_type, struct expression *exp,
 
 /* A helper function for BINOP_SUB.  */
 
-static struct value *
+struct value *
 eval_op_sub (struct type *expect_type, struct expression *exp,
-            enum noside noside, enum exp_opcode op,
+            enum noside noside,
             struct value *arg1, struct value *arg2)
 {
   if (noside == EVAL_SKIP)
     return eval_skip_value (exp);
-  if (binop_user_defined_p (op, arg1, arg2))
-    return value_x_binop (arg1, arg2, op, OP_NULL, noside);
+  if (binop_user_defined_p (BINOP_SUB, arg1, arg2))
+    return value_x_binop (arg1, arg2, BINOP_SUB, OP_NULL, noside);
   else if (ptrmath_type_p (exp->language_defn, value_type (arg1))
           && ptrmath_type_p (exp->language_defn, value_type (arg2)))
     {
@@ -1512,7 +1511,7 @@ eval_op_sub (struct type *expect_type, struct expression *exp,
 
 /* Helper function for several different binary operations.  */
 
-static struct value *
+struct value *
 eval_op_binary (struct type *expect_type, struct expression *exp,
                enum noside noside, enum exp_opcode op,
                struct value *arg1, struct value *arg2)
@@ -2791,7 +2790,7 @@ evaluate_subexp_standard (struct type *expect_type,
     case BINOP_CONCAT:
       arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
       arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
-      return eval_op_concat (expect_type, exp, noside, op, arg1, arg2);
+      return eval_op_concat (expect_type, exp, noside, arg1, arg2);
 
     case BINOP_ASSIGN:
       arg1 = evaluate_subexp (nullptr, exp, pos, noside);
@@ -2823,12 +2822,12 @@ evaluate_subexp_standard (struct type *expect_type,
     case BINOP_ADD:
       arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
       arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
-      return eval_op_add (expect_type, exp, noside, op, arg1, arg2);
+      return eval_op_add (expect_type, exp, noside, arg1, arg2);
 
     case BINOP_SUB:
       arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
       arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
-      return eval_op_sub (expect_type, exp, noside, op, arg1, arg2);
+      return eval_op_sub (expect_type, exp, noside, arg1, arg2);
 
     case BINOP_EXP:
     case BINOP_MUL:
This page took 0.040478 seconds and 4 git commands to generate.