参照元

説明

引数

返り値

参考

実装

/* Entry point of cc1, cc1plus, jc1, f771, etc.
   Exit code is FATAL_EXIT_CODE if can't open files or if there were
   any errors, or SUCCESS_EXIT_CODE if compilation succeeded.

   It is not safe to call this function more than once.  */

int
toplev::main (int argc, char **argv)
{
  /* Parsing and gimplification sometimes need quite large stack.
     Increase stack size limits if possible.  */
  stack_limit_increase (64 * 1024 * 1024);

  expandargv (&argc, &argv);

  /* Initialization of GCC's environment, and diagnostics.  */
  general_init (argv[0], m_init_signals);

  /* One-off initialization of options that does not need to be
     repeated when options are added for particular functions.  */
  init_options_once ();
  init_opts_obstack ();

  /* Initialize global options structures; this must be repeated for
     each structure used for parsing options.  */
  init_options_struct (&global_options, &global_options_set);
  lang_hooks.init_options_struct (&global_options);

  /* Convert the options to an array.  */
  decode_cmdline_options_to_array_default_mask (argc,
						CONST_CAST2 (const char **,
							     char **, argv),
						&save_decoded_options,
						&save_decoded_options_count);

  /* Perform language-specific options initialization.  */
  lang_hooks.init_options (save_decoded_options_count, save_decoded_options);

  /* Parse the options and do minimal processing; basically just
     enough to default flags appropriately.  */
  decode_options (&global_options, &global_options_set,
		  save_decoded_options, save_decoded_options_count,
		  UNKNOWN_LOCATION, global_dc,
		  targetm.target_option.override);

  handle_common_deferred_options ();

  init_local_tick ();

  initialize_plugins ();

  if (version_flag)
    print_version (stderr, "", true);

  if (help_flag)
    print_plugins_help (stderr, "");

  /* Exit early if we can (e.g. -help).  */
  if (!exit_after_options)
    {
      if (m_use_TV_TOTAL)
	start_timevars ();
      do_compile ();
    }

  if (warningcount || errorcount || werrorcount)
    print_ignored_options ();

  if (flag_self_test)
    run_self_tests ();

  /* Invoke registered plugin callbacks if any.  Some plugins could
     emit some diagnostics here.  */
  invoke_plugin_callbacks (PLUGIN_FINISH, NULL);

  if (flag_diagnostics_generate_patch)
    {
      gcc_assert (global_dc->edit_context_ptr);

      pretty_printer pp;
      pp_show_color (&pp) = pp_show_color (global_dc->printer);
      global_dc->edit_context_ptr->print_diff (&pp, true);
      pp_flush (&pp);
    }

  diagnostic_finish (global_dc);

  finalize_plugins ();

  after_memory_report = true;

  if (seen_error () || werrorcount)
    return (FATAL_EXIT_CODE);

  return (SUCCESS_EXIT_CODE);
}

コメント


トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2019-05-10 (金) 13:43:26