diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-22 08:37:31 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-22 08:37:31 +0000 |
commit | fa12a6a571735b75297868fa3d03f4f67b58d4ba (patch) | |
tree | 62a3ca30e62aa783756f4c06b09db7da83251339 /libcpp | |
parent | 6688f8ec2a10bdb44e228e2c53dc5b198a9deaa7 (diff) | |
download | gcc-fa12a6a571735b75297868fa3d03f4f67b58d4ba.tar.gz |
2009-09-22 Richard Guenther <rguenther@suse.de>
PR pch/38987
* files.c (pch_open_file): Disallow non-toplevel PCH inclusion.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151970 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 5 | ||||
-rw-r--r-- | libcpp/files.c | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 6b257d211cb..eff8cd4ae27 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,8 @@ +2009-09-22 Richard Guenther <rguenther@suse.de> + + PR pch/38987 + * files.c (pch_open_file): Disallow non-toplevel PCH inclusion. + 2009-09-18 Chris Demetriou <cgd@google.com> PR preprocessor/28435: diff --git a/libcpp/files.c b/libcpp/files.c index 96ba7e80afc..ecf9d6c4651 100644 --- a/libcpp/files.c +++ b/libcpp/files.c @@ -288,6 +288,12 @@ pch_open_file (cpp_reader *pfile, _cpp_file *file, bool *invalid_pch) if (file->name[0] == '\0' || !pfile->cb.valid_pch) return false; + /* 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) + return false; + flen = strlen (path); len = flen + sizeof (extension); pchname = XNEWVEC (char, len); |