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/files.c | |
parent | 6688f8ec2a10bdb44e228e2c53dc5b198a9deaa7 (diff) | |
download | ppe42-gcc-fa12a6a571735b75297868fa3d03f4f67b58d4ba.tar.gz ppe42-gcc-fa12a6a571735b75297868fa3d03f4f67b58d4ba.zip |
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/files.c')
-rw-r--r-- | libcpp/files.c | 6 |
1 files changed, 6 insertions, 0 deletions
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); |