xref: /minix3/external/bsd/llvm/dist/clang/test/Sema/format-strings-non-iso.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple i686-linux-gnu -fsyntax-only -verify -std=c99 -Wformat-non-iso %s
2f4a2713aSLionel Sambuc 
3f4a2713aSLionel Sambuc int printf(const char *restrict, ...);
4f4a2713aSLionel Sambuc int scanf(const char * restrict, ...);
5f4a2713aSLionel Sambuc 
f(void)6f4a2713aSLionel Sambuc void f(void) {
7f4a2713aSLionel Sambuc   char *cp;
8f4a2713aSLionel Sambuc 
9f4a2713aSLionel Sambuc   // The 'q' length modifier.
10f4a2713aSLionel Sambuc   printf("%qd", (long long)42); // expected-warning{{'q' length modifier is not supported by ISO C}} expected-note{{did you mean to use 'll'?}}
11f4a2713aSLionel Sambuc   scanf("%qd", (long long *)0); // expected-warning{{'q' length modifier is not supported by ISO C}} expected-note{{did you mean to use 'll'?}}
12f4a2713aSLionel Sambuc 
13f4a2713aSLionel Sambuc   // The 'm' length modifier.
14f4a2713aSLionel Sambuc   scanf("%ms", &cp); // expected-warning{{'m' length modifier is not supported by ISO C}}
15f4a2713aSLionel Sambuc 
16f4a2713aSLionel Sambuc   // The 'S' and 'C' conversion specifiers.
17f4a2713aSLionel Sambuc   printf("%S", L"foo"); // expected-warning{{'S' conversion specifier is not supported by ISO C}}
18f4a2713aSLionel Sambuc   printf("%C", L'x'); // expected-warning{{'C' conversion specifier is not supported by ISO C}}
19f4a2713aSLionel Sambuc 
20f4a2713aSLionel Sambuc   // Combining 'L' with an integer conversion specifier.
21f4a2713aSLionel Sambuc   printf("%Li", (long long)42); // expected-warning{{using length modifier 'L' with conversion specifier 'i' is not supported by ISO C}} expected-note{{did you mean to use 'll'?}}
22f4a2713aSLionel Sambuc   printf("%Lo", (long long)42); // expected-warning{{using length modifier 'L' with conversion specifier 'o' is not supported by ISO C}} expected-note{{did you mean to use 'll'?}}
23f4a2713aSLionel Sambuc   printf("%Lu", (long long)42); // expected-warning{{using length modifier 'L' with conversion specifier 'u' is not supported by ISO C}} expected-note{{did you mean to use 'll'?}}
24f4a2713aSLionel Sambuc   printf("%Lx", (long long)42); // expected-warning{{using length modifier 'L' with conversion specifier 'x' is not supported by ISO C}} expected-note{{did you mean to use 'll'?}}
25f4a2713aSLionel Sambuc   printf("%LX", (long long)42); // expected-warning{{using length modifier 'L' with conversion specifier 'X' is not supported by ISO C}} expected-note{{did you mean to use 'll'?}}
26f4a2713aSLionel Sambuc 
27f4a2713aSLionel Sambuc   // Positional arguments.
28f4a2713aSLionel Sambuc   printf("%1$d", 42); // expected-warning{{positional arguments are not supported by ISO C}}
29f4a2713aSLionel Sambuc }
30