OSDN Git Service

* bad.c (inhibit_warnings): Delete redundant declaration.
[pf3gnuchains/gcc-fork.git] / gcc / f / com.h
1 /* com.h -- Public #include File (module.h template V1.0)
2    Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
3    Contributed by James Craig Burley.
4
5 This file is part of GNU Fortran.
6
7 GNU Fortran is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GNU Fortran is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU Fortran; see the file COPYING.  If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA.
21
22    Owning Modules:
23       com.c
24
25    Modifications:
26 */
27
28 /* Allow multiple inclusion to work. */
29
30 #ifndef _H_f_com
31 #define _H_f_com
32
33 /* Simple definitions and enumerations. */
34
35 #define FFECOM_dimensionsMAX 7  /* Max # dimensions (quick hack). */
36
37 #define FFECOM_targetFFE 1
38 #define FFECOM_targetGCC 2
39
40 #ifndef FFE_STANDALONE
41 #define FFECOM_targetCURRENT FFECOM_targetGCC   /* Backend! */
42 #define FFECOM_ONEPASS 0
43 #else
44 #define FFECOM_targetCURRENT FFECOM_targetFFE
45 #define FFECOM_ONEPASS 0
46 #endif
47
48 #if FFECOM_ONEPASS
49 #define FFECOM_TWOPASS 0
50 #else
51 #define FFECOM_TWOPASS 1
52 #endif
53
54 #define FFECOM_SIZE_UNIT "byte" /* Singular form. */
55 #define FFECOM_SIZE_UNITS "bytes"       /* Plural form. */
56
57 #if FFECOM_targetCURRENT == FFECOM_targetGCC
58 #define FFECOM_constantNULL NULL_TREE
59 #define FFECOM_nonterNULL NULL_TREE
60 #define FFECOM_globalNULL NULL_TREE
61 #define FFECOM_labelNULL NULL_TREE
62 #define FFECOM_storageNULL NULL_TREE
63 #define FFECOM_symbolNULL ffecom_symbol_null_
64
65 /* Shorthand for types used in f2c.h and that g77 perhaps allows some
66    flexibility regarding in the section below.  I.e. the actual numbers
67    below aren't important, as long as they're unique.  */
68
69 #define FFECOM_f2ccodeCHAR 1
70 #define FFECOM_f2ccodeSHORT 2
71 #define FFECOM_f2ccodeINT 3
72 #define FFECOM_f2ccodeLONG 4
73 #define FFECOM_f2ccodeLONGLONG 5
74 #define FFECOM_f2ccodeCHARPTR 6         /* char * */
75 #define FFECOM_f2ccodeFLOAT 7
76 #define FFECOM_f2ccodeDOUBLE 8
77 #define FFECOM_f2ccodeLONGDOUBLE 9
78 #define FFECOM_f2ccodeTWOREALS 10
79 #define FFECOM_f2ccodeTWODOUBLEREALS 11
80
81 #if FFECOM_DETERMINE_TYPES      /* only for com.c and configure */
82
83 /* Begin f2c.h information.  This must match the info in the f2c.h used
84    to build the libf2c with which g77-generated code is linked, or there
85    will probably be bugs, some of them difficult to detect or even trigger.  */
86
87 /* The C front-end provides __g77_integer and __g77_uinteger types so that
88    the appropriately-sized signed and unsigned integer types are available
89    for libf2c.  If you change this, also the definitions of those types
90    in ../c-decl.c. */
91 #define FFECOM_f2cINTEGER                       \
92   (LONG_TYPE_SIZE == FLOAT_TYPE_SIZE            \
93    ? FFECOM_f2ccodeLONG                         \
94    : (INT_TYPE_SIZE == FLOAT_TYPE_SIZE          \
95       ? FFECOM_f2ccodeINT                       \
96       : (abort (), -1)))
97
98 #define FFECOM_f2cLOGICAL FFECOM_f2cINTEGER
99
100 /* The C front-end provides __g77_longint and __g77_ulongint types so that
101    the appropriately-sized signed and unsigned integer types are available
102    for libf2c.  If you change this, also the definitions of those types
103    in ../c-decl.c. */
104 #define FFECOM_f2cLONGINT                               \
105  (LONG_TYPE_SIZE == (FLOAT_TYPE_SIZE * 2)               \
106   ? FFECOM_f2ccodeLONG                                  \
107   : (LONG_LONG_TYPE_SIZE == (FLOAT_TYPE_SIZE * 2)       \
108      ? FFECOM_f2ccodeLONGLONG                           \
109      : (abort (), -1)))
110
111 #define FFECOM_f2cADDRESS FFECOM_f2ccodeCHARPTR
112 #define FFECOM_f2cSHORTINT FFECOM_f2ccodeSHORT
113 #define FFECOM_f2cREAL FFECOM_f2ccodeFLOAT
114 #define FFECOM_f2cDOUBLEREAL FFECOM_f2ccodeDOUBLE
115 #define FFECOM_f2cCOMPLEX FFECOM_f2ccodeTWOREALS
116 #define FFECOM_f2cDOUBLECOMPLEX FFECOM_f2ccodeTWODOUBLEREALS
117 #define FFECOM_f2cSHORTLOGICAL FFECOM_f2ccodeSHORT
118 #define FFECOM_f2cLOGICAL1 FFECOM_f2ccodeCHAR
119 #define FFECOM_f2cINTEGER1 FFECOM_f2ccodeCHAR
120
121 /* These must be f2c's INTEGER type, to match runtime/f2c.h.in.  */
122
123 #define FFECOM_f2cFLAG FFECOM_f2cINTEGER
124 #define FFECOM_f2cFTNINT FFECOM_f2cINTEGER
125 #define FFECOM_f2cFTNLEN FFECOM_f2cINTEGER
126
127 #endif  /* #if FFECOM_DETERMINE_TYPES */
128
129 /* Everything else in f2c.h, specifically the structures used in
130    interfacing compiled code with the library, must remain exactly
131    as delivered, or g77 internals (mostly com.c and ste.c) must
132    be modified accordingly to compensate.  Or there will be...trouble.  */
133
134 typedef enum
135   {
136 #define DEFGFRT(CODE,NAME,TYPE,ARGS,VOLATILE,COMPLEX,CONST) CODE,
137 #include "com-rt.def"
138 #undef DEFGFRT
139     FFECOM_gfrt
140   } ffecomGfrt;
141
142 #endif  /* FFECOM_targetCURRENT == FFECOM_targetGCC */
143
144 /* Typedefs. */
145
146 #if FFECOM_targetCURRENT == FFECOM_targetGCC
147 #ifndef TREE_CODE
148 #include "tree.h"
149 #endif
150
151 #ifndef BUILT_FOR_270
152 #ifdef DECL_STATIC_CONSTRUCTOR  /* In gcc/tree.h. */
153 #define BUILT_FOR_270 1
154 #else
155 #define BUILT_FOR_270 0
156 #endif
157 #endif  /* !defined (BUILT_FOR_270) */
158
159 #ifndef BUILT_FOR_280
160 #ifdef DECL_ONE_ONLY    /* In gcc/tree.h. */
161 #define BUILT_FOR_280 1
162 #else
163 #define BUILT_FOR_280 0
164 #endif
165 #endif  /* !defined (BUILT_FOR_280) */
166
167 typedef tree ffecomConstant;
168 #define FFECOM_constantHOOK
169 typedef tree ffecomNonter;
170 #define FFECOM_nonterHOOK
171 typedef tree ffecomLabel;
172 #define FFECOM_globalHOOK
173 typedef tree ffecomGlobal;
174 #define FFECOM_labelHOOK
175 typedef tree ffecomStorage;
176 #define FFECOM_storageHOOK
177 typedef struct _ffecom_symbol_ ffecomSymbol;
178 #define FFECOM_symbolHOOK
179
180 struct _ffecom_symbol_
181   {
182     tree decl_tree;
183     tree length_tree;           /* For CHARACTER dummies. */
184     tree vardesc_tree;          /* For NAMELIST. */
185     tree assign_tree;           /* For ASSIGN'ed vars. */
186     bool addr;                  /* Is address of item instead of item. */
187   };
188 #endif  /* FFECOM_targetCURRENT == FFECOM_targetGCC */
189
190 /* Include files needed by this one. */
191
192 #include "bld.h"
193 #include "info.h"
194 #include "lab.h"
195 #include "storag.h"
196 #include "symbol.h"
197
198 /* Structure definitions. */
199
200
201 /* Global objects accessed by users of this module. */
202
203 #if FFECOM_targetCURRENT == FFECOM_targetGCC
204 extern tree string_type_node;
205 extern tree ffecom_integer_type_node;
206 extern tree ffecom_integer_zero_node;
207 extern tree ffecom_integer_one_node;
208 extern tree ffecom_tree_type[FFEINFO_basictype][FFEINFO_kindtype];
209 extern ffecomSymbol ffecom_symbol_null_;
210 extern ffeinfoKindtype ffecom_pointer_kind_;
211 extern ffeinfoKindtype ffecom_label_kind_;
212
213 extern int ffecom_f2c_typecode_[FFEINFO_basictype][FFEINFO_kindtype];
214 extern tree ffecom_f2c_integer_type_node;
215 extern tree ffecom_f2c_address_type_node;
216 extern tree ffecom_f2c_real_type_node;
217 extern tree ffecom_f2c_doublereal_type_node;
218 extern tree ffecom_f2c_complex_type_node;
219 extern tree ffecom_f2c_doublecomplex_type_node;
220 extern tree ffecom_f2c_longint_type_node;
221 extern tree ffecom_f2c_logical_type_node;
222 extern tree ffecom_f2c_flag_type_node;
223 extern tree ffecom_f2c_ftnlen_type_node;
224 extern tree ffecom_f2c_ftnlen_zero_node;
225 extern tree ffecom_f2c_ftnlen_one_node;
226 extern tree ffecom_f2c_ftnlen_two_node;
227 extern tree ffecom_f2c_ptr_to_ftnlen_type_node;
228 extern tree ffecom_f2c_ftnint_type_node;
229 extern tree ffecom_f2c_ptr_to_ftnint_type_node;
230 #endif  /* FFECOM_targetCURRENT == FFECOM_targetGCC */
231
232 /* Declare functions with prototypes. */
233
234 #if FFECOM_targetCURRENT == FFECOM_targetGCC
235 tree ffecom_1 (enum tree_code code, tree type, tree node);
236 tree ffecom_1_fn (tree node);
237 tree ffecom_2 (enum tree_code code, tree type, tree node1, tree node2);
238 bool ffecom_2pass_advise_entrypoint (ffesymbol entry);
239 void ffecom_2pass_do_entrypoint (ffesymbol entry);
240 tree ffecom_2s (enum tree_code code, tree type, tree node1, tree node2);
241 tree ffecom_3 (enum tree_code code, tree type, tree node1, tree node2,
242                tree node3);
243 tree ffecom_3s (enum tree_code code, tree type, tree node1, tree node2,
244                 tree node3);
245 tree ffecom_arg_expr (ffebld expr, tree *length);
246 tree ffecom_arg_ptr_to_const_expr (ffebld expr, tree *length);
247 tree ffecom_arg_ptr_to_expr (ffebld expr, tree *length);
248 tree ffecom_call_gfrt (ffecomGfrt ix, tree args, tree hook);
249 tree ffecom_constantunion (ffebldConstantUnion *cu, ffeinfoBasictype bt,
250                            ffeinfoKindtype kt, tree tree_type);
251 tree ffecom_const_expr (ffebld expr);
252 tree ffecom_decl_field (tree context, tree prevfield, const char *name,
253                         tree type);
254 #endif  /* FFECOM_targetCURRENT == FFECOM_targetGCC */
255 void ffecom_close_include (FILE *f);
256 int ffecom_decode_include_option (char *spec);
257 #if FFECOM_targetCURRENT == FFECOM_targetGCC
258 tree ffecom_end_compstmt (void);
259 #endif  /* FFECOM_targetCURRENT == FFECOM_targetGCC */
260 void ffecom_end_transition (void);
261 void ffecom_exec_transition (void);
262 void ffecom_expand_let_stmt (ffebld dest, ffebld source);
263 #if FFECOM_targetCURRENT == FFECOM_targetGCC
264 tree ffecom_expr (ffebld expr);
265 tree ffecom_expr_assign (ffebld expr);
266 tree ffecom_expr_assign_w (ffebld expr);
267 tree ffecom_expr_rw (tree type, ffebld expr);
268 tree ffecom_expr_w (tree type, ffebld expr);
269 void ffecom_finish_compile (void);
270 void ffecom_finish_decl (tree decl, tree init, bool is_top_level);
271 void ffecom_finish_progunit (void);
272 tree ffecom_get_invented_identifier (const char *pattern, ...)
273   ATTRIBUTE_PRINTF_1;
274 ffeinfoKindtype ffecom_gfrt_basictype (ffecomGfrt ix);
275 ffeinfoKindtype ffecom_gfrt_kindtype (ffecomGfrt ix);
276 void ffecom_init_0 (void);
277 void ffecom_init_2 (void);
278 tree ffecom_list_expr (ffebld list);
279 tree ffecom_list_ptr_to_expr (ffebld list);
280 tree ffecom_lookup_label (ffelab label);
281 tree ffecom_make_tempvar (const char *commentary, tree type,
282                           ffetargetCharacterSize size, int elements);
283 tree ffecom_modify (tree newtype, tree lhs, tree rhs);
284 void ffecom_save_tree_forever (tree t);
285 #endif  /* FFECOM_targetCURRENT == FFECOM_targetGCC */
286 void ffecom_file (const char *name);
287 void ffecom_notify_init_storage (ffestorag st);
288 void ffecom_notify_init_symbol (ffesymbol s);
289 void ffecom_notify_primary_entry (ffesymbol fn);
290 FILE *ffecom_open_include (char *name, ffewhereLine l, ffewhereColumn c);
291 #if FFECOM_targetCURRENT == FFECOM_targetGCC
292 void ffecom_prepare_arg_ptr_to_expr (ffebld expr);
293 bool ffecom_prepare_end (void);
294 void ffecom_prepare_expr_ (ffebld expr, ffebld dest);
295 void ffecom_prepare_expr_rw (tree type, ffebld expr);
296 void ffecom_prepare_expr_w (tree type, ffebld expr);
297 void ffecom_prepare_ptr_to_expr (ffebld expr);
298 void ffecom_prepare_return_expr (ffebld expr);
299 tree ffecom_ptr_to_const_expr (ffebld expr);
300 tree ffecom_ptr_to_expr (ffebld expr);
301 tree ffecom_return_expr (ffebld expr);
302 tree ffecom_save_tree (tree t);
303 void ffecom_start_compstmt (void);
304 tree ffecom_start_decl (tree decl, bool is_init);
305 void ffecom_sym_commit (ffesymbol s);
306 #endif  /* FFECOM_targetCURRENT == FFECOM_targetGCC */
307 ffesymbol ffecom_sym_end_transition (ffesymbol s);
308 ffesymbol ffecom_sym_exec_transition (ffesymbol s);
309 ffesymbol ffecom_sym_learned (ffesymbol s);
310 #if FFECOM_targetCURRENT == FFECOM_targetGCC
311 void ffecom_sym_retract (ffesymbol s);
312 tree ffecom_temp_label (void);
313 tree ffecom_truth_value (tree expr);
314 tree ffecom_truth_value_invert (tree expr);
315 tree ffecom_type_expr (ffebld expr);
316 tree ffecom_which_entrypoint_decl (void);
317 #endif  /* FFECOM_targetCURRENT == FFECOM_targetGCC */
318
319 /* Define macros. */
320
321 #if FFECOM_targetCURRENT == FFECOM_targetFFE
322 #define ffecom_expr(e) (e)
323 #define ffecom_init_0()
324 #define ffecom_init_2()
325 #define ffecom_label_kind() FFEINFO_kindtypeINTEGERDEFAULT
326 #define ffecom_pointer_kind() FFEINFO_kindtypeINTEGERDEFAULT
327 #define ffecom_ptr_to_expr(e) (e)
328 #define ffecom_sym_commit(s)
329 #define ffecom_sym_retract(s)
330 #endif  /* FFECOM_targetCURRENT == FFECOM_targetFFE */
331
332 #if FFECOM_targetCURRENT == FFECOM_targetGCC
333 #define ffecom_f2c_typecode(bt,kt) ffecom_f2c_typecode_[(bt)][(kt)]
334 #define ffecom_label_kind() ffecom_label_kind_
335 #define ffecom_pointer_kind() ffecom_pointer_kind_
336 #define ffecom_prepare_expr(e) ffecom_prepare_expr_ ((e), NULL)
337 #endif  /* FFECOM_targetCURRENT == FFECOM_targetGCC */
338
339 #define ffecom_init_1()
340 #define ffecom_init_3()
341 #define ffecom_init_4()
342 #define ffecom_terminate_0()
343 #define ffecom_terminate_1()
344 #define ffecom_terminate_2()
345 #define ffecom_terminate_3()
346 #define ffecom_terminate_4()
347
348 /* End of #include file. */
349
350 #endif