Fixed #3009 (Using numeric constants in kernel space code)
This commit is contained in:
parent
a6c5eff1be
commit
4f962acf16
|
@ -3009,7 +3009,7 @@ void CheckOther::checkIncompleteStatement()
|
||||||
else if (tok->str() == "{" && Token::Match(tok->tokAt(-2), "%type% %var%"))
|
else if (tok->str() == "{" && Token::Match(tok->tokAt(-2), "%type% %var%"))
|
||||||
tok = tok->link();
|
tok = tok->link();
|
||||||
|
|
||||||
else if (Token::Match(tok, "[;{}] %str%") || Token::Match(tok, "[;{}] %num%"))
|
else if (Token::Match(tok, "[;{}] %str%") || Token::Match(tok, "[;{}] %num% !!."))
|
||||||
{
|
{
|
||||||
// bailout if there is a "? :" in this statement
|
// bailout if there is a "? :" in this statement
|
||||||
bool bailout = false;
|
bool bailout = false;
|
||||||
|
|
|
@ -69,6 +69,7 @@ private:
|
||||||
TEST_CASE(conditionalcall); // ; 0==x ? X() : Y();
|
TEST_CASE(conditionalcall); // ; 0==x ? X() : Y();
|
||||||
TEST_CASE(structinit); // #2462 : ABC abc{1,2,3};
|
TEST_CASE(structinit); // #2462 : ABC abc{1,2,3};
|
||||||
TEST_CASE(returnstruct);
|
TEST_CASE(returnstruct);
|
||||||
|
TEST_CASE(cast); // #3009 : (struct Foo *)123.a = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void test1()
|
void test1()
|
||||||
|
@ -201,6 +202,14 @@ private:
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cast()
|
||||||
|
{
|
||||||
|
check("void f() {\n"
|
||||||
|
" ((struct foo *)(0x1234))->xy = 1;\n"
|
||||||
|
"}");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
REGISTER_TEST(TestIncompleteStatement)
|
REGISTER_TEST(TestIncompleteStatement)
|
||||||
|
|
Loading…
Reference in New Issue