This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: p2736.C Is dtor order guaranteed?
- To: mrs at wrs dot com
- Subject: Re: p2736.C Is dtor order guaranteed?
- From: Martin von Loewis <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Thu, 23 Jul 1998 10:53:06 +0200
- CC: egcs at cygnus dot com
- References: <199807230145.SAA27506@kankakee.wrs.com>
> No, all namespace variables, whether static or not. Keyed into a
> chain, one per loadable/unloadable module, not just one for exit time.
I'm getting confused. Of course cleanup applies to all variables with
static storage duration, be they namepace members or block level
statics variables.
However, it seems to me that the current code only generates atexit
calls for static variables inside functions:
void
expand_static_init (decl, init)
...
else if (! toplevel_bindings_p () && ! pseudo_global_level_p ())
{
...
if (TYPE_NEEDS_DESTRUCTOR (TREE_TYPE (decl)))
{
...
fcall = build_function_call (Atexit, expr_tree_cons (NULL_TREE, cleanup, NULL_TREE));
expand_expr_stmt (fcall);
}
}
else
{
...
static_aggregates = perm_tree_cons (init, decl, static_aggregates);
}
All I'm saying that it should always generate atexit calls. Also,
triggering execution of the static_aggregates with a single atexit
call is not enough, as we've already discussed.
Martin