Fixed some coverity findings about dead code, fixed a misleading comment
This commit is contained in:
parent
ac24635056
commit
076f7a7542
|
@ -792,7 +792,7 @@ void CheckClass::initializationListUsage()
|
||||||
tok2->strAt(-1)!=".") { // Is there a dependency between two member variables?
|
tok2->strAt(-1)!=".") { // Is there a dependency between two member variables?
|
||||||
allowed = false;
|
allowed = false;
|
||||||
break;
|
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;
|
allowed = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2058,7 +2058,7 @@ static bool astIsSignedChar(const Token *tok)
|
||||||
const Variable *var = tok->astOperand1()->variable();
|
const Variable *var = tok->astOperand1()->variable();
|
||||||
if (!var || !var->isPointer())
|
if (!var || !var->isPointer())
|
||||||
return false;
|
return false;
|
||||||
const Token *type = var ? var->typeStartToken() : nullptr;
|
const Token *type = var->typeStartToken();
|
||||||
while (type && type->str() == "const")
|
while (type && type->str() == "const")
|
||||||
type = type->next();
|
type = type->next();
|
||||||
return (type && type->str() == "char" && !type->isUnsigned());
|
return (type && type->str() == "char" && !type->isUnsigned());
|
||||||
|
|
|
@ -1601,7 +1601,7 @@ void CheckStl::readingEmptyStlContainer()
|
||||||
if (tok->strAt(-1) == "=")
|
if (tok->strAt(-1) == "=")
|
||||||
readingEmptyStlContainerError(tok);
|
readingEmptyStlContainerError(tok);
|
||||||
empty_map.erase(tok->varId());
|
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);
|
readingEmptyStlContainerError(tok);
|
||||||
} else if (Token::Match(tok, "%var% . %type% (")) {
|
} else if (Token::Match(tok, "%var% . %type% (")) {
|
||||||
// Member function call
|
// Member function call
|
||||||
|
|
|
@ -2928,10 +2928,6 @@ bool Tokenizer::simplifySizeof()
|
||||||
// We have variable++ or variable--, there should be
|
// We have variable++ or variable--, there should be
|
||||||
// nothing after this
|
// nothing after this
|
||||||
tempToken = tempToken->tokAt(2);
|
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
|
// Ok, we should be clean. Add ) after tempToken
|
||||||
|
|
|
@ -787,7 +787,7 @@ static bool valueFlowForLoop1(const Token *tok, unsigned int * const varid, Math
|
||||||
}
|
}
|
||||||
if (!num2tok)
|
if (!num2tok)
|
||||||
return false;
|
return false;
|
||||||
*num2 = MathLib::toLongNumber(num2tok ? num2tok->str() : "0") - ((tok->str()=="<=") ? 0 : 1);
|
*num2 = MathLib::toLongNumber(num2tok->str()) - ((tok->str()=="<=") ? 0 : 1);
|
||||||
if (!num1tok)
|
if (!num1tok)
|
||||||
*num1 = *num2;
|
*num1 = *num2;
|
||||||
while (tok && tok->str() != ";")
|
while (tok && tok->str() != ";")
|
||||||
|
@ -804,7 +804,6 @@ static bool valueFlowForLoop2(const Token *tok,
|
||||||
const Token *firstExpression = tok->next()->astOperand2()->astOperand1();
|
const Token *firstExpression = tok->next()->astOperand2()->astOperand1();
|
||||||
const Token *secondExpression = tok->next()->astOperand2()->astOperand2()->astOperand1();
|
const Token *secondExpression = tok->next()->astOperand2()->astOperand2()->astOperand1();
|
||||||
const Token *thirdExpression = tok->next()->astOperand2()->astOperand2()->astOperand2();
|
const Token *thirdExpression = tok->next()->astOperand2()->astOperand2()->astOperand2();
|
||||||
tok = tok->linkAt(1);
|
|
||||||
|
|
||||||
std::map<unsigned int, MathLib::bigint> programMemory;
|
std::map<unsigned int, MathLib::bigint> programMemory;
|
||||||
MathLib::bigint result(0);
|
MathLib::bigint result(0);
|
||||||
|
|
Loading…
Reference in New Issue