Implement Ada min and max operations
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:34 +0000 (07:28 -0700)
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.

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

index 34f80b444866e51c25f553ae88000b7b8c67732c..408ad7f319cc1ac82cf7c6b06e14feaebcbfd655 100644 (file)
@@ -1,3 +1,9 @@
+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):
index 0fe6ecf7e93a45cb302a529add2bc3b691bd8534..f3808935f994745c31a095642ac02dc51fd45a76 100644 (file)
@@ -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>
index eb21748ef6aee430d9270b45764ba080e628d152..418cc04cce1dd195d57940bb1f76dc874f500bd1 100644 (file)
@@ -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,