format-strings-ms.c revision df72071db0ddfd7264485105c19230c315e8ce2c
1// RUN: %clang_cc1 -fsyntax-only -verify -fms-compatibility -triple=i386-pc-win32 -pedantic %s 2 3int printf(const char *format, ...) __attribute__((format(printf, 1, 2))); 4 5void unsigned_test() { 6 short val = 30; 7 printf("val = %I64d\n", val); // expected-warning{{'I64' length modifier is not supported by ISO C}} \ 8 // expected-warning{{format specifies type '__int64' (aka 'long long') but the argument has type 'short'}} 9 long long bigval = 30; 10 printf("val = %I32d\n", bigval); // expected-warning{{'I32' length modifier is not supported by ISO C}} \ 11 // expected-warning{{format specifies type '__int32' (aka 'int') but the argument has type 'long long'}} 12 printf("val = %Id\n", bigval); // expected-warning{{'I' length modifier is not supported by ISO C}} \ 13 // expected-warning{{format specifies type '__int32' (aka 'int') but the argument has type 'long long'}} 14} 15 16void signed_test() { 17 unsigned short val = 30; 18 printf("val = %I64u\n", val); // expected-warning{{'I64' length modifier is not supported by ISO C}} \ 19 // expected-warning{{format specifies type 'unsigned __int64' (aka 'unsigned long long') but the argument has type 'unsigned short'}} 20 unsigned long long bigval = 30; 21 printf("val = %I32u\n", bigval); // expected-warning{{'I32' length modifier is not supported by ISO C}} \ 22 // expected-warning{{format specifies type 'unsigned __int32' (aka 'unsigned int') but the argument has type 'unsigned long long'}} 23 printf("val = %Iu\n", bigval); // expected-warning{{'I' length modifier is not supported by ISO C}} \ 24 // expected-warning{{format specifies type 'unsigned __int32' (aka 'unsigned int') but the argument has type 'unsigned long long'}} 25} 26