aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-03-08 07:27:57 -0700
committerTom Tromey <tom@tromey.com>2021-03-08 07:28:34 -0700
commit6ad3b8bf3b118e9635a0dcc022128496f4fc13ca (patch)
tree8a35c0e6cf7ef7cd781fe2f7ca6df716962a8647 /gdb
parent3f4a0053d9699d19a0251cd8c87871c65994e8e1 (diff)
downloadbinutils-6ad3b8bf3b118e9635a0dcc022128496f4fc13ca.zip
binutils-6ad3b8bf3b118e9635a0dcc022128496f4fc13ca.tar.gz
binutils-6ad3b8bf3b118e9635a0dcc022128496f4fc13ca.tar.bz2
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 <tom@tromey.com> * ada-lang.c (ada_binop_minmax): No longer static. * ada-exp.h (ada_binop_min_operation, ada_binop_max_operation): New typedefs.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/ada-exp.h8
-rw-r--r--gdb/ada-lang.c2
3 files changed, 15 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 34f80b4..408ad7f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2021-03-08 Tom Tromey <tom@tromey.com>
+ * 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 <tom@tromey.com>
+
* ada-lang.c (ada_var_msym_value_operation::evaluate_for_cast):
New method.
* ada-exp.h (class ada_var_msym_value_operation): New.
diff --git a/gdb/ada-exp.h b/gdb/ada-exp.h
index 0fe6ecf..f380893 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<BINOP_DIV, ada_mult_binop>;
using ada_binop_rem_operation = binop_operation<BINOP_REM, ada_mult_binop>;
using ada_binop_mod_operation = binop_operation<BINOP_MOD, ada_mult_binop>;
+using ada_binop_min_operation = binop_operation<OP_ATR_MIN, ada_binop_minmax>;
+using ada_binop_max_operation = binop_operation<OP_ATR_MAX, ada_binop_minmax>;
+
/* Implement the equal and not-equal operations for Ada. */
class ada_binop_equal_operation
: public tuple_holding_operation<enum exp_opcode, operation_up, operation_up>
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index eb21748..418cc04 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,