This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PCH not being used, but I can't tell why


On Wed, Aug 20, 2003 at 09:44:44AM -0700, Geoff Keating wrote:
> Phil Edwards <phil@jaj.com> writes:
> 
> > @@ -1184,14 +1188,14 @@ static bool
> >  validate_pch (cpp_reader *pfile, _cpp_file *file, const char *pchname)
> >  {
> >    const char *saved_path = file->path;
> > +  bool valid = false;
> >  
> >    file->path = pchname;
> >    if (open_file (file))
> >      {
> > -      if ((file->pch & 2) == 0)
> > -	file->pch = pfile->cb.valid_pch (pfile, pchname, file->fd);
> > +      valid = 1 & pfile->cb.valid_pch (pfile, pchname, file->fd);
> 
> This seems to lose information...

AFAICT, it's precisely the lost information that was causing problems before.
The "can never be valid" test is what's killing things once a directory
gets tested.

You said that validate_pch should not be setting state, and that it
should only be testing the individual candidate file under examination.
"if (file-pch & 2)" isn't testing the individual candidates; it's also
testing all the ones that came before.  Accumulation of directory-wide
state /during the tests/ is the bug here.

The patch I posted works for me; the libstdc++ testsuite runtime is cut in
half (after an unrelated-to-PCH library patch which I'll commit later), and
-H clearly shows the invalid files being skipped before the valid one is
(now, finally) used.  I'm not knowledgeable about our PCH mechanics and,
to be honest, trying to read your mind is frustrating.  If you have a
better fix in mind, please just implement it.


Phil

-- 
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.
    - Brian W. Kernighan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]