diff gcc/c-pch.c @ 63:b7f97abdc517 gcc-4.6-20100522

update gcc from gcc-4.5.0 to gcc-4.6
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Mon, 24 May 2010 12:47:05 +0900
parents 77e2b8dfacca
children
line wrap: on
line diff
--- a/gcc/c-pch.c	Fri Feb 12 23:41:23 2010 +0900
+++ b/gcc/c-pch.c	Mon May 24 12:47:05 2010 +0900
@@ -1,5 +1,5 @@
 /* Precompiled header implementation for the C languages.
-   Copyright (C) 2000, 2002, 2003, 2004, 2005, 2007, 2008, 2009
+   Copyright (C) 2000, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -35,6 +35,7 @@
 #include "hosthooks.h"
 #include "target.h"
 #include "opts.h"
+#include "timevar.h"
 
 /* This is a list of flag variables that must match exactly, and their
    names for the error message.  The possible values for *flag_var must
@@ -134,6 +135,7 @@
 
   gcc_assert (memcmp (executable_checksum, no_checksum, 16) != 0);
 
+  memset (&v, '\0', sizeof (v));
   v.debug_info_type = write_symbols;
   {
     size_t i;
@@ -177,6 +179,8 @@
   long written;
   struct c_pch_header h;
 
+  timevar_push (TV_PCH_SAVE);
+
   (*debug_hooks->handle_pch) (1);
 
   cpp_write_pch_deps (parse_in, pch_outfile);
@@ -210,13 +214,18 @@
     fatal_error ("can%'t seek in %s: %m", asm_file_name);
 
   gt_pch_save (pch_outfile);
+
+  timevar_push (TV_PCH_CPP_SAVE);
   cpp_write_pch_state (parse_in, pch_outfile);
+  timevar_pop (TV_PCH_CPP_SAVE);
 
   if (fseek (pch_outfile, 0, SEEK_SET) != 0
       || fwrite (get_ident (), IDENT_LENGTH, 1, pch_outfile) != 1)
     fatal_error ("can%'t write %s: %m", pch_file);
 
   fclose (pch_outfile);
+
+  timevar_pop (TV_PCH_SAVE);
 }
 
 /* Check the PCH file called NAME, open on FD, to see if it can be
@@ -370,12 +379,14 @@
   expanded_location saved_loc;
   bool saved_trace_includes;
 
+  timevar_push (TV_PCH_RESTORE);
+
   f = fdopen (fd, "rb");
   if (f == NULL)
     {
       cpp_errno (pfile, CPP_DL_ERROR, "calling fdopen");
       close (fd);
-      return;
+      goto end;
     }
 
   cpp_get_callbacks (parse_in)->valid_pch = NULL;
@@ -384,7 +395,7 @@
     {
       cpp_errno (pfile, CPP_DL_ERROR, "reading");
       fclose (f);
-      return;
+      goto end;
     }
 
   if (!flag_preprocess_only)
@@ -416,15 +427,21 @@
   saved_loc = expand_location (line_table->highest_line);
   saved_trace_includes = line_table->trace_includes;
 
+  timevar_push (TV_PCH_CPP_RESTORE);
   cpp_prepare_state (pfile, &smd);
+  timevar_pop (TV_PCH_CPP_RESTORE);
 
   gt_pch_restore (f);
 
+  timevar_push (TV_PCH_CPP_RESTORE);
   if (cpp_read_state (pfile, name, f, smd) != 0)
     {
       fclose (f);
-      return;
+      timevar_pop (TV_PCH_CPP_RESTORE);
+      goto end;
     }
+  timevar_pop (TV_PCH_CPP_RESTORE);
+
 
   fclose (f);
 
@@ -436,6 +453,9 @@
      been loaded.  */
   if (lang_post_pch_load)
     (*lang_post_pch_load) ();
+
+end:
+  timevar_pop (TV_PCH_RESTORE);
 }
 
 /* Indicate that no more PCH files should be read.  */