X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fc-pch.c;h=b4f70506e40b40466da26f7f22b23d345da66849;hb=ec1936763426eda04e532df52fae10b7e3d01902;hp=ccf3c86590cc681668d0a7f428c5d0671c89cab8;hpb=c12ee0c6f87eba261d98bca334f8ea8026d0dd7c;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/c-pch.c b/gcc/c-pch.c index ccf3c86590c..b4f70506e40 100644 --- a/gcc/c-pch.c +++ b/gcc/c-pch.c @@ -1,5 +1,5 @@ /* Precompiled header implementation for the C languages. - Copyright (C) 2000, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc. This file is part of GCC. @@ -45,7 +45,6 @@ static const struct c_pch_matching const char *flag_name; } pch_matching[] = { { &flag_exceptions, "-fexceptions" }, - { &flag_unit_at_a_time, "-funit-at-a-time" } }; enum { @@ -93,10 +92,10 @@ static const char * get_ident (void) { static char result[IDENT_LENGTH]; - static const char template[IDENT_LENGTH] = "gpch.013"; + static const char templ[IDENT_LENGTH] = "gpch.013"; static const char c_language_chars[] = "Co+O"; - memcpy (result, template, IDENT_LENGTH); + memcpy (result, templ, IDENT_LENGTH); result[4] = c_language_chars[c_language]; return result; @@ -368,11 +367,13 @@ c_common_read_pch (cpp_reader *pfile, const char *name, struct c_pch_header h; struct save_macro_data *smd; expanded_location saved_loc; + bool saved_trace_includes; f = fdopen (fd, "rb"); if (f == NULL) { cpp_errno (pfile, CPP_DL_ERROR, "calling fdopen"); + close (fd); return; } @@ -381,6 +382,7 @@ c_common_read_pch (cpp_reader *pfile, const char *name, if (fread (&h, sizeof (h), 1, f) != 1) { cpp_errno (pfile, CPP_DL_ERROR, "reading"); + fclose (f); return; } @@ -410,26 +412,22 @@ c_common_read_pch (cpp_reader *pfile, const char *name, } /* Save the location and then restore it after reading the PCH. */ -#ifdef USE_MAPPED_LOCATION saved_loc = expand_location (line_table->highest_line); -#else - { - const struct line_map *map = linemap_lookup (line_table, - line_table->highest_line); - saved_loc.file = map->to_file; - saved_loc.line = SOURCE_LINE (map, line_table->highest_line); - } -#endif + saved_trace_includes = line_table->trace_includes; cpp_prepare_state (pfile, &smd); gt_pch_restore (f); if (cpp_read_state (pfile, name, f, smd) != 0) - return; + { + fclose (f); + return; + } fclose (f); + line_table->trace_includes = saved_trace_includes; cpp_set_line_map (pfile, line_table); linemap_add (line_table, LC_RENAME, 0, saved_loc.file, saved_loc.line); @@ -465,7 +463,7 @@ c_common_pch_pragma (cpp_reader *pfile, const char *name) if (!cpp_get_options (pfile)->preprocessed) { error ("pch_preprocess pragma should only be used with -fpreprocessed"); - inform ("use #include instead"); + inform (input_location, "use #include instead"); return; } @@ -476,7 +474,7 @@ c_common_pch_pragma (cpp_reader *pfile, const char *name) if (c_common_valid_pch (pfile, name, fd) != 1) { if (!cpp_get_options (pfile)->warn_invalid_pch) - inform ("use -Winvalid-pch for more information"); + inform (input_location, "use -Winvalid-pch for more information"); fatal_error ("%s: PCH file was invalid", name); }