Home | History | Annotate | Download | only in Sema
      1 // RUN: %clang_cc1 -triple i686-linux-gnu -fsyntax-only -verify -std=c99 -Wformat-non-iso %s
      2 
      3 int printf(const char *restrict, ...);
      4 int scanf(const char * restrict, ...);
      5 
      6 void f(void) {
      7   char *cp;
      8 
      9   // The 'q' length modifier.
     10   printf("%qd", (long long)42); // expected-warning{{'q' length modifier is not supported by ISO C}} expected-note{{did you mean to use 'll'?}}
     11   scanf("%qd", (long long *)0); // expected-warning{{'q' length modifier is not supported by ISO C}} expected-note{{did you mean to use 'll'?}}
     12 
     13   // The 'm' length modifier.
     14   scanf("%ms", &cp); // expected-warning{{'m' length modifier is not supported by ISO C}}
     15 
     16   // The 'S' and 'C' conversion specifiers.
     17   printf("%S", L"foo"); // expected-warning{{'S' conversion specifier is not supported by ISO C}}
     18   printf("%C", L'x'); // expected-warning{{'C' conversion specifier is not supported by ISO C}}
     19 
     20   // Combining 'L' with an integer conversion specifier.
     21   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'?}}
     22   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'?}}
     23   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'?}}
     24   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'?}}
     25   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'?}}
     26 
     27   // Positional arguments.
     28   printf("%1$d", 42); // expected-warning{{positional arguments are not supported by ISO C}}
     29 }
     30