runastyle and fix checkInternal messages.

This commit is contained in:
Edoardo Prezioso 2012-12-01 03:17:55 +01:00
parent 9ce6630b28
commit f6c23fa1e7
3 changed files with 5 additions and 7 deletions

View File

@ -54,7 +54,7 @@ void CheckAssignIf::assignIf()
bitop = tok->strAt(2).at(0); bitop = tok->strAt(2).at(0);
num = MathLib::toLongNumber(tok->next()->str()); num = MathLib::toLongNumber(tok->next()->str());
} else { } else {
const Token * const endToken = Token::findmatch(tok, ";"); const Token * const endToken = Token::findsimplematch(tok, ";");
if (endToken && Token::Match(endToken->tokAt(-2), "[&|] %num% ;")) { if (endToken && Token::Match(endToken->tokAt(-2), "[&|] %num% ;")) {
bitop = endToken->strAt(-2).at(0); bitop = endToken->strAt(-2).at(0);
num = MathLib::toLongNumber(endToken->previous()->str()); num = MathLib::toLongNumber(endToken->previous()->str());

View File

@ -1212,7 +1212,7 @@ void CheckNullPointer::nullPointerDefaultArgument()
bool unknown = _settings->inconclusive; bool unknown = _settings->inconclusive;
for (const Token *tok = scope->classStart; tok != scope->classEnd; tok = tok->next()) { for (const Token *tok = scope->classStart; tok != scope->classEnd; tok = tok->next()) {
// If we encounter a possible NULL-pointer check, skip over its body // If we encounter a possible NULL-pointer check, skip over its body
if (Token::Match(tok, "if ( ")) { if (Token::simpleMatch(tok, "if ( ")) {
bool dependsOnPointer = false; bool dependsOnPointer = false;
const Token *endOfCondition = tok->next()->link(); const Token *endOfCondition = tok->next()->link();
for (const Token *tok2 = tok->next(); tok2 != endOfCondition; tok2 = tok2->next()) { for (const Token *tok2 = tok->next(); tok2 != endOfCondition; tok2 = tok2->next()) {
@ -1220,7 +1220,7 @@ void CheckNullPointer::nullPointerDefaultArgument()
dependsOnPointer = true; dependsOnPointer = true;
} }
} }
if (dependsOnPointer && Token::Match(endOfCondition, ") {")) { if (dependsOnPointer && Token::simpleMatch(endOfCondition, ") {")) {
tok = endOfCondition->next()->link(); tok = endOfCondition->next()->link();
continue; continue;
} }

View File

@ -639,8 +639,7 @@ bool Token::Match(const Token *tok, const char pattern[], unsigned int varid)
multicompare(p,tok->isNumber(),ismulticomp); multicompare(p,tok->isNumber(),ismulticomp);
} }
break; break;
case 'c': case 'c': {
{
p += 1; p += 1;
// Character (%char%) // Character (%char%)
if (p[0] == 'h') { if (p[0] == 'h') {
@ -668,8 +667,7 @@ bool Token::Match(const Token *tok, const char pattern[], unsigned int varid)
multicompare(p,tok->isBoolean(),ismulticomp); multicompare(p,tok->isBoolean(),ismulticomp);
} }
break; break;
case 'o': case 'o': {
{
++p; ++p;
if (p[1] == '%') { if (p[1] == '%') {
// Op (%op%) // Op (%op%)