+
+alpha.valist.CopyToSelf
+(C)
+Calls to the va_copy macro should not copy onto itself. |
+
+
+#include <stdarg.h>
+
+void test(int x, ...) {
+ va_list args;
+ va_start(args, x);
+ va_copy(args, args); // warn
+ va_end(args);
+}
+ |
+
+
+alpha.valist.Uninitialized
+(C)
+Calls to the va_arg , va_copy , or
+va_end macro must happen after calling va_start and
+before calling va_end . |
+
+
+#include <stdarg.h>
+
+void test(int x, ...) {
+ va_list args;
+ int y = va_arg(args, int); // warn
+}
+
+
+#include <stdarg.h>
+
+void test(int x, ...) {
+ va_list args;
+ va_start(args, x);
+ va_end(args);
+ int z = va_arg(args, int); // warn
+}
+ |
+
+
+alpha.valist.Unterminated
+(C)
+Every va_start must be matched by a va_end . A va_list
+can only be ended once. |
+
+
+#include <stdarg.h>
+
+void test(int x, ...) {
+ va_list args;
+ va_start(args, x);
+ int y = x + va_arg(args, int);
+} // warn: missing va_end
+ |
+
+