Fixed #2355 (simplifyTypedef: wrong simplification of 'typedef FMAC1 void (*a)();')

This commit is contained in:
Daniel Marjamäki 2010-12-28 14:04:44 +01:00
parent 80afa7a04f
commit 0667fcf53c
2 changed files with 19 additions and 0 deletions

View File

@ -947,6 +947,15 @@ void Tokenizer::simplifyTypedef()
// or a function typedef
else if (Token::Match(tok->tokAt(offset), "("))
{
if (typeName->str() == "void")
{
unsupportedTypedef(typeDef);
// unhandled typedef, skip it and continue
tok = tok->tokAt(offset);
continue;
}
function = true;
if (tok->tokAt(offset)->link()->next())
{

View File

@ -225,6 +225,7 @@ private:
TEST_CASE(simplifyTypedef65); // ticket #2314
TEST_CASE(simplifyTypedef66); // ticket #2341
TEST_CASE(simplifyTypedef67); // ticket #2354
TEST_CASE(simplifyTypedef68); // ticket #2355
TEST_CASE(simplifyTypedefFunction1);
TEST_CASE(simplifyTypedefFunction2); // ticket #1685
@ -4635,6 +4636,15 @@ private:
ASSERT_EQUALS("", errout.str());
}
void simplifyTypedef68() // ticket #2355
{
const char code[] = "typedef FMAC1 void (* a) ();\n"
"void *(*b) ();\n";
const std::string actual(sizeof_(code));
ASSERT_EQUALS("typedef FMAC1 void ( * a ) ( ) ; void * * b ;", actual);
ASSERT_EQUALS("", errout.str());
}
void simplifyTypedefFunction1()
{
{