[v3,156/206] Implement Ada multiplicative operators

Message ID 20210220201609.838264-157-tom@tromey.com
State New
Headers show
Series
  • Refactor expressions
Related show

Commit Message

Tom Tromey Feb. 20, 2021, 8:15 p.m.
This implements the Ada multiplicative operators, using an existing
template class.

gdb/ChangeLog
2021-02-20  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  | 6 ++++++
 gdb/ada-exp.h  | 9 +++++++++
 gdb/ada-lang.c | 2 +-
 3 files changed, 16 insertions(+), 1 deletion(-)

-- 
2.26.2

Patch

diff --git a/gdb/ada-exp.h b/gdb/ada-exp.h
index ad69d939489..da52d5cb299 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 @@  class ada_binop_addsub_operation
   { 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 e394a657c21..f798546bb07 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -10273,7 +10273,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,