Fixed #4561 (cppcheck 1.58 crashes on empty signals block in headerfile)
This commit is contained in:
parent
ad61ed2f93
commit
463121be71
|
@ -8790,7 +8790,7 @@ void Tokenizer::simplifyBitfields()
|
|||
tok->next()->str() != "default") {
|
||||
const bool offset = (tok->next()->str() == "const");
|
||||
|
||||
if (tok->strAt(3 + (offset ? 1 : 0)) != "{") {
|
||||
if (!Token::Match(tok->tokAt(3 + (offset ? 1 : 0)), "[{};]")) {
|
||||
tok->deleteNext(4 + (offset ? 1 : 0));
|
||||
goback = true;
|
||||
}
|
||||
|
|
|
@ -419,6 +419,7 @@ private:
|
|||
TEST_CASE(bitfields11); // ticket #2845 (segmentation fault)
|
||||
TEST_CASE(bitfields12); // ticket #3485 (segmentation fault)
|
||||
TEST_CASE(bitfields13); // ticket #3502 (segmentation fault)
|
||||
TEST_CASE(bitfields14); // ticket #4561 (segfault for 'class a { signals: };')
|
||||
|
||||
TEST_CASE(simplifyNamespaceStd);
|
||||
|
||||
|
@ -6846,6 +6847,11 @@ private:
|
|||
ASSERT_EQUALS("x y ;", tokenizeAndStringify("struct{x y:};\n",false));
|
||||
}
|
||||
|
||||
void bitfields14() { // #4561 - crash for 'signals:'
|
||||
ASSERT_EQUALS("class x { signals : } ;", tokenizeAndStringify("class x { signals: };\n",false));
|
||||
}
|
||||
|
||||
|
||||
void simplifyNamespaceStd() {
|
||||
static const char code1[] = "map<foo, bar> m;"; // namespace std is not used
|
||||
ASSERT_EQUALS("map < foo , bar > m ;", tokenizeAndStringify(code1, false));
|
||||
|
|
Loading…
Reference in New Issue