diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2025-03-09 19:35:06 +0100 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2025-03-09 19:47:42 +0100 |
commit | 9f5b508bc5c16ae11ea385f6031487a518f62c8f (patch) | |
tree | 829fb45515699b1990891484e093b86c0cee735c | |
parent | 7232c005afb5002cdfd0a2dbd0e8b8f2d80250ce (diff) | |
download | gcc-9f5b508bc5c16ae11ea385f6031487a518f62c8f.zip gcc-9f5b508bc5c16ae11ea385f6031487a518f62c8f.tar.gz gcc-9f5b508bc5c16ae11ea385f6031487a518f62c8f.tar.bz2 |
Use gfc_commit_symbol() to remove UNDO status instead of new function.
This is a cleaner version, removing an unneeded function and
making sure that no memory leaks can occur if callers change.
gcc/fortran/ChangeLog:
PR fortran/119157
* gfortran.h (gfc_pop_undo_symbol): Remove prototype.
* interface.cc (gfc_get_formal_from_actual_arglist): Use
gfc_commit_symbol() instead of gfc_pop_undo_symbol().
* symbol.cc (gfc_pop_undo_symbol): Remove.
-rw-r--r-- | gcc/fortran/gfortran.h | 1 | ||||
-rw-r--r-- | gcc/fortran/interface.cc | 4 | ||||
-rw-r--r-- | gcc/fortran/symbol.cc | 5 |
3 files changed, 2 insertions, 8 deletions
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index f81be1d..cf48d02 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -3736,7 +3736,6 @@ void gfc_traverse_user_op (gfc_namespace *, void (*)(gfc_user_op *)); void gfc_save_all (gfc_namespace *); void gfc_enforce_clean_symbol_state (void); -void gfc_pop_undo_symbol (void); gfc_gsymbol *gfc_get_gsymbol (const char *, bool bind_c); gfc_gsymbol *gfc_find_gsymbol (gfc_gsymbol *, const char *); diff --git a/gcc/fortran/interface.cc b/gcc/fortran/interface.cc index e3bc22f..c59ed1f 100644 --- a/gcc/fortran/interface.cc +++ b/gcc/fortran/interface.cc @@ -5836,8 +5836,6 @@ gfc_get_formal_from_actual_arglist (gfc_symbol *sym, { snprintf (name, GFC_MAX_SYMBOL_LEN, "_formal_%d", var_num ++); gfc_get_symbol (name, gfc_current_ns, &s); - /* We do not need this in an undo table. */ - gfc_pop_undo_symbol(); if (a->expr->ts.type == BT_PROCEDURE) { gfc_symbol *asym = a->expr->symtree->n.sym; @@ -5878,12 +5876,14 @@ gfc_get_formal_from_actual_arglist (gfc_symbol *sym, s->declared_at = a->expr->where; s->attr.intent = INTENT_UNKNOWN; (*f)->sym = s; + gfc_commit_symbol (s); } else /* If a->expr is NULL, this is an alternate rerturn. */ (*f)->sym = NULL; f = &((*f)->next); } + } diff --git a/gcc/fortran/symbol.cc b/gcc/fortran/symbol.cc index 92cba41..81aa81d 100644 --- a/gcc/fortran/symbol.cc +++ b/gcc/fortran/symbol.cc @@ -3898,11 +3898,6 @@ enforce_single_undo_checkpoint (void) gcc_checking_assert (single_undo_checkpoint_p ()); } -void -gfc_pop_undo_symbol () -{ - latest_undo_chgset->syms.pop(); -} /* Undoes all the changes made to symbols in the current statement. */ |