1*67e74705SXin Li /* RUN: %clang_cc1 -fsyntax-only -verify -triple i386-apple-darwin9 -Wformat-non-iso -std=c89 %s
2*67e74705SXin Li */
3*67e74705SXin Li
4*67e74705SXin Li int scanf(const char * restrict, ...);
5*67e74705SXin Li int printf(const char *restrict, ...);
6*67e74705SXin Li
foo(char ** sp,float * fp,int * ip)7*67e74705SXin Li void foo(char **sp, float *fp, int *ip) {
8*67e74705SXin Li scanf("%as", sp); /* expected-warning{{'a' length modifier is not supported by ISO C}} */
9*67e74705SXin Li scanf("%a[abc]", sp); /* expected-warning{{'a' length modifier is not supported by ISO C}} */
10*67e74705SXin Li
11*67e74705SXin Li /* TODO: Warn that the 'a' conversion specifier is a C99 feature. */
12*67e74705SXin Li scanf("%a", fp);
13*67e74705SXin Li scanf("%afoobar", fp);
14*67e74705SXin Li printf("%a", 1.0);
15*67e74705SXin Li printf("%as", 1.0);
16*67e74705SXin Li printf("%aS", 1.0);
17*67e74705SXin Li printf("%a[", 1.0);
18*67e74705SXin Li printf("%afoo", 1.0);
19*67e74705SXin Li
20*67e74705SXin Li scanf("%da", ip);
21*67e74705SXin Li
22*67e74705SXin Li /* Test argument type check for the 'a' length modifier. */
23*67e74705SXin Li scanf("%as", fp); /* expected-warning{{format specifies type 'char **' but the argument has type 'float *'}}
24*67e74705SXin Li expected-warning{{'a' length modifier is not supported by ISO C}} */
25*67e74705SXin Li scanf("%aS", fp); /* expected-warning{{format specifies type 'wchar_t **' (aka 'int **') but the argument has type 'float *'}}
26*67e74705SXin Li expected-warning{{'a' length modifier is not supported by ISO C}}
27*67e74705SXin Li expected-warning{{'S' conversion specifier is not supported by ISO C}} */
28*67e74705SXin Li scanf("%a[abc]", fp); /* expected-warning{{format specifies type 'char **' but the argument has type 'float *'}}
29*67e74705SXin Li expected-warning{{'a' length modifier is not supported by ISO C}} */
30*67e74705SXin Li }
31