Fixed some coverity findings about dead code, fixed a misleading comment

This commit is contained in:
PKEuS 2014-04-14 22:46:51 +02:00
parent ac24635056
commit 076f7a7542
5 changed files with 4 additions and 9 deletions

View File

@ -792,7 +792,7 @@ void CheckClass::initializationListUsage()
tok2->strAt(-1)!=".") { // Is there a dependency between two member variables?
allowed = false;
break;
} else if (var2 && (var2->isArray() && var2->isLocal())) { // Can't initialize an array
} else if (var2 && (var2->isArray() && var2->isLocal())) { // Can't initialize with a local array
allowed = false;
break;
}

View File

@ -2058,7 +2058,7 @@ static bool astIsSignedChar(const Token *tok)
const Variable *var = tok->astOperand1()->variable();
if (!var || !var->isPointer())
return false;
const Token *type = var ? var->typeStartToken() : nullptr;
const Token *type = var->typeStartToken();
while (type && type->str() == "const")
type = type->next();
return (type && type->str() == "char" && !type->isUnsigned());

View File

@ -1601,7 +1601,7 @@ void CheckStl::readingEmptyStlContainer()
if (tok->strAt(-1) == "=")
readingEmptyStlContainerError(tok);
empty_map.erase(tok->varId());
} else if ((map && empty_map.find(tok->varId()) != empty_map.end()) || (!map && empty_nonmap.find(tok->varId()) != empty_nonmap.end()))
} else
readingEmptyStlContainerError(tok);
} else if (Token::Match(tok, "%var% . %type% (")) {
// Member function call

View File

@ -2928,10 +2928,6 @@ bool Tokenizer::simplifySizeof()
// We have variable++ or variable--, there should be
// nothing after this
tempToken = tempToken->tokAt(2);
} else if (parlevel > 0 && Token::simpleMatch(tempToken->next(), ") .")) {
--parlevel;
tempToken = tempToken->tokAt(2);
continue;
}
// Ok, we should be clean. Add ) after tempToken

View File

@ -787,7 +787,7 @@ static bool valueFlowForLoop1(const Token *tok, unsigned int * const varid, Math
}
if (!num2tok)
return false;
*num2 = MathLib::toLongNumber(num2tok ? num2tok->str() : "0") - ((tok->str()=="<=") ? 0 : 1);
*num2 = MathLib::toLongNumber(num2tok->str()) - ((tok->str()=="<=") ? 0 : 1);
if (!num1tok)
*num1 = *num2;
while (tok && tok->str() != ";")
@ -804,7 +804,6 @@ static bool valueFlowForLoop2(const Token *tok,
const Token *firstExpression = tok->next()->astOperand2()->astOperand1();
const Token *secondExpression = tok->next()->astOperand2()->astOperand2()->astOperand1();
const Token *thirdExpression = tok->next()->astOperand2()->astOperand2()->astOperand2();
tok = tok->linkAt(1);
std::map<unsigned int, MathLib::bigint> programMemory;
MathLib::bigint result(0);