Partial fix for #11770 cppcheckError with unknown macro
This commit is contained in:
parent
c033c62190
commit
9579b4509d
|
@ -8106,6 +8106,8 @@ void Tokenizer::reportUnknownMacros() const
|
||||||
else
|
else
|
||||||
unknownMacroError(tok);
|
unknownMacroError(tok);
|
||||||
}
|
}
|
||||||
|
} else if (isCPP() && Token::Match(tok, "public|private|protected %name% :")) {
|
||||||
|
unknownMacroError(tok->next());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6936,6 +6936,14 @@ private:
|
||||||
ASSERT_THROW_EQUALS(tokenizeAndStringify("int f() { MACRO(x) return 0; }"),
|
ASSERT_THROW_EQUALS(tokenizeAndStringify("int f() { MACRO(x) return 0; }"),
|
||||||
InternalError,
|
InternalError,
|
||||||
"There is an unknown macro here somewhere. Configuration is required. If MACRO is a macro then please configure it.");
|
"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.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue