Fixed false positive #6453: Skip over inner class if checking outer function
This commit is contained in:
parent
e56671101e
commit
e82d2b3c8d
|
@ -39,7 +39,9 @@ void CheckVaarg::va_start_argument()
|
|||
const Scope* scope = symbolDatabase->functionScopes[i];
|
||||
const Function* function = scope->function;
|
||||
for (const Token* tok = scope->classStart->next(); tok != scope->classEnd; tok = tok->next()) {
|
||||
if (Token::simpleMatch(tok, "va_start (")) {
|
||||
if (!tok->scope()->isExecutable())
|
||||
tok = tok->scope()->classEnd;
|
||||
else if (Token::simpleMatch(tok, "va_start (")) {
|
||||
const Token* param2 = tok->tokAt(2)->nextArgument();
|
||||
if (!param2)
|
||||
continue;
|
||||
|
|
|
@ -90,6 +90,18 @@ private:
|
|||
" va_end(arg_ptr);\n"
|
||||
"}"); // Don't crash if less than expected arguments are given.
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("void assertf_fail(const char *assertion, const char *file, int line, const char *func, const char* msg, ...) {\n"
|
||||
" struct A {\n"
|
||||
" A(char* buf, int size) {}\n"
|
||||
" void printf(const char * format, ...) {\n"
|
||||
" va_list args;\n"
|
||||
" va_start(args, format);\n"
|
||||
" va_end(args);\n"
|
||||
" }\n"
|
||||
" };\n"
|
||||
"}"); // Inner class (#6453)
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void referenceAs_va_start() {
|
||||
|
|
Loading…
Reference in New Issue