blob: 88f6dec50a25e373707495008bc31ffe7eaf1bdd [file] [log] [blame]
David Majnemer47ad6ce2013-08-21 21:54:46 +00001// 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
David Majnemerdf720712013-08-22 07:53:21 +00005void unsigned_test() {
David Majnemer47ad6ce2013-08-21 21:54:46 +00006 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'}}
David Majnemerdf720712013-08-22 07:53:21 +00009 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'}}
David Majnemer47ad6ce2013-08-21 21:54:46 +000025}