doc: added more information when '--verbose' is used for these error messages:
* dangerous usage of erase * overlapping data buffer
This commit is contained in:
parent
0ea09b1cb6
commit
89115bd417
10
src/check.h
10
src/check.h
|
@ -84,7 +84,7 @@ protected:
|
|||
}
|
||||
|
||||
/** report an error */
|
||||
void reportError(const std::list<const Token *> &callstack, const std::string &severity, const std::string &id, const std::string &msg)
|
||||
void reportError(const std::list<const Token *> &callstack, const std::string &severity, const std::string &id, std::string msg)
|
||||
{
|
||||
// No errorLogger => just report the message to stdout
|
||||
if (_errorLogger == NULL)
|
||||
|
@ -93,6 +93,14 @@ protected:
|
|||
return;
|
||||
}
|
||||
|
||||
// If the verbose flag hasn't been given, don't show verbose information
|
||||
if (!_settings || !_settings->_verbose)
|
||||
{
|
||||
std::string::size_type pos = msg.find("\n");
|
||||
if (pos != std::string::npos)
|
||||
msg.erase(pos);
|
||||
}
|
||||
|
||||
std::list<ErrorLogger::ErrorMessage::FileLocation> locationList;
|
||||
for (std::list<const Token *>::const_iterator it = callstack.begin(); it != callstack.end(); ++it)
|
||||
{
|
||||
|
|
|
@ -990,7 +990,7 @@ void CheckOther::ifNoActionError(const Token *tok)
|
|||
|
||||
void CheckOther::sprintfOverlappingDataError(const Token *tok, const std::string &varname)
|
||||
{
|
||||
reportError(tok, "error", "sprintfOverlappingData", "Overlapping data buffer " + varname);
|
||||
reportError(tok, "error", "sprintfOverlappingData", "Overlapping data buffer " + varname + "\nWhen using sprintf the same buffer must not be used both for output and input. The behaviour is undefined when that happens.\nFor example: 'sprintf(str,\"<%s>\",str);'");
|
||||
}
|
||||
|
||||
void CheckOther::udivError(const Token *tok)
|
||||
|
|
|
@ -210,7 +210,7 @@ void CheckStl::eraseCheckLoop(const Token *it)
|
|||
// Error message for bad iterator usage..
|
||||
void CheckStl::eraseError(const Token *tok)
|
||||
{
|
||||
reportError(tok, "error", "erase", "Dangerous usage of erase");
|
||||
reportError(tok, "error", "erase", "Dangerous usage of erase\nAfter erase has been used the iterator may be invalid so dereferencing it or comparing it with other iterator is invalid.");
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue