Tokenizer: remove unnamed anonymous structures and unions (#1493)

This commit is contained in:
Robert Reif 2010-03-19 19:04:56 +01:00 committed by Daniel Marjamäki
parent 92fe14e7f0
commit 0fb680d887
2 changed files with 24 additions and 0 deletions

View File

@ -6854,6 +6854,16 @@ void Tokenizer::simplifyStructDecl()
tok = tok->next();
tok->insertToken(name.c_str());
}
else if (tok->next()->str() == ";")
{
Token *previous = tok1->previous();
previous->deleteNext();
previous->deleteNext();
tok1 = previous->next();
previous = tok->previous();
previous->deleteNext();
previous->deleteNext();
}
tok = tok1->next();
}

View File

@ -2100,6 +2100,20 @@ private:
" void foo() { }\n"
"};");
ASSERT_EQUALS("[test.cpp:4]: (style) The function 'Fred::foo' can be const\n", errout.str());
checkConst("struct fast_string\n"
"{\n"
" union\n"
" {\n"
" char buff[100];\n"
" };\n"
" void set_type(char t);\n"
"};\n"
"inline void fast_string::set_type(char t)\n"
"{\n"
" buff[10] = t;\n"
"}");
ASSERT_EQUALS("", errout.str());
}
void const7()