aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2003-04-27 19:33:38 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2003-04-27 19:33:38 +0000
commit0b50d7f1826b8093258fa0ef25164aafbf183b2f (patch)
tree24897350fdc46c95e3e8ec19d7698e591653f78c
parent32a619073cabf92631b4a7d017de59f7390cae62 (diff)
downloadgcc-0b50d7f1826b8093258fa0ef25164aafbf183b2f.zip
gcc-0b50d7f1826b8093258fa0ef25164aafbf183b2f.tar.gz
gcc-0b50d7f1826b8093258fa0ef25164aafbf183b2f.tar.bz2
decl.c (maybe_commonize_var): Make the code match the comments.
* decl.c (maybe_commonize_var): Make the code match the comments. * pt.c (instantiate_decl): Move call to import_export_decl. From-SVN: r66135
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl.c13
-rw-r--r--gcc/cp/pt.c2
3 files changed, 14 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ddf0c3e..1b6444d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2003-04-27 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (maybe_commonize_var): Make the code match the comments.
+ * pt.c (instantiate_decl): Move call to import_export_decl.
+
2003-04-26 Mark Mitchell <mark@codesourcery.com>
* decl2.c (finish_file): Fix merge botch.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 181dd6f..575a612 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -7337,11 +7337,14 @@ maybe_commonize_var (tree decl)
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))
+ && 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
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 9faf035..02d910d 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -10998,6 +10998,7 @@ instantiate_decl (d, defer_ok)
NULL);
/* Set up context. */
+ import_export_decl (d);
start_function (NULL_TREE, d, NULL_TREE, SF_PRE_PARSED);
/* Create substitution entries for the parameters. */
@@ -11028,7 +11029,6 @@ instantiate_decl (d, defer_ok)
/* Finish the function. */
d = finish_function (0);
- import_export_decl (d);
expand_body (d);
}