Implement Ada multiplicative operators
authorTom Tromey <tom@tromey.com>
Mon, 8 Mar 2021 14:27:57 +0000 (07:27 -0700)
committerTom Tromey <tom@tromey.com>
Mon, 8 Mar 2021 14:28:32 +0000 (07:28 -0700)
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.

gdb/ChangeLog
gdb/ada-exp.h
gdb/ada-lang.c

index 597513aea86ade2ad43094e098284e54483d83ea..9080b8a72a05f2c7bb212e611f1bfe16795de78e 100644 (file)
@@ -1,3 +1,9 @@
+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.
index ad69d93948928c367069117177542c9cc5e0310d..da52d5cb2998c0b756f90736a211a2d4aab3b539 100644 (file)
@@ -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 */
index 86ccc57334892ba399d9c558f332c3a95876357d..45f5592274d3597df50d9be0c4070e89ed67abe6 100644 (file)
@@ -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,