Implement fortran_allocated_operation
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:30 +0000 (07:28 -0700)
This implements the Fortran ALLOCATED intrinsic.

gdb/ChangeLog
2021-03-08  Tom Tromey  <tom@tromey.com>

* f-exp.h (eval_op_f_allocated): Declare.
(fortran_allocated_operation): New typedef.
* f-lang.c (eval_op_f_allocated): No longer static.

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

index d92f16b12d5dece6c5ebe6309cc09604a3fb8eed..856d6ffbf0a46f66e816afb9f87f62713d436c72 100644 (file)
@@ -1,3 +1,9 @@
+2021-03-08  Tom Tromey  <tom@tromey.com>
+
+       * f-exp.h (eval_op_f_allocated): Declare.
+       (fortran_allocated_operation): New typedef.
+       * f-lang.c (eval_op_f_allocated): No longer static.
+
 2021-03-08  Tom Tromey  <tom@tromey.com>
 
        * f-lang.c (eval_op_f_associated): New functions.
index 11f403d13ca67ad3776d98f00e1b6f58a0e096c8..81cf3412ee2bce48506fcd161ff0f2e074620448 100644 (file)
@@ -1,6 +1,6 @@
 /* Definitions for Fortran expressions
 
-   Copyright (C) 2020 Free Software Foundation, Inc.
+   Copyright (C) 2020, 2021 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -68,6 +68,11 @@ extern struct value *eval_op_f_associated (struct type *expect_type,
                                           enum exp_opcode opcode,
                                           struct value *arg1,
                                           struct value *arg2);
+extern struct value * eval_op_f_allocated (struct type *expect_type,
+                                          struct expression *exp,
+                                          enum noside noside,
+                                          enum exp_opcode op,
+                                          struct value *arg1);
 
 namespace expr
 {
@@ -79,6 +84,8 @@ using fortran_floor_operation = unop_operation<UNOP_FORTRAN_FLOOR,
                                               eval_op_f_floor>;
 using fortran_kind_operation = unop_operation<UNOP_FORTRAN_KIND,
                                              eval_op_f_kind>;
+using fortran_allocated_operation = unop_operation<UNOP_FORTRAN_ALLOCATED,
+                                                  eval_op_f_allocated>;
 
 using fortran_mod_operation = binop_operation<BINOP_MOD, eval_op_f_mod>;
 using fortran_modulo_operation = binop_operation<BINOP_FORTRAN_MODULO,
index 1a49b6bdb2f81ce5c84f09b469902e794b305ac7..90ff3d155104cddd877dff5174940d4aee99b2f8 100644 (file)
@@ -1209,7 +1209,7 @@ eval_op_f_kind (struct type *expect_type, struct expression *exp,
 
 /* A helper function for UNOP_FORTRAN_ALLOCATED.  */
 
-static struct value *
+struct value *
 eval_op_f_allocated (struct type *expect_type, struct expression *exp,
                     enum noside noside, enum exp_opcode op,
                     struct value *arg1)