Package: cppcheck Version: 1.90-4 Severity: normal Hi!
There's a false positive on missing va_end() after a non-returning function. Either because it contains f.ex. an explicit exit() or because it is marked with attribute __noreturn__. Attached a test case. Thanks. Guillem
#include <stdarg.h> #include <stdlib.h> #include <stdio.h> static void __attribute__((__noreturn__)) __attribute__((__format__(__printf__, 1, 0))) notreturning(const char *fmt, va_list args) { va_list args_copy; va_copy(args_copy, args); vprintf(fmt, args_copy); va_end(args_copy); exit(1); } static void check_noret_va_end(const char *fmt, ...) { va_list args; va_start(args, fmt); notreturning(fmt, args); } int main() { check_noret_va_end("some error"); return 0; }