diff mbox

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

Message ID 20160128143239.GA3017@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Jan. 28, 2016, 2:32 p.m. UTC
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.


	Jakub

Comments

Marek Polacek Jan. 28, 2016, 10:17 p.m. UTC | #1
On Thu, Jan 28, 2016 at 03:32:39PM +0100, Jakub Jelinek wrote:
> 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.

Ok.

	Marek
diff mbox

Patch

--- 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 ;)