Fixed #1378 (#error macro makes unrelated errors undetectable)
This commit is contained in:
parent
3b8a3aa4ba
commit
0bff08ca44
|
@ -303,6 +303,7 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string
|
||||||
|
|
||||||
std::set<unsigned long long> checksums;
|
std::set<unsigned long long> checksums;
|
||||||
unsigned int checkCount = 0;
|
unsigned int checkCount = 0;
|
||||||
|
bool hasValidConfig = false;
|
||||||
for (std::set<std::string>::const_iterator it = configurations.begin(); it != configurations.end(); ++it) {
|
for (std::set<std::string>::const_iterator it = configurations.begin(); it != configurations.end(); ++it) {
|
||||||
// bail out if terminated
|
// bail out if terminated
|
||||||
if (_settings.terminated())
|
if (_settings.terminated())
|
||||||
|
@ -362,6 +363,7 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string
|
||||||
timer.Stop();
|
timer.Stop();
|
||||||
if (tokensP.empty())
|
if (tokensP.empty())
|
||||||
continue;
|
continue;
|
||||||
|
hasValidConfig = true;
|
||||||
|
|
||||||
// skip rest of iteration if just checking configuration
|
// skip rest of iteration if just checking configuration
|
||||||
if (_settings.checkConfiguration)
|
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<ErrorLogger::ErrorMessage::FileLocation> 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 </dumps> element now
|
// dumped all configs, close root </dumps> element now
|
||||||
if (_settings.dump && fdump.is_open())
|
if (_settings.dump && fdump.is_open())
|
||||||
fdump << "</dumps>" << std::endl;
|
fdump << "</dumps>" << std::endl;
|
||||||
|
|
Loading…
Reference in New Issue