[cmake-commits] king committed cmComputeLinkInformation.cxx 1.6 1.7
cmComputeLinkInformation.h 1.4 1.5
cmake-commits at cmake.org
cmake-commits at cmake.org
Wed Jan 23 15:56:19 EST 2008
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv8440/Source
Modified Files:
cmComputeLinkInformation.cxx cmComputeLinkInformation.h
Log Message:
BUG: Fix cmComputeLinkInformation cycle detection.
Index: cmComputeLinkInformation.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmComputeLinkInformation.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- cmComputeLinkInformation.cxx 23 Jan 2008 20:22:38 -0000 1.6
+++ cmComputeLinkInformation.cxx 23 Jan 2008 20:56:17 -0000 1.7
@@ -1025,7 +1025,7 @@
}
// Add link directories specified for the target.
- std::vector<std::string> const& dirs = this->GetDirectories();
+ std::vector<std::string> const& dirs = this->Target->GetLinkDirectories();
for(std::vector<std::string>::const_iterator di = dirs.begin();
di != dirs.end(); ++di)
{
@@ -1168,39 +1168,41 @@
{
// Allow a cycle to be diagnosed once.
this->CycleDiagnosed = false;
+ this->WalkId = 0;
// Iterate through the directories in the original order.
for(unsigned int i=0; i < this->RuntimeDirectories.size(); ++i)
{
- this->VisitRuntimeDirectory(i, true);
+ // Start a new DFS from this node.
+ ++this->WalkId;
+ this->VisitRuntimeDirectory(i);
}
}
//----------------------------------------------------------------------------
-void cmComputeLinkInformation::VisitRuntimeDirectory(unsigned int i,
- bool top)
+void cmComputeLinkInformation::VisitRuntimeDirectory(unsigned int i)
{
// Skip nodes already visited.
if(this->RuntimeDirectoryVisited[i])
{
- if(!top)
+ if(this->RuntimeDirectoryVisited[i] == this->WalkId)
{
- // We have reached a previously visited node but were not called
- // to start a new section of the graph. There is a cycle.
+ // We have reached a node previously visited on this DFS.
+ // There is a cycle.
this->DiagnoseCycle();
}
return;
}
- // We are not visiting this node so mark it.
- this->RuntimeDirectoryVisited[i] = 1;
+ // We are now visiting this node so mark it.
+ this->RuntimeDirectoryVisited[i] = this->WalkId;
// Visit the neighbors of the node first.
RuntimeConflictList const& clist = this->RuntimeConflictGraph[i];
for(RuntimeConflictList::const_iterator j = clist.begin();
j != clist.end(); ++j)
{
- this->VisitRuntimeDirectory(j->first, false);
+ this->VisitRuntimeDirectory(j->first);
}
// Now that all directories required to come before this one have
Index: cmComputeLinkInformation.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmComputeLinkInformation.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- cmComputeLinkInformation.h 23 Jan 2008 20:22:38 -0000 1.4
+++ cmComputeLinkInformation.h 23 Jan 2008 20:56:17 -0000 1.5
@@ -146,7 +146,7 @@
std::set<cmStdString> LibraryRuntimeInfoEmmitted;
std::vector<std::string> RuntimeDirectories;
std::map<cmStdString, int> RuntimeDirectoryIndex;
- std::vector<char> RuntimeDirectoryVisited;
+ std::vector<int> RuntimeDirectoryVisited;
void AddLibraryRuntimeInfo(std::string const& fullPath, cmTarget* target);
void AddLibraryRuntimeInfo(std::string const& fullPath,
const char* soname = 0);
@@ -155,9 +155,10 @@
void FindConflictingLibraries();
void FindDirectoriesForLib(unsigned int lri);
void OrderRuntimeSearchPath();
- void VisitRuntimeDirectory(unsigned int i, bool top);
+ void VisitRuntimeDirectory(unsigned int i);
void DiagnoseCycle();
bool CycleDiagnosed;
+ int WalkId;
// Adjacency-list representation of runtime path ordering graph.
// This maps from directory to those that must come *before* it.
More information about the Cmake-commits
mailing list