diff options
author | Tom Tromey <tom@tromey.com> | 2021-03-08 07:27:57 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2021-03-08 07:28:32 -0700 |
commit | d9e7db065eb663303dc8f0dad2c784dde9df6555 (patch) | |
tree | 29225c0ff2cdaf56cf6eb037e279354fbbf3e59c /gdb | |
parent | 73796c73263da16cedbefd5a43ab7e1887836115 (diff) | |
download | gdb-d9e7db065eb663303dc8f0dad2c784dde9df6555.zip gdb-d9e7db065eb663303dc8f0dad2c784dde9df6555.tar.gz gdb-d9e7db065eb663303dc8f0dad2c784dde9df6555.tar.bz2 |
Implement Ada multiplicative operators
This implements the Ada multiplicative operators, using an existing
template class.
gdb/ChangeLog
2021-03-08 Tom Tromey <tom@tromey.com>
* ada-lang.c (ada_mult_binop): No longer static.
* ada-exp.h (ada_binop_mul_operation ada_binop_div_operation)
(ada_binop_rem_operation, ada_binop_mod_operation): New typedefs.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/ada-exp.h | 9 | ||||
-rw-r--r-- | gdb/ada-lang.c | 2 |
3 files changed, 16 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 597513a..9080b8a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2021-03-08 Tom Tromey <tom@tromey.com> + * ada-lang.c (ada_mult_binop): No longer static. + * ada-exp.h (ada_binop_mul_operation ada_binop_div_operation) + (ada_binop_rem_operation, ada_binop_mod_operation): New typedefs. + +2021-03-08 Tom Tromey <tom@tromey.com> + * ada-lang.c (ada_binop_addsub_operation::evaluate): New method. * ada-exp.h (class ada_binop_addsub_operation): New. diff --git a/gdb/ada-exp.h b/gdb/ada-exp.h index ad69d93..da52d5c 100644 --- a/gdb/ada-exp.h +++ b/gdb/ada-exp.h @@ -42,6 +42,10 @@ extern struct value *ada_unop_in_range (struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1, struct type *type); +extern struct value *ada_mult_binop (struct type *expect_type, + struct expression *exp, + enum noside noside, enum exp_opcode op, + struct value *arg1, struct value *arg2); namespace expr { @@ -150,6 +154,11 @@ public: { return std::get<0> (m_storage); } }; +using ada_binop_mul_operation = binop_operation<BINOP_MUL, ada_mult_binop>; +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>; + } /* namespace expr */ #endif /* ADA_EXP_H */ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 86ccc57..45f5592 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -10114,7 +10114,7 @@ ada_abs (struct type *expect_type, /* A helper function for BINOP_MUL. */ -static value * +value * ada_mult_binop (struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, |