mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-24 05:58:56 +08:00
pt.c (pop_tinst_level): Call extract_interface_info.
* pt.c (pop_tinst_level): Call extract_interface_info. (instantiate_decl): Don't save and restore file position. * decl.c (cp_finish_decl): Make statics in extern inlines and templates common, if possible and the target doesn't support weak symbols. From-SVN: r22824
This commit is contained in:
parent
b4558b577c
commit
5f2c99c43b
@ -1,5 +1,12 @@
|
||||
1998-10-04 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* pt.c (pop_tinst_level): Call extract_interface_info.
|
||||
(instantiate_decl): Don't save and restore file position.
|
||||
|
||||
* decl.c (cp_finish_decl): Make statics in extern inlines and
|
||||
templates common, if possible and the target doesn't support weak
|
||||
symbols.
|
||||
|
||||
* decl.c (grokdeclarator): Remove redundant calls to
|
||||
build_type_variant and some duplicated code.
|
||||
* sig.c (build_signature_reference_type): Only take the type parm.
|
||||
|
@ -7298,20 +7298,52 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
|
||||
if (was_temp)
|
||||
end_temporary_allocation ();
|
||||
|
||||
/* Extern inline function static data has external linkage.
|
||||
Instead of trying to deal with that, we disable inlining of
|
||||
such functions. The ASM_WRITTEN check is to avoid hitting this
|
||||
for __FUNCTION__. */
|
||||
/* Static data in a function with comdat linkage also has comdat
|
||||
linkage. */
|
||||
if (TREE_CODE (decl) == VAR_DECL
|
||||
&& TREE_STATIC (decl)
|
||||
/* Don't mess with __FUNCTION__. */
|
||||
&& ! TREE_ASM_WRITTEN (decl)
|
||||
&& current_function_decl
|
||||
&& DECL_CONTEXT (decl) == current_function_decl
|
||||
&& DECL_THIS_INLINE (current_function_decl)
|
||||
&& (DECL_THIS_INLINE (current_function_decl)
|
||||
|| DECL_TEMPLATE_INSTANTIATION (current_function_decl))
|
||||
&& TREE_PUBLIC (current_function_decl))
|
||||
{
|
||||
/* Rather than try to get this right with inlining, we suppress
|
||||
inlining of such functions. */
|
||||
current_function_cannot_inline
|
||||
= "function with static variable cannot be inline";
|
||||
|
||||
/* If flag_weak, we don't need to mess with this, as we can just
|
||||
make the function weak, and let it refer to its unique local
|
||||
copy. This works because we don't allow the function to be
|
||||
inlined. */
|
||||
if (! flag_weak)
|
||||
{
|
||||
if (DECL_INTERFACE_KNOWN (current_function_decl))
|
||||
{
|
||||
TREE_PUBLIC (decl) = 1;
|
||||
DECL_EXTERNAL (decl) = DECL_EXTERNAL (current_function_decl);
|
||||
}
|
||||
else if (DECL_INITIAL (decl) == NULL_TREE
|
||||
|| DECL_INITIAL (decl) == error_mark_node)
|
||||
{
|
||||
TREE_PUBLIC (decl) = 1;
|
||||
DECL_COMMON (decl) = 1;
|
||||
}
|
||||
/* else we lose. We can only do this if we can use common,
|
||||
which we can't if it has been initialized. */
|
||||
|
||||
if (TREE_PUBLIC (decl))
|
||||
DECL_ASSEMBLER_NAME (decl)
|
||||
= build_static_name (current_function_decl, DECL_NAME (decl));
|
||||
else if (! DECL_ARTIFICIAL (decl))
|
||||
{
|
||||
cp_warning_at ("sorry: semantics of inline function static data `%#D' are wrong (you'll wind up with multiple copies)", decl);
|
||||
cp_warning_at (" you can work around this by removing the initializer"), decl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (TREE_CODE (decl) == VAR_DECL
|
||||
|
@ -3995,6 +3995,7 @@ pop_tinst_level ()
|
||||
this instantiation. */
|
||||
lineno = old->line;
|
||||
input_filename = old->file;
|
||||
extract_interface_info ();
|
||||
|
||||
current_tinst_level = old->next;
|
||||
old->next = free_tinst_level;
|
||||
@ -8004,8 +8005,6 @@ instantiate_decl (d)
|
||||
tree gen_tmpl;
|
||||
int nested = in_function_p ();
|
||||
int pattern_defined;
|
||||
int line = lineno;
|
||||
char *file = input_filename;
|
||||
|
||||
/* This function should only be used to instantiate templates for
|
||||
functions and static member variables. */
|
||||
@ -8142,9 +8141,6 @@ instantiate_decl (d)
|
||||
{
|
||||
/* Defer all templates except inline functions used in another
|
||||
function. */
|
||||
lineno = line;
|
||||
input_filename = file;
|
||||
|
||||
if (at_eof && !pattern_defined
|
||||
&& DECL_EXPLICIT_INSTANTIATION (d))
|
||||
/* [temp.explicit]
|
||||
@ -8217,9 +8213,6 @@ instantiate_decl (d)
|
||||
}
|
||||
|
||||
out:
|
||||
lineno = line;
|
||||
input_filename = file;
|
||||
|
||||
pop_from_top_level ();
|
||||
pop_tinst_level ();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user