1*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -verify -fsyntax-only %s 2f4a2713aSLionel Sambuc 3f4a2713aSLionel Sambuc@class NSString; 4f4a2713aSLionel Sambuc 5f4a2713aSLionel Sambucextern NSString *fa2 (const NSString *) __attribute__((format_arg(1))); 6f4a2713aSLionel Sambucextern NSString *fa3 (NSString *) __attribute__((format_arg(1))); 7f4a2713aSLionel Sambuc 8f4a2713aSLionel Sambucextern void fc1 (const NSString *) __attribute__((format_arg)); // expected-error {{'format_arg' attribute takes one argument}} 9f4a2713aSLionel Sambucextern void fc2 (const NSString *) __attribute__((format_arg())); // expected-error {{'format_arg' attribute takes one argument}} 10f4a2713aSLionel Sambucextern void fc3 (const NSString *) __attribute__((format_arg(1, 2))); // expected-error {{'format_arg' attribute takes one argument}} 11f4a2713aSLionel Sambuc 12*0a6a1f1dSLionel Sambucstruct s1 { int i; } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to functions}} 13*0a6a1f1dSLionel Sambucunion u1 { int i; } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to functions}} 14*0a6a1f1dSLionel Sambucenum e1 { E1V0 } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to functions}} 15f4a2713aSLionel Sambuc 16f4a2713aSLionel Sambucextern NSString *ff3 (const NSString *) __attribute__((format_arg(3-2))); 17f4a2713aSLionel Sambucextern NSString *ff4 (const NSString *) __attribute__((format_arg(foo))); // expected-error {{use of undeclared identifier 'foo'}} 18f4a2713aSLionel Sambuc 19f4a2713aSLionel Sambuc/* format_arg formats must take and return a string. */ 20f4a2713aSLionel Sambucextern NSString *fi0 (int) __attribute__((format_arg(1))); // expected-error {{format argument not a string type}} 21f4a2713aSLionel Sambucextern NSString *fi1 (NSString *) __attribute__((format_arg(1))); 22f4a2713aSLionel Sambuc 23f4a2713aSLionel Sambucextern NSString *fi2 (NSString *) __attribute__((format_arg(1))); 24f4a2713aSLionel Sambuc 25f4a2713aSLionel Sambucextern int fi3 (const NSString *) __attribute__((format_arg(1))); // expected-error {{function does not return NSString}} 26f4a2713aSLionel Sambucextern NSString *fi4 (const NSString *) __attribute__((format_arg(1))); 27f4a2713aSLionel Sambucextern NSString *fi5 (const NSString *) __attribute__((format_arg(1))); 28