blob: 678a6ef373a6ecf0604dd65524a6b3644075b995 [file] [log] [blame]
Hans Wennborg37969b72012-01-12 17:11:12 +00001/* RUN: %clang_cc1 -fsyntax-only -verify -triple i386-apple-darwin9 -pedantic -std=c89 %s
Hans Wennborgd02deeb2011-12-15 10:25:47 +00002 */
3
4int scanf(const char * restrict, ...);
5int printf(const char *restrict, ...);
6
7void foo(char **sp, float *fp, int *ip) {
8 /* TODO: Warn that the 'a' length modifier is an extension. */
9 scanf("%as", sp);
Hans Wennborg28058d12012-01-12 15:07:16 +000010 scanf("%a[abc]", sp);
Hans Wennborgd02deeb2011-12-15 10:25:47 +000011
12 /* TODO: Warn that the 'a' conversion specifier is a C99 feature. */
13 scanf("%a", fp);
14 scanf("%afoobar", fp);
15 printf("%a", 1.0);
16 printf("%as", 1.0);
17 printf("%aS", 1.0);
18 printf("%a[", 1.0);
19 printf("%afoo", 1.0);
20
21 scanf("%da", ip);
Hans Wennborg37969b72012-01-12 17:11:12 +000022
23 /* Test argument type check for the 'a' length modifier. */
24 scanf("%as", fp); /* expected-warning{{conversion specifies type 'char **' but the argument has type 'float *'}} */
25 scanf("%aS", fp); /* expected-warning{{conversion specifies type 'wchar_t **' (aka 'int **') but the argument has type 'float *'}} */
26 scanf("%a[abc]", fp); /* expected-warning{{conversion specifies type 'char **' but the argument has type 'float *'}} */
Hans Wennborgd02deeb2011-12-15 10:25:47 +000027}