aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@gcc.gnu.org>2000-03-10 19:23:18 -0500
committerJason Merrill <jason@gcc.gnu.org>2000-03-10 19:23:18 -0500
commitcf74fb8675044d976ab9bcf852756b471e6b0012 (patch)
treecd9fc77d9320650c3a10531cbef56137bda127b5 /gcc
parente5fd03ba4078a755ca863360150654ef2e3eb1ba (diff)
downloadgcc-cf74fb8675044d976ab9bcf852756b471e6b0012.zip
gcc-cf74fb8675044d976ab9bcf852756b471e6b0012.tar.gz
gcc-cf74fb8675044d976ab9bcf852756b471e6b0012.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog16
-rw-r--r--gcc/cp/decl.c21
-rw-r--r--gcc/cp/except.c1
-rw-r--r--gcc/cp/pt.c5
-rw-r--r--gcc/cp/rtti.c11
-rw-r--r--gcc/cp/semantics.c16
6 files changed, 46 insertions, 24 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index d518d73..052f293 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,21 @@
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.
* cp-tree.h: Declare flag_enforce_eh_specs.
* decl.c (store_parm_decls, finish_function): Check it.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 53cbb74..8374729 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -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);
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index 3a54ea8..c6cdaa2 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -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);
}
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index b9d4627..28d08a5 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -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)
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 15e4617..fa5f85c 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -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);
}
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 3402d3b..3071f1f0 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -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;