OSDN Git Service

./:
[pf3gnuchains/gcc-fork.git] / gcc / toplev.c
index 50790a1..9f1bb79 100644 (file)
@@ -267,9 +267,9 @@ int flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
 
 /* 0 means straightforward implementation of complex divide acceptable.
    1 means wide ranges of inputs must work for complex divide.
-   2 means C99-like requirements for complex divide (not yet implemented).  */
+   2 means C99-like requirements for complex multiply and divide.  */
 
-int flag_complex_divide_method = 0;
+int flag_complex_method = 1;
 
 /* Nonzero means that we don't want inlining by virtue of -fno-inline,
    not just because the tree inliner turned us off.  */
@@ -374,6 +374,7 @@ static const param_info lang_independent_params[] = {
   { NULL, 0, 0, 0, NULL }
 };
 
+#ifdef TARGET_SWITCHES
 /* Here is a table, controlled by the tm.h file, listing each -m switch
    and which bits in `target_switches' it should set or clear.
    If VALUE is positive, it is bits to set.
@@ -387,6 +388,7 @@ static const struct
   const char *const description;
 }
 target_switches[] = TARGET_SWITCHES;
+#endif
 
 /* This table is similar, but allows the switch to have a value.  */
 
@@ -779,9 +781,11 @@ wrapup_global_declarations (tree *vec, int len)
              bool needed = 1;
              node = cgraph_varpool_node (decl);
 
-             if (flag_unit_at_a_time && node->finalized)
+             if (node->finalized)
+               needed = 0;
+             else if (node->alias)
                needed = 0;
-             else if ((flag_unit_at_a_time && !cgraph_global_info_ready)
+             else if (!cgraph_global_info_ready
                       && (TREE_USED (decl)
                           || TREE_USED (DECL_ASSEMBLER_NAME (decl))))
                /* needed */;
@@ -847,7 +851,7 @@ check_global_declarations (tree *vec, int len)
          if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
            pedwarn ("%J%qF used but never defined", decl, decl);
          else
-           warning ("%J%qF declared %<static%> but never defined",
+           warning (0, "%J%qF declared %<static%> but never defined",
                     decl, decl);
          /* This symbol is effectively an "extern" declaration now.  */
          TREE_PUBLIC (decl) = 1;
@@ -873,7 +877,7 @@ check_global_declarations (tree *vec, int len)
          && ! (TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl))
          /* Otherwise, ask the language.  */
          && lang_hooks.decls.warn_unused_global (decl))
-       warning ("%J%qD defined but not used", decl, decl);
+       warning (0, "%J%qD defined but not used", decl, decl);
 
       /* Avoid confusing the debug information machinery when there are
         errors.  */
@@ -896,7 +900,7 @@ warn_deprecated_use (tree node)
   if (DECL_P (node))
     {
       expanded_location xloc = expand_location (DECL_SOURCE_LOCATION (node));
-      warning ("%qs is deprecated (declared at %s:%d)",
+      warning (0, "%qs is deprecated (declared at %s:%d)",
               IDENTIFIER_POINTER (DECL_NAME (node)),
               xloc.file, xloc.line);
     }
@@ -919,18 +923,18 @@ warn_deprecated_use (tree node)
          expanded_location xloc
            = expand_location (DECL_SOURCE_LOCATION (decl));
          if (what)
-           warning ("%qs is deprecated (declared at %s:%d)", what,
+           warning (0, "%qs is deprecated (declared at %s:%d)", what,
                       xloc.file, xloc.line);
          else
-           warning ("type is deprecated (declared at %s:%d)",
+           warning (0, "type is deprecated (declared at %s:%d)",
                     xloc.file, xloc.line);
        }
       else
        {
          if (what)
-           warning ("%qs is deprecated", what);
+           warning (0, "%qs is deprecated", what);
          else
-           warning ("type is deprecated");
+           warning (0, "type is deprecated");
        }
     }
 }
@@ -1007,8 +1011,8 @@ compile_file (void)
     return;
 
   lang_hooks.decls.final_write_globals ();
-
   cgraph_varpool_assemble_pending_decls ();
+  finish_aliases_2 ();
 
   /* This must occur after the loop to output deferred functions.
      Else the coverage initializer would not be emitted if all the
@@ -1043,9 +1047,6 @@ compile_file (void)
      expander can also generate them.  */
   process_pending_assemble_externals ();
 
