OSDN Git Service

* config/alpha/vms.h (INCLUDE_DEFAULTS): Add /gnu/lib/gcc-lib/include.
[pf3gnuchains/gcc-fork.git] / gcc / ch / except.c
index db02a92..1c8ef24 100644 (file)
@@ -1,6 +1,7 @@
 /* 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.
 
@@ -16,13 +17,11 @@ GNU General Public License for more details.
 
 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.  */
@@ -51,14 +50,21 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #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
@@ -124,7 +130,7 @@ static tree BISJ;
 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. */
@@ -355,8 +361,9 @@ pop_handler (used)
   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)
@@ -391,8 +398,7 @@ emit_setup_handler ()
       /* 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 ();
@@ -496,7 +502,7 @@ void
 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);
@@ -506,9 +512,13 @@ chill_handle_on_labels (labels)
   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),
@@ -530,7 +540,7 @@ void
 chill_check_no_handlers ()
 {
   if (current_handler != NULL)
-    fatal ("internal error: on stack not empty when done");
+    abort ();
 }
 
 static void
@@ -545,7 +555,7 @@ initialize_exceptions ()
   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);
@@ -596,9 +606,9 @@ initialize_exceptions ()
                                               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;
 }
@@ -614,7 +624,7 @@ expand_goto_except_cleanup (label_level)
   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;