OSDN Git Service

2009-10-15 Steven G. Kargl <kargl@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / fortran / options.c
index b45696d..d2c6d9b 100644 (file)
@@ -137,7 +137,7 @@ gfc_init_options (unsigned int argc, const char **argv)
   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);
@@ -238,14 +238,39 @@ gfc_post_options (const char **pfilename)
     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)
     {
@@ -368,6 +393,9 @@ gfc_post_options (const char **pfilename)
       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 ();
@@ -468,10 +496,11 @@ gfc_handle_runtime_check_option (const char *arg)
 {
   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)
@@ -858,7 +887,7 @@ gfc_handle_option (size_t scode, const char *arg, int value)
       break;
 
     case OPT_fshort_enums:
-      gfc_option.fshort_enums = 1;
+      flag_short_enums = 1;
       break;
 
     case OPT_fconvert_little_endian: