Merge topic 'AddCommentToCDependencyScanner'

318b0cd Add comment about one more problem of the C depency scanner.
4bb08e0 Remove trailing whitespace
This commit is contained in:
David Cole 2011-12-20 14:21:43 -05:00 committed by CMake Topic Stage
commit 7ca69a08cb
1 changed files with 11 additions and 8 deletions

View File

@ -237,10 +237,10 @@ bool cmDependsC::WriteDependencies(const char *src, const char *obj,
fileIt->second->Used=true; fileIt->second->Used=true;
dependencies.insert(fullName); dependencies.insert(fullName);
for (std::vector<UnscannedEntry>::const_iterator incIt= for (std::vector<UnscannedEntry>::const_iterator incIt=
fileIt->second->UnscannedEntries.begin(); fileIt->second->UnscannedEntries.begin();
incIt!=fileIt->second->UnscannedEntries.end(); ++incIt) incIt!=fileIt->second->UnscannedEntries.end(); ++incIt)
{ {
if (this->Encountered.find(incIt->FileName) == if (this->Encountered.find(incIt->FileName) ==
this->Encountered.end()) this->Encountered.end())
{ {
this->Encountered.insert(incIt->FileName); this->Encountered.insert(incIt->FileName);
@ -278,7 +278,7 @@ bool cmDependsC::WriteDependencies(const char *src, const char *obj,
for(std::set<cmStdString>::iterator i=dependencies.begin(); for(std::set<cmStdString>::iterator i=dependencies.begin();
i != dependencies.end(); ++i) i != dependencies.end(); ++i)
{ {
makeDepends << obj << ": " << makeDepends << obj << ": " <<
this->LocalGenerator->Convert(i->c_str(), this->LocalGenerator->Convert(i->c_str(),
cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::HOME_OUTPUT,
cmLocalGenerator::MAKEFILE) cmLocalGenerator::MAKEFILE)
@ -321,9 +321,9 @@ void cmDependsC::ReadCacheFile()
haveFileName=true; haveFileName=true;
int newer=0; int newer=0;
cmFileTimeComparison comp; cmFileTimeComparison comp;
bool res=comp.FileTimeCompare(this->CacheFileName.c_str(), bool res=comp.FileTimeCompare(this->CacheFileName.c_str(),
line.c_str(), &newer); line.c_str(), &newer);
if ((res==true) && (newer==1)) //cache is newer than the parsed file if ((res==true) && (newer==1)) //cache is newer than the parsed file
{ {
cacheEntry=new cmIncludeLines; cacheEntry=new cmIncludeLines;
@ -391,7 +391,7 @@ void cmDependsC::WriteCacheFile() const
{ {
return; return;
} }
cacheOut << this->IncludeRegexLineString << "\n\n"; cacheOut << this->IncludeRegexLineString << "\n\n";
cacheOut << this->IncludeRegexScanString << "\n\n"; cacheOut << this->IncludeRegexScanString << "\n\n";
cacheOut << this->IncludeRegexComplainString << "\n\n"; cacheOut << this->IncludeRegexComplainString << "\n\n";
@ -406,7 +406,7 @@ void cmDependsC::WriteCacheFile() const
cacheOut<<fileIt->first.c_str()<<std::endl; cacheOut<<fileIt->first.c_str()<<std::endl;
for (std::vector<UnscannedEntry>::const_iterator for (std::vector<UnscannedEntry>::const_iterator
incIt=fileIt->second->UnscannedEntries.begin(); incIt=fileIt->second->UnscannedEntries.begin();
incIt!=fileIt->second->UnscannedEntries.end(); ++incIt) incIt!=fileIt->second->UnscannedEntries.end(); ++incIt)
{ {
cacheOut<<incIt->FileName.c_str()<<std::endl; cacheOut<<incIt->FileName.c_str()<<std::endl;
@ -431,7 +431,7 @@ void cmDependsC::Scan(std::istream& is, const char* directory,
cmIncludeLines* newCacheEntry=new cmIncludeLines; cmIncludeLines* newCacheEntry=new cmIncludeLines;
newCacheEntry->Used=true; newCacheEntry->Used=true;
this->FileCache[fullName]=newCacheEntry; this->FileCache[fullName]=newCacheEntry;
// Read one line at a time. // Read one line at a time.
std::string line; std::string line;
while(cmSystemTools::GetLineFromStream(is, line)) while(cmSystemTools::GetLineFromStream(is, line))
@ -465,6 +465,9 @@ void cmDependsC::Scan(std::istream& is, const char* directory,
// that this check does not account for the possibility of two // that this check does not account for the possibility of two
// headers with the same name in different directories when one // headers with the same name in different directories when one
// is included by double-quotes and the other by angle brackets. // is included by double-quotes and the other by angle brackets.
// It also does not work properly if two header files with the same
// name exist in different directories, and both are included from a
// file their own directory by simply using "filename.h" (#12619)
// This kind of problem will be fixed when a more // This kind of problem will be fixed when a more
// preprocessor-like implementation of this scanner is created. // preprocessor-like implementation of this scanner is created.
if (this->IncludeRegexScan.find(entry.FileName.c_str())) if (this->IncludeRegexScan.find(entry.FileName.c_str()))