Fixed #3009 (Using numeric constants in kernel space code)

This commit is contained in:
Daniel Marjamäki 2011-08-16 20:16:33 +02:00
parent a6c5eff1be
commit 4f962acf16
2 changed files with 10 additions and 1 deletions

View File

@ -3009,7 +3009,7 @@ void CheckOther::checkIncompleteStatement()
else if (tok->str() == "{" && Token::Match(tok->tokAt(-2), "%type% %var%"))
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
bool bailout = false;

View File

@ -69,6 +69,7 @@ private:
TEST_CASE(conditionalcall); // ; 0==x ? X() : Y();
TEST_CASE(structinit); // #2462 : ABC abc{1,2,3};
TEST_CASE(returnstruct);
TEST_CASE(cast); // #3009 : (struct Foo *)123.a = 1;
}
void test1()
@ -201,6 +202,14 @@ private:
"}");
ASSERT_EQUALS("", errout.str());
}
void cast()
{
check("void f() {\n"
" ((struct foo *)(0x1234))->xy = 1;\n"
"}");
ASSERT_EQUALS("", errout.str());
}
};
REGISTER_TEST(TestIncompleteStatement)