analyzer: associate -Wanalyzer-va-list-exhausted with CWE-685
authorDavid Malcolm <dmalcolm@redhat.com>
Thu, 16 Jun 2022 21:33:40 +0000 (17:33 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Thu, 16 Jun 2022 21:33:40 +0000 (17:33 -0400)
commitf443024bca7c1ac988eb7c05e639b017347ee714
tree95c1477f070391d5b7e87790dd5ab4842e6ac0ff
parent065d191893234c1b2e4554fd78ba339d9b7d03e9
analyzer: associate -Wanalyzer-va-list-exhausted with CWE-685

gcc/analyzer/ChangeLog:
* varargs.cc: Include "diagnostic-metadata.h".
(va_list_exhausted::emit): Associate the warning with
CWE-685 ("Function Call With Incorrect Number of Arguments").

gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/stdarg-1.c
(__analyzer_called_by_test_not_enough_args): Verify that
-Wanalyzer-va-list-exhausted is associated with CWE-685.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/analyzer/varargs.cc
gcc/testsuite/gcc.dg/analyzer/stdarg-1.c