Tokenizer: remove unnamed anonymous structures and unions (#1493)
This commit is contained in:
parent
92fe14e7f0
commit
0fb680d887
|
@ -6854,6 +6854,16 @@ void Tokenizer::simplifyStructDecl()
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
tok->insertToken(name.c_str());
|
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();
|
tok = tok1->next();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2100,6 +2100,20 @@ private:
|
||||||
" void foo() { }\n"
|
" void foo() { }\n"
|
||||||
"};");
|
"};");
|
||||||
ASSERT_EQUALS("[test.cpp:4]: (style) The function 'Fred::foo' can be const\n", errout.str());
|
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()
|
void const7()
|
||||||
|
|
Loading…
Reference in New Issue