================
@@ -0,0 +1,143 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wmissing-format-attribute %s
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <uchar.h>
+#include <wchar.h>
+
+__attribute__((__format__ (__scanf__, 1, 4)))
+void f1(char *out, const size_t len, const char *format, ... /* args */)
+{
+ va_list args;
+ vsnprintf(out, len, format, args); // expected-warning {{diagnostic
behavior may be improved by adding the 'printf' format attribute to the
declaration of 'f1'}}
+ // CHECK-FIXES:
__attribute__((format(printf, 1, 4)))
----------------
aaronpuchert wrote:
Shouldn't it be `__attribute__((format(printf, 3, 4)))`, since the format
string is the third argument? The first argument is just the target buffer.
https://github.com/llvm/llvm-project/pull/70024
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits