From 363aab219509999ae48a7c8e5c515e7d82f08474 Mon Sep 17 00:00:00 2001 From: Mikael Morin Date: Wed, 6 Oct 2010 15:48:25 +0000 Subject: trans.c (gfc_restore_backend_locus): New function. 2010-10-06 Mikael Morin * 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 --- gcc/fortran/trans.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'gcc/fortran/trans.c') 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. */ -- cgit v1.1