summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-05-10 22:39:00 (GMT)
committerBrad King <brad.king@kitware.com>2008-05-10 22:39:00 (GMT)
commit09dd298f6319992db30755e759ef3c3a01a2bf1a (patch)
treeb6a9191c9bc3ac3071fd034c08ff1a7b0b767db3 /Source
parentffbe61bb117eb8bc4ef7ab0397f061d40877baff (diff)
downloadCMake-09dd298f6319992db30755e759ef3c3a01a2bf1a.zip
CMake-09dd298f6319992db30755e759ef3c3a01a2bf1a.tar.gz
CMake-09dd298f6319992db30755e759ef3c3a01a2bf1a.tar.bz2
BUG: Fix logic that loops over multiple output pairs to not loop beyond the vector when there are an odd number of entries.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx33
1 files changed, 15 insertions, 18 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 70ff492..a717bef 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1525,28 +1525,25 @@ void cmLocalUnixMakefileGenerator3::CheckMultipleOutputs(bool verbose)
std::vector<std::string> pairs;
cmSystemTools::ExpandListArgument(pairs_string, pairs, true);
for(std::vector<std::string>::const_iterator i = pairs.begin();
- i != pairs.end(); ++i)
+ i != pairs.end() && (i+1) != pairs.end();)
{
- const std::string& depender = *i;
- if(++i != pairs.end())
- {
- const std::string& dependee = *i;
+ const std::string& depender = *i++;
+ const std::string& dependee = *i++;
- // If the depender is missing then delete the dependee to make
- // sure both will be regenerated.
- if(cmSystemTools::FileExists(dependee.c_str()) &&
- !cmSystemTools::FileExists(depender.c_str()))
+ // If the depender is missing then delete the dependee to make
+ // sure both will be regenerated.
+ if(cmSystemTools::FileExists(dependee.c_str()) &&
+ !cmSystemTools::FileExists(depender.c_str()))
+ {
+ if(verbose)
{
- if(verbose)
- {
- cmOStringStream msg;
- msg << "Deleting primary custom command output \"" << dependee
- << "\" because another output \""
- << depender << "\" does not exist." << std::endl;
- cmSystemTools::Stdout(msg.str().c_str());
- }
- cmSystemTools::RemoveFile(dependee.c_str());
+ cmOStringStream msg;
+ msg << "Deleting primary custom command output \"" << dependee
+ << "\" because another output \""
+ << depender << "\" does not exist." << std::endl;
+ cmSystemTools::Stdout(msg.str().c_str());
}
+ cmSystemTools::RemoveFile(dependee.c_str());
}
}
}