summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/format-strings-c90.c
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2012-01-12 17:11:12 +0000
committerHans Wennborg <hans@hanshq.net>2012-01-12 17:11:12 +0000
commit6073e31baa3af760adbf4ec1688d6fb51bf89e0c (patch)
tree0b721c8977980f19f6d73c4d14fef4c2f5e40115 /clang/test/Sema/format-strings-c90.c
parentbf3a826f2cf7975cf6d92de325e00e50ede04cba (diff)
downloadbcm5719-llvm-6073e31baa3af760adbf4ec1688d6fb51bf89e0c.tar.gz
bcm5719-llvm-6073e31baa3af760adbf4ec1688d6fb51bf89e0c.zip
scanf: parse the 'm' length modifier, and check that the right arguments
are used with that and the 'a' length modifier. llvm-svn: 148029
Diffstat (limited to 'clang/test/Sema/format-strings-c90.c')
-rw-r--r--clang/test/Sema/format-strings-c90.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/test/Sema/format-strings-c90.c b/clang/test/Sema/format-strings-c90.c
index 74e5fb17ccf..678a6ef373a 100644
--- a/clang/test/Sema/format-strings-c90.c
+++ b/clang/test/Sema/format-strings-c90.c
@@ -1,4 +1,4 @@
-/* RUN: %clang_cc1 -fsyntax-only -verify -pedantic -std=c89 %s
+/* RUN: %clang_cc1 -fsyntax-only -verify -triple i386-apple-darwin9 -pedantic -std=c89 %s
*/
int scanf(const char * restrict, ...);
@@ -19,4 +19,9 @@ void foo(char **sp, float *fp, int *ip) {
printf("%afoo", 1.0);
scanf("%da", ip);
+
+ /* Test argument type check for the 'a' length modifier. */
+ scanf("%as", fp); /* expected-warning{{conversion specifies type 'char **' but the argument has type 'float *'}} */
+ scanf("%aS", fp); /* expected-warning{{conversion specifies type 'wchar_t **' (aka 'int **') but the argument has type 'float *'}} */
+ scanf("%a[abc]", fp); /* expected-warning{{conversion specifies type 'char **' but the argument has type 'float *'}} */
}
OpenPOWER on IntegriCloud