diff --git a/compiler2/ProjectGenHelper.cc b/compiler2/ProjectGenHelper.cc index 00f86067c07b10bfb8e80e1fd448145e1f20a84f..9973a20286e08c81a7973535fce59ccc52cffde1 100644 --- a/compiler2/ProjectGenHelper.cc +++ b/compiler2/ProjectGenHelper.cc @@ -699,7 +699,9 @@ bool ProjectGenHelper::sanityCheck() for (std::map<std::string, ProjectDescriptor>::reverse_iterator rit = projs.rbegin(); rit != projs.rend(); ++rit) { if ((rit->second).isLibrary() && (rit->second).getLinkingStrategy()) { //dynamic library ProjectDescriptor& proj = rit->second; - found = DynamicLibraryChecker(&proj, found, &execName); + std::vector<std::string> history; + history.push_back(proj.getProjectName()); + found = DynamicLibraryChecker(&proj, found, &execName, history); if (found) { ERROR("Project \"%s\" is dynamic linked library. Sub project \"%s\" is executable.\n" "in TPD file, %s's all sub-level defaultTarget shall be set library too.", @@ -748,7 +750,8 @@ void ProjectGenHelper::cleanUp() bool ProjectGenHelper::DynamicLibraryChecker(const ProjectDescriptor* desc, bool& found, - char** executableName) + char** executableName, + std::vector<std::string>& history) { if (found || !desc) return true; for (size_t i = 0; i < desc->numOfReferencedProjects(); ++i) { @@ -756,7 +759,19 @@ bool ProjectGenHelper::DynamicLibraryChecker(const ProjectDescriptor* desc, const ProjectDescriptor* subProj = getTargetOfProject(refProjName); if (0 == checkedProjs.count(subProj->getProjectName())) { if (subProj->isLibrary()) { - found = DynamicLibraryChecker(subProj, found, executableName); + // Check if we already checked this subproject. + bool inHistory = false; + for (size_t j = 0; j < history.size(); j++) { + if (history[j] == subProj->getProjectName()) { + inHistory = true; + ERROR("Project hierarchy has circular references which is not supported when the improved linking method is used.\n" + "For further information see the TITAN referenceguide."); + } + } + if (!inHistory) { + found = DynamicLibraryChecker(subProj, found, executableName, history); + history.push_back(subProj->getProjectName()); + } } else { // search for executable under dynamic linked library found = true; diff --git a/compiler2/ProjectGenHelper.hh b/compiler2/ProjectGenHelper.hh index d654f09e3eeee992100bd5f92ad257ef2450a3b4..381401793bea53e3b9fd18b4afc1c935672e9eb8 100644 --- a/compiler2/ProjectGenHelper.hh +++ b/compiler2/ProjectGenHelper.hh @@ -145,7 +145,8 @@ private: const ProjectDescriptor* getProject(const char* projName) const; bool DynamicLibraryChecker(const ProjectDescriptor* desc, bool& found, - char** executableName); + char** executableName, + std::vector<std::string>& history); private: static ProjectGenHelper& intance; static const std::string emptyString; diff --git a/usrguide/referenceguide.doc b/usrguide/referenceguide.doc index a4e2530b477741e8b22beb353ba707e7dcfd28a8..b1b6454e40c3fb035f6aead98d17ac4818572a06 100644 Binary files a/usrguide/referenceguide.doc and b/usrguide/referenceguide.doc differ