* optimize.c (initialize_inlined_parameters): Take FN to which the
[official-gcc.git] / gcc / f / top.c
blob6b199881282e8247c6080b042fc67df83111758b
1 /* top.c -- Implementation File (module.c template V1.0)
2 Copyright (C) 1995-1997, 1999 Free Software Foundation, Inc.
3 Contributed by James Craig Burley.
5 This file is part of GNU Fortran.
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.
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.
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.
22 Related Modules:
23 None.
25 Description:
26 The GNU Fortran Front End.
28 Modifications:
31 /* Include files. */
33 #include "proj.h"
34 #include "top.h"
35 #include "bad.h"
36 #include "bit.h"
37 #include "bld.h"
38 #include "com.h"
39 #include "data.h"
40 #include "equiv.h"
41 #include "expr.h"
42 #include "global.h"
43 #include "implic.h"
44 #include "info.h"
45 #include "intrin.h"
46 #include "lab.h"
47 #include "lex.h"
48 #include "malloc.h"
49 #include "name.h"
50 #include "src.h"
51 #include "st.h"
52 #include "storag.h"
53 #include "symbol.h"
54 #include "target.h"
55 #include "where.h"
56 #if FFECOM_targetCURRENT == FFECOM_targetGCC
57 #include "flags.j"
58 #include "toplev.j"
59 #endif
61 /* Externals defined here. */
63 int flag_traditional; /* Shouldn't need this (C front end only)! */
64 bool ffe_is_do_internal_checks_ = FALSE;
65 bool ffe_is_90_ = FFETARGET_defaultIS_90;
66 bool ffe_is_automatic_ = FFETARGET_defaultIS_AUTOMATIC;
67 bool ffe_is_backslash_ = FFETARGET_defaultIS_BACKSLASH;
68 bool ffe_is_emulate_complex_ = FALSE;
69 bool ffe_is_underscoring_ = FFETARGET_defaultEXTERNAL_UNDERSCORED
70 || FFETARGET_defaultUNDERSCORED_EXTERNAL_UNDERSCORED;
71 bool ffe_is_second_underscore_ = FFETARGET_defaultUNDERSCORED_EXTERNAL_UNDERSCORED;
72 bool ffe_is_debug_kludge_ = FALSE;
73 bool ffe_is_dollar_ok_ = FFETARGET_defaultIS_DOLLAR_OK;
74 bool ffe_is_f2c_ = FFETARGET_defaultIS_F2C;
75 bool ffe_is_f2c_library_ = FFETARGET_defaultIS_F2C_LIBRARY;
76 bool ffe_is_ffedebug_ = FALSE;
77 bool ffe_is_flatten_arrays_ = FALSE;
78 bool ffe_is_free_form_ = FFETARGET_defaultIS_FREE_FORM;
79 bool ffe_is_globals_ = TRUE;
80 bool ffe_is_init_local_zero_ = FFETARGET_defaultIS_INIT_LOCAL_ZERO;
81 bool ffe_is_mainprog_; /* TRUE if current prog unit known to be
82 main. */
83 bool ffe_is_null_version_ = FALSE;
84 bool ffe_is_onetrip_ = FALSE;
85 bool ffe_is_silent_ = TRUE;
86 bool ffe_is_typeless_boz_ = FALSE;
87 bool ffe_is_pedantic_ = FFETARGET_defaultIS_PEDANTIC;
88 bool ffe_is_saveall_; /* TRUE if mainprog or SAVE (no args) seen. */
89 bool ffe_is_ugly_args_ = TRUE;
90 bool ffe_is_ugly_assign_ = FALSE; /* Try and store pointer to ASSIGN labels in INTEGER vars. */
91 bool ffe_is_ugly_assumed_ = FALSE; /* DIMENSION X([...,]1) => DIMENSION X([...,]*) */
92 bool ffe_is_ugly_comma_ = FALSE;
93 bool ffe_is_ugly_complex_ = FALSE;
94 bool ffe_is_ugly_init_ = TRUE;
95 bool ffe_is_ugly_logint_ = FALSE;
96 bool ffe_is_version_ = FALSE;
97 bool ffe_is_vxt_ = FALSE;
98 bool ffe_is_warn_globals_ = TRUE;
99 bool ffe_is_warn_implicit_ = FALSE;
100 bool ffe_is_warn_surprising_ = FALSE;
101 bool ffe_is_zeros_ = FALSE;
102 ffeCase ffe_case_intrin_ = FFETARGET_defaultCASE_INTRIN;
103 ffeCase ffe_case_match_ = FFETARGET_defaultCASE_MATCH;
104 ffeCase ffe_case_source_ = FFETARGET_defaultCASE_SOURCE;
105 ffeCase ffe_case_symbol_ = FFETARGET_defaultCASE_SYMBOL;
106 ffeIntrinsicState ffe_intrinsic_state_badu77_ = FFE_intrinsicstateENABLED;
107 ffeIntrinsicState ffe_intrinsic_state_gnu_ = FFE_intrinsicstateENABLED;
108 ffeIntrinsicState ffe_intrinsic_state_f2c_ = FFE_intrinsicstateENABLED;
109 ffeIntrinsicState ffe_intrinsic_state_f90_ = FFE_intrinsicstateENABLED;
110 ffeIntrinsicState ffe_intrinsic_state_mil_ = FFE_intrinsicstateENABLED;
111 ffeIntrinsicState ffe_intrinsic_state_unix_ = FFE_intrinsicstateENABLED;
112 ffeIntrinsicState ffe_intrinsic_state_vxt_ = FFE_intrinsicstateENABLED;
113 int ffe_fixed_line_length_ = FFETARGET_defaultFIXED_LINE_LENGTH;
114 mallocPool ffe_file_pool_ = NULL;
115 mallocPool ffe_any_unit_pool_ = NULL;
116 mallocPool ffe_program_unit_pool_ = NULL;
117 ffeCounter ffe_count_0 = 0;
118 ffeCounter ffe_count_1 = 0;
119 ffeCounter ffe_count_2 = 0;
120 ffeCounter ffe_count_3 = 0;
121 ffeCounter ffe_count_4 = 0;
122 bool ffe_in_0 = FALSE;
123 bool ffe_in_1 = FALSE;
124 bool ffe_in_2 = FALSE;
125 bool ffe_in_3 = FALSE;
126 bool ffe_in_4 = FALSE;
128 /* Simple definitions and enumerations. */
131 /* Internal typedefs. */
134 /* Private include files. */
137 /* Internal structure definitions. */
140 /* Static objects accessed by functions in this module. */
143 /* Static functions (internal). */
145 static bool ffe_is_digit_string_ (char *s);
147 /* Internal macros. */
149 static bool
150 ffe_is_digit_string_ (char *s)
152 char *p;
154 for (p = s; ISDIGIT (*p); ++p)
157 return (p != s) && (*p == '\0');
160 /* Handle command-line options. Returns 0 if unrecognized, 1 if
161 recognized and handled. */
164 ffe_decode_option (argc, argv)
165 int argc ATTRIBUTE_UNUSED;
166 char **argv;
168 char *opt = argv[0];
169 if (opt[0] != '-')
170 return 0;
171 if (opt[1] == 'f')
173 if (strcmp (&opt[2], "version") == 0)
175 ffe_set_is_version (TRUE);
176 ffe_set_is_do_internal_checks (TRUE);
178 else if (strcmp (&opt[2], "null-version") == 0)
179 ffe_set_is_null_version (TRUE);
180 else if (strcmp (&opt[2], "f66") == 0)
182 ffe_set_is_onetrip (TRUE);
183 ffe_set_is_ugly_assumed (TRUE);
185 else if (strcmp (&opt[2], "no-f66") == 0)
187 ffe_set_is_onetrip (FALSE);
188 ffe_set_is_ugly_assumed (FALSE);
190 else if (strcmp (&opt[2], "f77") == 0)
192 ffe_set_is_backslash (TRUE);
193 ffe_set_is_typeless_boz (FALSE);
195 else if (strcmp (&opt[2], "no-f77") == 0)
197 ffe_set_is_backslash (FALSE);
199 else if (strcmp (&opt[2], "f90") == 0)
200 ffe_set_is_90 (TRUE);
201 else if (strcmp (&opt[2], "no-f90") == 0)
202 ffe_set_is_90 (FALSE);
203 else if (strcmp (&opt[2], "automatic") == 0)
204 ffe_set_is_automatic (TRUE);
205 else if (strcmp (&opt[2], "no-automatic") == 0)
206 ffe_set_is_automatic (FALSE);
207 else if (strcmp (&opt[2], "dollar-ok") == 0)
208 ffe_set_is_dollar_ok (TRUE);
209 else if (strcmp (&opt[2], "no-dollar-ok") == 0)
210 ffe_set_is_dollar_ok (FALSE);
211 else if (strcmp (&opt[2], "f2c") == 0)
212 ffe_set_is_f2c (TRUE);
213 else if (strcmp (&opt[2], "no-f2c") == 0)
214 ffe_set_is_f2c (FALSE);
215 else if (strcmp (&opt[2], "f2c-library") == 0)
216 ffe_set_is_f2c_library (TRUE);
217 else if (strcmp (&opt[2], "no-f2c-library") == 0)
218 ffe_set_is_f2c_library (FALSE);
219 else if (strcmp (&opt[2], "flatten-arrays") == 0)
220 ffe_set_is_flatten_arrays (TRUE);
221 else if (strcmp (&opt[2], "no-flatten-arrays") == 0)
222 ffe_set_is_flatten_arrays (FALSE);
223 else if (strcmp (&opt[2], "free-form") == 0)
224 ffe_set_is_free_form (TRUE);
225 else if (strcmp (&opt[2], "no-free-form") == 0)
226 ffe_set_is_free_form (FALSE);
227 else if (strcmp (&opt[2], "fixed-form") == 0)
228 ffe_set_is_free_form (FALSE);
229 else if (strcmp (&opt[2], "no-fixed-form") == 0)
230 ffe_set_is_free_form (TRUE);
231 else if (strcmp (&opt[2], "pedantic") == 0)
232 ffe_set_is_pedantic (TRUE);
233 else if (strcmp (&opt[2], "no-pedantic") == 0)
234 ffe_set_is_pedantic (FALSE);
235 else if (strcmp (&opt[2], "vxt") == 0)
236 ffe_set_is_vxt (TRUE);
237 else if (strcmp (&opt[2], "not-vxt") == 0)
238 ffe_set_is_vxt (FALSE);
239 else if (strcmp (&opt[2], "vxt-not-f90") == 0)
240 warning ("%s no longer supported -- try -fvxt", opt);
241 else if (strcmp (&opt[2], "f90-not-vxt") == 0)
242 warning ("%s no longer supported -- try -fno-vxt -ff90", opt);
243 else if (strcmp (&opt[2], "no-ugly") == 0)
245 ffe_set_is_ugly_args (FALSE);
246 ffe_set_is_ugly_assign (FALSE);
247 ffe_set_is_ugly_assumed (FALSE);
248 ffe_set_is_ugly_comma (FALSE);
249 ffe_set_is_ugly_complex (FALSE);
250 ffe_set_is_ugly_init (FALSE);
251 ffe_set_is_ugly_logint (FALSE);
253 else if (strcmp (&opt[2], "ugly-args") == 0)
254 ffe_set_is_ugly_args (TRUE);
255 else if (strcmp (&opt[2], "no-ugly-args") == 0)
256 ffe_set_is_ugly_args (FALSE);
257 else if (strcmp (&opt[2], "ugly-assign") == 0)
258 ffe_set_is_ugly_assign (TRUE);
259 else if (strcmp (&opt[2], "no-ugly-assign") == 0)
260 ffe_set_is_ugly_assign (FALSE);
261 else if (strcmp (&opt[2], "ugly-assumed") == 0)
262 ffe_set_is_ugly_assumed (TRUE);
263 else if (strcmp (&opt[2], "no-ugly-assumed") == 0)
264 ffe_set_is_ugly_assumed (FALSE);
265 else if (strcmp (&opt[2], "ugly-comma") == 0)
266 ffe_set_is_ugly_comma (TRUE);
267 else if (strcmp (&opt[2], "no-ugly-comma") == 0)
268 ffe_set_is_ugly_comma (FALSE);
269 else if (strcmp (&opt[2], "ugly-complex") == 0)
270 ffe_set_is_ugly_complex (TRUE);
271 else if (strcmp (&opt[2], "no-ugly-complex") == 0)
272 ffe_set_is_ugly_complex (FALSE);
273 else if (strcmp (&opt[2], "ugly-init") == 0)
274 ffe_set_is_ugly_init (TRUE);
275 else if (strcmp (&opt[2], "no-ugly-init") == 0)
276 ffe_set_is_ugly_init (FALSE);
277 else if (strcmp (&opt[2], "ugly-logint") == 0)
278 ffe_set_is_ugly_logint (TRUE);
279 else if (strcmp (&opt[2], "no-ugly-logint") == 0)
280 ffe_set_is_ugly_logint (FALSE);
281 else if (strcmp (&opt[2], "xyzzy") == 0)
282 ffe_set_is_ffedebug (TRUE);
283 else if (strcmp (&opt[2], "no-xyzzy") == 0)
284 ffe_set_is_ffedebug (FALSE);
285 else if (strcmp (&opt[2], "init-local-zero") == 0)
286 ffe_set_is_init_local_zero (TRUE);
287 else if (strcmp (&opt[2], "no-init-local-zero") == 0)
288 ffe_set_is_init_local_zero (FALSE);
289 else if (strcmp (&opt[2], "emulate-complex") == 0)
290 ffe_set_is_emulate_complex (TRUE);
291 else if (strcmp (&opt[2], "no-emulate-complex") == 0)
292 ffe_set_is_emulate_complex (FALSE);
293 else if (strcmp (&opt[2], "backslash") == 0)
294 ffe_set_is_backslash (TRUE);
295 else if (strcmp (&opt[2], "no-backslash") == 0)
296 ffe_set_is_backslash (FALSE);
297 else if (strcmp (&opt[2], "underscoring") == 0)
298 ffe_set_is_underscoring (TRUE);
299 else if (strcmp (&opt[2], "no-underscoring") == 0)
300 ffe_set_is_underscoring (FALSE);
301 else if (strcmp (&opt[2], "second-underscore") == 0)
302 ffe_set_is_second_underscore (TRUE);
303 else if (strcmp (&opt[2], "no-second-underscore") == 0)
304 ffe_set_is_second_underscore (FALSE);
305 else if (strcmp (&opt[2], "zeros") == 0)
306 ffe_set_is_zeros (TRUE);
307 else if (strcmp (&opt[2], "no-zeros") == 0)
308 ffe_set_is_zeros (FALSE);
309 else if (strcmp (&opt[2], "debug-kludge") == 0)
310 ffe_set_is_debug_kludge (TRUE);
311 else if (strcmp (&opt[2], "no-debug-kludge") == 0)
312 ffe_set_is_debug_kludge (FALSE);
313 else if (strcmp (&opt[2], "onetrip") == 0)
314 ffe_set_is_onetrip (TRUE);
315 else if (strcmp (&opt[2], "no-onetrip") == 0)
316 ffe_set_is_onetrip (FALSE);
317 else if (strcmp (&opt[2], "silent") == 0)
318 ffe_set_is_silent (TRUE);
319 else if (strcmp (&opt[2], "no-silent") == 0)
320 ffe_set_is_silent (FALSE);
321 else if (strcmp (&opt[2], "globals") == 0)
322 ffe_set_is_globals (TRUE);
323 else if (strcmp (&opt[2], "no-globals") == 0)
324 ffe_set_is_globals (FALSE);
325 else if (strcmp (&opt[2], "fortran-bounds-check") == 0)
326 flag_bounds_check = TRUE;
327 else if (strcmp (&opt[2], "no-fortran-bounds-check") == 0)
328 flag_bounds_check = FALSE;
329 else if (strcmp (&opt[2], "typeless-boz") == 0)
330 ffe_set_is_typeless_boz (TRUE);
331 else if (strcmp (&opt[2], "no-typeless-boz") == 0)
332 ffe_set_is_typeless_boz (FALSE);
333 else if (strcmp (&opt[2], "intrin-case-initcap") == 0)
334 ffe_set_case_intrin (FFE_caseINITCAP);
335 else if (strcmp (&opt[2], "intrin-case-upper") == 0)
336 ffe_set_case_intrin (FFE_caseUPPER);
337 else if (strcmp (&opt[2], "intrin-case-lower") == 0)
338 ffe_set_case_intrin (FFE_caseLOWER);
339 else if (strcmp (&opt[2], "intrin-case-any") == 0)
340 ffe_set_case_intrin (FFE_caseNONE);
341 else if (strcmp (&opt[2], "match-case-initcap") == 0)
342 ffe_set_case_match (FFE_caseINITCAP);
343 else if (strcmp (&opt[2], "match-case-upper") == 0)
344 ffe_set_case_match (FFE_caseUPPER);
345 else if (strcmp (&opt[2], "match-case-lower") == 0)
346 ffe_set_case_match (FFE_caseLOWER);
347 else if (strcmp (&opt[2], "match-case-any") == 0)
348 ffe_set_case_match (FFE_caseNONE);
349 else if (strcmp (&opt[2], "source-case-upper") == 0)
350 ffe_set_case_source (FFE_caseUPPER);
351 else if (strcmp (&opt[2], "source-case-lower") == 0)
352 ffe_set_case_source (FFE_caseLOWER);
353 else if (strcmp (&opt[2], "source-case-preserve") == 0)
354 ffe_set_case_source (FFE_caseNONE);
355 else if (strcmp (&opt[2], "symbol-case-initcap") == 0)
356 ffe_set_case_symbol (FFE_caseINITCAP);
357 else if (strcmp (&opt[2], "symbol-case-upper") == 0)
358 ffe_set_case_symbol (FFE_caseUPPER);
359 else if (strcmp (&opt[2], "symbol-case-lower") == 0)
360 ffe_set_case_symbol (FFE_caseLOWER);
361 else if (strcmp (&opt[2], "symbol-case-any") == 0)
362 ffe_set_case_symbol (FFE_caseNONE);
363 else if (strcmp (&opt[2], "case-strict-upper") == 0)
365 ffe_set_case_intrin (FFE_caseUPPER);
366 ffe_set_case_match (FFE_caseUPPER);
367 ffe_set_case_source (FFE_caseNONE);
368 ffe_set_case_symbol (FFE_caseUPPER);
370 else if (strcmp (&opt[2], "case-strict-lower") == 0)
372 ffe_set_case_intrin (FFE_caseLOWER);
373 ffe_set_case_match (FFE_caseLOWER);
374 ffe_set_case_source (FFE_caseNONE);
375 ffe_set_case_symbol (FFE_caseLOWER);
377 else if (strcmp (&opt[2], "case-initcap") == 0)
379 ffe_set_case_intrin (FFE_caseINITCAP);
380 ffe_set_case_match (FFE_caseINITCAP);
381 ffe_set_case_source (FFE_caseNONE);
382 ffe_set_case_symbol (FFE_caseINITCAP);
384 else if (strcmp (&opt[2], "case-upper") == 0)
386 ffe_set_case_intrin (FFE_caseNONE);
387 ffe_set_case_match (FFE_caseNONE);
388 ffe_set_case_source (FFE_caseUPPER);
389 ffe_set_case_symbol (FFE_caseNONE);
391 else if (strcmp (&opt[2], "case-lower") == 0)
393 ffe_set_case_intrin (FFE_caseNONE);
394 ffe_set_case_match (FFE_caseNONE);
395 ffe_set_case_source (FFE_caseLOWER);
396 ffe_set_case_symbol (FFE_caseNONE);
398 else if (strcmp (&opt[2], "case-preserve") == 0)
400 ffe_set_case_intrin (FFE_caseNONE);
401 ffe_set_case_match (FFE_caseNONE);
402 ffe_set_case_source (FFE_caseNONE);
403 ffe_set_case_symbol (FFE_caseNONE);
405 else if (strcmp (&opt[2], "badu77-intrinsics-delete") == 0)
406 ffe_set_intrinsic_state_badu77 (FFE_intrinsicstateDELETED);
407 else if (strcmp (&opt[2], "badu77-intrinsics-hide") == 0)
408 ffe_set_intrinsic_state_badu77 (FFE_intrinsicstateHIDDEN);
409 else if (strcmp (&opt[2], "badu77-intrinsics-disable") == 0)
410 ffe_set_intrinsic_state_badu77 (FFE_intrinsicstateDISABLED);
411 else if (strcmp (&opt[2], "badu77-intrinsics-enable") == 0)
412 ffe_set_intrinsic_state_badu77 (FFE_intrinsicstateENABLED);
413 else if (strcmp (&opt[2], "gnu-intrinsics-delete") == 0)
414 ffe_set_intrinsic_state_gnu (FFE_intrinsicstateDELETED);
415 else if (strcmp (&opt[2], "gnu-intrinsics-hide") == 0)
416 ffe_set_intrinsic_state_gnu (FFE_intrinsicstateHIDDEN);
417 else if (strcmp (&opt[2], "gnu-intrinsics-disable") == 0)
418 ffe_set_intrinsic_state_gnu (FFE_intrinsicstateDISABLED);
419 else if (strcmp (&opt[2], "gnu-intrinsics-enable") == 0)
420 ffe_set_intrinsic_state_gnu (FFE_intrinsicstateENABLED);
421 else if (strcmp (&opt[2], "f2c-intrinsics-delete") == 0)
422 ffe_set_intrinsic_state_f2c (FFE_intrinsicstateDELETED);
423 else if (strcmp (&opt[2], "f2c-intrinsics-hide") == 0)
424 ffe_set_intrinsic_state_f2c (FFE_intrinsicstateHIDDEN);
425 else if (strcmp (&opt[2], "f2c-intrinsics-disable") == 0)
426 ffe_set_intrinsic_state_f2c (FFE_intrinsicstateDISABLED);
427 else if (strcmp (&opt[2], "f2c-intrinsics-enable") == 0)
428 ffe_set_intrinsic_state_f2c (FFE_intrinsicstateENABLED);
429 else if (strcmp (&opt[2], "f90-intrinsics-delete") == 0)
430 ffe_set_intrinsic_state_f90 (FFE_intrinsicstateDELETED);
431 else if (strcmp (&opt[2], "f90-intrinsics-hide") == 0)
432 ffe_set_intrinsic_state_f90 (FFE_intrinsicstateHIDDEN);
433 else if (strcmp (&opt[2], "f90-intrinsics-disable") == 0)
434 ffe_set_intrinsic_state_f90 (FFE_intrinsicstateDISABLED);
435 else if (strcmp (&opt[2], "f90-intrinsics-enable") == 0)
436 ffe_set_intrinsic_state_f90 (FFE_intrinsicstateENABLED);
437 else if (strcmp (&opt[2], "mil-intrinsics-delete") == 0)
438 ffe_set_intrinsic_state_mil (FFE_intrinsicstateDELETED);
439 else if (strcmp (&opt[2], "mil-intrinsics-hide") == 0)
440 ffe_set_intrinsic_state_mil (FFE_intrinsicstateHIDDEN);
441 else if (strcmp (&opt[2], "mil-intrinsics-disable") == 0)
442 ffe_set_intrinsic_state_mil (FFE_intrinsicstateDISABLED);
443 else if (strcmp (&opt[2], "mil-intrinsics-enable") == 0)
444 ffe_set_intrinsic_state_mil (FFE_intrinsicstateENABLED);
445 else if (strcmp (&opt[2], "unix-intrinsics-delete") == 0)
446 ffe_set_intrinsic_state_unix (FFE_intrinsicstateDELETED);
447 else if (strcmp (&opt[2], "unix-intrinsics-hide") == 0)
448 ffe_set_intrinsic_state_unix (FFE_intrinsicstateHIDDEN);
449 else if (strcmp (&opt[2], "unix-intrinsics-disable") == 0)
450 ffe_set_intrinsic_state_unix (FFE_intrinsicstateDISABLED);
451 else if (strcmp (&opt[2], "unix-intrinsics-enable") == 0)
452 ffe_set_intrinsic_state_unix (FFE_intrinsicstateENABLED);
453 else if (strcmp (&opt[2], "vxt-intrinsics-delete") == 0)
454 ffe_set_intrinsic_state_vxt (FFE_intrinsicstateDELETED);
455 else if (strcmp (&opt[2], "vxt-intrinsics-hide") == 0)
456 ffe_set_intrinsic_state_vxt (FFE_intrinsicstateHIDDEN);
457 else if (strcmp (&opt[2], "vxt-intrinsics-disable") == 0)
458 ffe_set_intrinsic_state_vxt (FFE_intrinsicstateDISABLED);
459 else if (strcmp (&opt[2], "vxt-intrinsics-enable") == 0)
460 ffe_set_intrinsic_state_vxt (FFE_intrinsicstateENABLED);
461 else if (strncmp (&opt[2], "fixed-line-length-",
462 strlen ("fixed-line-length-")) == 0)
464 char *len = &opt[2] + strlen ("fixed-line-length-");
466 if (strcmp (len, "none") == 0)
467 ffe_set_fixed_line_length (0);
468 else if (ffe_is_digit_string_ (len))
469 ffe_set_fixed_line_length (atol (len));
470 else
471 return 0;
473 else
474 return 0;
476 else if (opt[1] == 'W')
478 if (!strcmp (&opt[2], "comment"))
479 ; /* cpp handles this one. */
480 else if (!strcmp (&opt[2], "no-comment"))
481 ; /* cpp handles this one. */
482 else if (!strcmp (&opt[2], "comments"))
483 ; /* cpp handles this one. */
484 else if (!strcmp (&opt[2], "no-comments"))
485 ; /* cpp handles this one. */
486 else if (!strcmp (&opt[2], "trigraphs"))
487 ; /* cpp handles this one. */
488 else if (!strcmp (&opt[2], "no-trigraphs"))
489 ; /* cpp handles this one. */
490 else if (!strcmp (&opt[2], "import"))
491 ; /* cpp handles this one. */
492 else if (!strcmp (&opt[2], "no-import"))
493 ; /* cpp handles this one. */
494 else if (!strcmp (&opt[2], "globals"))
495 ffe_set_is_warn_globals (TRUE);
496 else if (!strcmp (&opt[2], "no-globals"))
497 ffe_set_is_warn_globals (FALSE);
498 else if (!strcmp (&opt[2], "implicit"))
499 ffe_set_is_warn_implicit (TRUE);
500 else if (!strcmp (&opt[2], "no-implicit"))
501 ffe_set_is_warn_implicit (FALSE);
502 else if (!strcmp (&opt[2], "surprising"))
503 ffe_set_is_warn_surprising (TRUE);
504 else if (!strcmp (&opt[2], "no-surprising"))
505 ffe_set_is_warn_surprising (FALSE);
506 else if (!strcmp (&opt[2], "all"))
508 /* We save the value of warn_uninitialized, since if they put
509 -Wuninitialized on the command line, we need to generate a
510 warning about not using it without also specifying -O. */
511 if (warn_uninitialized != 1)
512 warn_uninitialized = 2;
513 warn_unused = 1;
515 else
516 return 0;
518 else if (opt[1] == 'I')
519 return ffecom_decode_include_option (&opt[2]);
520 else
521 return 0;
523 return 1;
526 /* Run the FFE on a source file (not an INCLUDEd file).
528 Runs the whole shebang.
530 Prepare and invoke the appropriate lexer. */
532 void
533 ffe_file (ffewhereFile wf, FILE *f)
535 ffe_init_1 ();
536 ffelex_set_handler ((ffelexHandler) ffest_first);
537 ffewhere_file_set (wf, TRUE, 0);
538 if (ffe_is_free_form_)
539 ffelex_file_free (wf, f);
540 else
541 ffelex_file_fixed (wf, f);
542 ffest_eof ();
543 ffe_terminate_1 ();
546 /* ffe_init_0 -- Initialize the FFE per image invocation
548 ffe_init_0();
550 Performs per-image invocation. */
552 void
553 ffe_init_0 ()
555 ++ffe_count_0;
556 ffe_in_0 = TRUE;
558 ffebad_init_0 ();
559 ffebit_init_0 ();
560 ffebld_init_0 ();
561 ffecom_init_0 ();
562 ffedata_init_0 ();
563 ffeequiv_init_0 ();
564 ffeexpr_init_0 ();
565 ffeglobal_init_0 ();
566 ffeimplic_init_0 ();
567 ffeinfo_init_0 ();
568 ffeintrin_init_0 ();
569 ffelab_init_0 ();
570 ffelex_init_0 ();
571 ffename_init_0 ();
572 ffesrc_init_0 ();
573 ffest_init_0 ();
574 ffestorag_init_0 ();
575 ffesymbol_init_0 ();
576 ffetarget_init_0 ();
577 ffetype_init_0 ();
578 ffewhere_init_0 ();
581 /* ffe_init_1 -- Initialize the FFE per source file
583 ffe_init_1();
585 Performs per-source-file invocation (not including INCLUDEd files). */
587 void
588 ffe_init_1 ()
590 ++ffe_count_1;
591 ffe_in_1 = TRUE;
593 assert (ffe_file_pool_ == NULL);
594 ffe_file_pool_ = malloc_pool_new ("File", malloc_pool_image (), 1024);
596 ffebad_init_1 ();
597 ffebit_init_1 ();
598 ffebld_init_1 ();
599 ffecom_init_1 ();
600 ffedata_init_1 ();
601 ffeequiv_init_1 ();
602 ffeexpr_init_1 ();
603 ffeglobal_init_1 ();
604 ffeimplic_init_1 ();
605 ffeinfo_init_1 ();
606 ffeintrin_init_1 ();
607 ffelab_init_1 ();
608 ffelex_init_1 ();
609 ffename_init_1 ();
610 ffesrc_init_1 ();
611 ffest_init_1 ();
612 ffestorag_init_1 ();
613 ffesymbol_init_1 ();
614 ffetarget_init_1 ();
615 ffetype_init_1 ();
616 ffewhere_init_1 ();
618 ffe_init_2 ();
621 /* ffe_init_2 -- Initialize the FFE per outer program unit
623 ffe_init_2();
625 Performs per-program-unit invocation. */
627 void
628 ffe_init_2 ()
630 ++ffe_count_2;
631 ffe_in_2 = TRUE;
633 assert (ffe_program_unit_pool_ == NULL);
634 ffe_program_unit_pool_ = malloc_pool_new ("Program unit", ffe_file_pool_, 1024);
635 ffe_is_mainprog_ = FALSE;
636 ffe_is_saveall_ = !ffe_is_automatic_;
638 ffebad_init_2 ();
639 ffebit_init_2 ();
640 ffebld_init_2 ();
641 ffecom_init_2 ();
642 ffedata_init_2 ();
643 ffeequiv_init_2 ();
644 ffeexpr_init_2 ();
645 ffeglobal_init_2 ();
646 ffeimplic_init_2 ();
647 ffeinfo_init_2 ();
648 ffeintrin_init_2 ();
649 ffelab_init_2 ();
650 ffelex_init_2 ();
651 ffename_init_2 ();
652 ffesrc_init_2 ();
653 ffest_init_2 ();
654 ffestorag_init_2 ();
655 ffesymbol_init_2 ();
656 ffetarget_init_2 ();
657 ffetype_init_2 ();
658 ffewhere_init_2 ();
660 ffe_init_3 ();
663 /* ffe_init_3 -- Initialize the FFE per any program unit
665 ffe_init_3();
667 Performs per-any-unit initialization; does NOT do
668 per-statement-function-definition initialization (i.e. the chain
669 of inits, from 0-3, breaks here; level 4 must be invoked independently). */
671 void
672 ffe_init_3 ()
674 ++ffe_count_3;
675 ffe_in_3 = TRUE;
677 assert (ffe_any_unit_pool_ == NULL);
678 ffe_any_unit_pool_ = malloc_pool_new ("Any unit", ffe_program_unit_pool_, 1024);
680 ffebad_init_3 ();
681 ffebit_init_3 ();
682 ffebld_init_3 ();
683 ffecom_init_3 ();
684 ffedata_init_3 ();
685 ffeequiv_init_3 ();
686 ffeexpr_init_3 ();
687 ffeglobal_init_3 ();
688 ffeimplic_init_3 ();
689 ffeinfo_init_3 ();
690 ffeintrin_init_3 ();
691 ffelab_init_3 ();
692 ffelex_init_3 ();
693 ffename_init_3 ();
694 ffesrc_init_3 ();
695 ffest_init_3 ();
696 ffestorag_init_3 ();
697 ffesymbol_init_3 ();
698 ffetarget_init_3 ();
699 ffetype_init_3 ();
700 ffewhere_init_3 ();
703 /* ffe_init_4 -- Initialize the FFE per statement function definition
705 ffe_init_4(); */
707 void
708 ffe_init_4 ()
710 ++ffe_count_4;
711 ffe_in_4 = TRUE;
713 ffebad_init_4 ();
714 ffebit_init_4 ();
715 ffebld_init_4 ();
716 ffecom_init_4 ();
717 ffedata_init_4 ();
718 ffeequiv_init_4 ();
719 ffeexpr_init_4 ();
720 ffeglobal_init_4 ();
721 ffeimplic_init_4 ();
722 ffeinfo_init_4 ();
723 ffeintrin_init_4 ();
724 ffelab_init_4 ();
725 ffelex_init_4 ();
726 ffename_init_4 ();
727 ffesrc_init_4 ();
728 ffest_init_4 ();
729 ffestorag_init_4 ();
730 ffesymbol_init_4 ();
731 ffetarget_init_4 ();
732 ffetype_init_4 ();
733 ffewhere_init_4 ();
736 /* ffe_terminate_0 -- Terminate the FFE prior to image termination
738 ffe_terminate_0(); */
740 void
741 ffe_terminate_0 ()
743 ffe_count_1 = 0;
744 ffe_in_0 = FALSE;
746 ffebad_terminate_0 ();
747 ffebit_terminate_0 ();
748 ffebld_terminate_0 ();
749 ffecom_terminate_0 ();
750 ffedata_terminate_0 ();
751 ffeequiv_terminate_0 ();
752 ffeexpr_terminate_0 ();
753 ffeglobal_terminate_0 ();
754 ffeimplic_terminate_0 ();
755 ffeinfo_terminate_0 ();
756 ffeintrin_terminate_0 ();
757 ffelab_terminate_0 ();
758 ffelex_terminate_0 ();
759 ffename_terminate_0 ();
760 ffesrc_terminate_0 ();
761 ffest_terminate_0 ();
762 ffestorag_terminate_0 ();
763 ffesymbol_terminate_0 ();
764 ffetarget_terminate_0 ();
765 ffetype_terminate_0 ();
766 ffewhere_terminate_0 ();
769 /* ffe_terminate_1 -- Terminate the FFE after seeing source file EOF
771 ffe_terminate_1(); */
773 void
774 ffe_terminate_1 ()
776 ffe_count_2 = 0;
777 ffe_in_1 = FALSE;
779 ffe_terminate_2 ();
781 ffebad_terminate_1 ();
782 ffebit_terminate_1 ();
783 ffebld_terminate_1 ();
784 ffecom_terminate_1 ();
785 ffedata_terminate_1 ();
786 ffeequiv_terminate_1 ();
787 ffeexpr_terminate_1 ();
788 ffeglobal_terminate_1 ();
789 ffeimplic_terminate_1 ();
790 ffeinfo_terminate_1 ();
791 ffeintrin_terminate_1 ();
792 ffelab_terminate_1 ();
793 ffelex_terminate_1 ();
794 ffename_terminate_1 ();
795 ffesrc_terminate_1 ();
796 ffest_terminate_1 ();
797 ffestorag_terminate_1 ();
798 ffesymbol_terminate_1 ();
799 ffetarget_terminate_1 ();
800 ffetype_terminate_1 ();
801 ffewhere_terminate_1 ();
803 assert (ffe_file_pool_ != NULL);
804 malloc_pool_kill (ffe_file_pool_);
805 ffe_file_pool_ = NULL;
808 /* ffe_terminate_2 -- Terminate the FFE after seeing outer program unit END
810 ffe_terminate_2(); */
812 void
813 ffe_terminate_2 ()
815 ffe_count_3 = 0;
816 ffe_in_2 = FALSE;
818 ffe_terminate_3 ();
820 ffebad_terminate_2 ();
821 ffebit_terminate_2 ();
822 ffebld_terminate_2 ();
823 ffecom_terminate_2 ();
824 ffedata_terminate_2 ();
825 ffeequiv_terminate_2 ();
826 ffeexpr_terminate_2 ();
827 ffeglobal_terminate_2 ();
828 ffeimplic_terminate_2 ();
829 ffeinfo_terminate_2 ();
830 ffeintrin_terminate_2 ();
831 ffelab_terminate_2 ();
832 ffelex_terminate_2 ();
833 ffename_terminate_2 ();
834 ffesrc_terminate_2 ();
835 ffest_terminate_2 ();
836 ffestorag_terminate_2 ();
837 ffesymbol_terminate_2 ();
838 ffetarget_terminate_2 ();
839 ffetype_terminate_2 ();
840 ffewhere_terminate_2 ();
842 assert (ffe_program_unit_pool_ != NULL);
843 malloc_pool_kill (ffe_program_unit_pool_);
844 ffe_program_unit_pool_ = NULL;
847 /* ffe_terminate_3 -- Terminate the FFE after seeing any program unit END
849 ffe_terminate_3(); */
851 void
852 ffe_terminate_3 ()
854 ffe_count_4 = 0;
855 ffe_in_3 = FALSE;
857 ffebad_terminate_3 ();
858 ffebit_terminate_3 ();
859 ffebld_terminate_3 ();
860 ffecom_terminate_3 ();
861 ffedata_terminate_3 ();
862 ffeequiv_terminate_3 ();
863 ffeexpr_terminate_3 ();
864 ffeglobal_terminate_3 ();
865 ffeimplic_terminate_3 ();
866 ffeinfo_terminate_3 ();
867 ffeintrin_terminate_3 ();
868 ffelab_terminate_3 ();
869 ffelex_terminate_3 ();
870 ffename_terminate_3 ();
871 ffesrc_terminate_3 ();
872 ffest_terminate_3 ();
873 ffestorag_terminate_3 ();
874 ffesymbol_terminate_3 ();
875 ffetarget_terminate_3 ();
876 ffetype_terminate_3 ();
877 ffewhere_terminate_3 ();
879 assert (ffe_any_unit_pool_ != NULL);
880 malloc_pool_kill (ffe_any_unit_pool_);
881 ffe_any_unit_pool_ = NULL;
884 /* ffe_terminate_4 -- Terminate the FFE after seeing sfunc def expression
886 ffe_terminate_4(); */
888 void
889 ffe_terminate_4 ()
891 ffe_in_4 = FALSE;
893 ffebad_terminate_4 ();
894 ffebit_terminate_4 ();
895 ffebld_terminate_4 ();
896 ffecom_terminate_4 ();
897 ffedata_terminate_4 ();
898 ffeequiv_terminate_4 ();
899 ffeexpr_terminate_4 ();
900 ffeglobal_terminate_4 ();
901 ffeimplic_terminate_4 ();
902 ffeinfo_terminate_4 ();
903 ffeintrin_terminate_4 ();
904 ffelab_terminate_4 ();
905 ffelex_terminate_4 ();
906 ffename_terminate_4 ();
907 ffesrc_terminate_4 ();
908 ffest_terminate_4 ();
909 ffestorag_terminate_4 ();
910 ffesymbol_terminate_4 ();
911 ffetarget_terminate_4 ();
912 ffetype_terminate_4 ();
913 ffewhere_terminate_4 ();