* Add valueflow for terminating conditions
* Add valueflow test
* Dont check for same expressions for now to avoid double diagnostics
* Check nesting
* Add more tests
* Ensure conditions happen in order
* Check for null
* Add error path
* Support same expression check as well
* Use early continue
* Skip checking the same token
* Avoid double condtion diagnosis
* Fix FP when in switch statements
* Fix FP when time function
* Skip conditional escapes
* Use simpleMatch
* Fix naming
* Fix typo
* Added a new naming check addon. Also verifies variable and function prefixes
* Verification added to code
* added naming checks ng selftest to travis file
* Ensure zero exit value for tests if tests succeed
* Expected values adjusted
* Fixed copy and paste error
* Add check for return value of boolean function
The rule for converting an integer to a boolean is that 0 is mapped to
false and everything else is mapped to true. There is nothing wrong with
the following code (according to the standards):
bool f()
{
return -1;
}
and neither gcc nor clang will warn about it. However, it's a bit
confusing. This commit adds a check that warns when a value other than 0
or 1 is returned from a boolean function (similar to the existing check
that functions with boolean arguments are only passed 0 or 1). Since the
code is perfectly legal, set the severity to "Style".
* Use early continue and remove some braces
* Add testcase with multiple returns
* Avoid null pointer dereference in case of return without operand
* Skip lambdas
Add TODO-test cases that shows FPs when the return type of lambdas are
specified explicitly (this is a problem with findLambdaEndToken).
* Enable testcases
* findLambdaEndToken: Add tests
* Add handling of explicit return in findLambdaEndToken()
* Use AST in findLambdaEndToken()
* Fix ast when lambda is mutable
The function “QListWidget::takeItem” is documented in the way
that a null pointer can be returned. This result was not checked
by the function “ProjectFileDialog::removeSuppression” so far.
Thus add a corresponding check so that an inappropriate pointer access
should not happen any more here.
Link: https://sourceforge.net/p/cppcheck/discussion/development/thread/d1d0b65245/#a1bf
Link: https://trac.cppcheck.net/ticket/8814
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>