[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Sema / format-type-confusion.c
blob03b7b8b8a8c91f61c93738b30933eac9c3ffe8b6
1 // RUN: %clang_cc1 -triple x86_64-apple-darwin9.0 -fsyntax-only -verify -Wno-format -Wformat-type-confusion %s
3 __attribute__((format(__printf__, 1, 2)))
4 int printf(const char *msg, ...);
6 #define FMT "%hd %hu %d %u %hhd %hhu %c"
8 int main(void) {
9 _Bool b = 0;
10 printf(FMT,
11 b, // expected-warning {{format specifies type 'short' but the argument has type '_Bool'}}
12 b, // expected-warning {{format specifies type 'unsigned short' but the argument has type '_Bool'}}
13 b, b, b, b, b);
15 unsigned char uc = 0;
16 printf(FMT,
17 uc, // expected-warning {{format specifies type 'short' but the argument has type 'unsigned char'}}
18 uc, // expected-warning {{format specifies type 'unsigned short' but the argument has type 'unsigned char'}}
19 uc, uc, uc, uc, uc);
21 signed char sc = 0;
22 printf(FMT,
23 sc, // expected-warning {{format specifies type 'short' but the argument has type 'signed char'}}
24 sc, // expected-warning {{format specifies type 'unsigned short' but the argument has type 'signed char'}}
25 sc, sc, sc, sc, sc);