aboutsummaryrefslogtreecommitdiff
path: root/libcpp/files.c
diff options
context:
space:
mode:
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 96ba7e8..ecf9d6c 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);