From 7c15d377deefea39bac6ce710d803cc23cbe19c9 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 8 Mar 2021 07:27:57 -0700 Subject: Implement some Ada unary operations This implements a few Ada unary operations, using the existing unop_operation template class. gdb/ChangeLog 2021-03-08 Tom Tromey * ada-lang.c (ada_unop_neg, ada_atr_tag, ada_atr_size, ada_abs): No longer static. * ada-exp.h (ada_neg_operation, ada_atr_tag_operation) (ada_atr_size_operation, ada_abs_operation): New typedefs. --- gdb/ChangeLog | 7 +++++++ gdb/ada-exp.h | 22 ++++++++++++++++++++++ gdb/ada-lang.c | 8 ++++---- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f91477a..08a9627 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,12 @@ 2021-03-08 Tom Tromey + * ada-lang.c (ada_unop_neg, ada_atr_tag, ada_atr_size, ada_abs): + No longer static. + * ada-exp.h (ada_neg_operation, ada_atr_tag_operation) + (ada_atr_size_operation, ada_abs_operation): New typedefs. + +2021-03-08 Tom Tromey + * expop.h (class logical_and_operation) (class logical_or_operation): New. * eval.c (logical_and_operation::evaluate) diff --git a/gdb/ada-exp.h b/gdb/ada-exp.h index 17a04ea..8f114b3 100644 --- a/gdb/ada-exp.h +++ b/gdb/ada-exp.h @@ -22,6 +22,23 @@ #include "expop.h" +extern struct value *ada_unop_neg (struct type *expect_type, + struct expression *exp, + enum noside noside, enum exp_opcode op, + struct value *arg1); +extern struct value *ada_atr_tag (struct type *expect_type, + struct expression *exp, + enum noside noside, enum exp_opcode op, + struct value *arg1); +extern struct value *ada_atr_size (struct type *expect_type, + struct expression *exp, + enum noside noside, enum exp_opcode op, + struct value *arg1); +extern struct value *ada_abs (struct type *expect_type, + struct expression *exp, + enum noside noside, enum exp_opcode op, + struct value *arg1); + namespace expr { @@ -87,6 +104,11 @@ public: { return TERNOP_IN_RANGE; } }; +using ada_neg_operation = unop_operation; +using ada_atr_tag_operation = unop_operation; +using ada_atr_size_operation = unop_operation; +using ada_abs_operation = unop_operation; + } /* namespace expr */ #endif /* ADA_EXP_H */ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index dd88466..ed691f5 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -9964,7 +9964,7 @@ eval_ternop_in_range (struct type *expect_type, struct expression *exp, /* A helper function for UNOP_NEG. */ -static value * +value * ada_unop_neg (struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, @@ -10015,7 +10015,7 @@ ada_unop_in_range (struct type *expect_type, /* A helper function for OP_ATR_TAG. */ -static value * +value * ada_atr_tag (struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, @@ -10029,7 +10029,7 @@ ada_atr_tag (struct type *expect_type, /* A helper function for OP_ATR_SIZE. */ -static value * +value * ada_atr_size (struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, @@ -10054,7 +10054,7 @@ ada_atr_size (struct type *expect_type, /* A helper function for UNOP_ABS. */ -static value * +value * ada_abs (struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, -- cgit v1.1