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