diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-04-09 13:37:53 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-04-09 13:37:53 +0000 |
commit | 2c8df1f3733844f313dc855d93f746466384a526 (patch) | |
tree | 9b4cb58f256db16c052fce0ddfa2a7b083ddbac8 /libcpp | |
parent | fec084449eaf22a42507a586c525243be2f9677c (diff) | |
download | gcc-2c8df1f3733844f313dc855d93f746466384a526.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@221949 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 6 | ||||
-rw-r--r-- | libcpp/files.c | 12 |
2 files changed, 13 insertions, 5 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 2ad145f8cc8..7f6603d0842 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,9 @@ +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. + 2015-04-06 Jakub Jelinek <jakub@redhat.com> PR preprocessor/61977 diff --git a/libcpp/files.c b/libcpp/files.c index a995071ad06..2f491224c6f 100644 --- a/libcpp/files.c +++ b/libcpp/files.c @@ -291,11 +291,13 @@ pch_open_file (cpp_reader *pfile, _cpp_file *file, bool *invalid_pch) /* 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); |