OSDN Git Service

* decl2.c (start_static_initialization_or_destruction): Correct
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 30 Apr 2001 22:20:03 +0000 (22:20 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 30 Apr 2001 22:20:03 +0000 (22:20 +0000)
logic to handle the -fno-use-cxa-atexit case.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@41697 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl2.c

index b3e4d39..57d2a4a 100644 (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>
 
        * optimize.c (update_cloned_parm): New function.
index 9bbfe3d..8cfc9da 100644 (file)
@@ -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;