GCC 初始化前端环境general_init

 

/* Initialization of the front end environment, before command line    options are parsed.  Signal handlers, internationalization etc.    ARGV0 is main's argv[0].  */ static void general_init (const char *argv0, bool init_signals) {   const char *p;   p = argv0 + strlen (argv0);   while (p != argv0 && !IS_DIR_SEPARATOR (p[-1]))     --p;

  progname = p;

  xmalloc_set_program_name (progname);

  hex_init ();

  /* Unlock the stdio streams.  */   unlock_std_streams ();

  gcc_init_libintl ();

  identifier_to_locale_alloc = alloc_for_identifier_to_locale;   identifier_to_locale_free = ggc_free;

  /* Initialize the diagnostics reporting machinery, so option parsing      can give warnings and errors.  */   diagnostic_initialize (global_dc, N_OPTS);   /* Set a default printer.  Language specific initializations will      override it later.  */   tree_diagnostics_defaults (global_dc);

  global_dc->show_caret     = global_options_init.x_flag_diagnostics_show_caret;   global_dc->show_option_requested     = global_options_init.x_flag_diagnostics_show_option;   global_dc->show_column     = global_options_init.x_flag_show_column;   global_dc->internal_error = plugins_internal_error_function;   global_dc->option_enabled = option_enabled;   global_dc->option_state = &global_options;   global_dc->option_name = option_name;

  if (init_signals)     {       /* Trap fatal signals, e.g. SIGSEGV, and convert them to ICE messages.  */ #ifdef SIGSEGV       signal (SIGSEGV, crash_signal); #endif #ifdef SIGILL       signal (SIGILL, crash_signal); #endif #ifdef SIGBUS       signal (SIGBUS, crash_signal); #endif #ifdef SIGABRT       signal (SIGABRT, crash_signal); #endif #if defined SIGIOT && (!defined SIGABRT || SIGABRT != SIGIOT)       signal (SIGIOT, crash_signal); #endif #ifdef SIGFPE       signal (SIGFPE, crash_signal); #endif

      /* Other host-specific signal setup.  */       (*host_hooks.extra_signals)();   }

  /* Initialize the garbage-collector, string pools and tree type hash      table.  */   init_ggc ();   init_stringpool ();   input_location = UNKNOWN_LOCATION;   line_table = ggc_alloc<line_maps> ();   linemap_init (line_table, BUILTINS_LOCATION);   line_table->reallocator = realloc_for_line_map;   line_table->round_alloc_size = ggc_round_alloc_size;   line_table->default_range_bits = 5;   init_ttree ();

  /* Initialize register usage now so switches may override.  */   init_reg_sets ();

  /* Register the language-independent parameters.  */   global_init_params ();

  /* This must be done after global_init_params but before argument      processing.  */   init_ggc_heuristics ();

  /* Create the singleton holder for global state.      Doing so also creates the pass manager and with it the passes.  */   g = new gcc::context ();   symtab = new (ggc_cleared_alloc <symbol_table> ()) symbol_table ();

  statistics_early_init ();   finish_params (); }

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值