-  /* Flush any pending equate directives.  */
-  process_pending_assemble_output_defs ();
-
   /* Attach a special .ident directive to the end of the file to identify
      the version of GCC which compiled this code.  The format of the .ident
      string is patterned after the ones produced by native SVR4 compilers.  */
@@ -1065,7 +1066,11 @@ compile_file (void)
 void
 display_target_options (void)
 {
-  int undoc, i;
+  int undoc;
+#if defined (TARGET_SWITCHES) || defined (TARGET_OPTIONS)
+  int i;
+#endif
+  unsigned int cli;
   static bool displayed = false;
 
   /* Avoid double printing for --help --target-help.  */
@@ -1074,18 +1079,26 @@ display_target_options (void)
 
   displayed = true;
 
-  if (ARRAY_SIZE (target_switches) > 1
+  for (cli = 0; cli < cl_options_count; cli++)
+    if ((cl_options[cli].flags & (CL_TARGET | CL_UNDOCUMENTED)) == CL_TARGET)
+      break;
+
+  if (cli < cl_options_count
+#ifdef TARGET_SWITCHES
+      || ARRAY_SIZE (target_switches) > 1
+#endif
 #ifdef TARGET_OPTIONS
       || ARRAY_SIZE (target_options) > 1
 #endif
       )
     {
-      int doc = 0;
+      int doc = cli < cl_options_count;
 
       undoc = 0;
 
       printf (_("\nTarget specific options:\n"));
 
+#ifdef TARGET_SWITCHES
       for (i = ARRAY_SIZE (target_switches); i--;)
        {
          const char *option      = target_switches[i].name;
@@ -1103,6 +1116,7 @@ display_target_options (void)
          else if (*description != 0)
            doc += printf ("  -m%-23s %s\n", option, _(description));
        }
+#endif
 
 #ifdef TARGET_OPTIONS
       for (i = ARRAY_SIZE (target_options); i--;)
@@ -1123,6 +1137,7 @@ display_target_options (void)
            doc += printf ("  -m%-23s %s\n", option, _(description));
        }
 #endif
+      print_filtered_help (CL_TARGET);
       if (undoc)
        {
          if (doc)
@@ -1172,7 +1187,7 @@ decode_d_option (const char *arg)
       case 'a':
       default:
        if (!enable_rtl_dump_file (c))
-         warning ("unrecognized gcc debugging option: %c", c);
+         warning (0, "unrecognized gcc debugging option: %c", c);
        break;
       }
 }
@@ -1189,9 +1204,12 @@ const char *const debug_type_names[] =
 void
 set_target_switch (const char *name)
 {
+#if defined (TARGET_SWITCHES) || defined (TARGET_OPTIONS)
   size_t j;
+#endif
   int valid_target_option = 0;
 
+#ifdef TARGET_SWITCHES
   for (j = 0; j < ARRAY_SIZE (target_switches); j++)
     if (!strcmp (target_switches[j].name, name))
       {
@@ -1208,6 +1226,7 @@ set_target_switch (const char *name)
          }
        valid_target_option = 1;
       }
+#endif
 
 #ifdef TARGET_OPTIONS
   if (!valid_target_option)
@@ -1233,7 +1252,7 @@ set_target_switch (const char *name)
       }
 #endif
 
-  if (!valid_target_option)
+  if (name[0] != 0 && !valid_target_option)
     error ("invalid option %qs", name);
 }
 
@@ -1340,28 +1359,14 @@ print_switch_values (FILE *file, int pos, int max,
                             _("options enabled: "), "");
 
   for (j = 0; j < cl_options_count; j++)
-    {
-      if (!cl_options[j].flag_var
-         || !(cl_options[j].flags & CL_REPORT))
-       continue;
-
-      if (cl_options[j].has_set_value)
-       {
-         if (*cl_options[j].flag_var != cl_options[j].set_value)
-           continue;
-       }
-      else
-       {
-         if (!*cl_options[j].flag_var)
-           continue;
-       }
-      
+    if ((cl_options[j].flags & CL_REPORT)
+       && option_enabled (j) > 0)
       pos = print_single_switch (file, pos, max, indent, sep, term,
                                 "", cl_options[j].opt_text);
-    }
 
   /* Print target specific options.  */
 
