[cfe-commits] r96319 - /cfe/trunk/test/Sema/format-strings.c
Ted Kremenek
kremenek at apple.com
Mon Feb 15 18:14:24 PST 2010
Author: kremenek
Date: Mon Feb 15 20:14:24 2010
New Revision: 96319
URL: http://llvm.org/viewvc/llvm-project?rev=96319&view=rev
Log:
Add test case to show that Clang now checks the format string
arguments of asprintf (<rdar://problem/6657191>).
Modified:
cfe/trunk/test/Sema/format-strings.c
Modified: cfe/trunk/test/Sema/format-strings.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/format-strings.c?rev=96319&r1=96318&r2=96319&view=diff
==============================================================================
--- cfe/trunk/test/Sema/format-strings.c (original)
+++ cfe/trunk/test/Sema/format-strings.c Mon Feb 15 20:14:24 2010
@@ -183,10 +183,13 @@
printf("%0s", p); // expected-warning{{flag '0' results in undefined behavior in 's' conversion specifier}}
}
-void test12() {
+void test12(char *b) {
unsigned char buf[4];
printf ("%.4s\n", buf); // no-warning
printf ("%.4s\n", &buf); // expected-warning{{conversion specifies type 'char *' but the argument has type 'unsigned char (*)[4]'}}
+
+ // Verify that we are checking asprintf
+ asprintf(&b, "%d", "asprintf"); // expected-warning{{conversion specifies type 'int' but the argument has type 'char *'}}
}
typedef struct __aslclient *aslclient;
More information about the cfe-commits
mailing list