aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans.c
diff options
context:
space:
mode:
authorMikael Morin <mikael@gcc.gnu.org>2010-10-06 15:48:25 +0000
committerMikael Morin <mikael@gcc.gnu.org>2010-10-06 15:48:25 +0000
commit363aab219509999ae48a7c8e5c515e7d82f08474 (patch)
tree24bd13baa0b098c0036174293c6c3deeab54b3e0 /gcc/fortran/trans.c
parent1b4544b729d2d4d159df843afa8252af13fb2e55 (diff)
downloadgcc-363aab219509999ae48a7c8e5c515e7d82f08474.zip
gcc-363aab219509999ae48a7c8e5c515e7d82f08474.tar.gz
gcc-363aab219509999ae48a7c8e5c515e7d82f08474.tar.bz2
trans.c (gfc_restore_backend_locus): New function.
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. From-SVN: r165045
Diffstat (limited to 'gcc/fortran/trans.c')
-rw-r--r--gcc/fortran/trans.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index 117d345..a9513af 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -1055,11 +1055,11 @@ gfc_add_block_to_block (stmtblock_t * block, stmtblock_t * append)
}
-/* 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;
@@ -1077,6 +1077,17 @@ gfc_set_backend_locus (locus * loc)
}
+/* 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. */