1 /* top.c -- Implementation File (module.c template V1.0)
2 Copyright (C) 1995, 1996, 1997, 1999, 2001 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)
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
26 The GNU Fortran Front End.
59 /* Externals defined here. */
61 int flag_traditional; /* Shouldn't need this (C front end only)! */
62 bool ffe_is_do_internal_checks_ = FALSE;
63 bool ffe_is_90_ = FFETARGET_defaultIS_90;
64 bool ffe_is_automatic_ = FFETARGET_defaultIS_AUTOMATIC;
65 bool ffe_is_backslash_ = FFETARGET_defaultIS_BACKSLASH;
66 bool ffe_is_emulate_complex_ = FALSE;
67 bool ffe_is_underscoring_ = FFETARGET_defaultEXTERNAL_UNDERSCORED
68 || FFETARGET_defaultUNDERSCORED_EXTERNAL_UNDERSCORED;
69 bool ffe_is_second_underscore_ = FFETARGET_defaultUNDERSCORED_EXTERNAL_UNDERSCORED;
70 bool ffe_is_debug_kludge_ = FALSE;
71 bool ffe_is_dollar_ok_ = FFETARGET_defaultIS_DOLLAR_OK;
72 bool ffe_is_f2c_ = FFETARGET_defaultIS_F2C;
73 bool ffe_is_f2c_library_ = FFETARGET_defaultIS_F2C_LIBRARY;
74 bool ffe_is_ffedebug_ = FALSE;
75 bool ffe_is_flatten_arrays_ = FALSE;
76 bool ffe_is_free_form_ = FFETARGET_defaultIS_FREE_FORM;
77 bool ffe_is_globals_ = TRUE;
78 bool ffe_is_init_local_zero_ = FFETARGET_defaultIS_INIT_LOCAL_ZERO;
79 bool ffe_is_mainprog_; /* TRUE if current prog unit known to be
81 bool ffe_is_onetrip_ = FALSE;
82 bool ffe_is_silent_ = TRUE;
83 bool ffe_is_typeless_boz_ = FALSE;
84 bool ffe_is_pedantic_ = FFETARGET_defaultIS_PEDANTIC;
85 bool ffe_is_saveall_; /* TRUE if mainprog or SAVE (no args) seen. */
86 bool ffe_is_ugly_args_ = TRUE;
87 bool ffe_is_ugly_assign_ = FALSE; /* Try and store pointer to ASSIGN labels in INTEGER vars. */
88 bool ffe_is_ugly_assumed_ = FALSE; /* DIMENSION X([...,]1) => DIMENSION X([...,]*) */
89 bool ffe_is_ugly_comma_ = FALSE;
90 bool ffe_is_ugly_complex_ = FALSE;
91 bool ffe_is_ugly_init_ = TRUE;
92 bool ffe_is_ugly_logint_ = FALSE;
93 bool ffe_is_version_ = FALSE;
94 bool ffe_is_vxt_ = FALSE;
95 bool ffe_is_warn_globals_ = TRUE;
96 bool ffe_is_warn_implicit_ = FALSE;
97 bool ffe_is_warn_surprising_ = FALSE;
98 bool ffe_is_zeros_ = FALSE;
99 ffeCase ffe_case_intrin_ = FFETARGET_defaultCASE_INTRIN;
100 ffeCase ffe_case_match_ = FFETARGET_defaultCASE_MATCH;
101 ffeCase ffe_case_source_ = FFETARGET_defaultCASE_SOURCE;
102 ffeCase ffe_case_symbol_ = FFETARGET_defaultCASE_SYMBOL;
103 ffeIntrinsicState ffe_intrinsic_state_badu77_ = FFE_intrinsicstateENABLED;
104 ffeIntrinsicState ffe_intrinsic_state_gnu_ = FFE_intrinsicstateENABLED;
105 ffeIntrinsicState ffe_intrinsic_state_f2c_ = FFE_intrinsicstateENABLED;
106 ffeIntrinsicState ffe_intrinsic_state_f90_ = FFE_intrinsicstateENABLED;
107 ffeIntrinsicState ffe_intrinsic_state_mil_ = FFE_intrinsicstateENABLED;
108 ffeIntrinsicState ffe_intrinsic_state_unix_ = FFE_intrinsicstateENABLED;
109 ffeIntrinsicState ffe_intrinsic_state_vxt_ = FFE_intrinsicstateENABLED;
110 int ffe_fixed_line_length_ = FFETARGET_defaultFIXED_LINE_LENGTH;
111 mallocPool ffe_file_pool_ = NULL;
112 mallocPool ffe_any_unit_pool_ = NULL;
113 mallocPool ffe_program_unit_pool_ = NULL;
114 ffeCounter ffe_count_0 = 0;
115 ffeCounter ffe_count_1 = 0;
116 ffeCounter ffe_count_2 = 0;
117 ffeCounter ffe_count_3 = 0;
118 ffeCounter ffe_count_4 = 0;
119 bool ffe_in_0 = FALSE;
120 bool ffe_in_1 = FALSE;
121 bool ffe_in_2 = FALSE;
122 bool ffe_in_3 = FALSE;
123 bool ffe_in_4 = FALSE;
125 /* Simple definitions and enumerations. */
128 /* Internal typedefs. */
131 /* Private include files. */
134 /* Internal structure definitions. */
137 /* Static objects accessed by functions in this module. */
140 /* Static functions (internal). */
142 static bool ffe_is_digit_string_ (char *s);
144 /* Internal macros. */
147 ffe_is_digit_string_ (char *s)
151 for (p = s; ISDIGIT (*p); ++p)
154 return (p != s) && (*p == '\0');
157 /* Handle command-line options. Returns 0 if unrecognized, 1 if
158 recognized and handled. */
161 ffe_decode_option (argc, argv)
162 int argc ATTRIBUTE_UNUSED;
170 if (strcmp (&opt[2], "version") == 0)
172 ffe_set_is_version (TRUE);
173 ffe_set_is_do_internal_checks (TRUE);
175 else if (strcmp (&opt[2], "f66") == 0)
177 ffe_set_is_onetrip (TRUE);
178 ffe_set_is_ugly_assumed (TRUE);
180 else if (strcmp (&opt[2], "no-f66") == 0)
182 ffe_set_is_onetrip (FALSE);
183 ffe_set_is_ugly_assumed (FALSE);
185 else if (strcmp (&opt[2], "f77") == 0)
187 ffe_set_is_backslash (TRUE);
188 ffe_set_is_typeless_boz (FALSE);
190 else if (strcmp (&opt[2], "no-f77") == 0)
192 ffe_set_is_backslash (FALSE);
194 else if (strcmp (&opt[2], "f90") == 0)
195 ffe_set_is_90 (TRUE);
196 else if (strcmp (&opt[2], "no-f90") == 0)
197 ffe_set_is_90 (FALSE);
198 else if (strcmp (&opt[2], "automatic") == 0)
199 ffe_set_is_automatic (TRUE);
200 else if (strcmp (&opt[2], "no-automatic") == 0)
201 ffe_set_is_automatic (FALSE);
202 else if (strcmp (&opt[2], "dollar-ok") == 0)
203 ffe_set_is_dollar_ok (TRUE);
204 else if (strcmp (&opt[2], "no-dollar-ok") == 0)
205 ffe_set_is_dollar_ok (FALSE);
206 else if (strcmp (&opt[2], "f2c") == 0)
207 ffe_set_is_f2c (TRUE);
208 else if (strcmp (&opt[2], "no-f2c") == 0)
209 ffe_set_is_f2c (FALSE);
210 else if (strcmp (&opt[2], "f2c-library") == 0)
211 ffe_set_is_f2c_library (TRUE);
212 else if (strcmp (&opt[2], "no-f2c-library") == 0)
213 ffe_set_is_f2c_library (FALSE);
214 else if (strcmp (&opt[2], "flatten-arrays") == 0)
215 ffe_set_is_flatten_arrays (TRUE);
216 else if (strcmp (&opt[2], "no-flatten-arrays") == 0)
217 ffe_set_is_flatten_arrays (FALSE);
218 else if (strcmp (&opt[2], "free-form") == 0)
219 ffe_set_is_free_form (TRUE);
220 else if (strcmp (&opt[2], "no-free-form") == 0)
221 ffe_set_is_free_form (FALSE);
222 else if (strcmp (&opt[2], "fixed-form") == 0)
224 ffe_set_is_free_form (FALSE);
227 else if (strcmp (&opt[2], "no-fixed-form") == 0)
228 ffe_set_is_free_form (TRUE);
229 else if (strcmp (&opt[2], "pedantic") == 0)
230 ffe_set_is_pedantic (TRUE);
231 else if (strcmp (&opt[2], "no-pedantic") == 0)
232 ffe_set_is_pedantic (FALSE);
233 else if (strcmp (&opt[2], "vxt") == 0)
234 ffe_set_is_vxt (TRUE);
235 else if (strcmp (&opt[2], "not-vxt") == 0)
236 ffe_set_is_vxt (FALSE);
237 else if (strcmp (&opt[2], "vxt-not-f90") == 0)
238 warning ("%s no longer supported -- try -fvxt", opt);
239 else if (strcmp (&opt[2], "f90-not-vxt") == 0)
240 warning ("%s no longer supported -- try -fno-vxt -ff90", opt);
241 else if (strcmp (&opt[2], "no-ugly") == 0)
243 ffe_set_is_ugly_args (FALSE);
244 ffe_set_is_ugly_assign (FALSE);
245 ffe_set_is_ugly_assumed (FALSE);
246 ffe_set_is_ugly_comma (FALSE);
247 ffe_set_is_ugly_complex (FALSE);
248 ffe_set_is_ugly_init (FALSE);
249 ffe_set_is_ugly_logint (FALSE);
251 else if (strcmp (&opt[2], "ugly-args") == 0)
252 ffe_set_is_ugly_args (TRUE);
253 else if (strcmp (&opt[2], "no-ugly-args") == 0)
254 ffe_set_is_ugly_args (FALSE);
255 else if (strcmp (&opt[2], "ugly-assign") == 0)
256 ffe_set_is_ugly_assign (TRUE);
257 else if (strcmp (&opt[2], "no-ugly-assign") == 0)
258 ffe_set_is_ugly_assign (FALSE);
259 else if (strcmp (&opt[2], "ugly-assumed") == 0)
260 ffe_set_is_ugly_assumed (TRUE);
261 else if (strcmp (&opt[2], "no-ugly-assumed") == 0)
262 ffe_set_is_ugly_assumed (FALSE);
263 else if (strcmp (&opt[2], "ugly-comma") == 0)
264 ffe_set_is_ugly_comma (TRUE);
265 else if (strcmp (&opt[2], "no-ugly-comma") == 0)
266 ffe_set_is_ugly_comma (FALSE);
267 else if (strcmp (&opt[2], "ugly-complex") == 0)
268 ffe_set_is_ugly_complex (TRUE);
269 else if (strcmp (&opt[2], "no-ugly-complex") == 0)
270 ffe_set_is_ugly_complex (FALSE);
271 else if (strcmp (&opt[2], "ugly-init") == 0)
272 ffe_set_is_ugly_init (TRUE);
273 else if (strcmp (&opt[2], "no-ugly-init") == 0)
274 ffe_set_is_ugly_init (FALSE);
275 else if (strcmp (&opt[2], "ugly-logint") == 0)
276 ffe_set_is_ugly_logint (TRUE);
277 else if (strcmp (&opt[2], "no-ugly-logint") == 0)
278 ffe_set_is_ugly_logint (FALSE);
279 else if (strcmp (&opt[2], "xyzzy") == 0)
280 ffe_set_is_ffedebug (TRUE);
281 else if (strcmp (&opt[2], "no-xyzzy") == 0)
282 ffe_set_is_ffedebug (FALSE);
283 else if (strcmp (&opt[2], "init-local-zero") == 0)
284 ffe_set_is_init_local_zero (TRUE);
285 else if (strcmp (&opt[2], "no-init-local-zero") == 0)
286 ffe_set_is_init_local_zero (FALSE);
287 else if (strcmp (&opt[2], "emulate-complex") == 0)
288 ffe_set_is_emulate_complex (TRUE);
289 else if (strcmp (&opt[2], "no-emulate-complex") == 0)
290 ffe_set_is_emulate_complex (FALSE);
291 else if (strcmp (&opt[2], "backslash") == 0)
292 ffe_set_is_backslash (TRUE);
293 else if (strcmp (&opt[2], "no-backslash") == 0)
294 ffe_set_is_backslash (FALSE);
295 else if (strcmp (&opt[2], "underscoring") == 0)
296 ffe_set_is_underscoring (TRUE);
297 else if (strcmp (&opt[2], "no-underscoring") == 0)
298 ffe_set_is_underscoring (FALSE);
299 else if (strcmp (&opt[2], "second-underscore") == 0)
300 ffe_set_is_second_underscore (TRUE);
301 else if (strcmp (&opt[2], "no-second-underscore") == 0)
302 ffe_set_is_second_underscore (FALSE);
303 else if (strcmp (&opt[2], "zeros") == 0)
304 ffe_set_is_zeros (TRUE);
305 else if (strcmp (&opt[2], "no-zeros") == 0)
306 ffe_set_is_zeros (FALSE);
307 else if (strcmp (&opt[2], "debug-kludge") == 0)
308 warning ("%s disabled, use normal debugging flags", opt);
309 else if (strcmp (&opt[2], "no-debug-kludge") == 0)
310 warning ("%s disabled, use normal debugging flags", opt);
311 else if (strcmp (&opt[2], "onetrip") == 0)
312 ffe_set_is_onetrip (TRUE);
313 else if (strcmp (&opt[2], "no-onetrip") == 0)
314 ffe_set_is_onetrip (FALSE);
315 else if (strcmp (&opt[2], "silent") == 0)
316 ffe_set_is_silent (TRUE);
317 else if (strcmp (&opt[2], "no-silent") == 0)
318 ffe_set_is_silent (FALSE);
319 else if (strcmp (&opt[2], "globals") == 0)
320 ffe_set_is_globals (TRUE);
321 else if (strcmp (&opt[2], "no-globals") == 0)
322 ffe_set_is_globals (FALSE);
323 else if (strcmp (&opt[2], "fortran-bounds-check") == 0)
324 flag_bounds_check = TRUE;
325 else if (strcmp (&opt[2], "no-fortran-bounds-check") == 0)
326 flag_bounds_check = FALSE;
327 else if (strcmp (&opt[2], "typeless-boz") == 0)
328 ffe_set_is_typeless_boz (TRUE);
329 else if (strcmp (&opt[2], "no-typeless-boz") == 0)
330 ffe_set_is_typeless_boz (FALSE);
331 else if (strcmp (&opt[2], "intrin-case-initcap") == 0)
332 ffe_set_case_intrin (FFE_caseINITCAP);
333 else if (strcmp (&opt[2], "intrin-case-upper") == 0)
334 ffe_set_case_intrin (FFE_caseUPPER);
335 else if (strcmp (&opt[2], "intrin-case-lower") == 0)
336 ffe_set_case_intrin (FFE_caseLOWER);
337 else if (strcmp (&opt[2], "intrin-case-any") == 0)
338 ffe_set_case_intrin (FFE_caseNONE);
339 else if (strcmp (&opt[2], "match-case-initcap") == 0)
340 ffe_set_case_match (FFE_caseINITCAP);
341 else if (strcmp (&opt[2], "match-case-upper") == 0)
342 ffe_set_case_match (FFE_caseUPPER);
343 else if (strcmp (&opt[2], "match-case-lower") == 0)
344 ffe_set_case_match (FFE_caseLOWER);
345 else if (strcmp (&opt[2], "match-case-any") == 0)
346 ffe_set_case_match (FFE_caseNONE);
347 else if (strcmp (&opt[2], "source-case-upper") == 0)
348 ffe_set_case_source (FFE_caseUPPER);
349 else if (strcmp (&opt[2], "source-case-lower") == 0)
350 ffe_set_case_source (FFE_caseLOWER);
351 else if (strcmp (&opt[2], "source-case-preserve") == 0)
352 ffe_set_case_source (FFE_caseNONE);
353 else if (strcmp (&opt[2], "symbol-case-initcap") == 0)
354 ffe_set_case_symbol (FFE_caseINITCAP);
355 else if (strcmp (&opt[2], "symbol-case-upper") == 0)
356 ffe_set_case_symbol (FFE_caseUPPER);
357 else if (strcmp (&opt[2], "symbol-case-lower") == 0)
358 ffe_set_case_symbol (FFE_caseLOWER);
359 else if (strcmp (&opt[2], "symbol-case-any") == 0)
360 ffe_set_case_symbol (FFE_caseNONE);
361 else if (strcmp (&opt[2], "case-strict-upper") == 0)
363 ffe_set_case_intrin (FFE_caseUPPER);
364 ffe_set_case_match (FFE_caseUPPER);
365 ffe_set_case_source (FFE_caseNONE);
366 ffe_set_case_symbol (FFE_caseUPPER);
368 else if (strcmp (&opt[2], "case-strict-lower") == 0)
370 ffe_set_case_intrin (FFE_caseLOWER);
371 ffe_set_case_match (FFE_caseLOWER);
372 ffe_set_case_source (FFE_caseNONE);
373 ffe_set_case_symbol (FFE_caseLOWER);
375 else if (strcmp (&opt[2], "case-initcap") == 0)
377 ffe_set_case_intrin (FFE_caseINITCAP);
378 ffe_set_case_match (FFE_caseINITCAP);
379 ffe_set_case_source (FFE_caseNONE);
380 ffe_set_case_symbol (FFE_caseINITCAP);
382 else if (strcmp (&opt[2], "case-upper") == 0)
384 ffe_set_case_intrin (FFE_caseNONE);
385 ffe_set_case_match (FFE_caseNONE);
386 ffe_set_case_source (FFE_caseUPPER);
387 ffe_set_case_symbol (FFE_caseNONE);
389 else if (strcmp (&opt[2], "case-lower") == 0)
391 ffe_set_case_intrin (FFE_caseNONE);
392 ffe_set_case_match (FFE_caseNONE);
393 ffe_set_case_source (FFE_caseLOWER);
394 ffe_set_case_symbol (FFE_caseNONE);
396 else if (strcmp (&opt[2], "case-preserve") == 0)
398 ffe_set_case_intrin (FFE_caseNONE);
399 ffe_set_case_match (FFE_caseNONE);
400 ffe_set_case_source (FFE_caseNONE);
401 ffe_set_case_symbol (FFE_caseNONE);
403 else if (strcmp (&opt[2], "badu77-intrinsics-delete") == 0)
404 ffe_set_intrinsic_state_badu77 (FFE_intrinsicstateDELETED);
405 else if (strcmp (&opt[2], "badu77-intrinsics-hide") == 0)
406 ffe_set_intrinsic_state_badu77 (FFE_intrinsicstateHIDDEN);
407 else if (strcmp (&opt[2], "badu77-intrinsics-disable") == 0)
408 ffe_set_intrinsic_state_badu77 (FFE_intrinsicstateDISABLED);
409 else if (strcmp (&opt[2], "badu77-intrinsics-enable") == 0)
410 ffe_set_intrinsic_state_badu77 (FFE_intrinsicstateENABLED);
411 else if (strcmp (&opt[2], "gnu-intrinsics-delete") == 0)
412 ffe_set_intrinsic_state_gnu (FFE_intrinsicstateDELETED);
413 else if (strcmp (&opt[2], "gnu-intrinsics-hide") == 0)
414 ffe_set_intrinsic_state_gnu (FFE_intrinsicstateHIDDEN);
415 else if (strcmp (&opt[2], "gnu-intrinsics-disable") == 0)
416 ffe_set_intrinsic_state_gnu (FFE_intrinsicstateDISABLED);
417 else if (strcmp (&opt[2], "gnu-intrinsics-enable") == 0)
418 ffe_set_intrinsic_state_gnu (FFE_intrinsicstateENABLED);
419 else if (strcmp (&opt[2], "f2c-intrinsics-delete") == 0)
420 ffe_set_intrinsic_state_f2c (FFE_intrinsicstateDELETED);
421 else if (strcmp (&opt[2], "f2c-intrinsics-hide") == 0)
422 ffe_set_intrinsic_state_f2c (FFE_intrinsicstateHIDDEN);
423 else if (strcmp (&opt[2], "f2c-intrinsics-disable") == 0)
424 ffe_set_intrinsic_state_f2c (FFE_intrinsicstateDISABLED);
425 else if (strcmp (&opt[2], "f2c-intrinsics-enable") == 0)
426 ffe_set_intrinsic_state_f2c (FFE_intrinsicstateENABLED);
427 else if (strcmp (&opt[2], "f90-intrinsics-delete") == 0)
428 ffe_set_intrinsic_state_f90 (FFE_intrinsicstateDELETED);
429 else if (strcmp (&opt[2], "f90-intrinsics-hide") == 0)
430 ffe_set_intrinsic_state_f90 (FFE_intrinsicstateHIDDEN);
431 else if (strcmp (&opt[2], "f90-intrinsics-disable") == 0)
432 ffe_set_intrinsic_state_f90 (FFE_intrinsicstateDISABLED);
433 else if (strcmp (&opt[2], "f90-intrinsics-enable") == 0)
434 ffe_set_intrinsic_state_f90 (FFE_intrinsicstateENABLED);
435 else if (strcmp (&opt[2], "mil-intrinsics-delete") == 0)
436 ffe_set_intrinsic_state_mil (FFE_intrinsicstateDELETED);
437 else if (strcmp (&opt[2], "mil-intrinsics-hide") == 0)
438 ffe_set_intrinsic_state_mil (FFE_intrinsicstateHIDDEN);
439 else if (strcmp (&opt[2], "mil-intrinsics-disable") == 0)
440 ffe_set_intrinsic_state_mil (FFE_intrinsicstateDISABLED);
441 else if (strcmp (&opt[2], "mil-intrinsics-enable") == 0)
442 ffe_set_intrinsic_state_mil (FFE_intrinsicstateENABLED);
443 else if (strcmp (&opt[2], "unix-intrinsics-delete") == 0)
444 ffe_set_intrinsic_state_unix (FFE_intrinsicstateDELETED);
445 else if (strcmp (&opt[2], "unix-intrinsics-hide") == 0)
446 ffe_set_intrinsic_state_unix (FFE_intrinsicstateHIDDEN);
447 else if (strcmp (&opt[2], "unix-intrinsics-disable") == 0)
448 ffe_set_intrinsic_state_unix (FFE_intrinsicstateDISABLED);
449 else if (strcmp (&opt[2], "unix-intrinsics-enable") == 0)
450 ffe_set_intrinsic_state_unix (FFE_intrinsicstateENABLED);
451 else if (strcmp (&opt[2], "vxt-intrinsics-delete") == 0)
452 ffe_set_intrinsic_state_vxt (FFE_intrinsicstateDELETED);
453 else if (strcmp (&opt[2], "vxt-intrinsics-hide") == 0)
454 ffe_set_intrinsic_state_vxt (FFE_intrinsicstateHIDDEN);
455 else if (strcmp (&opt[2], "vxt-intrinsics-disable") == 0)
456 ffe_set_intrinsic_state_vxt (FFE_intrinsicstateDISABLED);
457 else if (strcmp (&opt[2], "vxt-intrinsics-enable") == 0)
458 ffe_set_intrinsic_state_vxt (FFE_intrinsicstateENABLED);
459 else if (strncmp (&opt[2], "fixed-line-length-",
460 strlen ("fixed-line-length-")) == 0)
462 char *len = &opt[2] + strlen ("fixed-line-length-");
464 if (strcmp (len, "none") == 0)
466 ffe_set_fixed_line_length (0);
469 else if (ffe_is_digit_string_ (len))
471 ffe_set_fixed_line_length (atol (len));
480 else if (opt[1] == 'W')
482 if (!strcmp (&opt[2], "comment"))
483 ; /* cpp handles this one. */
484 else if (!strcmp (&opt[2], "no-comment"))
485 ; /* cpp handles this one. */
486 else if (!strcmp (&opt[2], "comments"))
487 ; /* cpp handles this one. */
488 else if (!strcmp (&opt[2], "no-comments"))
489 ; /* cpp handles this one. */
490 else if (!strcmp (&opt[2], "trigraphs"))
491 ; /* cpp handles this one. */
492 else if (!strcmp (&opt[2], "no-trigraphs"))
493 ; /* cpp handles this one. */
494 else if (!strcmp (&opt[2], "import"))
495 ; /* cpp handles this one. */
496 else if (!strcmp (&opt[2], "no-import"))
497 ; /* cpp handles this one. */
498 else if (!strcmp (&opt[2], "globals"))
499 ffe_set_is_warn_globals (TRUE);
500 else if (!strcmp (&opt[2], "no-globals"))
501 ffe_set_is_warn_globals (FALSE);
502 else if (!strcmp (&opt[2], "implicit"))
503 ffe_set_is_warn_implicit (TRUE);
504 else if (!strcmp (&opt[2], "no-implicit"))
505 ffe_set_is_warn_implicit (FALSE);
506 else if (!strcmp (&opt[2], "surprising"))
507 ffe_set_is_warn_surprising (TRUE);
508 else if (!strcmp (&opt[2], "no-surprising"))
509 ffe_set_is_warn_surprising (FALSE);
510 else if (!strcmp (&opt[2], "all"))
512 /* We save the value of warn_uninitialized, since if they put
513 -Wuninitialized on the command line, we need to generate a
514 warning about not using it without also specifying -O. */
515 if (warn_uninitialized != 1)
516 warn_uninitialized = 2;
522 else if (opt[1] == 'I')
523 return ffecom_decode_include_option (&opt[2]);
530 /* Run the FFE on a source file (not an INCLUDEd file).
532 Runs the whole shebang.
534 Prepare and invoke the appropriate lexer. */
537 ffe_file (ffewhereFile wf, FILE *f)
540 ffelex_set_handler ((ffelexHandler) ffest_first);
541 ffewhere_file_set (wf, TRUE, 0);
542 if (ffe_is_free_form_)
543 ffelex_file_free (wf, f);
545 ffelex_file_fixed (wf, f);
550 /* ffe_init_0 -- Initialize the FFE per image invocation
554 Performs per-image invocation. */
585 /* ffe_init_1 -- Initialize the FFE per source file
589 Performs per-source-file invocation (not including INCLUDEd files). */
597 assert (ffe_file_pool_ == NULL);
598 ffe_file_pool_ = malloc_pool_new ("File", malloc_pool_image (), 1024);
625 /* ffe_init_2 -- Initialize the FFE per outer program unit
629 Performs per-program-unit invocation. */
637 assert (ffe_program_unit_pool_ == NULL);
638 ffe_program_unit_pool_ = malloc_pool_new ("Program unit", ffe_file_pool_, 1024);
639 ffe_is_mainprog_ = FALSE;
640 ffe_is_saveall_ = !ffe_is_automatic_;
667 /* ffe_init_3 -- Initialize the FFE per any program unit
671 Performs per-any-unit initialization; does NOT do
672 per-statement-function-definition initialization (i.e. the chain
673 of inits, from 0-3, breaks here; level 4 must be invoked independently). */
681 assert (ffe_any_unit_pool_ == NULL);
682 ffe_any_unit_pool_ = malloc_pool_new ("Any unit", ffe_program_unit_pool_, 1024);
707 /* ffe_init_4 -- Initialize the FFE per statement function definition
740 /* ffe_terminate_0 -- Terminate the FFE prior to image termination
742 ffe_terminate_0(); */
750 ffebad_terminate_0 ();
751 ffebit_terminate_0 ();
752 ffebld_terminate_0 ();
753 ffecom_terminate_0 ();
754 ffedata_terminate_0 ();
755 ffeequiv_terminate_0 ();
756 ffeexpr_terminate_0 ();
757 ffeglobal_terminate_0 ();
758 ffeimplic_terminate_0 ();
759 ffeinfo_terminate_0 ();
760 ffeintrin_terminate_0 ();
761 ffelab_terminate_0 ();
762 ffelex_terminate_0 ();
763 ffename_terminate_0 ();
764 ffesrc_terminate_0 ();
765 ffest_terminate_0 ();
766 ffestorag_terminate_0 ();
767 ffesymbol_terminate_0 ();
768 ffetarget_terminate_0 ();
769 ffetype_terminate_0 ();
770 ffewhere_terminate_0 ();
773 /* ffe_terminate_1 -- Terminate the FFE after seeing source file EOF
775 ffe_terminate_1(); */
785 ffebad_terminate_1 ();
786 ffebit_terminate_1 ();
787 ffebld_terminate_1 ();
788 ffecom_terminate_1 ();
789 ffedata_terminate_1 ();
790 ffeequiv_terminate_1 ();
791 ffeexpr_terminate_1 ();
792 ffeglobal_terminate_1 ();
793 ffeimplic_terminate_1 ();
794 ffeinfo_terminate_1 ();
795 ffeintrin_terminate_1 ();
796 ffelab_terminate_1 ();
797 ffelex_terminate_1 ();
798 ffename_terminate_1 ();
799 ffesrc_terminate_1 ();
800 ffest_terminate_1 ();
801 ffestorag_terminate_1 ();
802 ffesymbol_terminate_1 ();
803 ffetarget_terminate_1 ();
804 ffetype_terminate_1 ();
805 ffewhere_terminate_1 ();
807 assert (ffe_file_pool_ != NULL);
808 malloc_pool_kill (ffe_file_pool_);
809 ffe_file_pool_ = NULL;
812 /* ffe_terminate_2 -- Terminate the FFE after seeing outer program unit END
814 ffe_terminate_2(); */
824 ffebad_terminate_2 ();
825 ffebit_terminate_2 ();
826 ffebld_terminate_2 ();
827 ffecom_terminate_2 ();
828 ffedata_terminate_2 ();
829 ffeequiv_terminate_2 ();
830 ffeexpr_terminate_2 ();
831 ffeglobal_terminate_2 ();
832 ffeimplic_terminate_2 ();
833 ffeinfo_terminate_2 ();
834 ffeintrin_terminate_2 ();
835 ffelab_terminate_2 ();
836 ffelex_terminate_2 ();
837 ffename_terminate_2 ();
838 ffesrc_terminate_2 ();
839 ffest_terminate_2 ();
840 ffestorag_terminate_2 ();
841 ffesymbol_terminate_2 ();
842 ffetarget_terminate_2 ();
843 ffetype_terminate_2 ();
844 ffewhere_terminate_2 ();
846 assert (ffe_program_unit_pool_ != NULL);
847 malloc_pool_kill (ffe_program_unit_pool_);
848 ffe_program_unit_pool_ = NULL;
851 /* ffe_terminate_3 -- Terminate the FFE after seeing any program unit END
853 ffe_terminate_3(); */
861 ffebad_terminate_3 ();
862 ffebit_terminate_3 ();
863 ffebld_terminate_3 ();
864 ffecom_terminate_3 ();
865 ffedata_terminate_3 ();
866 ffeequiv_terminate_3 ();
867 ffeexpr_terminate_3 ();
868 ffeglobal_terminate_3 ();
869 ffeimplic_terminate_3 ();
870 ffeinfo_terminate_3 ();
871 ffeintrin_terminate_3 ();
872 ffelab_terminate_3 ();
873 ffelex_terminate_3 ();
874 ffename_terminate_3 ();
875 ffesrc_terminate_3 ();
876 ffest_terminate_3 ();
877 ffestorag_terminate_3 ();
878 ffesymbol_terminate_3 ();
879 ffetarget_terminate_3 ();
880 ffetype_terminate_3 ();
881 ffewhere_terminate_3 ();
883 assert (ffe_any_unit_pool_ != NULL);
884 malloc_pool_kill (ffe_any_unit_pool_);
885 ffe_any_unit_pool_ = NULL;
888 /* ffe_terminate_4 -- Terminate the FFE after seeing sfunc def expression
890 ffe_terminate_4(); */
897 ffebad_terminate_4 ();
898 ffebit_terminate_4 ();
899 ffebld_terminate_4 ();
900 ffecom_terminate_4 ();
901 ffedata_terminate_4 ();
902 ffeequiv_terminate_4 ();
903 ffeexpr_terminate_4 ();
904 ffeglobal_terminate_4 ();
905 ffeimplic_terminate_4 ();
906 ffeinfo_terminate_4 ();
907 ffeintrin_terminate_4 ();
908 ffelab_terminate_4 ();
909 ffelex_terminate_4 ();
910 ffename_terminate_4 ();
911 ffesrc_terminate_4 ();
912 ffest_terminate_4 ();
913 ffestorag_terminate_4 ();
914 ffesymbol_terminate_4 ();
915 ffetarget_terminate_4 ();
916 ffetype_terminate_4 ();
917 ffewhere_terminate_4 ();