#389 Bad logic for cl task/.pch handling

0.85
closed-fixed
Tasks (408)
5
2005-05-04
2005-04-27
Robert Blum
No

It seems the CL task has some logic for PCH handling
that's inverted.

It checks if any of the sources are newer than the .PCH
file, and if so, recompiles them. However, .cpp files
will hopefully almost always be newer than the .pch -
at least we edit and recompile them quite frequently
without ever touching the precompiled header.

As a result, if you edit any .cpp file after the .pch
is created, it will be recompiled every time you
execute nant.

I assume what you wanted to check is if the *PCH*
source file is newer than the .PCH, and if so, rebuild.

I have a temporary fix in, but I'm not sure if that's
entirely right. It works for setups where you have all
files set to "Use PCH" except one that's set to "Create
PCH". I have not tried it with AutoGenerated PCHs.
(Sorry, not enough time...)

At line 472, replace

// check if sources fresher than pch file
string fileName =
FileSet.FindMoreRecentLastWriteTime(Sources.FileNames,
pchFileInfo.LastWriteTime);
if (fileName != null) {
Log(Level.Verbose, "'{0}' is newer than
pch file, recompiling.",
fileName);
return false;
}

with

string fileName;
if( PchMode != PrecompiledHeaderMode.Use ) {
fileName =
FileSet.FindMoreRecentLastWriteTime(Sources.FileNames,
pchFileInfo.LastWriteTime);
if (fileName != null)
{
Log(Level.Verbose, "'{0}' is newer than pch file,
recompiling.",
fileName);
return false;
}
}

Discussion

  • Robert Blum

    Robert Blum - 2005-04-27

    Logged In: YES
    user_id=25786

    Actually, you want to be even more agressive (sorry -
    learning about Nant internals as I go... :( )

    At the top of IsPchfileUpToDate(), after you checked if
    there even is a PCH, you want to return true if you're just
    using the PCH - you're not concerned with rebuilding it at
    that time.

    // If we just use the PCH, we don't want to rebuild it either
    if( PchMode == PrecompiledHeaderMode.Use )
    {
    return true;
    }

     
  • Gert Driesen

    Gert Driesen - 2005-05-04

    Logged In: YES
    user_id=707851

    This is now fixed in cvs.

    Thanks for the report !

     
  • Gert Driesen

    Gert Driesen - 2005-05-04
    • labels: --> Tasks
    • milestone: --> 0.85
    • assigned_to: nobody --> drieseng
    • status: open --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks