[ObjC] PATCH: set at_eof before instantiating templates

Matt Austern austern@apple.com
Thu Jan 27 21:23:00 GMT 2005


This only affects Objective-C++, but there's no sense in having 
something wrong in the tree even if ObjC++ integration is still 
incomplete.

objc_finish_file does the first round of C++ template instantiation 
before invoking cp_finish_file.  Doing end-of-file template 
instantiation without setting at_eof is incorrect; among other things, 
it results in extern templates getting emitted.  (There's no need to 
clear at_eof after calling instantiate_pending_templates, because 
nothing that follows this relies on at_eof being 0.  And, after all, 
it's just plain true that at this point we're at eof!)

OK to commit to mainline?

			--Matt

2005-01-27  Matt Austern  <austern@apple.com>
	* objc-act.c (objc_finish_file): In Objective-C++ mode, set at_eof 
before calling instantiate_pending_templates.

Index: gcc/objc/objc-act.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/objc/objc-act.c,v
retrieving revision 1.264
diff -p -r1.264 objc-act.c
*** gcc/objc/objc-act.c	26 Jan 2005 21:01:57 -0000	1.264
--- gcc/objc/objc-act.c	27 Jan 2005 21:21:48 -0000
*************** objc_finish_file (void)
*** 591,596 ****
--- 591,597 ----
   #ifdef OBJCPLUS
     /* We need to instantiate templates _before_ we emit ObjC metadata;
        if we do not, some metadata (such as selectors) may go missing.  
*/
+   at_eof = 1;
     instantiate_pending_templates (0);
   #endif



More information about the Gcc-patches mailing list