public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-5655] ada: Further cleanup in finalization machinery
@ 2023-11-21 9:59 Marc Poulhi?s
0 siblings, 0 replies; only message in thread
From: Marc Poulhi?s @ 2023-11-21 9:59 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:706535a9a2a726c388a3127fffc0848fb33bb951
commit r14-5655-g706535a9a2a726c388a3127fffc0848fb33bb951
Author: Eric Botcazou <ebotcazou@adacore.com>
Date: Fri Oct 27 11:34:31 2023 +0200
ada: Further cleanup in finalization machinery
The bodies of generic units are instantiated separately by GNAT at the end
of the processing of the compilation unit. This requires the deferral of
the generation of cleanups and finalization actions in enclosing scopes,
except for instantiations in generic units where they are not generated.
The criterion used to detect this latter case is Inside_A_Generic, but this
global variable is not properly updated during the instantiation of generic
bodies, leading to problems with nested instantiations, so it is changed to
Expander_Active instead. As a matter of fact, the exact same idiom is used
a few lines above to clear the Needs_Body variable.
gcc/ada/
* sem_ch12.adb (Analyze_Package_Instantiation): Test Expander_Active
to detect generic contexts for the generation of cleanup actions.
Diff:
---
gcc/ada/sem_ch12.adb | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 31fcbedf774..7c645c490ae 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -4824,10 +4824,7 @@ package body Sem_Ch12 is
-- Cleanup actions are not generated within generic units
-- or in the formal part of generic units.
- if Inside_A_Generic
- or else Is_Generic_Unit (S)
- or else Ekind (S) = E_Void
- then
+ if not Expander_Active then
exit;
-- For package scopes, cleanup actions are generated only
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-11-21 9:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-21 9:59 [gcc r14-5655] ada: Further cleanup in finalization machinery Marc Poulhi?s
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).