block-printf-attribute-1.c revision 1eb4433ac451dc16f4133a88af2d002ac26c58ef
1d66f22d9f8423579322a6dd16587ed52b0a58834Fariborz Jahanian// RUN: clang-cc %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 91eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump // FIXME: argument type poking not yet supportted. 101eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump z(1, "%s", 1); /* { dg-warning "format \\'\%s\\' expects type \\'char \\*\\'\, but argument 3 has type \\'int\\'" } */ 111eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump z(1, "%s", "HELLO"); // OK 12d66f22d9f8423579322a6dd16587ed52b0a58834Fariborz Jahanian} 13