================ @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wmissing-format-attribute %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c99 -Wmissing-format-attribute %s + +#include <stdarg.h> +#include <stdio.h> + +va_list args; + +__attribute__((__format__ (__scanf__, 1, 4))) +void foo(char *out, const size_t len, const char *format, ... /* args */) +{ + vsnprintf(out, len, format, args); // expected-warning {{Function 'foo' might be candidate for 'printf' format attribute}} ---------------- aaronpuchert wrote:
Add a test where we're calling the function with non-argument format string and variadic arguments. Then the warning should not be emitted. Not sure about mixing argument format string and non-argument variadic arguments and the other way around, but these should probably not warn either, since we can't propagate the attribute. Also where we're taking a `va_list` as argument and forwarding that. This should also warn. https://github.com/llvm/llvm-project/pull/70024 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits