decl.c (push_throw_library_fn): Take the FUNCTION_TYPE.

* decl.c (push_throw_library_fn): Take the FUNCTION_TYPE.
        * except.c (expand_end_eh_spec): Add the return type.
        * rtti.c (throw_bad_cast): Add the parmtypes.
        (throw_bad_typeid): Likewise.

        * semantics.c (expand_stmt): Only leave out rtl for unused
        artificials, and set DECL_IGNORED_P on them as well.
        * decl.c (wrapup_globals_for_namespace): Likewise.

        * decl.c (maybe_commonize_var): Skip all artificial decls.
        * pt.c (tsubst_decl): Don't copy TREE_ASM_WRITTEN.

From-SVN: r32475
This commit is contained in:
Jason Merrill 2000-03-10 19:23:18 -05:00
parent e5fd03ba40
commit cf74fb8675
6 changed files with 46 additions and 24 deletions

View File

@ -1,3 +1,19 @@
2000-03-10 Jason Merrill <jason@casey.cygnus.com>
* decl.c (push_throw_library_fn): Take the FUNCTION_TYPE.
* except.c (expand_end_eh_spec): Add the return type.
* rtti.c (throw_bad_cast): Add the parmtypes.
(throw_bad_typeid): Likewise.
* semantics.c (expand_stmt): Only leave out rtl for unused
artificials, and set DECL_IGNORED_P on them as well.
* decl.c (wrapup_globals_for_namespace): Likewise.
2000-03-09 Nathan Sidwell <nathan@codesourcery.com>
* decl.c (maybe_commonize_var): Skip all artificial decls.
* pt.c (tsubst_decl): Don't copy TREE_ASM_WRITTEN.
2000-03-10 Jason Merrill <jason@casey.cygnus.com>
* lang-options.h, decl2.c: Add -fno-enforce-eh-specs.

View File

@ -1789,9 +1789,12 @@ wrapup_globals_for_namespace (namespace, data)
/* Pretend we've output an unused static variable. This ensures
that the toplevel __FUNCTION__ etc won't be emitted, unless
needed. */
if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
&& !TREE_USED (decl))
TREE_ASM_WRITTEN (decl) = 1;
if (TREE_CODE (decl) == VAR_DECL && DECL_ARTIFICIAL (decl)
&& !TREE_PUBLIC (decl) && !TREE_USED (decl))
{
TREE_ASM_WRITTEN (decl) = 1;
DECL_IGNORED_P (decl) = 1;
}
vec[len - i - 1] = decl;
}
@ -6578,14 +6581,14 @@ push_void_library_fn (name, parmtypes)
return push_library_fn (name, type);
}
/* Like push_void_library_fn, but also note that this function throws
/* Like push_library_fn, but also note that this function throws
and does not return. Used for __throw_foo and the like. */
tree
push_throw_library_fn (name, parmtypes)
tree name, parmtypes;
push_throw_library_fn (name, type)
tree name, type;
{
tree fn = push_void_library_fn (name, parmtypes);
tree fn = push_library_fn (name, type);
TREE_THIS_VOLATILE (fn) = 1;
TREE_NOTHROW (fn) = 0;
return fn;
@ -7272,7 +7275,7 @@ maybe_commonize_var (decl)
linkage. */
if (TREE_STATIC (decl)
/* Don't mess with __FUNCTION__. */
&& ! TREE_ASM_WRITTEN (decl)
&& ! DECL_ARTIFICIAL (decl)
&& current_function_decl
&& DECL_CONTEXT (decl) == current_function_decl
&& (DECL_THIS_INLINE (current_function_decl)
@ -7307,7 +7310,7 @@ maybe_commonize_var (decl)
if (TREE_PUBLIC (decl))
DECL_ASSEMBLER_NAME (decl)
= build_static_name (current_function_decl, DECL_NAME (decl));
else if (! DECL_ARTIFICIAL (decl))
else
{
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);

View File

@ -719,6 +719,7 @@ expand_end_eh_spec (raises, try_block)
tmp = tree_cons
(NULL_TREE, integer_type_node, tree_cons
(NULL_TREE, TREE_TYPE (decl), void_list_node));
tmp = build_function_type (void_type_node, tmp);
fn = push_throw_library_fn (fn, tmp);
}

View File

@ -5924,11 +5924,6 @@ tsubst_decl (t, args, type, in_decl)
TREE_TYPE (r) = TREE_TYPE (DECL_INITIAL (r));
}
/* If the template variable was marked TREE_ASM_WRITTEN, that
means we don't need to write out any of the instantiations
either. (__FUNCTION__ and its ilk are marked thusly.) */
TREE_ASM_WRITTEN (r) = TREE_ASM_WRITTEN (t);
/* Even if the original location is out of scope, the newly
substituted one is not. */
if (TREE_CODE (r) == VAR_DECL)

View File

@ -175,7 +175,8 @@ throw_bad_cast ()
if (IDENTIFIER_GLOBAL_VALUE (fn))
fn = IDENTIFIER_GLOBAL_VALUE (fn);
else
fn = push_throw_library_fn (fn, ptr_type_node);
fn = push_throw_library_fn (fn, build_function_type (ptr_type_node,
void_list_node));
return build_call (fn, NULL_TREE);
}
@ -187,9 +188,11 @@ throw_bad_typeid ()
if (IDENTIFIER_GLOBAL_VALUE (fn))
fn = IDENTIFIER_GLOBAL_VALUE (fn);
else
fn = push_throw_library_fn (fn, build_reference_type
(build_qualified_type
(type_info_type_node, TYPE_QUAL_CONST)));
{
tree t = build_qualified_type (type_info_type_node, TYPE_QUAL_CONST);
t = build_function_type (build_reference_type (t), void_list_node);
fn = push_throw_library_fn (fn, t);
}
return build_call (fn, NULL_TREE);
}

View File

@ -2392,12 +2392,16 @@ expand_stmt (t)
expand_anon_union_decl (decl, NULL_TREE,
DECL_ANON_UNION_ELEMS (decl));
}
else if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
&& TREE_USED (decl))
/* Do not emit unused decls. This is not just an
optimization. We really do not want to emit
__PRETTY_FUNCTION__ etc, if they're never used. */
make_rtl_for_local_static (decl);
else if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl))
{
if (DECL_ARTIFICIAL (decl) && ! TREE_USED (decl))
/* Do not emit unused decls. This is not just an
optimization. We really do not want to emit
__PRETTY_FUNCTION__ etc, if they're never used. */
DECL_IGNORED_P (decl) = 1;
else
make_rtl_for_local_static (decl);
}
}
break;