summaryrefslogtreecommitdiff
path: root/libcpp/files.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-09-22 08:37:31 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-09-22 08:37:31 +0000
commit9a8a2b7a385aa2a749a3c7a263512707626a3045 (patch)
tree62a3ca30e62aa783756f4c06b09db7da83251339 /libcpp/files.c
parentf61e18ec67d800e358448907260604809f3151b9 (diff)
downloadgcc-9a8a2b7a385aa2a749a3c7a263512707626a3045.tar.gz
re PR preprocessor/38987 (Including a precompiled header from another header causes invalid assembly to be generated)
2009-09-22 Richard Guenther <rguenther@suse.de> PR pch/38987 * files.c (pch_open_file): Disallow non-toplevel PCH inclusion. From-SVN: r151970
Diffstat (limited to 'libcpp/files.c')
-rw-r--r--libcpp/files.c6
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);