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