This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [4.8, 4.9] Backport a PCH fix (PR pch/65550)
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>,Richard Biener <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 12 Jun 2015 13:41:30 +0200
- Subject: Re: [4.8, 4.9] Backport a PCH fix (PR pch/65550)
- Authentication-results: sourceware.org; auth=none
- References: <20150612112019 dot GP10247 at tucnak dot redhat dot com>
On June 12, 2015 1:20:19 PM GMT+02:00, Jakub Jelinek <jakub@redhat.com> wrote:
>Hi!
>
>Bootstrapped/regtested on 4.8 and 4.9 branches on x86_64-linux and
>i686-linux, ok for 4.8/4.9?
OK.
Thanks,
Richard.
>2015-06-12 Jakub Jelinek <jakub@redhat.com>
>
> Backported from mainline
> 2015-04-09 Richard Biener <rguenther@suse.de>
>
> PR pch/65550
> * files.c (pch_open_file): Allow main and pre-included files
> when trying to open a PCH.
>
>--- libcpp/files.c (revision 221948)
>+++ libcpp/files.c (revision 221949)
>@@ -291,11 +291,13 @@ pch_open_file (cpp_reader *pfile, _cpp_f
>
>/* If the file is not included as first include from either the
>toplevel
> file or the command-line it is not a valid use of PCH. */
>- if (pfile->all_files
>- && pfile->all_files->next_file
>- && !(pfile->all_files->implicit_preinclude
>- || pfile->all_files->next_file->implicit_preinclude))
>- return false;
>+ for (_cpp_file *f = pfile->all_files; f; f = f->next_file)
>+ if (f->implicit_preinclude)
>+ continue;
>+ else if (f->main_file)
>+ break;
>+ else
>+ return false;
>
> flen = strlen (path);
> len = flen + sizeof (extension);
>
> Jakub