[PATCH] Fix PCH on systems where stdc-predef.h includes other headers (PR pch/68176)

Jakub Jelinek jakub@redhat.com
Thu Jan 28 14:32:00 GMT 2016


Hi!

As mentioned in the PR, most of the pch tests fail if stdc-predef.h header
includes other headers.  I don't have such a system, but changed my
stdc-predef.h to include a dummy header bits/predef.h and this patch fixes
all the tests that failed because of that.
AFAIK file->implicit_preinclude flag is used solely for the PCH purposes,
and this patch makes sure that headers included from implicit_preinclude
headers are also implicit_preinclude.

Bootstrapped/regtested on x86_64-linux, ok for trunk?

2016-01-28  Jakub Jelinek  <jakub@redhat.com>

	PR pch/68176
	* files.c (_cpp_find_file): Set file->implicit_preinclude even if
	included from file->implicit_preinclude header.

--- libcpp/files.c.jj	2016-01-08 07:42:49.000000000 +0100
+++ libcpp/files.c	2016-01-28 09:53:06.569750380 +0100
@@ -522,7 +522,10 @@ _cpp_find_file (cpp_reader *pfile, const
     return entry->u.file;
 
   file = make_cpp_file (pfile, start_dir, fname);
-  file->implicit_preinclude = implicit_preinclude;
+  file->implicit_preinclude
+    = (implicit_preinclude
+       || (pfile->buffer
+	   && pfile->buffer->file->implicit_preinclude));
 
   /* Try each path in the include chain.  */
   for (; !fake ;)

	Jakub



More information about the Gcc-patches mailing list