This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Problem with PFE approach [Was: Faster compilation speed]
Let me see if I understand what people are talking about.
a.h:
/* Include header guard if appropriate */
#define X 1
b.h:
/* Include header guard if appropriate */
#define Y 1
m.c:
#include "a.h"
int main(void) { return Y; }
If m.c is compiled using PFE, and the PFE header contains both a.h and b.h,
will the compilation complete successfully?
If yes, and b.h is later modified to remove the Y definition will a build
system where m.c does not depend on the PFE header actually rebuild m.c,
since the output of m.c depends (erroneously) on an item in b.h through
the PFE header?
My understanding of the PFE symbol implies that m.c would see a definition
from b.h even though b.h was not the target of a #include directive. This
means that programmers will accidentally depend on symbols from b.h even
when it's not included, and that if they do, and the build system does not
consider the PFE header a dependency of each source file, the definitions
will not only be visible when they should not be, but the build will be
wrong since the new contents of these accidentally referenced header files
will not catually cause a rebuild.
Jeff