aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/st.cc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2023-03-03 20:34:09 +0100
committerMarc Poulhiès <poulhies@adacore.com>2023-05-26 09:29:16 +0200
commit0c1d2675f964808b042b9fafae2c540933bb8269 (patch)
treeec0c0ba62718895a80ef4a690fc50de54ffc3b1c /gcc/fortran/st.cc
parent9df0c1198ecba478ac27d28765224412ee6606e9 (diff)
downloadgcc-0c1d2675f964808b042b9fafae2c540933bb8269.zip
gcc-0c1d2675f964808b042b9fafae2c540933bb8269.tar.gz
gcc-0c1d2675f964808b042b9fafae2c540933bb8269.tar.bz2
ada: Fix missing finalization in library-level instance body
This extends the delaying mechanism present in the cases where the instance is not at library level, so as to wait until after the instantiation of the body is performed, before generating the finalizer of the compilation unit. gcc/ada/ * einfo.ads (Delay_Cleanups): Document new usage. * exp_ch7.ads (Build_Finalizer): New declaration. * exp_ch7.adb (Build_Finalizer.Process_Declarations): Do not treat library-level package instantiations specially. (Build_Finalizer): Return early for package bodies and specs that are not compilation units instead of using a more convoluted test. (Expand_N_Package_Body): Do not build a finalizer if Delay_Cleanups is set on the defining entity. (Expand_N_Package_Declaration): Likewise. * inline.ads (Pending_Body_Info): Reorder and add Fin_Scop. (Add_Pending_Instantiation): Add Fin_Scop parameter. * inline.adb (Add_Pending_Instantiation): Likewise and copy it into the Pending_Body_Info appended to Pending_Instantiations. (Add_Scope_To_Clean): Change parameter name to Scop and remove now irrelevant processing. (Cleanup_Scopes): Deal with scopes that are package specs or bodies. (Instantiate_Body): For package instantiations, deal specially with scopes that are package bodies and with scopes that are dynamic. Pass the resulting scope to Add_Scope_To_Clean directly. * sem_ch12.adb (Analyze_Package_Instantiation): In the case where a body is needed, compute the enclosing finalization scope and pass it in the call to Add_Pending_Instantiation. (Inline_Instance_Body): Adjust aggregate passed in the calls to Instantiate_Package_Body. (Load_Parent_Of_Generic): Likewise.
Diffstat (limited to 'gcc/fortran/st.cc')
0 files changed, 0 insertions, 0 deletions