toplev.c (wrapup_global_declarations): Don't write out artificial static variables...
authorMark Mitchell <mark@codesourcery.com>
Wed, 15 Nov 2000 18:34:29 +0000 (18:34 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Wed, 15 Nov 2000 18:34:29 +0000 (18:34 +0000)
* toplev.c (wrapup_global_declarations): Don't write out
artificial static variables that aren't needed.

* decl.c (wrapup_globals_for_namespace): Don't mark things
TREE_ASM_WRITTEN when they're not.

From-SVN: r37485

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/toplev.c

index c9d8ff6a4309a34615e50471166b27798ca33e22..dfed0a725efa06db27cc1c49ecb0bc8dd336485e 100644 (file)
@@ -1,3 +1,8 @@
+2000-11-15  Mark Mitchell  <mark@codesourcery.com>
+
+       * toplev.c (wrapup_global_declarations): Don't write out
+       artificial static variables that aren't needed.
+
 2000-11-15  Bernd Schmidt  <bernds@redhat.co.uk>
 
        * ia64.c (struct group): New structure.
index c5a369ccf4d87041568fe0bcc43b821c0035e783..5294676ff7a37178da97b0b4ac0078524dc34e89 100644 (file)
@@ -1,3 +1,8 @@
+2000-11-15  Mark Mitchell  <mark@codesourcery.com>
+
+       * decl.c (wrapup_globals_for_namespace): Don't mark things
+       TREE_ASM_WRITTEN when they're not.
+
 2000-11-15  Jason Merrill  <jason@redhat.com>
 
        * typeck2.c (friendly_abort): Uncount the error before handing
index 0d677febb115680955326a54dfacc2e2d5d25b43..192a7cd857ed1562173badbba8eb4262b1246d76 100644 (file)
@@ -1926,20 +1926,8 @@ wrapup_globals_for_namespace (namespace, data)
 
   /* Process the decls in reverse order--earliest first.
      Put them into VEC from back to front, then take out from front.  */
-
   for (i = 0, decl = globals; i < len; i++, decl = TREE_CHAIN (decl))
-    {
-      /* Pretend we've output an unused static variable.  This ensures
-         that the toplevel __FUNCTION__ etc won't be emitted, unless
-         needed. */
-      if (TREE_CODE (decl) == VAR_DECL && DECL_ARTIFICIAL (decl)
-         && !TREE_PUBLIC (decl) && !TREE_USED (decl))
-       {
-         TREE_ASM_WRITTEN (decl) = 1;
-         DECL_IGNORED_P (decl) = 1;
-       }
-      vec[len - i - 1] = decl;
-    }
+    vec[len - i - 1] = decl;
 
   if (last_time)
     {
index 95955fb6ca3f8f277631814cbae0ef2038a0870c..d25085a715c2ddd33ed91e130597914356ff4c49 100644 (file)
@@ -1950,7 +1950,9 @@ wrapup_global_declarations (vec, len)
          if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
              && (! TREE_READONLY (decl)
                  || TREE_PUBLIC (decl)
-                 || (!optimize && flag_keep_static_consts)
+                 || (!optimize 
+                     && flag_keep_static_consts
+                     && !DECL_ARTIFICIAL (decl))
                  || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
            {
              reconsider = 1;