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