astyle formatting
This commit is contained in:
parent
453adb4ea4
commit
f8442391af
|
@ -779,17 +779,17 @@ void CheckBufferOverrun::checkScope(const Token *tok, const ArrayInfo &arrayInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// in case %var% is declared as a pointer
|
// in case %var% is declared as a pointer
|
||||||
else if (Token::Match(tok, "%var% [ %num% ]"))
|
else if (Token::Match(tok, "%var% [ %num% ]"))
|
||||||
{
|
{
|
||||||
const int index = MathLib::toLongNumber(tok->strAt(2));
|
const int index = MathLib::toLongNumber(tok->strAt(2));
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
{
|
{
|
||||||
arrayIndexOutOfBounds(tok, index, index);
|
arrayIndexOutOfBounds(tok, index, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop..
|
// Loop..
|
||||||
else if (Token::simpleMatch(tok, "for ("))
|
else if (Token::simpleMatch(tok, "for ("))
|
||||||
|
|
|
@ -933,17 +933,17 @@ private:
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:5]: (error) Array 'a[10]' index -1 out of bounds\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:5]: (error) Array 'a[10]' index -1 out of bounds\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void array_index_28()
|
void array_index_28()
|
||||||
{
|
{
|
||||||
// ticket #1418
|
// ticket #1418
|
||||||
check("void f()\n"
|
check("void f()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" int i[2];\n"
|
" int i[2];\n"
|
||||||
" int *ip = &i[1];\n"
|
" int *ip = &i[1];\n"
|
||||||
" ip[-10] = 1;\n"
|
" ip[-10] = 1;\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:5]: (error) Array 'ip[-10]' index -10 out of bounds\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:5]: (error) Array 'ip[-10]' index -10 out of bounds\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void array_index_multidim()
|
void array_index_multidim()
|
||||||
|
|
Loading…
Reference in New Issue