block-printf-attribute-1.c revision ce506ae231703a23ea95335cd4de19c60082f361
1a5728872c7702ddd09537c95bc3cbd20e1f2fb09Daniel Dunbar// RUN: %clang_cc1 %s -fsyntax-only -verify -fblocks 2d66f22d9f8423579322a6dd16587ed52b0a58834Fariborz Jahanian 31eb4433ac451dc16f4133a88af2d002ac26c58efMike Stumpint main() { 41eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump void (^b) (int arg, const char * format, ...) __attribute__ ((__format__ (__printf__, 1, 3))) = // expected-error {{format argument not a string type}} 51eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump ^ __attribute__ ((__format__ (__printf__, 1, 3))) (int arg, const char * format, ...) {}; // expected-error {{format argument not a string type}} 6d66f22d9f8423579322a6dd16587ed52b0a58834Fariborz Jahanian 71eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump void (^z) (int arg, const char * format, ...) __attribute__ ((__format__ (__printf__, 2, 3))) = ^ __attribute__ ((__format__ (__printf__, 2, 3))) (int arg, const char * format, ...) {}; 8d66f22d9f8423579322a6dd16587ed52b0a58834Fariborz Jahanian 9ce506ae231703a23ea95335cd4de19c60082f361Ted Kremenek z(1, "%s", 1); // expected-warning{{format specifies type 'char *' but the argument has type 'int'}} 104e4b30ec62d78b24e6556fea2624855c193d0e3eTed Kremenek z(1, "%s", "HELLO"); // no-warning 11d66f22d9f8423579322a6dd16587ed52b0a58834Fariborz Jahanian} 12