Code cleanup

This commit is contained in:
PKEuS 2011-12-09 21:00:57 +01:00 committed by Daniel Marjamäki
parent 7d12951da0
commit 9b685ba3c3
12 changed files with 6 additions and 30 deletions

View File

@ -136,8 +136,11 @@ void CheckAssignIf::multiCondition()
if (!_settings->isEnabled("style"))
return;
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) {
if (Token::Match(tok, "if ( %var% & %num% ) {")) {
const SymbolDatabase* const symbolDatabase = _tokenizer->getSymbolDatabase();
for (std::list<Scope>::const_iterator i = symbolDatabase->scopeList.begin(); i != symbolDatabase->scopeList.end(); ++i) {
if (i->type == Scope::eIf && Token::Match(i->classDef, "if ( %var% & %num% ) {")) {
const Token* const tok = i->classDef;
const unsigned int varid(tok->tokAt(2)->varId());
if (varid == 0)
continue;

View File

@ -51,7 +51,6 @@ private:
Tokenizer tokenizer(&settings, this);
std::istringstream istr(code);
tokenizer.tokenize(istr, "test.cpp");
tokenizer.setVarId();
// Check char variable usage..
Check64BitPortability check64BitPortability(&tokenizer, &settings, this);

View File

@ -49,7 +49,6 @@ private:
Tokenizer tokenizer(&settings, this);
std::istringstream istr(code);
tokenizer.tokenize(istr, "test.cpp");
tokenizer.setVarId();
tokenizer.simplifyTokenList();
// Check char variable usage..

View File

@ -51,9 +51,6 @@ private:
tokenizer.simplifyTokenList();
// Assign variable ids
tokenizer.setVarId();
// Check auto variables
checkAutoVariables.autoVariables();
checkAutoVariables.returnPointerToLocalArray();

View File

@ -54,7 +54,6 @@ private:
Tokenizer tokenizer(&settings, this);
std::istringstream istr(code);
tokenizer.tokenize(istr, "test.cpp");
tokenizer.setVarId();
// Check char variable usage..
CheckOther checkOther(&tokenizer, &settings, this);

View File

@ -48,7 +48,6 @@ private:
Tokenizer tokenizer(&settings, this);
std::istringstream istr(code);
tokenizer.tokenize(istr, "test.cpp");
tokenizer.setVarId();
return ((const CheckMemoryLeak *)0)->functionReturnType(tokenizer.tokens());
}
@ -132,7 +131,6 @@ private:
Tokenizer tokenizer(&settings, this);
std::istringstream istr(code);
tokenizer.tokenize(istr, "test.cpp");
tokenizer.setVarId();
tokenizer.simplifyTokenList();
// Check for memory leaks..
@ -3077,7 +3075,6 @@ private:
Tokenizer tokenizer(&settings, this);
std::istringstream istr(code);
tokenizer.tokenize(istr, "test.cpp");
tokenizer.setVarId();
tokenizer.simplifyTokenList();
// Check for memory leaks..
@ -3784,7 +3781,6 @@ private:
Tokenizer tokenizer(&settings, this);
std::istringstream istr(code);
tokenizer.tokenize(istr, "test.cpp");
tokenizer.setVarId();
tokenizer.simplifyTokenList();
// Check for memory leaks..

View File

@ -51,9 +51,6 @@ private:
tokenizer.tokenize(istr, "test.cpp");
tokenizer.simplifyTokenList();
// Assign variable ids
tokenizer.setVarId();
// Check for non reentrant functions..
CheckNonReentrantFunctions checkNonReentrantFunctions(&tokenizer, &settings, this);
checkNonReentrantFunctions.nonReentrantFunctions();

View File

@ -38,7 +38,7 @@ private:
TEST_CASE(testgethostbyaddr);
TEST_CASE(testusleep);
TEST_CASE(testindex);
TEST_CASE(test_qt_index); // FP when using the Qt function 'index'?
TEST_CASE(test_qt_index); // FP when using the Qt function 'index'?
TEST_CASE(testrindex);
// no false positives for variables
@ -83,9 +83,6 @@ private:
tokenizer.tokenize(istr, "test.cpp");
tokenizer.simplifyTokenList();
// Assign variable ids
tokenizer.setVarId();
// Check for obsolete functions..
CheckObsoleteFunctions checkObsoleteFunctions(&tokenizer, &settings, this);
checkObsoleteFunctions.obsoleteFunctions();

View File

@ -371,7 +371,6 @@ private:
Tokenizer tokenizer(&settings, this);
std::istringstream istr(code);
tokenizer.tokenize(istr, "test.cpp");
tokenizer.setVarId();
//tokenizer.tokens()->printOut( "tokens" );
@ -437,7 +436,6 @@ private:
Tokenizer tokenizer(&settings, this);
std::istringstream istr(code);
tokenizer.tokenize(istr, "test.cpp");
tokenizer.setVarId();
// Check for redundant code..
CheckOther checkOther(&tokenizer, &settings, this);
@ -718,12 +716,10 @@ private:
Tokenizer tokenizerCpp(&settings, this);
std::istringstream istr(code);
tokenizerCpp.tokenize(istr, "test.cpp");
tokenizerCpp.setVarId();
Tokenizer tokenizerC(&settings, this);
std::istringstream istr2(code);
tokenizerC.tokenize(istr2, "test.c");
tokenizerC.setVarId();
CheckOther checkOtherCpp(&tokenizerCpp, &settings, this);
checkOtherCpp.warningOldStylePointerCast();

View File

@ -48,9 +48,6 @@ private:
tokenizer.tokenize(istr, "test.cpp");
tokenizer.simplifyTokenList();
// Assign variable ids
tokenizer.setVarId();
// Check for postfix operators..
CheckPostfixOperator checkPostfixOperator(&tokenizer, &settings, this);
checkPostfixOperator.postfixOperator();

View File

@ -873,7 +873,6 @@ private:
std::istringstream istr(code);
tokenizer.tokenize(istr, "test.cpp");
tokenizer.setVarId();
if (simplify)
tokenizer.simplifyTokenList();

View File

@ -1048,7 +1048,6 @@ private:
std::istringstream istr(code);
tokenizer.tokenize(istr, "test.cpp");
tokenizer.setVarId();
tokenizer.simplifyKnownVariables();
std::ostringstream ostr;
@ -4151,7 +4150,6 @@ private:
std::istringstream istr(code);
tokenizer.tokenize(istr, "test.cpp");
tokenizer.setVarId();
tokenizer.simplifyTokenList();
std::ostringstream ostr;
@ -4178,7 +4176,6 @@ private:
std::istringstream istr(code);
tokenizer.tokenize(istr, "test.cpp");
tokenizer.setVarId();
tokenizer.simplifyTokenList();
std::ostringstream ostr;