2
0
mirror of git://gcc.gnu.org/git/gcc.git synced 2024-12-28 18:35:33 +08:00

decl2.c (start_static_initialization_or_destruction): Correct logic to handle the -fno-use-cxa-atexit case.

* decl2.c (start_static_initialization_or_destruction): Correct
	logic to handle the -fno-use-cxa-atexit case.

From-SVN: r41697
This commit is contained in:
Mark Mitchell 2001-04-30 22:20:03 +00:00 committed by Mark Mitchell
parent 505cf15f07
commit 5fd893d507
2 changed files with 15 additions and 7 deletions

View File

@ -1,3 +1,8 @@
Mon Apr 30 16:14:10 2001 Mark P Mitchell <mark@codesourcery.com>
* decl2.c (start_static_initialization_or_destruction): Correct
logic to handle the -fno-use-cxa-atexit case.
2001-04-30 Mark Mitchell <mark@codesourcery.com> 2001-04-30 Mark Mitchell <mark@codesourcery.com>
* optimize.c (update_cloned_parm): New function. * optimize.c (update_cloned_parm): New function.

View File

@ -3206,10 +3206,13 @@ start_static_initialization_or_destruction (decl, initp)
my_friendly_assert (initp, 20000629); my_friendly_assert (initp, 20000629);
guard_cond = get_guard_cond (guard); guard_cond = get_guard_cond (guard);
} }
/* Under the old ABI, e do initializations only if the GUARD is /* If we don't have __cxa_atexit, then we will be running
zero, i.e., if we are the first to initialize the variable. destructors from .fini sections, or their equivalents. So,
We do destructions only if the GUARD is one, i.e., if we are we need to know how many times we've tried to initialize this
the last to destroy the variable. */ object. We do initializations only if the GUARD is zero,
i.e., if we are the first to initialize the variable. We do
destructions only if the GUARD is one, i.e., if we are the
last to destroy the variable. */
else if (initp) else if (initp)
guard_cond guard_cond
= cp_build_binary_op (EQ_EXPR, = cp_build_binary_op (EQ_EXPR,
@ -3230,9 +3233,9 @@ start_static_initialization_or_destruction (decl, initp)
finish_if_stmt_cond (cond, guard_if_stmt); finish_if_stmt_cond (cond, guard_if_stmt);
/* Under the new ABI, we have not already set the GUARD, so we must /* If we're using __cxa_atexit, we have not already set the GUARD,
do so now. */ so we must do so now. */
if (guard && initp) if (guard && initp && flag_use_cxa_atexit)
finish_expr_stmt (set_guard (guard)); finish_expr_stmt (set_guard (guard));
return guard_if_stmt; return guard_if_stmt;