]> gcc.gnu.org Git - gcc.git/blame - gcc/eh-common.h
If errorcount nonzero, don't call abort if the function is already defined.
[gcc.git] / gcc / eh-common.h
CommitLineData
9a0d1e1b
AM
1/* Copyright (C) 1997 Free Software Foundation, Inc.
2 This file is part of GNU CC. */
3
4/* This file contains the structures required for the language
5 independant exception handling model. Both the static compiler and
6 the runtime library share this file. */
7
a1622f83 8/* The runtime flag flag_new_exceptions is used to determine whether the
9a0d1e1b
AM
9 compiler supports the new runtime typechecking mechanism or not. Under
10 the new model, runtime info is contained in the exception table, and
11 the __throw() library routine determines which handler to call based
12 on the results of a call to a matching function provided by the expcetion
13 thrower. Otherwise the old scheme of calling any handler which matches
14 an exception range is used, and the handler is responsible for all
15 checking of runtime conditions. If the handler wasn't suppose to
16 get the exception, it performs a re-throw. */
17
18#include "gansidecl.h"
19
20
9a0d1e1b
AM
21/* The handler_label field MUST be the first field in this structure. The
22 __throw() library routine expects uses __eh_stub() from except.c, which
3301dc51
AM
23 simply dereferences the context pointer to get the handler.
24 The routine get_dynamic_handler_chain() also has a dependancy on
25 the location of 'dynamic_handler_chain'. If its location is changed,
26 that routine must be modified as well. */
9a0d1e1b
AM
27
28struct eh_context
29{
30 void *handler_label;
31 void **dynamic_handler_chain;
32 /* This is language dependent part of the eh context. */
33 void *info;
34};
35
9a0d1e1b
AM
36#ifndef EH_TABLE_LOOKUP
37
a1622f83 38typedef struct old_exception_table
9a0d1e1b
AM
39{
40 void *start_region;
41 void *end_region;
42 void *exception_handler;
a1622f83 43} old_exception_table;
9a0d1e1b
AM
44
45typedef struct exception_table
46{
47 void *start_region;
48 void *end_region;
49 void *exception_handler;
50 void *match_info; /* runtime type info */
51} exception_table;
52
53
54/* The language identifying portion of an exception table */
55
56typedef struct exception_lang_info
57{
58 short language;
59 short version;
60} exception_lang_info;
61
a1622f83
AM
62/* This value in the first field of the exception descriptor
63 identifies the descriptor as the new model format. This value would never
64 be present in this location under the old model */
65
66#define NEW_EH_RUNTIME ((void *) -2)
67
9a0d1e1b
AM
68/* Each function has an exception_descriptor which contains the
69 language info, and a table of exception ranges and handlers */
70
71typedef struct exception_descriptor
72{
a1622f83 73 void *runtime_id_field;
9a0d1e1b
AM
74 exception_lang_info lang;
75 exception_table table[1];
76} exception_descriptor;
77
78
79/* A pointer to a matching function is initialized at runtime by the
80 specific language if run-time exceptions are supported.
81 The function takes 3 parameters
82 1 - runtime exception that has been thrown info. (__eh_info *)
83 2 - Match info pointer from the region being considered (void *)
84 3 - exception table region is in (exception descriptor *)
85*/
86
87typedef void * (*__eh_matcher) PROTO ((void *, void *, void *));
88
9c606f69
AM
89/* This value is to be checked as a 'match all' case in the runtime field. */
90
91#define CATCH_ALL_TYPE ((void *) -1)
92
9a0d1e1b
AM
93/* This is the runtime exception information. This forms the minimum required
94 information for an exception info pointer in an eh_context structure. */
95
9c606f69 96
9a0d1e1b
AM
97typedef struct __eh_info
98{
99 __eh_matcher match_function;
9a0d1e1b
AM
100 short language;
101 short version;
102} __eh_info;
103
104/* Convienient language codes for ID the originating language. Similar
105 to the codes in dwarf2.h. */
106
107enum exception_source_language
108 {
109 EH_LANG_C89 = 0x0001,
110 EH_LANG_C = 0x0002,
111 EH_LANG_Ada83 = 0x0003,
112 EH_LANG_C_plus_plus = 0x0004,
113 EH_LANG_Cobol74 = 0x0005,
114 EH_LANG_Cobol85 = 0x0006,
115 EH_LANG_Fortran77 = 0x0007,
116 EH_LANG_Fortran90 = 0x0008,
117 EH_LANG_Pascal83 = 0x0009,
118 EH_LANG_Modula2 = 0x000a,
119 EH_LANG_Java = 0x000b,
120 EH_LANG_Mips_Assembler = 0x8001
121 };
122
9a0d1e1b
AM
123#endif /* EH_TABLE_LOOKUP */
124
125
This page took 0.122294 seconds and 5 git commands to generate.