aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/format-strings.c
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-02-16 02:14:24 +0000
committerTed Kremenek <kremenek@apple.com>2010-02-16 02:14:24 +0000
commit0da9e9582832ee776030a38420fc851b0118b598 (patch)
tree7ff692f79efb3ecd62da394231d0fa0f813f290a /test/Sema/format-strings.c
parent9715082c882617eee831af51979c332ab0e71f0d (diff)
Add test case to show that Clang now checks the format string
arguments of asprintf (<rdar://problem/6657191>). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96319 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/format-strings.c')
-rw-r--r--test/Sema/format-strings.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c
index 8c2788d3a2..f1fa6580e3 100644
--- a/test/Sema/format-strings.c
+++ b/test/Sema/format-strings.c
@@ -183,10 +183,13 @@ void test11(void *p, char *s) {
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;