This is the mail archive of the gcc-patches@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]

C++ PATCH for overleaous output of extern inlines



Yesterday's patch caused us to put out a few too many extern inlines.
Silly me.

-- 
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

1999-04-23  Mark Mitchell  <mark@codesourcery.com>

	* decl2.c (finish_file): Tweak handling of extern inlines so that
	they are not unnecessarily put out.

Index: decl2.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl2.c,v
retrieving revision 1.207
diff -u -p -r1.207 decl2.c
--- decl2.c	1999/04/22 23:13:04	1.207
+++ decl2.c	1999/04/23 23:40:53
@@ -3628,7 +3628,8 @@ finish_file ()
     {
       tree decl = VARRAY_TREE (saved_inlines, i);
       
-      if (DECL_NOT_REALLY_EXTERN (decl))
+      if (DECL_NOT_REALLY_EXTERN (decl) && !DECL_COMDAT (decl)
+	  && DECL_INITIAL (decl)) 
 	DECL_EXTERNAL (decl) = 0;
     }
 
@@ -3636,13 +3637,29 @@ finish_file ()
      initialization.  Do that now.  */
   do
     {
-      if (saved_inlines)
-	reconsider 
-	  |= wrapup_global_declarations (&VARRAY_TREE (saved_inlines, 0),
-					 saved_inlines_used);
-      reconsider 
-	= walk_namespaces (wrapup_globals_for_namespace, /*data=*/0);
+      reconsider = 0;
 
+      /* Above, we hung back on weak functions; they will be defined
+	 where they are needed.  But, here we loop again, so that we
+	 output the things that *are* needed.  */
+      for (i = 0; i < saved_inlines_used; ++i)
+	{
+	  tree decl = VARRAY_TREE (saved_inlines, i);
+      
+	  if (DECL_NOT_REALLY_EXTERN (decl)
+	      && DECL_INITIAL (decl)
+	      && TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
+	    DECL_EXTERNAL (decl) = 0;
+	}
+
+      if (saved_inlines_used
+	  && wrapup_global_declarations (&VARRAY_TREE (saved_inlines, 0),
+					 saved_inlines_used))
+	reconsider = 1;
+
+      if (walk_namespaces (wrapup_globals_for_namespace, /*data=*/0))
+	reconsider = 1;
+
       /* Static data members are just like namespace-scope globals.  */
       for (i = 0; i < pending_statics_used; ++i) 
 	{
@@ -3653,10 +3670,10 @@ finish_file ()
 	  if (DECL_NOT_REALLY_EXTERN (decl) && ! DECL_IN_AGGR_P (decl))
 	    DECL_EXTERNAL (decl) = 0;
 	}
-      if (pending_statics)
-	reconsider 
-	  |= wrapup_global_declarations (&VARRAY_TREE (pending_statics, 0),
-					 pending_statics_used);
+      if (pending_statics
+	  && wrapup_global_declarations (&VARRAY_TREE (pending_statics, 0),
+					 pending_statics_used))
+	reconsider = 1;
     }
   while (reconsider);
 


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