Commit 2aaf816d by Jason Merrill Committed by Jason Merrill

cp-tree.h: Declare flag_use_repository.

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

	* pt.c (push_template_decl_real): Complain about everything
	that isn't a valid template.

	* decl2.c (import_export_decl): If -fnew-abi, class linkage doesn't
	affect inlines.

From-SVN: r28767
parent 607eef6e
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.
* pt.c (push_template_decl_real): Complain about everything
that isn't a valid template.
* decl2.c (import_export_decl): If -fnew-abi, class linkage doesn't
affect inlines.
1999-08-19 Mark Mitchell <mark@codesourcery.com> 1999-08-19 Mark Mitchell <mark@codesourcery.com>
* cp-tree.def (PSEUDO_DTOR_EXPR): New tree code. * cp-tree.def (PSEUDO_DTOR_EXPR): New tree code.
......
...@@ -594,6 +594,10 @@ extern int flag_guiding_decls; ...@@ -594,6 +594,10 @@ extern int flag_guiding_decls;
and class qualifiers. */ and class qualifiers. */
extern int flag_do_squangling; 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 /* Nonzero if we want to issue diagnostics that the standard says are not
required. */ required. */
extern int flag_optional_diags; extern int flag_optional_diags;
......
...@@ -232,7 +232,8 @@ int warn_ctor_dtor_privacy = 1; ...@@ -232,7 +232,8 @@ int warn_ctor_dtor_privacy = 1;
#endif #endif
int flag_vtable_thunks = DEFAULT_VTABLE_THUNKS; int flag_vtable_thunks = DEFAULT_VTABLE_THUNKS;
/* True if we want to deal with repository information. */ /* Nonzero means generate separate instantiation control files and juggle
them at link time. */
int flag_use_repository; int flag_use_repository;
...@@ -2722,7 +2723,9 @@ import_export_decl (decl) ...@@ -2722,7 +2723,9 @@ import_export_decl (decl)
tree ctype = DECL_CLASS_CONTEXT (decl); tree ctype = DECL_CLASS_CONTEXT (decl);
import_export_class (ctype); import_export_class (ctype);
if (CLASSTYPE_INTERFACE_KNOWN (ctype) if (CLASSTYPE_INTERFACE_KNOWN (ctype)
&& (! DECL_ARTIFICIAL (decl) || DECL_VINDEX (decl))) && (flag_new_abi
? (! DECL_THIS_INLINE (decl))
: (! DECL_ARTIFICIAL (decl) || DECL_VINDEX (decl))))
{ {
DECL_NOT_REALLY_EXTERN (decl) DECL_NOT_REALLY_EXTERN (decl)
= ! (CLASSTYPE_INTERFACE_ONLY (ctype) = ! (CLASSTYPE_INTERFACE_ONLY (ctype)
......
...@@ -2424,11 +2424,12 @@ push_template_decl_real (decl, is_friend) ...@@ -2424,11 +2424,12 @@ push_template_decl_real (decl, is_friend)
else if (TREE_CODE (decl) == TYPE_DECL else if (TREE_CODE (decl) == TYPE_DECL
&& ANON_AGGRNAME_P (DECL_NAME (decl))) && ANON_AGGRNAME_P (DECL_NAME (decl)))
cp_error ("template class without a name"); cp_error ("template class without a name");
else if (TREE_CODE (decl) == TYPE_DECL else if ((DECL_IMPLICIT_TYPEDEF_P (decl)
&& TREE_CODE (TREE_TYPE (decl)) == ENUMERAL_TYPE) && CLASS_TYPE_P (TREE_TYPE (decl)))
cp_error ("template declaration of `%#T'", TREE_TYPE (decl)); || (TREE_CODE (decl) == VAR_DECL && ctx && CLASS_TYPE_P (ctx))
else if (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == FUNCTION_DECL)
&& !CLASS_TYPE_P (CP_DECL_CONTEXT (decl))) /* OK */;
else
cp_error ("template declaration of `%#D'", decl); cp_error ("template declaration of `%#D'", decl);
} }
...@@ -2582,9 +2583,7 @@ push_template_decl_real (decl, is_friend) ...@@ -2582,9 +2583,7 @@ push_template_decl_real (decl, is_friend)
&& TREE_CODE (TREE_TYPE (decl)) != ENUMERAL_TYPE) && TREE_CODE (TREE_TYPE (decl)) != ENUMERAL_TYPE)
DECL_NAME (decl) = classtype_mangled_name (TREE_TYPE (decl)); DECL_NAME (decl) = classtype_mangled_name (TREE_TYPE (decl));
} }
else if (! DECL_LANG_SPECIFIC (decl)) else if (DECL_LANG_SPECIFIC (decl))
cp_error ("template declaration of `%#D'", decl);
else
DECL_TEMPLATE_INFO (decl) = info; DECL_TEMPLATE_INFO (decl) = info;
return DECL_TEMPLATE_RESULT (tmpl); return DECL_TEMPLATE_RESULT (tmpl);
...@@ -9166,10 +9165,11 @@ do_decl_instantiation (declspecs, declarator, storage) ...@@ -9166,10 +9165,11 @@ do_decl_instantiation (declspecs, declarator, storage)
No program shall explicitly instantiate any template more No program shall explicitly instantiate any template more
than once. than once.
We check DECL_INTERFACE_KNOWN so as not to complain when the We check DECL_INTERFACE_KNOWN so as not to complain when the first
first instantiation was `extern' and the second is not, and instantiation was `extern' and the second is not, and EXTERN_P for
EXTERN_P for the opposite case. */ the opposite case. If -frepo, chances are we already got marked
if (DECL_INTERFACE_KNOWN (result) && !extern_p) 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); cp_pedwarn ("duplicate explicit instantiation of `%#D'", result);
/* If we've already instantiated the template, just return now. */ /* If we've already instantiated the template, just return now. */
...@@ -9294,11 +9294,12 @@ do_type_instantiation (t, storage) ...@@ -9294,11 +9294,12 @@ do_type_instantiation (t, storage)
No program shall explicitly instantiate any template more No program shall explicitly instantiate any template more
than once. than once.
If CLASSTYPE_INTERFACE_ONLY, then the first explicit If CLASSTYPE_INTERFACE_ONLY, then the first explicit instantiation
instantiation was `extern', and if EXTERN_P then the second was `extern'. If EXTERN_P then the second is. If -frepo, chances
is. Both cases are OK. */ are we already got marked as an explicit instantion because of the
if (!CLASSTYPE_INTERFACE_ONLY (t) && !extern_p) repo file. All these cases are OK. */
cp_error ("duplicate explicit instantiation of `%#T'", t); 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 we've already instantiated the template, just return now. */
if (!CLASSTYPE_INTERFACE_ONLY (t)) if (!CLASSTYPE_INTERFACE_ONLY (t))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment