Share

NAnt - A .NET Build Tool

Tracker: Bugs

5 Bad logic for cl task/.pch handling - ID: 1191185
Last Update: Comment added ( drieseng )

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


Robert Blum ( rblum ) - 2005-04-27 17:34

5

Closed

Fixed

Gert Driesen

Tasks

0.85

Public


Comments ( 2 )

Date: 2005-05-04 06:27
Sender: driesengProject AdminAccepting Donations

Logged In: YES
user_id=707851

This is now fixed in cvs.

Thanks for the report !


Date: 2005-04-27 18:33
Sender: rblum

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



Attached File

No Files Currently Attached

Changes ( 6 )

Field Old Value Date By
status_id Open 2005-05-04 06:27 drieseng
resolution_id None 2005-05-04 06:27 drieseng
category_id None 2005-05-04 06:27 drieseng
artifact_group_id None 2005-05-04 06:27 drieseng
assigned_to nobody 2005-05-04 06:27 drieseng
close_date - 2005-05-04 06:27 drieseng