diff options
Diffstat (limited to 'gcc/fortran/interface.cc')
-rw-r--r-- | gcc/fortran/interface.cc | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/gcc/fortran/interface.cc b/gcc/fortran/interface.cc index ea82056..c01df04 100644 --- a/gcc/fortran/interface.cc +++ b/gcc/fortran/interface.cc @@ -78,14 +78,17 @@ along with GCC; see the file COPYING3. If not see gfc_interface_info current_interface; -/* Free a singly linked list of gfc_interface structures. */ +/* Free the leading members of the gfc_interface linked list given in INTR + up to the END element (exclusive: the END element is not freed). + If END is not nullptr, it is assumed that END is in the linked list starting + with INTR. */ -void -gfc_free_interface (gfc_interface *intr) +static void +free_interface_elements_until (gfc_interface *intr, gfc_interface *end) { gfc_interface *next; - for (; intr; intr = next) + for (; intr != end; intr = next) { next = intr->next; free (intr); @@ -93,6 +96,32 @@ gfc_free_interface (gfc_interface *intr) } +/* Free a singly linked list of gfc_interface structures. */ + +void +gfc_free_interface (gfc_interface *intr) +{ + free_interface_elements_until (intr, nullptr); +} + + +/* Update the interface pointer given by IFC_PTR to make it point to TAIL. + It is expected that TAIL (if non-null) is in the list pointed to by + IFC_PTR, hence the tail of it. The members of the list before TAIL are + freed before the pointer reassignment. */ + +void +gfc_drop_interface_elements_before (gfc_interface **ifc_ptr, + gfc_interface *tail) +{ + if (ifc_ptr == nullptr) + return; + + free_interface_elements_until (*ifc_ptr, tail); + *ifc_ptr = tail; +} + + /* Change the operators unary plus and minus into binary plus and minus respectively, leaving the rest unchanged. */ @@ -4953,7 +4982,7 @@ gfc_add_interface (gfc_symbol *new_sym) } -gfc_interface * +gfc_interface *& gfc_current_interface_head (void) { switch (current_interface.type) |