This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: p2736.C Is dtor order guaranteed?


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]