diff mbox

Don't call fatal_error before error reporting has been initialized.

Message ID 20140929140245.GA63569@msticlxl7.ims.intel.com
State New
Headers show

Commit Message

Ilya Tocar Sept. 29, 2014, 2:02 p.m. UTC
Hi,

Currently if call to atexit (lto_wrapper_cleanup) fails we
won't report error as we haven't initialized error-reporting
infrastructure. This patch moves this call after diagnostic_initialize.
I hope that we can't  exit inside diagnostic_initialize. Otherwise we
won't cleanup after it.
Ok for trunk?

2014-09-29  Ilya Tocar  <ilya.tocar@intel.com>

	* lto-wrapper.c (main): Don't call fatal_error before
	diagnostic_initialize.
---
 gcc/lto-wrapper.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Ilya Tocar Oct. 9, 2014, 11:40 a.m. UTC | #1
Ping.

On 29 Sep 18:02, Ilya Tocar wrote:
> Hi,
> 
> Currently if call to atexit (lto_wrapper_cleanup) fails we
> won't report error as we haven't initialized error-reporting
> infrastructure. This patch moves this call after diagnostic_initialize.
> I hope that we can't  exit inside diagnostic_initialize. Otherwise we
> won't cleanup after it.
> Ok for trunk?
> 
> 2014-09-29  Ilya Tocar  <ilya.tocar@intel.com>
> 
> 	* lto-wrapper.c (main): Don't call fatal_error before
> 	diagnostic_initialize.
> ---
>  gcc/lto-wrapper.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
> index 08fd090..39e13b8 100644
> --- a/gcc/lto-wrapper.c
> +++ b/gcc/lto-wrapper.c
> @@ -870,13 +870,13 @@ main (int argc, char *argv[])
>  
>    xmalloc_set_program_name (progname);
>  
> -  if (atexit (lto_wrapper_cleanup) != 0)
> -    fatal_error ("atexit failed");
> -
>    gcc_init_libintl ();
>  
>    diagnostic_initialize (global_dc, 0);
>  
> +  if (atexit (lto_wrapper_cleanup) != 0)
> +    fatal_error ("atexit failed");
> +
>    if (signal (SIGINT, SIG_IGN) != SIG_IGN)
>      signal (SIGINT, fatal_signal);
>  #ifdef SIGHUP
> -- 
> 1.8.3.1
>
diff mbox

Patch

diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index 08fd090..39e13b8 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -870,13 +870,13 @@  main (int argc, char *argv[])
 
   xmalloc_set_program_name (progname);
 
-  if (atexit (lto_wrapper_cleanup) != 0)
-    fatal_error ("atexit failed");
-
   gcc_init_libintl ();
 
   diagnostic_initialize (global_dc, 0);
 
+  if (atexit (lto_wrapper_cleanup) != 0)
+    fatal_error ("atexit failed");
+
   if (signal (SIGINT, SIG_IGN) != SIG_IGN)
     signal (SIGINT, fatal_signal);
 #ifdef SIGHUP