2008-11-01 Steven G. Kargl <kargls@comcast.net>
[official-gcc.git] / gcc / fortran / options.c
blob3f49d563131cb25ceb139cd23b48b44c95457577
1 /* Parse and display command line options.
2 Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
3 Free Software Foundation, Inc.
4 Contributed by Andy Vaught
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #include "config.h"
23 #include "system.h"
24 #include "coretypes.h"
25 #include "tree.h"
26 #include "flags.h"
27 #include "intl.h"
28 #include "opts.h"
29 #include "options.h"
30 #include "params.h"
31 #include "tree-inline.h"
32 #include "gfortran.h"
33 #include "target.h"
34 #include "cpp.h"
36 gfc_option_t gfc_option;
39 /* Set flags that control warnings and errors for different
40 Fortran standards to their default values. Keep in sync with
41 libgfortran/runtime/compile_options.c (init_compile_options). */
43 static void
44 set_default_std_flags (void)
46 gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
47 | GFC_STD_F2003 | GFC_STD_F2008 | GFC_STD_F95 | GFC_STD_F77
48 | GFC_STD_GNU | GFC_STD_LEGACY;
49 gfc_option.warn_std = GFC_STD_F95_DEL | GFC_STD_LEGACY;
53 /* Get ready for options handling. Keep in sync with
54 libgfortran/runtime/compile_options.c (init_compile_options). */
56 unsigned int
57 gfc_init_options (unsigned int argc, const char **argv)
59 gfc_source_file = NULL;
60 gfc_option.module_dir = NULL;
61 gfc_option.source_form = FORM_UNKNOWN;
62 gfc_option.fixed_line_length = 72;
63 gfc_option.free_line_length = 132;
64 gfc_option.max_continue_fixed = 255;
65 gfc_option.max_continue_free = 255;
66 gfc_option.max_identifier_length = GFC_MAX_SYMBOL_LEN;
67 gfc_option.max_subrecord_length = 0;
68 gfc_option.flag_max_array_constructor = 65535;
69 gfc_option.convert = GFC_CONVERT_NATIVE;
70 gfc_option.record_marker = 0;
71 gfc_option.dump_parse_tree = 0;
73 gfc_option.warn_aliasing = 0;
74 gfc_option.warn_ampersand = 0;
75 gfc_option.warn_character_truncation = 0;
76 gfc_option.warn_array_temp = 0;
77 gfc_option.warn_conversion = 0;
78 gfc_option.warn_implicit_interface = 0;
79 gfc_option.warn_line_truncation = 0;
80 gfc_option.warn_surprising = 0;
81 gfc_option.warn_tabs = 1;
82 gfc_option.warn_underflow = 1;
83 gfc_option.warn_intrinsic_shadow = 0;
84 gfc_option.warn_intrinsics_std = 0;
85 gfc_option.warn_align_commons = 1;
86 gfc_option.max_errors = 25;
88 gfc_option.flag_all_intrinsics = 0;
89 gfc_option.flag_default_double = 0;
90 gfc_option.flag_default_integer = 0;
91 gfc_option.flag_default_real = 0;
92 gfc_option.flag_dollar_ok = 0;
93 gfc_option.flag_underscoring = 1;
94 gfc_option.flag_f2c = 0;
95 gfc_option.flag_second_underscore = -1;
96 gfc_option.flag_implicit_none = 0;
98 /* Default value of flag_max_stack_var_size is set in gfc_post_options. */
99 gfc_option.flag_max_stack_var_size = -2;
101 gfc_option.flag_range_check = 1;
102 gfc_option.flag_pack_derived = 0;
103 gfc_option.flag_repack_arrays = 0;
104 gfc_option.flag_preprocessed = 0;
105 gfc_option.flag_automatic = 1;
106 gfc_option.flag_backslash = 0;
107 gfc_option.flag_module_private = 0;
108 gfc_option.flag_backtrace = 0;
109 gfc_option.flag_check_array_temporaries = 0;
110 gfc_option.flag_allow_leading_underscore = 0;
111 gfc_option.flag_dump_core = 0;
112 gfc_option.flag_external_blas = 0;
113 gfc_option.blas_matmul_limit = 30;
114 gfc_option.flag_cray_pointer = 0;
115 gfc_option.flag_d_lines = -1;
116 gfc_option.flag_openmp = 0;
117 gfc_option.flag_sign_zero = 1;
118 gfc_option.flag_recursive = 0;
119 gfc_option.flag_init_integer = GFC_INIT_INTEGER_OFF;
120 gfc_option.flag_init_integer_value = 0;
121 gfc_option.flag_init_real = GFC_INIT_REAL_OFF;
122 gfc_option.flag_init_logical = GFC_INIT_LOGICAL_OFF;
123 gfc_option.flag_init_character = GFC_INIT_CHARACTER_OFF;
124 gfc_option.flag_init_character_value = (char)0;
125 gfc_option.flag_align_commons = 1;
127 gfc_option.fpe = 0;
129 /* Argument pointers cannot point to anything but their argument. */
130 flag_argument_noalias = 3;
132 flag_errno_math = 0;
134 set_default_std_flags ();
136 /* -fshort-enums can be default on some targets. */
137 gfc_option.fshort_enums = targetm.default_short_enums ();
139 /* Initialize cpp-related options. */
140 gfc_cpp_init_options(argc, argv);
142 return CL_Fortran;
146 /* Determine the source form from the filename extension. We assume
147 case insensitivity. */
149 static gfc_source_form
150 form_from_filename (const char *filename)
152 static const struct
154 const char *extension;
155 gfc_source_form form;
157 exttype[] =
160 ".f90", FORM_FREE}
163 ".f95", FORM_FREE}
166 ".f03", FORM_FREE}
169 ".f08", FORM_FREE}
172 ".f", FORM_FIXED}
175 ".for", FORM_FIXED}
178 ".ftn", FORM_FIXED}
181 "", FORM_UNKNOWN}
182 }; /* sentinel value */
184 gfc_source_form f_form;
185 const char *fileext;
186 int i;
188 /* Find end of file name. Note, filename is either a NULL pointer or
189 a NUL terminated string. */
190 i = 0;
191 while (filename[i] != '\0')
192 i++;
194 /* Find last period. */
195 while (i >= 0 && (filename[i] != '.'))
196 i--;
198 /* Did we see a file extension? */
199 if (i < 0)
200 return FORM_UNKNOWN; /* Nope */
202 /* Get file extension and compare it to others. */
203 fileext = &(filename[i]);
205 i = -1;
206 f_form = FORM_UNKNOWN;
209 i++;
210 if (strcasecmp (fileext, exttype[i].extension) == 0)
212 f_form = exttype[i].form;
213 break;
216 while (exttype[i].form != FORM_UNKNOWN);
218 return f_form;
222 /* Finalize commandline options. */
224 bool
225 gfc_post_options (const char **pfilename)
227 const char *filename = *pfilename, *canon_source_file = NULL;
228 char *source_path;
229 int i;
231 /* Issue an error if -fwhole-program was used. */
232 if (flag_whole_program)
233 gfc_fatal_error ("Option -fwhole-program is not supported for Fortran");
235 /* Verify the input file name. */
236 if (!filename || strcmp (filename, "-") == 0)
238 filename = "";
241 if (gfc_option.flag_preprocessed)
243 /* For preprocessed files, if the first tokens are of the form # NUM.
244 handle the directives so we know the original file name. */
245 gfc_source_file = gfc_read_orig_filename (filename, &canon_source_file);
246 if (gfc_source_file == NULL)
247 gfc_source_file = filename;
248 else
249 *pfilename = gfc_source_file;
251 else
252 gfc_source_file = filename;
254 if (canon_source_file == NULL)
255 canon_source_file = gfc_source_file;
257 /* Adds the path where the source file is to the list of include files. */
259 i = strlen (canon_source_file);
260 while (i > 0 && !IS_DIR_SEPARATOR (canon_source_file[i]))
261 i--;
263 if (i != 0)
265 source_path = (char *) alloca (i + 1);
266 memcpy (source_path, canon_source_file, i);
267 source_path[i] = 0;
268 gfc_add_include_path (source_path, true);
270 else
271 gfc_add_include_path (".", true);
273 if (canon_source_file != gfc_source_file)
274 gfc_free (CONST_CAST (char *, canon_source_file));
276 /* Decide which form the file will be read in as. */
278 if (gfc_option.source_form != FORM_UNKNOWN)
279 gfc_current_form = gfc_option.source_form;
280 else
282 gfc_current_form = form_from_filename (filename);
284 if (gfc_current_form == FORM_UNKNOWN)
286 gfc_current_form = FORM_FREE;
287 gfc_warning_now ("Reading file '%s' as free form",
288 (filename[0] == '\0') ? "<stdin>" : filename);
292 /* If the user specified -fd-lines-as-{code|comments} verify that we're
293 in fixed form. */
294 if (gfc_current_form == FORM_FREE)
296 if (gfc_option.flag_d_lines == 0)
297 gfc_warning_now ("'-fd-lines-as-comments' has no effect "
298 "in free form");
299 else if (gfc_option.flag_d_lines == 1)
300 gfc_warning_now ("'-fd-lines-as-code' has no effect in free form");
303 /* If -pedantic, warn about the use of GNU extensions. */
304 if (pedantic && (gfc_option.allow_std & GFC_STD_GNU) != 0)
305 gfc_option.warn_std |= GFC_STD_GNU;
306 /* -std=legacy -pedantic is effectively -std=gnu. */
307 if (pedantic && (gfc_option.allow_std & GFC_STD_LEGACY) != 0)
308 gfc_option.warn_std |= GFC_STD_F95_OBS | GFC_STD_F95_DEL | GFC_STD_LEGACY;
310 /* If the user didn't explicitly specify -f(no)-second-underscore we
311 use it if we're trying to be compatible with f2c, and not
312 otherwise. */
313 if (gfc_option.flag_second_underscore == -1)
314 gfc_option.flag_second_underscore = gfc_option.flag_f2c;
316 if (!gfc_option.flag_automatic && gfc_option.flag_max_stack_var_size != -2
317 && gfc_option.flag_max_stack_var_size != 0)
318 gfc_warning_now ("Flag -fno-automatic overwrites -fmax-stack-var-size=%d",
319 gfc_option.flag_max_stack_var_size);
320 else if (!gfc_option.flag_automatic && gfc_option.flag_recursive)
321 gfc_warning_now ("Flag -fno-automatic overwrites -frecursive");
322 else if (!gfc_option.flag_automatic && gfc_option.flag_openmp)
323 gfc_warning_now ("Flag -fno-automatic overwrites -frecursive implied by "
324 "-fopenmp");
325 else if (gfc_option.flag_max_stack_var_size != -2
326 && gfc_option.flag_recursive)
327 gfc_warning_now ("Flag -frecursive overwrites -fmax-stack-var-size=%d",
328 gfc_option.flag_max_stack_var_size);
329 else if (gfc_option.flag_max_stack_var_size != -2
330 && gfc_option.flag_openmp)
331 gfc_warning_now ("Flag -fmax-stack-var-size=%d overwrites -frecursive "
332 "implied by -fopenmp",
333 gfc_option.flag_max_stack_var_size);
335 /* Implied -frecursive; implemented as -fmax-stack-var-size=-1. */
336 if (gfc_option.flag_max_stack_var_size == -2 && gfc_option.flag_openmp)
337 gfc_option.flag_max_stack_var_size = -1;
339 /* Set default. */
340 if (gfc_option.flag_max_stack_var_size == -2)
341 gfc_option.flag_max_stack_var_size = 32768;
343 /* Implement -frecursive as -fmax-stack-var-size=-1. */
344 if (gfc_option.flag_recursive)
345 gfc_option.flag_max_stack_var_size = -1;
347 /* Implement -fno-automatic as -fmax-stack-var-size=0. */
348 if (!gfc_option.flag_automatic)
349 gfc_option.flag_max_stack_var_size = 0;
351 if (pedantic)
353 gfc_option.warn_ampersand = 1;
354 gfc_option.warn_tabs = 0;
357 gfc_cpp_post_options ();
359 /* FIXME: return gfc_cpp_preprocess_only ();
361 The return value of this function indicates whether the
362 backend needs to be initialized. On -E, we don't need
363 the backend. However, if we return 'true' here, an
364 ICE occurs. Initializing the backend doesn't hurt much,
365 hence, for now we can live with it as is. */
366 return false;
370 /* Set the options for -Wall. */
372 static void
373 set_Wall (int setting)
375 gfc_option.warn_aliasing = setting;
376 gfc_option.warn_ampersand = setting;
377 gfc_option.warn_line_truncation = setting;
378 gfc_option.warn_surprising = setting;
379 gfc_option.warn_tabs = !setting;
380 gfc_option.warn_underflow = setting;
381 gfc_option.warn_intrinsic_shadow = setting;
382 gfc_option.warn_intrinsics_std = setting;
383 gfc_option.warn_character_truncation = setting;
385 warn_unused = setting;
386 warn_return_type = setting;
387 warn_switch = setting;
389 /* We save the value of warn_uninitialized, since if they put
390 -Wuninitialized on the command line, we need to generate a
391 warning about not using it without also specifying -O. */
392 if (setting == 0)
393 warn_uninitialized = 0;
394 else if (warn_uninitialized != 1)
395 warn_uninitialized = 2;
399 static void
400 gfc_handle_module_path_options (const char *arg)
403 if (gfc_option.module_dir != NULL)
404 gfc_fatal_error ("gfortran: Only one -J option allowed");
406 gfc_option.module_dir = (char *) gfc_getmem (strlen (arg) + 2);
407 strcpy (gfc_option.module_dir, arg);
408 strcat (gfc_option.module_dir, "/");
410 gfc_add_include_path (gfc_option.module_dir, true);
414 static void
415 gfc_handle_fpe_trap_option (const char *arg)
417 int result, pos = 0, n;
418 static const char * const exception[] = { "invalid", "denormal", "zero",
419 "overflow", "underflow",
420 "precision", NULL };
421 static const int opt_exception[] = { GFC_FPE_INVALID, GFC_FPE_DENORMAL,
422 GFC_FPE_ZERO, GFC_FPE_OVERFLOW,
423 GFC_FPE_UNDERFLOW, GFC_FPE_PRECISION,
424 0 };
426 while (*arg)
428 while (*arg == ',')
429 arg++;
431 while (arg[pos] && arg[pos] != ',')
432 pos++;
434 result = 0;
435 for (n = 0; exception[n] != NULL; n++)
437 if (exception[n] && strncmp (exception[n], arg, pos) == 0)
439 gfc_option.fpe |= opt_exception[n];
440 arg += pos;
441 pos = 0;
442 result = 1;
443 break;
446 if (!result)
447 gfc_fatal_error ("Argument to -ffpe-trap is not valid: %s", arg);
452 /* Handle command-line options. Returns 0 if unrecognized, 1 if
453 recognized and handled. */
456 gfc_handle_option (size_t scode, const char *arg, int value)
458 int result = 1;
459 enum opt_code code = (enum opt_code) scode;
461 /* Ignore file names. */
462 if (code == N_OPTS)
463 return 1;
465 if (gfc_cpp_handle_option (scode, arg, value) == 1)
466 return 1;
468 switch (code)
470 default:
471 result = 0;
472 break;
474 case OPT_Wall:
475 set_Wall (value);
476 break;
478 case OPT_Waliasing:
479 gfc_option.warn_aliasing = value;
480 break;
482 case OPT_Wampersand:
483 gfc_option.warn_ampersand = value;
484 break;
486 case OPT_Warray_temporaries:
487 gfc_option.warn_array_temp = value;
488 break;
490 case OPT_Wcharacter_truncation:
491 gfc_option.warn_character_truncation = value;
492 break;
494 case OPT_Wconversion:
495 gfc_option.warn_conversion = value;
496 break;
498 case OPT_Wimplicit_interface:
499 gfc_option.warn_implicit_interface = value;
500 break;
502 case OPT_Wline_truncation:
503 gfc_option.warn_line_truncation = value;
504 break;
506 case OPT_Wreturn_type:
507 warn_return_type = value;
508 break;
510 case OPT_Wsurprising:
511 gfc_option.warn_surprising = value;
512 break;
514 case OPT_Wtabs:
515 gfc_option.warn_tabs = value;
516 break;
518 case OPT_Wunderflow:
519 gfc_option.warn_underflow = value;
520 break;
522 case OPT_Wintrinsic_shadow:
523 gfc_option.warn_intrinsic_shadow = value;
524 break;
526 case OPT_Walign_commons:
527 gfc_option.warn_align_commons = value;
528 break;
530 case OPT_fall_intrinsics:
531 gfc_option.flag_all_intrinsics = 1;
532 break;
534 case OPT_fautomatic:
535 gfc_option.flag_automatic = value;
536 break;
538 case OPT_fallow_leading_underscore:
539 gfc_option.flag_allow_leading_underscore = value;
540 break;
542 case OPT_fbackslash:
543 gfc_option.flag_backslash = value;
544 break;
546 case OPT_fbacktrace:
547 gfc_option.flag_backtrace = value;
548 break;
550 case OPT_fcheck_array_temporaries:
551 gfc_option.flag_check_array_temporaries = value;
552 break;
554 case OPT_fdump_core:
555 gfc_option.flag_dump_core = value;
556 break;
558 case OPT_fcray_pointer:
559 gfc_option.flag_cray_pointer = value;
560 break;
562 case OPT_ff2c:
563 gfc_option.flag_f2c = value;
564 break;
566 case OPT_fdollar_ok:
567 gfc_option.flag_dollar_ok = value;
568 break;
570 case OPT_fexternal_blas:
571 gfc_option.flag_external_blas = value;
572 break;
574 case OPT_fblas_matmul_limit_:
575 gfc_option.blas_matmul_limit = value;
576 break;
578 case OPT_fd_lines_as_code:
579 gfc_option.flag_d_lines = 1;
580 break;
582 case OPT_fd_lines_as_comments:
583 gfc_option.flag_d_lines = 0;
584 break;
586 case OPT_fdump_parse_tree:
587 gfc_option.dump_parse_tree = value;
588 break;
590 case OPT_ffixed_form:
591 gfc_option.source_form = FORM_FIXED;
592 break;
594 case OPT_ffixed_line_length_none:
595 gfc_option.fixed_line_length = 0;
596 break;
598 case OPT_ffixed_line_length_:
599 if (value != 0 && value < 7)
600 gfc_fatal_error ("Fixed line length must be at least seven.");
601 gfc_option.fixed_line_length = value;
602 break;
604 case OPT_ffree_form:
605 gfc_option.source_form = FORM_FREE;
606 break;
608 case OPT_fopenmp:
609 gfc_option.flag_openmp = value;
610 break;
612 case OPT_ffree_line_length_none:
613 gfc_option.free_line_length = 0;
614 break;
616 case OPT_ffree_line_length_:
617 if (value != 0 && value < 4)
618 gfc_fatal_error ("Free line length must be at least three.");
619 gfc_option.free_line_length = value;
620 break;
622 case OPT_funderscoring:
623 gfc_option.flag_underscoring = value;
624 break;
626 case OPT_fsecond_underscore:
627 gfc_option.flag_second_underscore = value;
628 break;
630 case OPT_static_libgfortran:
631 #ifndef HAVE_LD_STATIC_DYNAMIC
632 gfc_fatal_error ("-static-libgfortran is not supported in this "
633 "configuration");
634 #endif
635 break;
637 case OPT_fimplicit_none:
638 gfc_option.flag_implicit_none = value;
639 break;
641 case OPT_fintrinsic_modules_path:
642 gfc_add_include_path (arg, false);
643 gfc_add_intrinsic_modules_path (arg);
644 break;
646 case OPT_fmax_array_constructor_:
647 gfc_option.flag_max_array_constructor = value > 65535 ? value : 65535;
648 break;
650 case OPT_fmax_errors_:
651 gfc_option.max_errors = value;
652 break;
654 case OPT_fmax_stack_var_size_:
655 gfc_option.flag_max_stack_var_size = value;
656 break;
658 case OPT_fmodule_private:
659 gfc_option.flag_module_private = value;
660 break;
662 case OPT_frange_check:
663 gfc_option.flag_range_check = value;
664 break;
666 case OPT_fpack_derived:
667 gfc_option.flag_pack_derived = value;
668 break;
670 case OPT_frepack_arrays:
671 gfc_option.flag_repack_arrays = value;
672 break;
674 case OPT_fpreprocessed:
675 gfc_option.flag_preprocessed = value;
676 break;
678 case OPT_fmax_identifier_length_:
679 if (value > GFC_MAX_SYMBOL_LEN)
680 gfc_fatal_error ("Maximum supported identifier length is %d",
681 GFC_MAX_SYMBOL_LEN);
682 gfc_option.max_identifier_length = value;
683 break;
685 case OPT_fdefault_integer_8:
686 gfc_option.flag_default_integer = value;
687 break;
689 case OPT_fdefault_real_8:
690 gfc_option.flag_default_real = value;
691 break;
693 case OPT_fdefault_double_8:
694 gfc_option.flag_default_double = value;
695 break;
697 case OPT_finit_local_zero:
698 gfc_option.flag_init_integer = GFC_INIT_INTEGER_ON;
699 gfc_option.flag_init_integer_value = 0;
700 gfc_option.flag_init_real = GFC_INIT_REAL_ZERO;
701 gfc_option.flag_init_logical = GFC_INIT_LOGICAL_FALSE;
702 gfc_option.flag_init_character = GFC_INIT_CHARACTER_ON;
703 gfc_option.flag_init_character_value = (char)0;
704 break;
706 case OPT_finit_logical_:
707 if (!strcasecmp (arg, "false"))
708 gfc_option.flag_init_logical = GFC_INIT_LOGICAL_FALSE;
709 else if (!strcasecmp (arg, "true"))
710 gfc_option.flag_init_logical = GFC_INIT_LOGICAL_TRUE;
711 else
712 gfc_fatal_error ("Unrecognized option to -finit-logical: %s",
713 arg);
714 break;
716 case OPT_finit_real_:
717 if (!strcasecmp (arg, "zero"))
718 gfc_option.flag_init_real = GFC_INIT_REAL_ZERO;
719 else if (!strcasecmp (arg, "nan"))
720 gfc_option.flag_init_real = GFC_INIT_REAL_NAN;
721 else if (!strcasecmp (arg, "inf"))
722 gfc_option.flag_init_real = GFC_INIT_REAL_INF;
723 else if (!strcasecmp (arg, "-inf"))
724 gfc_option.flag_init_real = GFC_INIT_REAL_NEG_INF;
725 else
726 gfc_fatal_error ("Unrecognized option to -finit-real: %s",
727 arg);
728 break;
730 case OPT_finit_integer_:
731 gfc_option.flag_init_integer = GFC_INIT_INTEGER_ON;
732 gfc_option.flag_init_integer_value = atoi (arg);
733 break;
735 case OPT_finit_character_:
736 if (value >= 0 && value <= 127)
738 gfc_option.flag_init_character = GFC_INIT_CHARACTER_ON;
739 gfc_option.flag_init_character_value = (char)value;
741 else
742 gfc_fatal_error ("The value of n in -finit-character=n must be "
743 "between 0 and 127");
744 break;
746 case OPT_I:
747 gfc_add_include_path (arg, true);
748 break;
750 case OPT_J:
751 gfc_handle_module_path_options (arg);
752 break;
754 case OPT_fsign_zero:
755 gfc_option.flag_sign_zero = value;
756 break;
758 case OPT_ffpe_trap_:
759 gfc_handle_fpe_trap_option (arg);
760 break;
762 case OPT_std_f95:
763 gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95 | GFC_STD_F77;
764 gfc_option.warn_std = GFC_STD_F95_OBS;
765 gfc_option.max_continue_fixed = 19;
766 gfc_option.max_continue_free = 39;
767 gfc_option.max_identifier_length = 31;
768 gfc_option.warn_ampersand = 1;
769 gfc_option.warn_tabs = 0;
770 break;
772 case OPT_std_f2003:
773 gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F77
774 | GFC_STD_F2003 | GFC_STD_F95;
775 gfc_option.warn_std = GFC_STD_F95_OBS;
776 gfc_option.max_identifier_length = 63;
777 gfc_option.warn_ampersand = 1;
778 gfc_option.warn_tabs = 0;
779 break;
781 case OPT_std_f2008:
782 gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F77
783 | GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F2008;
784 gfc_option.warn_std = GFC_STD_F95_OBS;
785 gfc_option.max_identifier_length = 63;
786 gfc_option.warn_ampersand = 1;
787 gfc_option.warn_tabs = 0;
788 break;
790 case OPT_std_gnu:
791 set_default_std_flags ();
792 break;
794 case OPT_std_legacy:
795 set_default_std_flags ();
796 gfc_option.warn_std = 0;
797 break;
799 case OPT_Wintrinsics_std:
800 gfc_option.warn_intrinsics_std = value;
801 break;
803 case OPT_fshort_enums:
804 gfc_option.fshort_enums = 1;
805 break;
807 case OPT_fconvert_little_endian:
808 gfc_option.convert = GFC_CONVERT_LITTLE;
809 break;
811 case OPT_fconvert_big_endian:
812 gfc_option.convert = GFC_CONVERT_BIG;
813 break;
815 case OPT_fconvert_native:
816 gfc_option.convert = GFC_CONVERT_NATIVE;
817 break;
819 case OPT_fconvert_swap:
820 gfc_option.convert = GFC_CONVERT_SWAP;
821 break;
823 case OPT_frecord_marker_4:
824 gfc_option.record_marker = 4;
825 break;
827 case OPT_frecord_marker_8:
828 gfc_option.record_marker = 8;
829 break;
831 case OPT_fmax_subrecord_length_:
832 if (value > MAX_SUBRECORD_LENGTH)
833 gfc_fatal_error ("Maximum subrecord length cannot exceed %d",
834 MAX_SUBRECORD_LENGTH);
836 gfc_option.max_subrecord_length = value;
837 break;
839 case OPT_frecursive:
840 gfc_option.flag_recursive = 1;
841 break;
843 case OPT_falign_commons:
844 gfc_option.flag_align_commons = value;
845 break;
848 return result;