Cppcheck: Don't show information messages about interrupted checking unless --enable=information has been given.

This commit is contained in:
Daniel Marjamäki 2011-08-19 22:32:57 +02:00
parent 80ba3d6a92
commit fe78e28d70
3 changed files with 22 additions and 19 deletions

View File

@ -217,22 +217,25 @@ unsigned int CppCheck::processFile()
// was used. // was used.
if (!_settings._force && checkCount > 11) if (!_settings._force && checkCount > 11)
{ {
const std::string fixedpath = Path::toNativeSeparators(_filename); if (_settings.isEnabled("information"))
ErrorLogger::ErrorMessage::FileLocation location; {
location.setfile(fixedpath); const std::string fixedpath = Path::toNativeSeparators(_filename);
std::list<ErrorLogger::ErrorMessage::FileLocation> loclist; ErrorLogger::ErrorMessage::FileLocation location;
loclist.push_back(location); location.setfile(fixedpath);
const std::string msg("Interrupted checking because of too many #ifdef configurations.\n" std::list<ErrorLogger::ErrorMessage::FileLocation> loclist;
"The checking of the file was interrupted because there were too many " loclist.push_back(location);
"#ifdef configurations. Checking of all #ifdef configurations can be forced " const std::string msg("Interrupted checking because of too many #ifdef configurations.\n"
"by --force command line option or from GUI preferences. However that may " "The checking of the file was interrupted because there were too many "
"increase the checking time."); "#ifdef configurations. Checking of all #ifdef configurations can be forced "
ErrorLogger::ErrorMessage errmsg(loclist, "by --force command line option or from GUI preferences. However that may "
Severity::information, "increase the checking time.");
msg, ErrorLogger::ErrorMessage errmsg(loclist,
"toomanyconfigs", Severity::information,
false); msg,
_errorLogger.reportErr(errmsg); "toomanyconfigs",
false);
_errorLogger.reportErr(errmsg);
}
break; break;
} }

View File

@ -400,11 +400,11 @@ std::string Settings::addEnabled(const std::string &str)
{ {
std::set<std::string>::const_iterator it; std::set<std::string>::const_iterator it;
for (it = id.begin(); it != id.end(); ++it) for (it = id.begin(); it != id.end(); ++it)
_enabled[*it] = true; _enabled.insert(*it);
} }
else if (id.find(str) != id.end()) else if (id.find(str) != id.end())
{ {
_enabled[str] = true; _enabled.insert(str);
} }
else if (!handled) else if (!handled)
{ {

View File

@ -41,7 +41,7 @@ private:
std::string _append; std::string _append;
/** @brief enable extra checks by id */ /** @brief enable extra checks by id */
std::map<std::string, bool> _enabled; std::set<std::string> _enabled;
/** @brief terminate checking */ /** @brief terminate checking */
bool _terminate; bool _terminate;