diff options
author | Daniel Kraft <d@domob.eu> | 2010-07-15 14:23:47 +0200 |
---|---|---|
committer | Daniel Kraft <domob@gcc.gnu.org> | 2010-07-15 14:23:47 +0200 |
commit | 0019d49828d868ffec69eba1ea65e659a1aed0bf (patch) | |
tree | 0b4c5c6d817b7ea90e44a560553aff0ce48f0a1e /gcc/fortran/trans.h | |
parent | f644b3d1af766044c4ff14a24d3266c948785dd1 (diff) | |
download | gcc-0019d49828d868ffec69eba1ea65e659a1aed0bf.zip gcc-0019d49828d868ffec69eba1ea65e659a1aed0bf.tar.gz gcc-0019d49828d868ffec69eba1ea65e659a1aed0bf.tar.bz2 |
re PR fortran/44709 (BLOCK and GOTO/EXIT/CYCLE)
2010-07-15 Daniel Kraft <d@domob.eu>
PR fortran/44709
* trans.h (struct gfc_wrapped_block): New struct.
(gfc_start_wrapped_block), (gfc_add_init_cleanup): New methods.
(gfc_finish_wrapped_block): New method.
(gfc_init_default_dt): Add new init code to block rather than
returning it.
* trans-array.h (gfc_trans_auto_array_allocation): Use gfc_wrapped_block
(gfc_trans_dummy_array_bias): Ditto.
(gfc_trans_g77_array): Ditto.
(gfc_trans_deferred_array): Ditto.
* trans.c (gfc_add_expr_to_block): Call add_expr_to_chain.
(add_expr_to_chain): New method based on old gfc_add_expr_to_block.
(gfc_start_wrapped_block), (gfc_add_init_cleanup): New methods.
(gfc_finish_wrapped_block): New method.
* trans-array.c (gfc_trans_auto_array_allocation): use gfc_wrapped_block
(gfc_trans_g77_array), (gfc_trans_dummy_array_bias): Ditto.
(gfc_trans_deferred_array): Ditto.
* trans-decl.c (gfc_trans_dummy_character): Ditto.
(gfc_trans_auto_character_variable), (gfc_trans_assign_aux_var): Ditto.
(init_intent_out_dt): Ditto.
(gfc_init_default_dt): Add new init code to block rather than
returning it.
(gfc_trans_deferred_vars): Use gfc_wrapped_block to collect all init
and cleanup code and put it all together.
From-SVN: r162219
Diffstat (limited to 'gcc/fortran/trans.h')
-rw-r--r-- | gcc/fortran/trans.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h index c30d3b8..5147852 100644 --- a/gcc/fortran/trans.h +++ b/gcc/fortran/trans.h @@ -258,6 +258,29 @@ typedef struct gfc_saved_var; +/* Store information about a block of code together with special + initialization and clean-up code. This can be used to incrementally add + init and cleanup, and in the end put everything together to a + try-finally expression. */ +typedef struct +{ + tree init; + tree cleanup; + tree code; +} +gfc_wrapped_block; + + +/* Initialize an init/cleanup block. */ +void gfc_start_wrapped_block (gfc_wrapped_block* block, tree code); +/* Add a pair of init/cleanup code to the block. Each one might be a + NULL_TREE if not required. */ +void gfc_add_init_cleanup (gfc_wrapped_block* block, tree init, tree cleanup); +/* Finalize the block, that is, create a single expression encapsulating the + original code together with init and clean-up code. */ +tree gfc_finish_wrapped_block (gfc_wrapped_block* block); + + /* Advance the SS chain to the next term. */ void gfc_advance_se_ss_chain (gfc_se *); @@ -403,7 +426,7 @@ tree gfc_get_symbol_decl (gfc_symbol *); tree gfc_conv_initializer (gfc_expr *, gfc_typespec *, tree, bool, bool); /* Assign a default initializer to a derived type. */ -tree gfc_init_default_dt (gfc_symbol *, tree, bool); +void gfc_init_default_dt (gfc_symbol *, stmtblock_t *, bool); /* Substitute a temporary variable in place of the real one. */ void gfc_shadow_sym (gfc_symbol *, tree, gfc_saved_var *); |