diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-02-16 02:14:24 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-02-16 02:14:24 +0000 |
commit | 588fc83c74edfdc97458e7b692dfe5ac6ca4ae23 (patch) | |
tree | 1cc0f164cf71abf95b11974602918c3a9b2e6cac /clang/test/Sema/format-strings.c | |
parent | d7eb69364310c32a5ca5d7dc943abeb84b74c2d7 (diff) | |
download | bcm5719-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.c | 5 |
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; |