+#ifdef TARGET_SWITCHES
   for (j = 0; j < ARRAY_SIZE (target_switches); j++)
     if (target_switches[j].name[0] != '\0'
        && target_switches[j].value > 0
@@ -1371,6 +1376,7 @@ print_switch_values (FILE *file, int pos, int max,
        pos = print_single_switch (file, pos, max, indent, sep, term,
                                   "-m", target_switches[j].name);
       }
+#endif
 
 #ifdef TARGET_OPTIONS
   for (j = 0; j < ARRAY_SIZE (target_options); j++)
@@ -1414,11 +1420,6 @@ init_asm_output (const char *name)
        fatal_error ("can%'t open %s for writing: %m", asm_file_name);
     }
 
-#ifdef IO_BUFFER_SIZE
-  setvbuf (asm_out_file, xmalloc (IO_BUFFER_SIZE),
-          _IOFBF, IO_BUFFER_SIZE);
-#endif
-
   if (!flag_syntax_only)
     {
       targetm.asm_out.file_start ();
@@ -1502,12 +1503,13 @@ default_pch_valid_p (const void *data_p, size_t len)
   /* Check target_flags.  */
   if (memcmp (data, &target_flags, sizeof (target_flags)) != 0)
     {
+      int tf;
+
+      memcpy (&tf, data, sizeof (target_flags));
+#ifdef TARGET_SWITCHES
       for (i = 0; i < ARRAY_SIZE (target_switches); i++)
        {
          int bits;
-         int tf;
-
-         memcpy (&tf, data, sizeof (target_flags));
 
          bits = target_switches[i].value;
          if (bits < 0)
@@ -1518,6 +1520,14 @@ default_pch_valid_p (const void *data_p, size_t len)
              goto make_message;
            }
        }
+#endif
+      for (i = 0; i < cl_options_count; i++)
+       if (cl_options[i].flag_var == &target_flags
+           && (cl_options[i].var_value & (target_flags ^ tf)) != 0)
+         {
+           flag_that_differs = cl_options[i].opt_text + 2;
+           goto make_message;
+         }
       gcc_unreachable ();
     }
   data += sizeof (target_flags);
@@ -1559,23 +1569,36 @@ default_pch_valid_p (const void *data_p, size_t len)
 static bool
 default_tree_printer (pretty_printer * pp, text_info *text)
 {
+  tree t;
+
   switch (*text->format_spec)
     {
     case 'D':
+      t = va_arg (*text->args_ptr, tree);
+      if (DECL_DEBUG_EXPR (t) && DECL_DEBUG_EXPR_IS_FROM (t))
+       t = DECL_DEBUG_EXPR (t);
+      break;
+
     case 'F':
     case 'T':
-      {
-        tree t = va_arg (*text->args_ptr, tree);
-        const char *n = DECL_NAME (t)
-          ? lang_hooks.decl_printable_name (t, 2)
-          : "<anonymous>";
-        pp_string (pp, n);
-      }
-      return true;
+      t = va_arg (*text->args_ptr, tree);
+      break;
 
     default:
       return false;
     }
+
+  if (DECL_P (t))
+    {
+      const char *n = DECL_NAME (t)
+        ? lang_hooks.decl_printable_name (t, 2)
+        : "<anonymous>";
+      pp_string (pp, n);
+    }
+  else
+    dump_generic_node (pp, t, 0, 0, 0);
+
+  return true;
 }
 
 /* Initialization of the front end environment, before command line
@@ -1595,6 +1618,9 @@ general_init (const char *argv0)
 
   hex_init ();
 
+  /* Unlock the stdio streams.  */
+  unlock_std_streams ();
+
   gcc_init_libintl ();
 
   /* Initialize the diagnostics reporting machinery, so option parsing
@@ -1745,16 +1771,13 @@ process_options (void)
   /* Warn about options that are not supported on this machine.  */
 #ifndef INSN_SCHEDULING
   if (flag_schedule_insns || flag_schedule_insns_after_reload)
-    warning ("instruction scheduling not supported on this target machine");
+    warning (0, "instruction scheduling not supported on this target machine");
 #endif
 #ifndef DELAY_SLOTS
   if (flag_delayed_branch)
-    warning ("this target machine does not have delayed branches");
+    warning (0, "this target machine does not have delayed branches");
 #endif
 
-  if (flag_tree_based_profiling && flag_profile_values)
-    sorry ("value-based profiling not yet implemented in trees.");
-
   user_label_prefix = USER_LABEL_PREFIX;
   if (flag_leading_underscore != -1)
     {
@@ -1766,7 +1789,7 @@ process_options (void)
          user_label_prefix = flag_leading_underscore ? "_" : "";
        }
       else
-       warning ("-f%sleading-underscore not supported on this target machine",
+       warning (0, "-f%sleading-underscore not supported on this target machine",
                 flag_leading_underscore ? "" : "no-");
     }
 
