This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH: Fix deduct5.C
- From: Mark Mitchell <mark at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 27 Apr 2003 12:45:09 -0700
- Subject: C++ PATCH: Fix deduct5.C
- Reply-to: mark at codesourcery dot com
This patch fixes deduct5.C on targets without weak, and seems to do no
damage on i686-pc-linux-gnu.
There is some major ugliness in the way this stuff works, but
it's gettling a little cleaner...
--
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery dot com
2003-04-27 Mark Mitchell <mark at codesourcery dot com>
* decl.c (maybe_commonize_var): Make the code match the comments.
* pt.c (instantiate_decl): Move call to import_export_decl.
Index: decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.965.2.38
diff -c -5 -p -r1.965.2.38 decl.c
*** decl.c 23 Apr 2003 17:32:58 -0000 1.965.2.38
--- decl.c 27 Apr 2003 19:24:14 -0000
*************** maybe_commonize_var (decl)
*** 7792,7806 ****
/* Static data in a function with comdat linkage also has comdat
linkage. */
if (TREE_STATIC (decl)
/* Don't mess with __FUNCTION__. */
&& ! DECL_ARTIFICIAL (decl)
! && current_function_decl
! && DECL_CONTEXT (decl) == current_function_decl
! && (DECL_DECLARED_INLINE_P (current_function_decl)
! || DECL_TEMPLATE_INSTANTIATION (current_function_decl))
! && TREE_PUBLIC (current_function_decl))
{
/* 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. */
--- 7792,7809 ----
/* Static data in a function with comdat linkage also has comdat
linkage. */
if (TREE_STATIC (decl)
/* Don't mess with __FUNCTION__. */
&& ! DECL_ARTIFICIAL (decl)
! && DECL_FUNCTION_SCOPE_P (decl)
! /* Unfortunately, import_export_decl has not always been called
! before the function is processed, so we cannot simply check
! DECL_COMDAT. */
! && (DECL_COMDAT (decl)
! || ((DECL_DECLARED_INLINE_P (DECL_CONTEXT (decl))
! || DECL_TEMPLATE_INSTANTIATION (DECL_CONTEXT (decl)))
! && TREE_PUBLIC (DECL_CONTEXT (decl)))))
{
/* 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. */
Index: pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.635.2.20
diff -c -5 -p -r1.635.2.20 pt.c
*** pt.c 25 Apr 2003 23:37:01 -0000 1.635.2.20
--- pt.c 27 Apr 2003 19:24:17 -0000
*************** instantiate_decl (d, defer_ok)
*** 10422,10431 ****
--- 10422,10432 ----
htab_hash_pointer,
htab_eq_pointer,
NULL);
/* Set up context. */
+ import_export_decl (d);
start_function (NULL_TREE, d, NULL_TREE, SF_PRE_PARSED);
/* Substitute into the body of the function. */
tsubst_expr (DECL_SAVED_TREE (code_pattern), args,
tf_error | tf_warning, tmpl);
*************** instantiate_decl (d, defer_ok)
*** 10434,10444 ****
htab_delete (local_specializations);
local_specializations = saved_local_specializations;
/* Finish the function. */
d = finish_function (0);
- import_export_decl (d);
expand_body (d);
}
/* We're not deferring instantiation any more. */
TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (d)) = 0;
--- 10435,10444 ----