Fixed false positive #6066: va_list may be used after being copied.

This commit is contained in:
PKEuS 2014-08-18 10:40:39 +02:00
parent 5c54f8d0d8
commit a69860eb70
2 changed files with 9 additions and 1 deletions

View File

@ -104,7 +104,6 @@ void CheckVaarg::va_list_usage()
if (tok->linkAt(1)->previous()->varId() == var->declarationId()) { // Source
if (!open)
va_list_usedBeforeStartedError(tok, var->name());
nopen = false;
}
if (tok->tokAt(2)->varId() == var->declarationId()) { // Destination
if (open)

View File

@ -167,6 +167,15 @@ private:
" va_end(arg_ptr);\n"
"}");
ASSERT_EQUALS("", errout.str());
// #6066
check("void Format(va_list v1) {\n"
" va_list v2;\n"
" va_copy(v2, v1);\n"
" foo(va_arg(v1, float));\n"
" va_end(v2);\n"
"}");
ASSERT_EQUALS("", errout.str());
}
void va_start_subsequentCalls() {