(C++) fix for bogus dup instantiation error with -frepo

Jason Merrill jason@cygnus.com
Thu Aug 19 14:19:00 GMT 1999


Fixes g++.pt/repo1.C

1999-08-19  Jason Merrill  <jason@yorick.cygnus.com>

	* cp-tree.h: Declare flag_use_repository.
	* pt.c (do_decl_instantiation): Don't complain about duplicate
	instantiation with -frepo.
	(do_type_instantiation): Likewise.

Index: cp-tree.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/cp-tree.h,v
retrieving revision 1.269
diff -c -p -r1.269 cp-tree.h
*** cp-tree.h	1999/08/18 20:44:05	1.269
--- cp-tree.h	1999/08/19 21:17:48
*************** extern int flag_guiding_decls;
*** 594,599 ****
--- 594,603 ----
     and class qualifiers.       */
  extern int flag_do_squangling;
  
+ /* Nonzero means generate separate instantiation control files and juggle
+    them at link time.  */
+ extern int flag_use_repository;
+ 
  /* Nonzero if we want to issue diagnostics that the standard says are not
     required.  */
  extern int flag_optional_diags;
Index: decl2.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl2.c,v
retrieving revision 1.240
diff -c -p -r1.240 decl2.c
*** decl2.c	1999/08/19 08:06:14	1.240
--- decl2.c	1999/08/19 21:17:48
*************** int warn_ctor_dtor_privacy = 1;
*** 232,238 ****
  #endif
  int flag_vtable_thunks = DEFAULT_VTABLE_THUNKS;
  
! /* True if we want to deal with repository information.  */
  
  int flag_use_repository;
  
--- 232,239 ----
  #endif
  int flag_vtable_thunks = DEFAULT_VTABLE_THUNKS;
  
! /* Nonzero means generate separate instantiation control files and juggle
!    them at link time.  */
  
  int flag_use_repository;
  
Index: pt.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/pt.c,v
retrieving revision 1.335
diff -c -p -r1.335 pt.c
*** pt.c	1999/08/19 08:06:15	1.335
--- pt.c	1999/08/19 21:17:49
*************** do_decl_instantiation (declspecs, declar
*** 9166,9175 ****
  	 No program shall explicitly instantiate any template more
  	 than once.  
  
! 	 We check DECL_INTERFACE_KNOWN so as not to complain when the
! 	 first instantiation was `extern' and the second is not, and
! 	 EXTERN_P for the opposite case.  */
!       if (DECL_INTERFACE_KNOWN (result) && !extern_p)
  	cp_pedwarn ("duplicate explicit instantiation of `%#D'", result);
  
        /* If we've already instantiated the template, just return now.  */
--- 9165,9175 ----
  	 No program shall explicitly instantiate any template more
  	 than once.  
  
! 	 We check DECL_INTERFACE_KNOWN so as not to complain when the first
! 	 instantiation was `extern' and the second is not, and EXTERN_P for
! 	 the opposite case.  If -frepo, chances are we already got marked
! 	 as an explicit instantion because of the repo file.  */
!       if (DECL_INTERFACE_KNOWN (result) && !extern_p && !flag_use_repository)
  	cp_pedwarn ("duplicate explicit instantiation of `%#D'", result);
  
        /* If we've already instantiated the template, just return now.  */
*************** do_type_instantiation (t, storage)
*** 9294,9304 ****
  	 No program shall explicitly instantiate any template more
  	 than once.  
  
!          If CLASSTYPE_INTERFACE_ONLY, then the first explicit
! 	 instantiation was `extern', and if EXTERN_P then the second
! 	 is.  Both cases are OK.  */
!       if (!CLASSTYPE_INTERFACE_ONLY (t) && !extern_p)
! 	cp_error ("duplicate explicit instantiation of `%#T'", t);
        
        /* If we've already instantiated the template, just return now.  */
        if (!CLASSTYPE_INTERFACE_ONLY (t))
--- 9294,9305 ----
  	 No program shall explicitly instantiate any template more
  	 than once.  
  
!          If CLASSTYPE_INTERFACE_ONLY, then the first explicit instantiation
! 	 was `extern'.  If EXTERN_P then the second is.  If -frepo, chances
! 	 are we already got marked as an explicit instantion because of the
! 	 repo file.  All these cases are OK.  */
!       if (!CLASSTYPE_INTERFACE_ONLY (t) && !extern_p && !flag_use_repository)
! 	cp_pedwarn ("duplicate explicit instantiation of `%#T'", t);
        
        /* If we've already instantiated the template, just return now.  */
        if (!CLASSTYPE_INTERFACE_ONLY (t))


More information about the Gcc-patches mailing list