Replace 'unsigned' with 'nonneg' in checkcondition
This commit is contained in:
parent
e19068504d
commit
5dc4f44091
|
@ -63,7 +63,7 @@ bool CheckCondition::diag(const Token* tok, bool insert)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CheckCondition::isAliased(const std::set<unsigned int> &vars) const
|
||||
bool CheckCondition::isAliased(const std::set<int> &vars) const
|
||||
{
|
||||
for (const Token *tok = mTokenizer->tokens(); tok; tok = tok->next()) {
|
||||
if (Token::Match(tok, "= & %var% ;") && vars.find(tok->tokAt(2)->varId()) != vars.end())
|
||||
|
@ -119,7 +119,7 @@ void CheckCondition::assignIf()
|
|||
static bool isParameterChanged(const Token *partok)
|
||||
{
|
||||
bool addressOf = Token::Match(partok, "[(,] &");
|
||||
unsigned int argumentNumber = 0;
|
||||
int argumentNumber = 0;
|
||||
const Token *ftok;
|
||||
for (ftok = partok; ftok && ftok->str() != "("; ftok = ftok->previous()) {
|
||||
if (ftok->str() == ")")
|
||||
|
@ -145,7 +145,7 @@ static bool isParameterChanged(const Token *partok)
|
|||
/** parse scopes recursively */
|
||||
bool CheckCondition::assignIfParseScope(const Token * const assignTok,
|
||||
const Token * const startTok,
|
||||
const unsigned int varid,
|
||||
const nonneg int varid,
|
||||
const bool islocal,
|
||||
const char bitop,
|
||||
const MathLib::bigint num)
|
||||
|
@ -518,7 +518,7 @@ void CheckCondition::multiCondition()
|
|||
}
|
||||
}
|
||||
|
||||
void CheckCondition::overlappingElseIfConditionError(const Token *tok, unsigned int line1)
|
||||
void CheckCondition::overlappingElseIfConditionError(const Token *tok, nonneg int line1)
|
||||
{
|
||||
std::ostringstream errmsg;
|
||||
errmsg << "Expression is always false because 'else if' condition matches previous condition at line "
|
||||
|
@ -590,7 +590,7 @@ void CheckCondition::multiCondition2()
|
|||
|
||||
bool nonConstFunctionCall = false;
|
||||
bool nonlocal = false; // nonlocal variable used in condition
|
||||
std::set<unsigned int> vars; // variables used in condition
|
||||
std::set<int> vars; // variables used in condition
|
||||
visitAstNodes(condTok,
|
||||
[&](const Token *cond) {
|
||||
if (Token::Match(cond, "%name% (")) {
|
||||
|
@ -730,7 +730,7 @@ void CheckCondition::multiCondition2()
|
|||
break;
|
||||
}
|
||||
bool changed = false;
|
||||
for (unsigned int varid : vars) {
|
||||
for (int varid : vars) {
|
||||
if (isVariableChanged(tok1, tok2, varid, nonlocal, mSettings, mTokenizer->isCPP())) {
|
||||
changed = true;
|
||||
break;
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
/** parse scopes recursively */
|
||||
bool assignIfParseScope(const Token * const assignTok,
|
||||
const Token * const startTok,
|
||||
const unsigned int varid,
|
||||
const nonneg int varid,
|
||||
const bool islocal,
|
||||
const char bitop,
|
||||
const MathLib::bigint num);
|
||||
|
@ -122,7 +122,7 @@ private:
|
|||
// The conditions that have been diagnosed
|
||||
std::set<const Token*> mCondDiags;
|
||||
bool diag(const Token* tok, bool insert=true);
|
||||
bool isAliased(const std::set<unsigned int> &vars) const;
|
||||
bool isAliased(const std::set<int> &vars) const;
|
||||
bool isOverlappingCond(const Token * const cond1, const Token * const cond2, bool pure) const;
|
||||
void assignIfError(const Token *tok1, const Token *tok2, const std::string &condition, bool result);
|
||||
void mismatchingBitAndError(const Token *tok1, const MathLib::bigint num1, const Token *tok2, const MathLib::bigint num2);
|
||||
|
@ -134,7 +134,7 @@ private:
|
|||
MathLib::bigint value2,
|
||||
bool result);
|
||||
void duplicateConditionError(const Token *tok1, const Token *tok2, ErrorPath errorPath);
|
||||
void overlappingElseIfConditionError(const Token *tok, unsigned int line1);
|
||||
void overlappingElseIfConditionError(const Token *tok, nonneg int line1);
|
||||
void oppositeElseIfConditionError(const Token *ifCond, const Token *elseIfCond, ErrorPath errorPath);
|
||||
|
||||
void oppositeInnerConditionError(const Token *tok1, const Token* tok2, ErrorPath errorPath);
|
||||
|
|
Loading…
Reference in New Issue