| 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | |
| 3 | typedef int kern_return_t; |
| 4 | typedef kern_return_t IOReturn; |
| 5 | #define KERN_SUCCESS 0 |
| 6 | #define kIOReturnSuccess KERN_SUCCESS |
| 7 | |
| 8 | class MyServer { |
| 9 | public: |
| 10 | virtual __attribute__((mig_server_routine)) IOReturn externalMethod(); |
| 11 | virtual __attribute__((mig_server_routine)) void anotherMethod(); // expected-warning{{'mig_server_routine' attribute only applies to routines that return a kern_return_t}} |
| 12 | virtual __attribute__((mig_server_routine)) int yetAnotherMethod(); // expected-warning{{'mig_server_routine' attribute only applies to routines that return a kern_return_t}} |
| 13 | [[clang::mig_server_routine]] virtual IOReturn cppAnnotatedMethod(); |
| 14 | [[clang::mig_server_routine("arg")]] virtual IOReturn cppAnnotatedMethodWithInvalidArgs(); // expected-error{{'mig_server_routine' attribute takes no arguments}} |
| 15 | [[clang::mig_server_routine]] virtual int cppInvalidAnnotatedMethod(); // expected-warning{{'mig_server_routine' attribute only applies to routines that return a kern_return_t}} |
| 16 | }; |
| 17 | |
| 18 | IOReturn MyServer::externalMethod() { |
| 19 | return kIOReturnSuccess; |
| 20 | } |
| 21 | |