1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 3 typedef int kern_return_t; 4 #define KERN_SUCCESS 0 5 6 __attribute__((mig_server_routine)) kern_return_t var = KERN_SUCCESS; // expected-warning{{'mig_server_routine' attribute only applies to functions, Objective-C methods, and blocks}} 7 8 __attribute__((mig_server_routine)) void foo_void(void); // expected-warning{{'mig_server_routine' attribute only applies to routines that return a kern_return_t}} 9 __attribute__((mig_server_routine)) int foo_int(void); // expected-warning{{'mig_server_routine' attribute only applies to routines that return a kern_return_t}} 10 11 __attribute__((mig_server_routine)) kern_return_t bar_extern(void); // no-warning 12 __attribute__((mig_server_routine)) kern_return_t bar_forward(void); // no-warning 13 bar_definition(void)14__attribute__((mig_server_routine)) kern_return_t bar_definition(void) { // no-warning 15 return KERN_SUCCESS; 16 } 17 bar_forward(void)18kern_return_t bar_forward(void) { // no-warning 19 return KERN_SUCCESS; 20 } 21 22 __attribute__((mig_server_routine(123))) kern_return_t bar_with_argument(void); // expected-error{{'mig_server_routine' attribute takes no arguments}} 23