diff --git a/cli/cppcheckexecutor.cpp b/cli/cppcheckexecutor.cpp index f484281b4..eecdc8376 100644 --- a/cli/cppcheckexecutor.cpp +++ b/cli/cppcheckexecutor.cpp @@ -65,16 +65,21 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c // Check that all include paths exist { - std::list::const_iterator iter; - for (iter = _settings._includePaths.begin(); - iter != _settings._includePaths.end(); + std::list::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::iterator del_iter(iter.base()); + --del_iter; + ++iter; + _settings._includePaths.erase(del_iter); } } }