aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@casey.cygnus.com>2000-03-11 09:00:13 +0000
committerJason Merrill <jason@gcc.gnu.org>2000-03-11 04:00:13 -0500
commit1ef9f74981eaa09748cae61ca1ac445d708bc420 (patch)
tree29e5fc3f2a154b2cf3626e127d81c7e810b54cd6 /gcc
parent8d2daaa79cad720c8ab5a9f5dee5d008aee46dbf (diff)
downloadgcc-1ef9f74981eaa09748cae61ca1ac445d708bc420.zip
gcc-1ef9f74981eaa09748cae61ca1ac445d708bc420.tar.gz
gcc-1ef9f74981eaa09748cae61ca1ac445d708bc420.tar.bz2
exception.cc (__check_null_eh_spec): New fn.
* exception.cc (__check_null_eh_spec): New fn. * except.c (expand_end_eh_spec): Call it if the spec is throw(). From-SVN: r32480
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/except.c73
-rw-r--r--gcc/cp/exception.cc10
3 files changed, 60 insertions, 28 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 052f293..f495735 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2000-03-11 Jason Merrill <jason@casey.cygnus.com>
+
+ * exception.cc (__check_null_eh_spec): New fn.
+ * except.c (expand_end_eh_spec): Call it if the spec is throw().
+
2000-03-10 Jason Merrill <jason@casey.cygnus.com>
* decl.c (push_throw_library_fn): Take the FUNCTION_TYPE.
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index c6cdaa2..d069b2c 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -690,42 +690,61 @@ expand_end_eh_spec (raises, try_block)
handler = begin_handler ();
blocks = finish_handler_parms (NULL_TREE, handler);
- /* Build up an array of type_infos. */
- for (; raises && TREE_VALUE (raises); raises = TREE_CHAIN (raises))
+ if (TREE_VALUE (raises) == NULL_TREE)
{
- types = tree_cons
- (NULL_TREE, build_eh_type_type (TREE_VALUE (raises)), types);
- ++count;
+ fn = get_identifier ("__check_null_eh_spec");
+ if (IDENTIFIER_GLOBAL_VALUE (fn))
+ fn = IDENTIFIER_GLOBAL_VALUE (fn);
+ else
+ {
+ tmp = build_function_type (void_type_node, void_list_node);
+ fn = push_throw_library_fn (fn, tmp);
+ /* Since the spec doesn't allow any exceptions, this call
+ will never throw. */
+ TREE_NOTHROW (fn) = 1;
+ }
+ tmp = NULL_TREE;
}
+ else
+ {
+ /* Build up an array of type_infos. */
+ for (; raises && TREE_VALUE (raises); raises = TREE_CHAIN (raises))
+ {
+ types = tree_cons
+ (NULL_TREE, build_eh_type_type (TREE_VALUE (raises)), types);
+ ++count;
+ }
- types = build_nt (CONSTRUCTOR, NULL_TREE, types);
- TREE_HAS_CONSTRUCTOR (types) = 1;
+ types = build_nt (CONSTRUCTOR, NULL_TREE, types);
+ TREE_HAS_CONSTRUCTOR (types) = 1;
- /* We can't pass the CONSTRUCTOR directly, so stick it in a variable. */
- tmp = build_cplus_array_type (const_ptr_type_node, NULL_TREE);
- decl = build_decl (VAR_DECL, NULL_TREE, tmp);
- DECL_ARTIFICIAL (decl) = 1;
- DECL_INITIAL (decl) = types;
- DECL_CONTEXT (decl) = current_function_decl;
- cp_finish_decl (decl, types, NULL_TREE, 0);
+ /* We can't pass the CONSTRUCTOR directly, so stick it in a variable. */
+ tmp = build_cplus_array_type (const_ptr_type_node, NULL_TREE);
+ decl = build_decl (VAR_DECL, NULL_TREE, tmp);
+ DECL_ARTIFICIAL (decl) = 1;
+ DECL_INITIAL (decl) = types;
+ DECL_CONTEXT (decl) = current_function_decl;
+ cp_finish_decl (decl, types, NULL_TREE, 0);
- decl = decay_conversion (decl);
+ decl = decay_conversion (decl);
- fn = get_identifier ("__check_eh_spec");
- if (IDENTIFIER_GLOBAL_VALUE (fn))
- fn = IDENTIFIER_GLOBAL_VALUE (fn);
- else
- {
- 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 = get_identifier ("__check_eh_spec");
+ if (IDENTIFIER_GLOBAL_VALUE (fn))
+ fn = IDENTIFIER_GLOBAL_VALUE (fn);
+ else
+ {
+ 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);
+ }
- fn = push_throw_library_fn (fn, tmp);
+ tmp = tree_cons (NULL_TREE, build_int_2 (count, 0),
+ tree_cons (NULL_TREE, decl, NULL_TREE));
}
- tmp = tree_cons (NULL_TREE, build_int_2 (count, 0),
- tree_cons (NULL_TREE, decl, NULL_TREE));
tmp = build_call (fn, tmp);
finish_expr_stmt (tmp);
diff --git a/gcc/cp/exception.cc b/gcc/cp/exception.cc
index d6b47d9..b7d6a64 100644
--- a/gcc/cp/exception.cc
+++ b/gcc/cp/exception.cc
@@ -1,5 +1,5 @@
// Functions for Exception Support for -*- C++ -*-
-// Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999 Free Software Foundation
+// Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000 Free Software Foundation
// This file is part of GNU CC.
@@ -321,6 +321,14 @@ __check_eh_spec (int n, const void **spec)
}
}
+/* Special case of the above for throw() specs. */
+
+extern "C" void
+__check_null_eh_spec (void)
+{
+ __check_eh_spec (0, 0);
+}
+
// Helpers for rtti. Although these don't return, we give them return types so
// that the type system is not broken.