null pointer: perform proper null pointer checking when no --enable=warning is given.

This commit is contained in:
Daniel Marjamäki 2014-08-16 12:48:20 +02:00
parent e91a63c834
commit 76510e0006
1 changed files with 5 additions and 5 deletions

View File

@ -382,11 +382,8 @@ void CheckNullPointer::nullPointerByDeRefAndChec()
void CheckNullPointer::nullPointer()
{
nullPointerLinkedList();
if (_settings->isEnabled("warning")) {
nullPointerByDeRefAndChec();
nullPointerDefaultArgument();
}
nullPointerByDeRefAndChec();
nullPointerDefaultArgument();
}
/** Dereferencing null constant (simplified token list) */
@ -501,6 +498,9 @@ void CheckNullPointer::removeAssignedVarFromSet(const Token* tok, std::set<unsig
*/
void CheckNullPointer::nullPointerDefaultArgument()
{
if (!_settings->isEnabled("warning"))
return;
const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
const std::size_t functions = symbolDatabase->functionScopes.size();
for (std::size_t i = 0; i < functions; ++i) {