Merge pull request #5158 from chrchr-github/chr_Fix11770
Partial fix for #11770 cppcheckError with unknown macro
This commit is contained in:
commit
3f0f9e4476
|
@ -8106,6 +8106,8 @@ void Tokenizer::reportUnknownMacros() const
|
|||
else
|
||||
unknownMacroError(tok);
|
||||
}
|
||||
} else if (isCPP() && Token::Match(tok, "public|private|protected %name% :")) {
|
||||
unknownMacroError(tok->next());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5513,7 +5513,7 @@ private:
|
|||
" QString s;\n"
|
||||
"public:\n"
|
||||
" C(QString);\n"
|
||||
"private slots:\n"
|
||||
"private:\n"
|
||||
" void f() {\n"
|
||||
" QVERIFY(QDir(s).exists());\n"
|
||||
" }\n"
|
||||
|
|
|
@ -2859,7 +2859,7 @@ private:
|
|||
|
||||
void symboldatabase2() {
|
||||
check("class foo {\n"
|
||||
"public slots :\n"
|
||||
"public:\n"
|
||||
"foo() { }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
|
|
@ -6936,6 +6936,21 @@ private:
|
|||
ASSERT_THROW_EQUALS(tokenizeAndStringify("int f() { MACRO(x) return 0; }"),
|
||||
InternalError,
|
||||
"There is an unknown macro here somewhere. Configuration is required. If MACRO is a macro then please configure it.");
|
||||
|
||||
ASSERT_THROW_EQUALS(tokenizeAndStringify("class C : public QObject {\n" // #11770
|
||||
" struct S { static void g() {} };\n"
|
||||
"private Q_SLOTS:\n"
|
||||
" void f() { S::g(); }\n"
|
||||
"};\n"),
|
||||
InternalError,
|
||||
"There is an unknown macro here somewhere. Configuration is required. If Q_SLOTS is a macro then please configure it.");
|
||||
ASSERT_THROW_EQUALS(tokenizeAndStringify("class C : public QObject {\n"
|
||||
" struct S { static void g() {} };\n"
|
||||
"private slots:\n"
|
||||
" void f() { S::g(); }\n"
|
||||
"};\n"),
|
||||
InternalError,
|
||||
"There is an unknown macro here somewhere. Configuration is required. If slots is a macro then please configure it.");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7074,7 +7074,7 @@ private:
|
|||
valueOfTok(code, "c");
|
||||
|
||||
code = "class T {\n"
|
||||
"private slots:\n"
|
||||
"private:\n"
|
||||
" void f() { D& r = dynamic_cast<D&>(*m); }\n"
|
||||
" void g() { m.reset(new D); }\n"
|
||||
"private:\n"
|
||||
|
|
Loading…
Reference in New Issue