* trans.c (gfc_restore_backend_locus): New function.
(gfc_get_backend_locus): Renamed to ...
(gfc_save_backend_locus): ... this.
* trans.h (gfc_restore_backend_locus, gfc_get_backend_locus,
gfc_save_backend_locus): Same.
* trans-array.c (gfc_trans_g77_array, gfc_trans_dummy_array_bias,
gfc_trans_deferred_array): Rename gfc_get_backend_locus to
gfc_save_backend_locus.
(gfc_trans_dummy_array_bias): Call gfc_restore_backend_locus at the
end.
(gfc_trans_g77_array, gfc_trans_deferred_array): Use
gfc_restore_backend_locus instead of gfc_set_backend_locus.
(gfc_trans_deferred_array): Call gfc_restore_backend_locus on early
return.
* trans-decl.c (gfc_get_extern_function_decl, build_entry_thunks,
gfc_trans_deferred_vars):
Rename gfc_get_backend_locus to gfc_save_backend_locus.
Use gfc_restore_backend_locus insted of gfc_set_backend_locus.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165045
138bc75d-0d04-0410-961f-
82ee72b054a4
2010-10-06 Mikael Morin <mikael@gcc.gnu.org>
+ * trans.c (gfc_restore_backend_locus): New function.
+ (gfc_get_backend_locus): Renamed to ...
+ (gfc_save_backend_locus): ... this.
+ * trans.h (gfc_restore_backend_locus, gfc_get_backend_locus,
+ gfc_save_backend_locus): Same.
+ * trans-array.c (gfc_trans_g77_array, gfc_trans_dummy_array_bias,
+ gfc_trans_deferred_array): Rename gfc_get_backend_locus to
+ gfc_save_backend_locus.
+ (gfc_trans_dummy_array_bias): Call gfc_restore_backend_locus at the
+ end.
+ (gfc_trans_g77_array, gfc_trans_deferred_array): Use
+ gfc_restore_backend_locus instead of gfc_set_backend_locus.
+ (gfc_trans_deferred_array): Call gfc_restore_backend_locus on early
+ return.
+ * trans-decl.c (gfc_get_extern_function_decl, build_entry_thunks,
+ gfc_trans_deferred_vars):
+ Rename gfc_get_backend_locus to gfc_save_backend_locus.
+ Use gfc_restore_backend_locus insted of gfc_set_backend_locus.
+
+2010-10-06 Mikael Morin <mikael@gcc.gnu.org>
+
* trans-array.c (gfc_build_constant_array_constructor): Free array
spec when done.
locus loc;
tree offset;
tree tmp;
- tree stmt;
+ tree stmt;
stmtblock_t init;
- gfc_get_backend_locus (&loc);
+ gfc_save_backend_locus (&loc);
gfc_set_backend_locus (&sym->declared_at);
/* Descriptor type. */
}
stmt = gfc_finish_block (&init);
- gfc_set_backend_locus (&loc);
+ gfc_restore_backend_locus (&loc);
/* Add the initialization code to the start of the function. */
return;
}
- gfc_get_backend_locus (&loc);
+ gfc_save_backend_locus (&loc);
gfc_set_backend_locus (&sym->declared_at);
/* Descriptor type. */
/* We don't need to free any memory allocated by internal_pack as it will
be freed at the end of the function by pop_context. */
gfc_add_init_cleanup (block, stmtInit, stmtCleanup);
+
+ gfc_restore_backend_locus (&loc);
}
return;
}
- gfc_get_backend_locus (&loc);
+ gfc_save_backend_locus (&loc);
gfc_set_backend_locus (&sym->declared_at);
descriptor = sym->backend_decl;
gfc_trans_static_array_pointer (sym);
gfc_add_init_cleanup (block, gfc_finish_block (&init), NULL_TREE);
+ gfc_restore_backend_locus (&loc);
return;
}
gfc_conv_descriptor_data_set (&init, descriptor, null_pointer_node);
gfc_init_block (&cleanup);
- gfc_set_backend_locus (&loc);
+ gfc_restore_backend_locus (&loc);
/* Allocatable arrays need to be freed when they go out of scope.
The allocatable components of pointers must not be touched. */
tree save_fn_decl = current_function_decl;
current_function_decl = NULL_TREE;
- gfc_get_backend_locus (&old_loc);
+ gfc_save_backend_locus (&old_loc);
push_cfun (cfun);
gfc_create_function_decl (gsym->ns, true);
pop_cfun ();
- gfc_set_backend_locus (&old_loc);
+ gfc_restore_backend_locus (&old_loc);
current_function_decl = save_fn_decl;
}
/* This should always be a toplevel function. */
gcc_assert (current_function_decl == NULL_TREE);
- gfc_get_backend_locus (&old_loc);
+ gfc_save_backend_locus (&old_loc);
for (el = ns->entries; el; el = el->next)
{
VEC(tree,gc) *args = NULL;
}
}
- gfc_set_backend_locus (&old_loc);
+ gfc_restore_backend_locus (&old_loc);
}
NULL_TREE);
}
- gfc_get_backend_locus (&loc);
+ gfc_save_backend_locus (&loc);
gfc_set_backend_locus (&sym->declared_at);
gfc_trans_auto_array_allocation (sym->backend_decl,
sym, block);
- gfc_set_backend_locus (&loc);
+ gfc_restore_backend_locus (&loc);
}
break;
gfc_trans_deferred_array (sym, block);
else if (sym->ts.type == BT_CHARACTER)
{
- gfc_get_backend_locus (&loc);
+ gfc_save_backend_locus (&loc);
gfc_set_backend_locus (&sym->declared_at);
if (sym->attr.dummy || sym->attr.result)
gfc_trans_dummy_character (sym, sym->ts.u.cl, block);
else
gfc_trans_auto_character_variable (sym, block);
- gfc_set_backend_locus (&loc);
+ gfc_restore_backend_locus (&loc);
}
else if (sym->attr.assign)
{
- gfc_get_backend_locus (&loc);
+ gfc_save_backend_locus (&loc);
gfc_set_backend_locus (&sym->declared_at);
gfc_trans_assign_aux_var (sym, block);
- gfc_set_backend_locus (&loc);
+ gfc_restore_backend_locus (&loc);
}
else if (sym->ts.type == BT_DERIVED
&& sym->value
}
-/* Get the current locus. The structure may not be complete, and should
- only be used with gfc_set_backend_locus. */
+/* Save the current locus. The structure may not be complete, and should
+ only be used with gfc_restore_backend_locus. */
void
-gfc_get_backend_locus (locus * loc)
+gfc_save_backend_locus (locus * loc)
{
loc->lb = XCNEW (gfc_linebuf);
loc->lb->location = input_location;
}
+/* Restore the saved locus. Only used in conjonction with
+ gfc_save_backend_locus, to free the memory when we are done. */
+
+void
+gfc_restore_backend_locus (locus * loc)
+{
+ gfc_set_backend_locus (loc);
+ gfc_free (loc->lb);
+}
+
+
/* Translate an executable statement. The tree cond is used by gfc_trans_do.
This static function is wrapped by gfc_trans_code_cond and
gfc_trans_code. */
void gfc_module_add_decl (struct module_htab_entry *, tree);
/* Get and set the current location. */
+void gfc_save_backend_locus (locus *);
void gfc_set_backend_locus (locus *);
-void gfc_get_backend_locus (locus *);
+void gfc_restore_backend_locus (locus *);
/* Handle static constructor functions. */
extern GTY(()) tree gfc_static_ctors;