/* Exception support for GNU CHILL.
WARNING: Only works for native (needs setjmp.h)! FIXME!
- Copyright (C) 1992, 93, 1994 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1993, 1994, 1998, 1999, 2000, 2001
+ Free Software Foundation, Inc.
This file is part of GNU CC.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
#include "config.h"
-#include "tree.h"
-#include "ch-tree.h"
-#include "rtl.h"
-#include "toplev.h"
+#include "system.h"
/* On Suns this can get you to the right definition if you
set the right value for TARGET. */
#endif
#endif
+#include "tree.h"
+#include "ch-tree.h"
+#include "rtl.h"
+#include "toplev.h"
+
extern int expand_exit_needed;
static tree link_handler_decl;
static tree handler_link_pointer_type;
static tree unlink_handler_decl;
static int exceptions_initialized = 0;
-static void emit_setup_handler PROTO((void));
-static void initialize_exceptions PROTO((void));
+static void emit_setup_handler PARAMS ((void));
+static void initialize_exceptions PARAMS ((void));
+static tree start_handler_array PARAMS ((void));
+static void finish_handler_array PARAMS ((void));
static tree char_pointer_type_for_handler;
/* If this is 1, operations to push and pop on the __exceptionStack
static tree jbuf_ident, prev_ident, handlers_ident;
static tree exception_stack_decl = 0;
-/* Chain of cleanups assocated with exception handlers.
+/* Chain of cleanups associated with exception handlers.
The TREE_PURPOSE is an INTEGER_CST whose value is the
DECL_ACTION_NESTING_LEVEL (when the handled actions was entered).
The TREE_VALUE is an expression to expand when we exit that action. */
if (pass == 1)
{
struct handler_state *old = current_handler;
+
if (old == NULL)
- fatal ("internal error: on stack out of sync");
+ abort ();
current_handler = old->next;
if (used)
/* We temporarily reset the maximum_field_alignment to zero so the
compiler's exception data structures can be compatible with the
run-time system, even when we're compiling with -fpack. */
- extern int maximum_field_alignment;
- int save_maximum_field_alignment = maximum_field_alignment;
+ unsigned int save_maximum_field_alignment = maximum_field_alignment;
maximum_field_alignment = 0;
push_obstacks_nochange ();
end_temporary_allocation ();
chill_handle_on_labels (labels)
tree labels;
{
- int alternative = ++current_handler->prev_on_alternative;
+ unsigned int alternative = ++current_handler->prev_on_alternative;
if (pass == 1)
{
tree handler_number = build_int_2 (alternative, 0);
else
{
/* Find handler_number saved in pass 1. */
- tree tmp = current_handler->on_alt_list;
- while (TREE_INT_CST_LOW (TREE_PURPOSE (tmp)) != alternative)
- tmp = TREE_CHAIN (tmp);
+ tree tmp;
+
+ for (tmp = current_handler->on_alt_list;
+ compare_tree_int (TREE_PURPOSE (tmp), alternative) != 0;
+ tmp = TREE_CHAIN (tmp))
+ ;
+
if (expand_exit_needed)
expand_exit_something (), expand_exit_needed = 0;
chill_handle_case_label (TREE_PURPOSE (tmp),
chill_check_no_handlers ()
{
if (current_handler != NULL)
- fatal ("internal error: on stack not empty when done");
+ abort ();
}
static void
setjmp_fndecl = builtin_function ("setjmp",
build_function_type (integer_type_node,
parmtypes),
- NOT_BUILT_IN,
+ 0, NOT_BUILT_IN,
SETJMP_LIBRARY_NAME);
BISJ = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (setjmp_fndecl)),
setjmp_fndecl);
handler_link_pointer_type,
void_list_node));
link_handler_decl = builtin_function ("__ch_link_handler", link_ftype,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
unlink_handler_decl = builtin_function ("__ch_unlink_handler", link_ftype,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
exceptions_initialized = 1;
}
tree last = NULL_TREE;
for ( ; list != NULL_TREE; list = TREE_CHAIN (list))
{
- if (TREE_INT_CST_LOW (TREE_PURPOSE (list)) > label_level)
+ if (compare_tree_int (TREE_PURPOSE (list), label_level) > 0)
last = list;
else
break;