p2736.C Is dtor order guaranteed?
Martin von Loewis
martin@mira.isdn.cs.tu-berlin.de
Thu Jul 23 01:56:00 GMT 1998
> 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
More information about the Gcc
mailing list