Implement binary comparison operations

This implements the binary comparison operations via a template class.

gdb/ChangeLog
2021-03-08  Tom Tromey  <tom@tromey.com>

	* expop.h (class comparison_operation): New.
	(equal_operation, notequal_operation, less_operation)
	(gtr_operation, geq_operation, leq_operation): New typedefs.
	* eval.c (eval_op_equal, eval_op_notequal, eval_op_less)
	(eval_op_gtr, eval_op_geq, eval_op_leq): No longer static.
This commit is contained in:
Tom Tromey
2021-03-08 07:27:57 -07:00
parent 224d6424ba
commit 46916f2bcb
3 changed files with 74 additions and 6 deletions

View File

@@ -1594,7 +1594,7 @@ eval_op_subscript (struct type *expect_type, struct expression *exp,
/* A helper function for BINOP_EQUAL. */
static struct value *
struct value *
eval_op_equal (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op,
struct value *arg1, struct value *arg2)
@@ -1617,7 +1617,7 @@ eval_op_equal (struct type *expect_type, struct expression *exp,
/* A helper function for BINOP_NOTEQUAL. */
static struct value *
struct value *
eval_op_notequal (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op,
struct value *arg1, struct value *arg2)
@@ -1640,7 +1640,7 @@ eval_op_notequal (struct type *expect_type, struct expression *exp,
/* A helper function for BINOP_LESS. */
static struct value *
struct value *
eval_op_less (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op,
struct value *arg1, struct value *arg2)
@@ -1663,7 +1663,7 @@ eval_op_less (struct type *expect_type, struct expression *exp,
/* A helper function for BINOP_GTR. */
static struct value *
struct value *
eval_op_gtr (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op,
struct value *arg1, struct value *arg2)
@@ -1686,7 +1686,7 @@ eval_op_gtr (struct type *expect_type, struct expression *exp,
/* A helper function for BINOP_GEQ. */
static struct value *
struct value *
eval_op_geq (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op,
struct value *arg1, struct value *arg2)
@@ -1709,7 +1709,7 @@ eval_op_geq (struct type *expect_type, struct expression *exp,
/* A helper function for BINOP_LEQ. */
static struct value *
struct value *
eval_op_leq (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op,
struct value *arg1, struct value *arg2)