David Majnemer | 47ad6ce | 2013-08-21 21:54:46 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -fms-compatibility -triple=i386-pc-win32 -pedantic %s |
| 2 | |
| 3 | int printf(const char *format, ...) __attribute__((format(printf, 1, 2))); |
| 4 | |
David Majnemer | df72071 | 2013-08-22 07:53:21 +0000 | [diff] [blame^] | 5 | void unsigned_test() { |
David Majnemer | 47ad6ce | 2013-08-21 21:54:46 +0000 | [diff] [blame] | 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'}} |
David Majnemer | df72071 | 2013-08-22 07:53:21 +0000 | [diff] [blame^] | 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 | |
| 16 | void 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 Majnemer | 47ad6ce | 2013-08-21 21:54:46 +0000 | [diff] [blame] | 25 | } |