Ticket #2688 (Missing include path shouldn't exit the program)

Non-existing include path is not a fatal problem requiring exiting
the program. Instead we just print a warning and remove the non-
existing include path from the list.
This commit is contained in:
Kimmo Varis 2011-03-26 18:44:22 +02:00
parent aab1b996ab
commit 139fbf57e0
1 changed files with 10 additions and 5 deletions

View File

@ -65,16 +65,21 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c
// Check that all include paths exist
{
std::list<std::string>::const_iterator iter;
for (iter = _settings._includePaths.begin();
iter != _settings._includePaths.end();
std::list<std::string>::reverse_iterator iter;
for (iter = _settings._includePaths.rbegin();
iter != _settings._includePaths.rend();
++iter)
{
const std::string path(Path::toNativeSeparators(*iter));
if (!FileLister::isDirectory(path))
{
std::cout << "cppcheck: error: Couldn't find path given by -I '" + path + "'" << std::endl;
return false;
// If the include path is not found, warn user and remove the
// non-existing path from the list.
std::cout << "cppcheck: warning: Couldn't find path given by -I '" + path + "'" << std::endl;
std::list<std::string>::iterator del_iter(iter.base());
--del_iter;
++iter;
_settings._includePaths.erase(del_iter);
}
}
}