This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Fix pch failures when opening a header that has been precompiled multiple times (PR pch/13675)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>, Geoffrey Keating <geoffk at geoffk dot org>, gcc-patches at gcc dot gnu dot org
- Date: Mon, 31 Mar 2008 15:17:10 -0400
- Subject: Re: [PATCH] Fix pch failures when opening a header that has been precompiled multiple times (PR pch/13675)
- References: <20080331141010.GK30807@devserv.devel.redhat.com> <firstname.lastname@example.org>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Mar 31, 2008 at 12:06:15PM -0600, Tom Tromey wrote:
> >>>>> "Jakub" == Jakub Jelinek <email@example.com> writes:
> Jakub> The fix below clears pch (and frees pchname) once the *.gch
> Jakub> file is read using cb.read_pch, which means that an include
> Jakub> file won't be handled as a PCH file in the second and following
> Jakub> #include (which matches the PCH design).
> Jakub> This patch also removes unnecessary field from struct _cpp_file
> Jakub> (file->pch is true iff file->pchname != NULL) and fixes a
> Jakub> double close bug
> This looks good to me.
> I don't think I can approve the c-pch.c part.
Joseph, are you ok with that change?
BTW, from what I see, cmacro isn't being written into the *.gch/* files
and isn't read back when reading the PCH file. I guess it would be pretty
cheap to save it into the PCH file and read it back, but wonder whether
that would help in the wild, given that only a few people reported this PR.
Without saving/restoring the multiple include guard macro when a
preprocessed header is included the second time, libcpp will need to read it
and parse to find out that the whole header is ifdefed out and remember
cmacro for the next time.