blob: b89ee421ced8abce305dd298aa952218dc4d4620 [file] [log] [blame]
David Majnemer3cba4952013-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 Majnemeree7e86c2013-08-22 10:04:41 +00005void signed_test() {
David Majnemer3cba4952013-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 Majnemera39da8e2013-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
David Majnemeree7e86c2013-08-22 10:04:41 +000016void unsigned_test() {
David Majnemera39da8e2013-08-22 07:53:21 +000017 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 Majnemer3cba4952013-08-21 21:54:46 +000025}