Added CHECK_WRONG_DATA() that can be used to avoid crashes/hangs in release binaries
This commit is contained in:
parent
4a1c04cb33
commit
6874f27e73
|
@ -30,6 +30,13 @@
|
|||
#include <list>
|
||||
#include <set>
|
||||
|
||||
/**
|
||||
* Use this macro Cppcheck data can be wrong and you need a to check if that happens to avoid crash/hang
|
||||
* Using this macro we can make sure that released binaries don't crash/hang but the problem is not hidden
|
||||
* in debug builds.
|
||||
*/
|
||||
#define CHECK_WRONG_DATA(X) (X)
|
||||
|
||||
/// @addtogroup Core
|
||||
/// @{
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ void CheckFunctions::checkIgnoredReturnValue()
|
|||
while (parent->astParent() && parent->astParent()->str() == "::")
|
||||
parent = parent->astParent();
|
||||
|
||||
if (!tok->next()->astParent() && (!tok->function() || !Token::Match(tok->function()->retDef, "void %name%")) && _settings->library.isUseRetVal(tok))
|
||||
if (CHECK_WRONG_DATA(tok->next()->astOperand1()) && !tok->next()->astParent() && (!tok->function() || !Token::Match(tok->function()->retDef, "void %name%")) && _settings->library.isUseRetVal(tok))
|
||||
ignoredReturnValueError(tok, tok->next()->astOperand1()->expressionString());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue