From: Tom Tromey Date: Mon, 8 Mar 2021 14:27:57 +0000 (-0700) Subject: Implement Ada min and max operations X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6ad3b8bf3b118e9635a0dcc022128496f4fc13ca;p=binutils-gdb.git Implement Ada min and max operations This implement the Ada min and max operations using an existing template class. gdb/ChangeLog 2021-03-08 Tom Tromey * ada-lang.c (ada_binop_minmax): No longer static. * ada-exp.h (ada_binop_min_operation, ada_binop_max_operation): New typedefs. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 34f80b44486..408ad7f319c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2021-03-08 Tom Tromey + + * ada-lang.c (ada_binop_minmax): No longer static. + * ada-exp.h (ada_binop_min_operation, ada_binop_max_operation): + New typedefs. + 2021-03-08 Tom Tromey * ada-lang.c (ada_var_msym_value_operation::evaluate_for_cast): diff --git a/gdb/ada-exp.h b/gdb/ada-exp.h index 0fe6ecf7e93..f3808935f99 100644 --- a/gdb/ada-exp.h +++ b/gdb/ada-exp.h @@ -60,6 +60,11 @@ extern struct value *ada_binop_in_bounds (struct expression *exp, struct value *arg1, struct value *arg2, int n); +extern struct value *ada_binop_minmax (struct type *expect_type, + struct expression *exp, + enum noside noside, enum exp_opcode op, + struct value *arg1, + struct value *arg2); namespace expr { @@ -173,6 +178,9 @@ using ada_binop_div_operation = binop_operation; using ada_binop_rem_operation = binop_operation; using ada_binop_mod_operation = binop_operation; +using ada_binop_min_operation = binop_operation; +using ada_binop_max_operation = binop_operation; + /* Implement the equal and not-equal operations for Ada. */ class ada_binop_equal_operation : public tuple_holding_operation diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index eb21748ef6a..418cc04cce1 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -10394,7 +10394,7 @@ ada_unop_atr (struct expression *exp, enum noside noside, enum exp_opcode op, /* A helper function for OP_ATR_MIN and OP_ATR_MAX. */ -static struct value * +struct value * ada_binop_minmax (struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op,