[Bug c++/54780] G++ does not find precompiled headers in some cases

2014-11-08 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54780

Manuel López-Ibáñez  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||manu at gcc dot gnu.org
 Resolution|--- |INVALID

--- Comment #6 from Manuel López-Ibáñez  ---
Thus, not a bug then, no?

[Bug c++/54780] G++ does not find precompiled headers in some cases

2012-10-03 Thread sch...@linux-m68k.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54780



--- Comment #5 from Andreas Schwab  2012-10-03 13:10:32 
UTC ---

> I guess this is not a big issue if you are using Autotools, where the

> established practice is to compile inside the source directory.



It is common practice to build outside the source directory, since it is very

well supported.


[Bug c++/54780] G++ does not find precompiled headers in some cases

2012-10-03 Thread redi at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54780



--- Comment #4 from Jonathan Wakely  2012-10-03 
09:00:05 UTC ---

I think the majority don't use PCH anyway.


[Bug c++/54780] G++ does not find precompiled headers in some cases

2012-10-03 Thread jpakkane at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54780



--- Comment #3 from jpakkane at gmail dot com 2012-10-03 07:53:59 UTC ---

Thanks for the explanation and workaround.



I guess this is not a big issue if you are using Autotools, where the

established practice is to compile inside the source directory. It might cause

a lot of head scratching for users of other build systems or those few

autotools users that use a dedicated build directory.


[Bug c++/54780] G++ does not find precompiled headers in some cases

2012-10-02 Thread redi at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54780



--- Comment #1 from Jonathan Wakely  2012-10-02 
13:53:13 UTC ---

(In reply to comment #0)

> Next the script copies common.h to the main directory and compiles the sources

> again using the exact same compiler switches. What happens is that g++ does 
> not

> find the precompiled header, probably because it first looks in the source dir

> and finds common.h but not the corresponding pch and just stops looking. This

> makes the compilation very slow.



This is by design.  A header included as #include "common.h" looks in the

current dir first, so the compiler looks for ./common.h.gch, then for

./common.h, then stops because it's found.  The alternative would be to

continue searching *every* other directory looking for common.h.gch, which

would be *much* slower (there might be no PCH anywhere, so for projects that

don't use PCH it would mean checking every single directory for every single

header)



Maybe the solution you want is to use #include  and add -I. to the

compilation commands, ensuring that -Ipchdir comes before -I. because that will

not start with the current dir, and will look for pchdir/common.h.gch first and

will stop when found. Doing that makes all three steps in your script very

fast.