1 /* Parse and display command line options.
2 Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
4 Free Software Foundation, Inc.
5 Contributed by Andy Vaught
7 This file is part of GCC.
9 GCC is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free
11 Software Foundation; either version 3, or (at your option) any later
14 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING3. If not see
21 <http://www.gnu.org/licenses/>. */
25 #include "coretypes.h"
30 #include "toplev.h" /* For save_decoded_options. */
33 #include "tree-inline.h"
37 #include "diagnostic-core.h" /* For sorry. */
40 gfc_option_t gfc_option;
43 /* Set flags that control warnings and errors for different
44 Fortran standards to their default values. Keep in sync with
45 libgfortran/runtime/compile_options.c (init_compile_options). */
48 set_default_std_flags (void)
50 gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
51 | GFC_STD_F2003 | GFC_STD_F2008 | GFC_STD_F95 | GFC_STD_F77
52 | GFC_STD_F2008_OBS | GFC_STD_GNU | GFC_STD_LEGACY;
53 gfc_option.warn_std = GFC_STD_F95_DEL | GFC_STD_LEGACY;
57 /* Return language mask for Fortran options. */
60 gfc_option_lang_mask (void)
66 /* Get ready for options handling. Keep in sync with
67 libgfortran/runtime/compile_options.c (init_compile_options). */
70 gfc_init_options (unsigned int decoded_options_count,
71 struct cl_decoded_option *decoded_options)
73 gfc_source_file = NULL;
74 gfc_option.module_dir = NULL;
75 gfc_option.source_form = FORM_UNKNOWN;
76 gfc_option.fixed_line_length = 72;
77 gfc_option.free_line_length = 132;
78 gfc_option.max_continue_fixed = 255;
79 gfc_option.max_continue_free = 255;
80 gfc_option.max_identifier_length = GFC_MAX_SYMBOL_LEN;
81 gfc_option.max_subrecord_length = 0;
82 gfc_option.flag_max_array_constructor = 65535;
83 gfc_option.convert = GFC_CONVERT_NATIVE;
84 gfc_option.record_marker = 0;
85 gfc_option.dump_parse_tree = 0;
87 gfc_option.warn_aliasing = 0;
88 gfc_option.warn_ampersand = 0;
89 gfc_option.warn_character_truncation = 0;
90 gfc_option.warn_array_temp = 0;
91 gfc_option.gfc_warn_conversion = 0;
92 gfc_option.warn_conversion_extra = 0;
93 gfc_option.warn_implicit_interface = 0;
94 gfc_option.warn_line_truncation = 0;
95 gfc_option.warn_surprising = 0;
96 gfc_option.warn_tabs = 1;
97 gfc_option.warn_underflow = 1;
98 gfc_option.warn_intrinsic_shadow = 0;
99 gfc_option.warn_intrinsics_std = 0;
100 gfc_option.warn_align_commons = 1;
101 gfc_option.warn_unused_dummy_argument = 0;
102 gfc_option.max_errors = 25;
104 gfc_option.flag_all_intrinsics = 0;
105 gfc_option.flag_default_double = 0;
106 gfc_option.flag_default_integer = 0;
107 gfc_option.flag_default_real = 0;
108 gfc_option.flag_dollar_ok = 0;
109 gfc_option.flag_underscoring = 1;
110 gfc_option.flag_whole_file = 1;
111 gfc_option.flag_f2c = 0;
112 gfc_option.flag_second_underscore = -1;
113 gfc_option.flag_implicit_none = 0;
115 /* Default value of flag_max_stack_var_size is set in gfc_post_options. */
116 gfc_option.flag_max_stack_var_size = -2;
118 gfc_option.flag_range_check = 1;
119 gfc_option.flag_pack_derived = 0;
120 gfc_option.flag_repack_arrays = 0;
121 gfc_option.flag_preprocessed = 0;
122 gfc_option.flag_automatic = 1;
123 gfc_option.flag_backslash = 0;
124 gfc_option.flag_module_private = 0;
125 gfc_option.flag_backtrace = 0;
126 gfc_option.flag_allow_leading_underscore = 0;
127 gfc_option.flag_dump_core = 0;
128 gfc_option.flag_external_blas = 0;
129 gfc_option.blas_matmul_limit = 30;
130 gfc_option.flag_cray_pointer = 0;
131 gfc_option.flag_d_lines = -1;
132 gfc_option.gfc_flag_openmp = 0;
133 gfc_option.flag_sign_zero = 1;
134 gfc_option.flag_recursive = 0;
135 gfc_option.flag_init_integer = GFC_INIT_INTEGER_OFF;
136 gfc_option.flag_init_integer_value = 0;
137 gfc_option.flag_init_real = GFC_INIT_REAL_OFF;
138 gfc_option.flag_init_logical = GFC_INIT_LOGICAL_OFF;
139 gfc_option.flag_init_character = GFC_INIT_CHARACTER_OFF;
140 gfc_option.flag_init_character_value = (char)0;
141 gfc_option.flag_align_commons = 1;
142 gfc_option.flag_protect_parens = 1;
145 gfc_option.rtcheck = 0;
146 gfc_option.coarray = GFC_FCOARRAY_NONE;
149 flag_associative_math = -1;
151 set_default_std_flags ();
153 /* -fshort-enums can be default on some targets. */
154 flag_short_enums = targetm.default_short_enums ();
156 /* Initialize cpp-related options. */
157 gfc_cpp_init_options (decoded_options_count, decoded_options);
161 /* Determine the source form from the filename extension. We assume
162 case insensitivity. */
164 static gfc_source_form
165 form_from_filename (const char *filename)
169 const char *extension;
170 gfc_source_form form;
197 }; /* sentinel value */
199 gfc_source_form f_form;
203 /* Find end of file name. Note, filename is either a NULL pointer or
204 a NUL terminated string. */
206 while (filename[i] != '\0')
209 /* Find last period. */
210 while (i >= 0 && (filename[i] != '.'))
213 /* Did we see a file extension? */
215 return FORM_UNKNOWN; /* Nope */
217 /* Get file extension and compare it to others. */
218 fileext = &(filename[i]);
221 f_form = FORM_UNKNOWN;
225 if (strcasecmp (fileext, exttype[i].extension) == 0)
227 f_form = exttype[i].form;
231 while (exttype[i].form != FORM_UNKNOWN);
237 /* Finalize commandline options. */
240 gfc_post_options (const char **pfilename)
242 const char *filename = *pfilename, *canon_source_file = NULL;
246 /* Excess precision other than "fast" requires front-end
248 if (flag_excess_precision_cmdline == EXCESS_PRECISION_STANDARD
249 && TARGET_FLT_EVAL_METHOD_NON_DEFAULT)
250 sorry ("-fexcess-precision=standard for Fortran");
251 flag_excess_precision_cmdline = EXCESS_PRECISION_FAST;
253 /* Whole program needs whole file mode. */
254 if (flag_whole_program)
255 gfc_option.flag_whole_file = 1;
257 /* Enable whole-file mode if LTO is in effect. */
258 if (flag_lto || flag_whopr)
259 gfc_option.flag_whole_file = 1;
261 /* Fortran allows associative math - but we cannot reassociate if
262 we want traps or signed zeros. Cf. also flag_protect_parens. */
263 if (flag_associative_math == -1)
264 flag_associative_math = (!flag_trapping_math && !flag_signed_zeros);
266 /* -fbounds-check is equivalent to -fcheck=bounds */
267 if (flag_bounds_check)
268 gfc_option.rtcheck |= GFC_RTCHECK_BOUNDS;
270 if (flag_compare_debug)
271 gfc_option.dump_parse_tree = 0;
273 /* Verify the input file name. */
274 if (!filename || strcmp (filename, "-") == 0)
279 if (gfc_option.flag_preprocessed)
281 /* For preprocessed files, if the first tokens are of the form # NUM.
282 handle the directives so we know the original file name. */
283 gfc_source_file = gfc_read_orig_filename (filename, &canon_source_file);
284 if (gfc_source_file == NULL)
285 gfc_source_file = filename;
287 *pfilename = gfc_source_file;
290 gfc_source_file = filename;
292 if (canon_source_file == NULL)
293 canon_source_file = gfc_source_file;
295 /* Adds the path where the source file is to the list of include files. */
297 i = strlen (canon_source_file);
298 while (i > 0 && !IS_DIR_SEPARATOR (canon_source_file[i]))
303 source_path = (char *) alloca (i + 1);
304 memcpy (source_path, canon_source_file, i);
306 gfc_add_include_path (source_path, true, true);
309 gfc_add_include_path (".", true, true);
311 if (canon_source_file != gfc_source_file)
312 gfc_free (CONST_CAST (char *, canon_source_file));
314 /* Decide which form the file will be read in as. */
316 if (gfc_option.source_form != FORM_UNKNOWN)
317 gfc_current_form = gfc_option.source_form;
320 gfc_current_form = form_from_filename (filename);
322 if (gfc_current_form == FORM_UNKNOWN)
324 gfc_current_form = FORM_FREE;
325 gfc_warning_now ("Reading file '%s' as free form",
326 (filename[0] == '\0') ? "<stdin>" : filename);
330 /* If the user specified -fd-lines-as-{code|comments} verify that we're
332 if (gfc_current_form == FORM_FREE)
334 if (gfc_option.flag_d_lines == 0)
335 gfc_warning_now ("'-fd-lines-as-comments' has no effect "
337 else if (gfc_option.flag_d_lines == 1)
338 gfc_warning_now ("'-fd-lines-as-code' has no effect in free form");
341 /* If -pedantic, warn about the use of GNU extensions. */
342 if (pedantic && (gfc_option.allow_std & GFC_STD_GNU) != 0)
343 gfc_option.warn_std |= GFC_STD_GNU;
344 /* -std=legacy -pedantic is effectively -std=gnu. */
345 if (pedantic && (gfc_option.allow_std & GFC_STD_LEGACY) != 0)
346 gfc_option.warn_std |= GFC_STD_F95_OBS | GFC_STD_F95_DEL | GFC_STD_LEGACY;
348 /* If the user didn't explicitly specify -f(no)-second-underscore we
349 use it if we're trying to be compatible with f2c, and not
351 if (gfc_option.flag_second_underscore == -1)
352 gfc_option.flag_second_underscore = gfc_option.flag_f2c;
354 if (!gfc_option.flag_automatic && gfc_option.flag_max_stack_var_size != -2
355 && gfc_option.flag_max_stack_var_size != 0)
356 gfc_warning_now ("Flag -fno-automatic overwrites -fmax-stack-var-size=%d",
357 gfc_option.flag_max_stack_var_size);
358 else if (!gfc_option.flag_automatic && gfc_option.flag_recursive)
359 gfc_warning_now ("Flag -fno-automatic overwrites -frecursive");
360 else if (!gfc_option.flag_automatic && gfc_option.gfc_flag_openmp)
361 gfc_warning_now ("Flag -fno-automatic overwrites -frecursive implied by "
363 else if (gfc_option.flag_max_stack_var_size != -2
364 && gfc_option.flag_recursive)
365 gfc_warning_now ("Flag -frecursive overwrites -fmax-stack-var-size=%d",
366 gfc_option.flag_max_stack_var_size);
367 else if (gfc_option.flag_max_stack_var_size != -2
368 && gfc_option.gfc_flag_openmp)
369 gfc_warning_now ("Flag -fmax-stack-var-size=%d overwrites -frecursive "
370 "implied by -fopenmp",
371 gfc_option.flag_max_stack_var_size);
373 /* Implement -frecursive as -fmax-stack-var-size=-1. */
374 if (gfc_option.flag_recursive)
375 gfc_option.flag_max_stack_var_size = -1;
377 /* Implied -frecursive; implemented as -fmax-stack-var-size=-1. */
378 if (gfc_option.flag_max_stack_var_size == -2 && gfc_option.gfc_flag_openmp
379 && gfc_option.flag_automatic)
381 gfc_option.flag_recursive = 1;
382 gfc_option.flag_max_stack_var_size = -1;
386 if (gfc_option.flag_max_stack_var_size == -2)
387 gfc_option.flag_max_stack_var_size = 32768;
389 /* Implement -fno-automatic as -fmax-stack-var-size=0. */
390 if (!gfc_option.flag_automatic)
391 gfc_option.flag_max_stack_var_size = 0;
395 gfc_option.warn_ampersand = 1;
396 gfc_option.warn_tabs = 0;
399 if (pedantic && gfc_option.flag_whole_file)
400 gfc_option.flag_whole_file = 2;
402 gfc_cpp_post_options ();
404 /* FIXME: return gfc_cpp_preprocess_only ();
406 The return value of this function indicates whether the
407 backend needs to be initialized. On -E, we don't need
408 the backend. However, if we return 'true' here, an
409 ICE occurs. Initializing the backend doesn't hurt much,
410 hence, for now we can live with it as is. */
415 /* Set the options for -Wall. */
418 set_Wall (int setting)
420 gfc_option.warn_aliasing = setting;
421 gfc_option.warn_ampersand = setting;
422 gfc_option.gfc_warn_conversion = setting;
423 gfc_option.warn_line_truncation = setting;
424 gfc_option.warn_surprising = setting;
425 gfc_option.warn_tabs = !setting;
426 gfc_option.warn_underflow = setting;
427 gfc_option.warn_intrinsic_shadow = setting;
428 gfc_option.warn_intrinsics_std = setting;
429 gfc_option.warn_character_truncation = setting;
430 gfc_option.warn_unused_dummy_argument = setting;
432 warn_unused = setting;
433 warn_return_type = setting;
434 warn_switch = setting;
435 warn_uninitialized = setting;
440 gfc_handle_module_path_options (const char *arg)
443 if (gfc_option.module_dir != NULL)
444 gfc_fatal_error ("gfortran: Only one -J option allowed");
446 gfc_option.module_dir = (char *) gfc_getmem (strlen (arg) + 2);
447 strcpy (gfc_option.module_dir, arg);
448 strcat (gfc_option.module_dir, "/");
450 gfc_add_include_path (gfc_option.module_dir, true, false);
455 gfc_handle_fpe_trap_option (const char *arg)
457 int result, pos = 0, n;
458 static const char * const exception[] = { "invalid", "denormal", "zero",
459 "overflow", "underflow",
461 static const int opt_exception[] = { GFC_FPE_INVALID, GFC_FPE_DENORMAL,
462 GFC_FPE_ZERO, GFC_FPE_OVERFLOW,
463 GFC_FPE_UNDERFLOW, GFC_FPE_PRECISION,
471 while (arg[pos] && arg[pos] != ',')
475 for (n = 0; exception[n] != NULL; n++)
477 if (exception[n] && strncmp (exception[n], arg, pos) == 0)
479 gfc_option.fpe |= opt_exception[n];
487 gfc_fatal_error ("Argument to -ffpe-trap is not valid: %s", arg);
493 gfc_handle_coarray_option (const char *arg)
495 if (strcmp (arg, "none") == 0)
496 gfc_option.coarray = GFC_FCOARRAY_NONE;
497 else if (strcmp (arg, "single") == 0)
498 gfc_option.coarray = GFC_FCOARRAY_SINGLE;
500 gfc_fatal_error ("Argument to -fcoarray is not valid: %s", arg);
505 gfc_handle_runtime_check_option (const char *arg)
507 int result, pos = 0, n;
508 static const char * const optname[] = { "all", "bounds", "array-temps",
509 "recursion", "do", "pointer",
511 static const int optmask[] = { GFC_RTCHECK_ALL, GFC_RTCHECK_BOUNDS,
512 GFC_RTCHECK_ARRAY_TEMPS,
513 GFC_RTCHECK_RECURSION, GFC_RTCHECK_DO,
514 GFC_RTCHECK_POINTER, GFC_RTCHECK_MEM,
522 while (arg[pos] && arg[pos] != ',')
526 for (n = 0; optname[n] != NULL; n++)
528 if (optname[n] && strncmp (optname[n], arg, pos) == 0)
530 gfc_option.rtcheck |= optmask[n];
538 gfc_fatal_error ("Argument to -fcheck is not valid: %s", arg);
543 /* Handle command-line options. Returns 0 if unrecognized, 1 if
544 recognized and handled. */
547 gfc_handle_option (size_t scode, const char *arg, int value,
548 int kind ATTRIBUTE_UNUSED,
549 const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED)
552 enum opt_code code = (enum opt_code) scode;
554 if (gfc_cpp_handle_option (scode, arg, value) == 1)
568 gfc_option.warn_aliasing = value;
572 gfc_option.warn_ampersand = value;
575 case OPT_Warray_temporaries:
576 gfc_option.warn_array_temp = value;
579 case OPT_Wcharacter_truncation:
580 gfc_option.warn_character_truncation = value;
583 case OPT_Wconversion:
584 gfc_option.gfc_warn_conversion = value;
587 case OPT_Wconversion_extra:
588 gfc_option.warn_conversion_extra = value;
591 case OPT_Wimplicit_interface:
592 gfc_option.warn_implicit_interface = value;
595 case OPT_Wimplicit_procedure:
596 gfc_option.warn_implicit_procedure = value;
599 case OPT_Wline_truncation:
600 gfc_option.warn_line_truncation = value;
603 case OPT_Wreturn_type:
604 warn_return_type = value;
607 case OPT_Wsurprising:
608 gfc_option.warn_surprising = value;
612 gfc_option.warn_tabs = value;
616 gfc_option.warn_underflow = value;
619 case OPT_Wintrinsic_shadow:
620 gfc_option.warn_intrinsic_shadow = value;
623 case OPT_Walign_commons:
624 gfc_option.warn_align_commons = value;
627 case OPT_Wunused_dummy_argument:
628 gfc_option.warn_unused_dummy_argument = value;
631 case OPT_fall_intrinsics:
632 gfc_option.flag_all_intrinsics = 1;
636 gfc_option.flag_automatic = value;
639 case OPT_fallow_leading_underscore:
640 gfc_option.flag_allow_leading_underscore = value;
644 gfc_option.flag_backslash = value;
648 gfc_option.flag_backtrace = value;
651 case OPT_fcheck_array_temporaries:
652 gfc_option.rtcheck |= GFC_RTCHECK_ARRAY_TEMPS;
656 gfc_option.flag_dump_core = value;
659 case OPT_fcray_pointer:
660 gfc_option.flag_cray_pointer = value;
664 gfc_option.flag_f2c = value;
668 gfc_option.flag_dollar_ok = value;
671 case OPT_fexternal_blas:
672 gfc_option.flag_external_blas = value;
675 case OPT_fblas_matmul_limit_:
676 gfc_option.blas_matmul_limit = value;
679 case OPT_fd_lines_as_code:
680 gfc_option.flag_d_lines = 1;
683 case OPT_fd_lines_as_comments:
684 gfc_option.flag_d_lines = 0;
687 case OPT_fdump_parse_tree:
688 gfc_option.dump_parse_tree = value;
691 case OPT_ffixed_form:
692 gfc_option.source_form = FORM_FIXED;
695 case OPT_ffixed_line_length_none:
696 gfc_option.fixed_line_length = 0;
699 case OPT_ffixed_line_length_:
700 if (value != 0 && value < 7)
701 gfc_fatal_error ("Fixed line length must be at least seven.");
702 gfc_option.fixed_line_length = value;
706 gfc_option.source_form = FORM_FREE;
710 gfc_option.gfc_flag_openmp = value;
713 case OPT_ffree_line_length_none:
714 gfc_option.free_line_length = 0;
717 case OPT_ffree_line_length_:
718 if (value != 0 && value < 4)
719 gfc_fatal_error ("Free line length must be at least three.");
720 gfc_option.free_line_length = value;
723 case OPT_funderscoring:
724 gfc_option.flag_underscoring = value;
727 case OPT_fwhole_file:
728 gfc_option.flag_whole_file = value;
731 case OPT_fsecond_underscore:
732 gfc_option.flag_second_underscore = value;
735 case OPT_static_libgfortran:
736 #ifndef HAVE_LD_STATIC_DYNAMIC
737 gfc_fatal_error ("-static-libgfortran is not supported in this "
742 case OPT_fimplicit_none:
743 gfc_option.flag_implicit_none = value;
746 case OPT_fintrinsic_modules_path:
747 gfc_add_include_path (arg, false, false);
748 gfc_add_intrinsic_modules_path (arg);
751 case OPT_fmax_array_constructor_:
752 gfc_option.flag_max_array_constructor = value > 65535 ? value : 65535;
755 case OPT_fmax_errors_:
756 gfc_option.max_errors = value;
759 case OPT_fmax_stack_var_size_:
760 gfc_option.flag_max_stack_var_size = value;
763 case OPT_fmodule_private:
764 gfc_option.flag_module_private = value;
767 case OPT_frange_check:
768 gfc_option.flag_range_check = value;
771 case OPT_fpack_derived:
772 gfc_option.flag_pack_derived = value;
775 case OPT_frepack_arrays:
776 gfc_option.flag_repack_arrays = value;
779 case OPT_fpreprocessed:
780 gfc_option.flag_preprocessed = value;
783 case OPT_fmax_identifier_length_:
784 if (value > GFC_MAX_SYMBOL_LEN)
785 gfc_fatal_error ("Maximum supported identifier length is %d",
787 gfc_option.max_identifier_length = value;
790 case OPT_fdefault_integer_8:
791 gfc_option.flag_default_integer = value;
794 case OPT_fdefault_real_8:
795 gfc_option.flag_default_real = value;
798 case OPT_fdefault_double_8:
799 gfc_option.flag_default_double = value;
802 case OPT_finit_local_zero:
803 gfc_option.flag_init_integer = GFC_INIT_INTEGER_ON;
804 gfc_option.flag_init_integer_value = 0;
805 gfc_option.flag_init_real = GFC_INIT_REAL_ZERO;
806 gfc_option.flag_init_logical = GFC_INIT_LOGICAL_FALSE;
807 gfc_option.flag_init_character = GFC_INIT_CHARACTER_ON;
808 gfc_option.flag_init_character_value = (char)0;
811 case OPT_finit_logical_:
812 if (!strcasecmp (arg, "false"))
813 gfc_option.flag_init_logical = GFC_INIT_LOGICAL_FALSE;
814 else if (!strcasecmp (arg, "true"))
815 gfc_option.flag_init_logical = GFC_INIT_LOGICAL_TRUE;
817 gfc_fatal_error ("Unrecognized option to -finit-logical: %s",
821 case OPT_finit_real_:
822 if (!strcasecmp (arg, "zero"))
823 gfc_option.flag_init_real = GFC_INIT_REAL_ZERO;
824 else if (!strcasecmp (arg, "nan"))
825 gfc_option.flag_init_real = GFC_INIT_REAL_NAN;
826 else if (!strcasecmp (arg, "snan"))
827 gfc_option.flag_init_real = GFC_INIT_REAL_SNAN;
828 else if (!strcasecmp (arg, "inf"))
829 gfc_option.flag_init_real = GFC_INIT_REAL_INF;
830 else if (!strcasecmp (arg, "-inf"))
831 gfc_option.flag_init_real = GFC_INIT_REAL_NEG_INF;
833 gfc_fatal_error ("Unrecognized option to -finit-real: %s",
837 case OPT_finit_integer_:
838 gfc_option.flag_init_integer = GFC_INIT_INTEGER_ON;
839 gfc_option.flag_init_integer_value = atoi (arg);
842 case OPT_finit_character_:
843 if (value >= 0 && value <= 127)
845 gfc_option.flag_init_character = GFC_INIT_CHARACTER_ON;
846 gfc_option.flag_init_character_value = (char)value;
849 gfc_fatal_error ("The value of n in -finit-character=n must be "
850 "between 0 and 127");
854 gfc_add_include_path (arg, true, false);
858 gfc_handle_module_path_options (arg);
862 gfc_option.flag_sign_zero = value;
866 gfc_handle_fpe_trap_option (arg);
870 gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95 | GFC_STD_F77
872 gfc_option.warn_std = GFC_STD_F95_OBS;
873 gfc_option.max_continue_fixed = 19;
874 gfc_option.max_continue_free = 39;
875 gfc_option.max_identifier_length = 31;
876 gfc_option.warn_ampersand = 1;
877 gfc_option.warn_tabs = 0;
881 gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F77
882 | GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F2008_OBS;
883 gfc_option.warn_std = GFC_STD_F95_OBS;
884 gfc_option.max_identifier_length = 63;
885 gfc_option.warn_ampersand = 1;
886 gfc_option.warn_tabs = 0;
890 gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F77
891 | GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F2008 | GFC_STD_F2008_OBS;
892 gfc_option.warn_std = GFC_STD_F95_OBS | GFC_STD_F2008_OBS;
893 gfc_option.max_identifier_length = 63;
894 gfc_option.warn_ampersand = 1;
895 gfc_option.warn_tabs = 0;
899 set_default_std_flags ();
903 set_default_std_flags ();
904 gfc_option.warn_std = 0;
907 case OPT_Wintrinsics_std:
908 gfc_option.warn_intrinsics_std = value;
911 case OPT_fshort_enums:
912 /* Handled in language-independent code. */
915 case OPT_fconvert_little_endian:
916 gfc_option.convert = GFC_CONVERT_LITTLE;
919 case OPT_fconvert_big_endian:
920 gfc_option.convert = GFC_CONVERT_BIG;
923 case OPT_fconvert_native:
924 gfc_option.convert = GFC_CONVERT_NATIVE;
927 case OPT_fconvert_swap:
928 gfc_option.convert = GFC_CONVERT_SWAP;
931 case OPT_frecord_marker_4:
932 gfc_option.record_marker = 4;
935 case OPT_frecord_marker_8:
936 gfc_option.record_marker = 8;
939 case OPT_fmax_subrecord_length_:
940 if (value > MAX_SUBRECORD_LENGTH)
941 gfc_fatal_error ("Maximum subrecord length cannot exceed %d",
942 MAX_SUBRECORD_LENGTH);
944 gfc_option.max_subrecord_length = value;
948 gfc_option.flag_recursive = value;
951 case OPT_falign_commons:
952 gfc_option.flag_align_commons = value;
955 case OPT_fprotect_parens:
956 gfc_option.flag_protect_parens = value;
960 gfc_handle_runtime_check_option (arg);
964 gfc_handle_coarray_option (arg);
972 /* Return a string with the options passed to the compiler; used for
973 Fortran's compiler_options() intrinsic. */
976 gfc_get_option_string (void)
982 /* Determine required string length. */
985 for (j = 1; j < save_decoded_options_count; j++)
987 switch (save_decoded_options[j].opt_index)
996 case OPT_fintrinsic_modules_path:
1000 /* Ignore file names. */
1001 if (save_decoded_options[j].orig_option_with_args_text[0] == '-')
1003 + strlen (save_decoded_options[j].orig_option_with_args_text);
1007 result = (char *) gfc_getmem (len);
1010 for (j = 1; j < save_decoded_options_count; j++)
1012 switch (save_decoded_options[j].opt_index)
1021 case OPT_fintrinsic_modules_path:
1026 /* Use "-cpp" rather than "-cpp=<temporary file>". */
1031 /* Ignore file names. */
1032 if (save_decoded_options[j].orig_option_with_args_text[0] != '-')
1035 len = strlen (save_decoded_options[j].orig_option_with_args_text);
1038 memcpy (&result[pos], save_decoded_options[j].orig_option_with_args_text, len);
1040 result[pos++] = ' ';
1043 result[--pos] = '\0';