diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index 50f72df61..c52c57091 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -303,6 +303,7 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string std::set checksums; unsigned int checkCount = 0; + bool hasValidConfig = false; for (std::set::const_iterator it = configurations.begin(); it != configurations.end(); ++it) { // bail out if terminated if (_settings.terminated()) @@ -362,6 +363,7 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string timer.Stop(); if (tokensP.empty()) continue; + hasValidConfig = true; // skip rest of iteration if just checking configuration if (_settings.checkConfiguration) @@ -442,6 +444,20 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string } } + if (!hasValidConfig && configurations.size() > 1) { + std::list locationList; + ErrorLogger::ErrorMessage::FileLocation loc; + loc.setfile(Path::toNativeSeparators(filename)); + locationList.push_back(loc); + ErrorLogger::ErrorMessage errmsg(locationList, + loc.getfile(), + Severity::information, + "No tested configuration is valid, this file is not analyzed.", + "noValidConfiguration", + false); + reportErr(errmsg); + } + // dumped all configs, close root element now if (_settings.dump && fdump.is_open()) fdump << "" << std::endl;