aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1998-06-08 10:52:37 +0000
committerJason Merrill <jason@gcc.gnu.org>1998-06-08 06:52:37 -0400
commitaeb302bbec86aff44fadaad0c9c9bf5e59cbe3f5 (patch)
tree2c388127a95218487e93567ec1198ce237ce1ede /gcc/cp/decl.c
parent8b015896c2a46c08cd90f2686a8fb533709e984c (diff)
downloadgcc-aeb302bbec86aff44fadaad0c9c9bf5e59cbe3f5.zip
gcc-aeb302bbec86aff44fadaad0c9c9bf5e59cbe3f5.tar.gz
gcc-aeb302bbec86aff44fadaad0c9c9bf5e59cbe3f5.tar.bz2
function.c: Define current_function_cannot_inline.
* function.c: Define current_function_cannot_inline. (push_function_context_to): Save it. (pop_function_context_from): Restore it. * function.h (struct function): Provide it a home. * output.h: Declare it. * integrate.c (function_cannot_inline_p): Check it. * decl.c (cp_finish_decl): Disable inlining of extern inlines with static variables. From-SVN: r20332
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 6772073..0505cc6 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -6992,35 +6992,20 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
if (was_temp)
end_temporary_allocation ();
- /* Extern inline function static data has external linkage. */
+ /* 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__. */
if (TREE_CODE (decl) == VAR_DECL
&& TREE_STATIC (decl)
+ && ! TREE_ASM_WRITTEN (decl)
&& current_function_decl
&& DECL_CONTEXT (decl) == current_function_decl
&& DECL_THIS_INLINE (current_function_decl)
&& TREE_PUBLIC (current_function_decl))
{
- if (DECL_INTERFACE_KNOWN (current_function_decl))
- {
- TREE_PUBLIC (decl) = 1;
- DECL_EXTERNAL (decl) = DECL_EXTERNAL (current_function_decl);
- }
- /* We can only do this if we can use common or weak, and we
- can't if it has been initialized and we don't support weak. */
- else if (DECL_INITIAL (decl) == NULL_TREE
- || DECL_INITIAL (decl) == error_mark_node)
- {
- TREE_PUBLIC (decl) = 1;
- DECL_COMMON (decl) = 1;
- }
- else if (flag_weak)
- make_decl_one_only (decl);
-
- 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);
+ current_function_cannot_inline
+ = "function with static variable cannot be inline";
}
else if (TREE_CODE (decl) == VAR_DECL