@@ -1852,10 +1875,10 @@ process_options (void)
       if (flag_var_tracking == 1)
         {
          if (debug_info_level < DINFO_LEVEL_NORMAL)
-           warning ("variable tracking requested, but useless unless "
+           warning (0, "variable tracking requested, but useless unless "
                     "producing debug info");
          else
-           warning ("variable tracking requested, but not supported "
+           warning (0, "variable tracking requested, but not supported "
                     "by this debug format");
        }
       flag_var_tracking = 0;
@@ -1882,44 +1905,44 @@ process_options (void)
     {
       if (flag_function_sections)
        {
-         warning ("-ffunction-sections not supported for this target");
+         warning (0, "-ffunction-sections not supported for this target");
          flag_function_sections = 0;
        }
       if (flag_data_sections)
        {
-         warning ("-fdata-sections not supported for this target");
+         warning (0, "-fdata-sections not supported for this target");
          flag_data_sections = 0;
        }
     }
 
   if (flag_function_sections && profile_flag)
     {
-      warning ("-ffunction-sections disabled; it makes profiling impossible");
+      warning (0, "-ffunction-sections disabled; it makes profiling impossible");
       flag_function_sections = 0;
     }
 
 #ifndef HAVE_prefetch
   if (flag_prefetch_loop_arrays)
     {
-      warning ("-fprefetch-loop-arrays not supported for this target");
+      warning (0, "-fprefetch-loop-arrays not supported for this target");
       flag_prefetch_loop_arrays = 0;
     }
   if (flag_speculative_prefetching)
     {
       if (flag_speculative_prefetching_set)
-       warning ("-fspeculative-prefetching not supported for this target");
+       warning (0, "-fspeculative-prefetching not supported for this target");
       flag_speculative_prefetching = 0;
     }
 #else
   if (flag_prefetch_loop_arrays && !HAVE_prefetch)
     {
-      warning ("-fprefetch-loop-arrays not supported for this target (try -march switches)");
+      warning (0, "-fprefetch-loop-arrays not supported for this target (try -march switches)");
       flag_prefetch_loop_arrays = 0;
     }
   if (flag_speculative_prefetching && !HAVE_prefetch)
     {
       if (flag_speculative_prefetching_set)
-       warning ("-fspeculative-prefetching not supported for this target (try -march switches)");
+       warning (0, "-fspeculative-prefetching not supported for this target (try -march switches)");
       flag_speculative_prefetching = 0;
     }
 #endif
@@ -1928,26 +1951,28 @@ process_options (void)
      make much sense anyway, so don't allow it.  */
   if (flag_prefetch_loop_arrays && optimize_size)
     {
-      warning ("-fprefetch-loop-arrays is not supported with -Os");
+      warning (0, "-fprefetch-loop-arrays is not supported with -Os");
       flag_prefetch_loop_arrays = 0;
     }
 
 #ifndef OBJECT_FORMAT_ELF
   if (flag_function_sections && write_symbols != NO_DEBUG)
-    warning ("-ffunction-sections may affect debugging on some targets");
+    warning (0, "-ffunction-sections may affect debugging on some targets");
 #endif
 
   /* The presence of IEEE signaling NaNs, implies all math can trap.  */
   if (flag_signaling_nans)
     flag_trapping_math = 1;
+
+  /* With -fcx-limited-range, we do cheap and quick complex arithmetic.  */
+  if (flag_cx_limited_range)
+    flag_complex_method = 0;
 }
 
 /* Initialize the compiler back end.  */
 static void
 backend_init (void)
 {
-  init_adjust_machine_modes ();
-
   init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
                  || debug_info_level == DINFO_LEVEL_VERBOSE
 #ifdef VMS_DEBUGGING_INFO
@@ -1956,6 +1981,7 @@ backend_init (void)
 #endif
                    || flag_test_coverage);
 
+  init_rtlanal ();
   init_regs ();
   init_fake_stack_mems ();
   init_alias_once ();
@@ -2083,6 +2109,11 @@ do_compile (void)
   /* Don't do any more if an error has already occurred.  */
   if (!errorcount)
     {
+      /* This must be run always, because it is needed to compute the FP
+        predefined macros, such as __LDBL_MAX__, for targets using non
+        default FP formats.  */
+      init_adjust_machine_modes ();
+
       /* Set up the back-end if requested.  */
       if (!no_backend)
        backend_init ();