OSDN Git Service

New Language: Ada
[pf3gnuchains/gcc-fork.git] / gcc / ada / raise.c
1 /****************************************************************************
2  *                                                                          *
3  *                         GNAT COMPILER COMPONENTS                         *
4  *                                                                          *
5  *                                R A I S E                                 *
6  *                                                                          *
7  *                          C Implementation File                           *
8  *                                                                          *
9  *                            $Revision: 1.1 $
10  *                                                                          *
11  *             Copyright (C) 1992-2001, Free Software Foundation, Inc.      *
12  *                                                                          *
13  * GNAT is free software;  you can  redistribute it  and/or modify it under *
14  * terms of the  GNU General Public License as published  by the Free Soft- *
15  * ware  Foundation;  either version 2,  or (at your option) any later ver- *
16  * sion.  GNAT is distributed in the hope that it will be useful, but WITH- *
17  * OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY *
18  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License *
19  * for  more details.  You should have  received  a copy of the GNU General *
20  * Public License  distributed with GNAT;  see file COPYING.  If not, write *
21  * to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, *
22  * MA 02111-1307, USA.                                                      *
23  *                                                                          *
24  * As a  special  exception,  if you  link  this file  with other  files to *
25  * produce an executable,  this file does not by itself cause the resulting *
26  * executable to be covered by the GNU General Public License. This except- *
27  * ion does not  however invalidate  any other reasons  why the  executable *
28  * file might be covered by the  GNU Public License.                        *
29  *                                                                          *
30  * GNAT was originally developed  by the GNAT team at  New York University. *
31  * It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). *
32  *                                                                          *
33  ****************************************************************************/
34
35 /* Routines to support runtime exception handling */
36
37 #ifdef IN_RTS
38 #include "tconfig.h"
39 #include "tsystem.h"
40 #include <sys/stat.h>
41 #else
42 #include "config.h"
43 #include "system.h"
44 #endif
45
46 #include "adaint.h"
47 #include "raise.h"
48
49 /*  We have not yet figured out how to import this directly */
50
51 void
52 _gnat_builtin_longjmp (ptr, flag)
53      void *ptr;
54      int flag ATTRIBUTE_UNUSED;
55 {
56    __builtin_longjmp (ptr, 1);
57 }
58
59 /* When an exception is raised for which no handler exists, the procedure
60    Ada.Exceptions.Unhandled_Exception is called, which performs the call to
61    adafinal to complete finalization, and then prints out the error messages
62    for the unhandled exception. The final step is to call this routine, which
63    performs any system dependent cleanup required.  */
64
65 void
66 __gnat_unhandled_terminate ()
67 {
68   /* Special termination handling for VMS */
69
70 #ifdef VMS
71     {
72       long prvhnd;
73
74       /* Remove the exception vector so it won't intercept any errors
75          in the call to exit, and go into and endless loop */
76
77       SYS$SETEXV (1, 0, 3, &prvhnd);
78       __gnat_os_exit (1);
79     }
80
81 /* Termination handling for all other systems. */
82
83 #elif !defined (__RT__)
84     __gnat_os_exit (1);
85 #endif
86 }