set_default_std_flags ();
/* -fshort-enums can be default on some targets. */
- gfc_option.fshort_enums = targetm.default_short_enums ();
+ flag_short_enums = targetm.default_short_enums ();
/* Initialize cpp-related options. */
gfc_cpp_init_options(argc, argv);
sorry ("-fexcess-precision=standard for Fortran");
flag_excess_precision_cmdline = EXCESS_PRECISION_FAST;
- /* Issue an error if -fwhole-program was used. */
+ /* Whole program needs whole file mode. */
if (flag_whole_program)
- gfc_fatal_error ("Option -fwhole-program is not supported for Fortran");
+ gfc_option.flag_whole_file = 1;
+
+ if (flag_lto || flag_whopr)
+ {
+#ifdef ENABLE_LTO
+ flag_generate_lto = 1;
+
+ /* When generating IL, do not operate in whole-program mode.
+ Otherwise, symbols will be privatized too early, causing link
+ errors later. */
+ flag_whole_program = 0;
+
+ /* But do enable whole-file mode. */
+ gfc_option.flag_whole_file = 1;
+#else
+ error ("LTO support has not been enabled in this configuration");
+#endif
+ }
+
+ /* Reconcile -flto and -fwhopr. Set additional flags as appropriate and
+ check option consistency. */
+ if (flag_lto && flag_whopr)
+ error ("-flto and -fwhopr are mutually exclusive");
/* -fbounds-check is equivalent to -fcheck=bounds */
if (flag_bounds_check)
gfc_option.rtcheck |= GFC_RTCHECK_BOUNDS;
+ if (flag_compare_debug)
+ gfc_option.dump_parse_tree = 0;
+
/* Verify the input file name. */
if (!filename || strcmp (filename, "-") == 0)
{
gfc_option.warn_tabs = 0;
}
+ if (pedantic && gfc_option.flag_whole_file)
+ gfc_option.flag_whole_file = 2;
+
gfc_cpp_post_options ();
/* FIXME: return gfc_cpp_preprocess_only ();
{
int result, pos = 0, n;
static const char * const optname[] = { "all", "bounds", "array-temps",
- "recursion", "do", NULL };
+ "recursion", "do", "pointer", NULL };
static const int optmask[] = { GFC_RTCHECK_ALL, GFC_RTCHECK_BOUNDS,
GFC_RTCHECK_ARRAY_TEMPS,
GFC_RTCHECK_RECURSION, GFC_RTCHECK_DO,
+ GFC_RTCHECK_POINTER,
0 };
while (*arg)
break;
case OPT_fshort_enums:
- gfc_option.fshort_enums = 1;
+ flag_short_enums = 1;
break;
case OPT_fconvert_little_endian: