summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-01-23 20:56:17 (GMT)
committerBrad King <brad.king@kitware.com>2008-01-23 20:56:17 (GMT)
commit48fddd602da3df44554b20ba134c811010af5dc4 (patch)
treeb9ebc5fed679d99d41f818681f7c0944d9f8be4c /Source
parentf27379e3f7291abd0c7f3706cd9e1202052c9889 (diff)
downloadCMake-48fddd602da3df44554b20ba134c811010af5dc4.zip
CMake-48fddd602da3df44554b20ba134c811010af5dc4.tar.gz
CMake-48fddd602da3df44554b20ba134c811010af5dc4.tar.bz2
BUG: Fix cmComputeLinkInformation cycle detection.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmComputeLinkInformation.cxx22
-rw-r--r--Source/cmComputeLinkInformation.h5
2 files changed, 15 insertions, 12 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 5414041..d7db9b5 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1025,7 +1025,7 @@ void cmComputeLinkInformation::CollectRuntimeDirectories()
}
// 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 @@ void cmComputeLinkInformation::OrderRuntimeSearchPath()
{
// 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
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index 9f86c7d..65a870a 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -146,7 +146,7 @@ private:
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 @@ private:
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.