summaryrefslogtreecommitdiffstats
path: root/clang/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
commit588fc83c74edfdc97458e7b692dfe5ac6ca4ae23 (patch)
tree1cc0f164cf71abf95b11974602918c3a9b2e6cac /clang/test/Sema/format-strings.c
parentd7eb69364310c32a5ca5d7dc943abeb84b74c2d7 (diff)
downloadbcm5719-llvm-588fc83c74edfdc97458e7b692dfe5ac6ca4ae23.tar.gz
bcm5719-llvm-588fc83c74edfdc97458e7b692dfe5ac6ca4ae23.zip
Add test case to show that Clang now checks the format string
arguments of asprintf (<rdar://problem/6657191>). llvm-svn: 96319
Diffstat (limited to 'clang/test/Sema/format-strings.c')
-rw-r--r--clang/test/Sema/format-strings.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/test/Sema/format-strings.c b/clang/test/Sema/format-strings.c
index 8c2788d3a25..f1fa6580e3b 100644
--- a/clang/test/Sema/format-strings.c
+++ b/clang/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;
OpenPOWER on IntegriCloud