1 // RUN: %clang_cc1 -xc %s -verify -DBOOL=_Bool
2 // RUN: %clang_cc1 -xc++ %s -verify -DBOOL=bool
3 // RUN: %clang_cc1 -xobjective-c %s -verify -DBOOL=_Bool
4 // RUN: %clang_cc1 -xc %s -verify -DBOOL=_Bool -Wformat-type-confusion -DTYPE_CONF
5 // RUN: %clang_cc1 -xc++ %s -verify -DBOOL=bool -Wformat-type-confusion -DTYPE_CONF
7 __attribute__((format(__printf__
, 1, 2)))
8 int p(const char *fmt
, ...);
14 +(NSString
*)stringWithFormat
:(NSString
*)fmt
, ...
15 __attribute__((format(__NSString__
, 1, 2)));
18 #define YES __objc_yes
26 // expected-warning@-2 {{format specifies type 'short' but the argument has type}}
32 // expected-warning@-2 {{format specifies type 'unsigned short' but the argument has type}}
35 p("%c", b
); // expected-warning {{using '%c' format specifier, but argument has boolean value}}
36 p("%lc", b
); // expected-warning {{using '%lc' format specifier, but argument has boolean value}}
37 p("%c", 1 == 1); // expected-warning {{using '%c' format specifier, but argument has boolean value}}
38 p("%f", b
); // expected-warning{{format specifies type 'double' but the argument has type}}
39 p("%ld", b
); // expected-warning{{format specifies type 'long' but the argument has type}}
40 p("%lld", b
); // expected-warning{{format specifies type 'long long' but the argument has type}}
43 [NSString stringWithFormat
: @
"%c", 0]; // probably fine?
44 [NSString stringWithFormat
: @
"%c", NO
]; // expected-warning {{using '%c' format specifier, but argument has boolean value}}