diff options
author | Mark Mitchell <mark@codesourcery.com> | 2001-04-30 22:20:03 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2001-04-30 22:20:03 +0000 |
commit | 5fd893d507445801b27c0ebb36b4b802b4df86af (patch) | |
tree | ec5a1b3f95c43485a87f77ee9e0866764f490441 /gcc/cp/decl2.c | |
parent | 505cf15f076220417c5af1bd83029403a3c8dd48 (diff) | |
download | gcc-5fd893d507445801b27c0ebb36b4b802b4df86af.zip gcc-5fd893d507445801b27c0ebb36b4b802b4df86af.tar.gz gcc-5fd893d507445801b27c0ebb36b4b802b4df86af.tar.bz2 |
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
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r-- | gcc/cp/decl2.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 9bbfe3d..8cfc9da 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -3206,10 +3206,13 @@ start_static_initialization_or_destruction (decl, initp) my_friendly_assert (initp, 20000629); guard_cond = get_guard_cond (guard); } - /* Under the old ABI, e 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. */ + /* If we don't have __cxa_atexit, then we will be running + destructors from .fini sections, or their equivalents. So, + we need to know how many times we've tried to initialize this + 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) guard_cond = 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); - /* Under the new ABI, we have not already set the GUARD, so we must - do so now. */ - if (guard && initp) + /* If we're using __cxa_atexit, we have not already set the GUARD, + so we must do so now. */ + if (guard && initp && flag_use_cxa_atexit) finish_expr_stmt (set_guard (guard)); return guard_if_stmt; |