Debian Codegraph @

clang/test/Sema/attr-mig.m

raw
1 // RUN: %clang_cc1 -fsyntax-only -fblocks -verify %s
2
3 typedef int kern_return_t;
4 #define KERN_SUCCESS 0
5
6 @interface NSObject
7 @end
8
9 @interface I: NSObject
10 - (kern_return_t)foo __attribute__((mig_server_routine)); // no-warning
11 - (void) bar_void __attribute__((mig_server_routine)); // expected-warning{{'mig_server_routine' attribute only applies to routines that return a kern_return_t}}
12 - (int) bar_int __attribute__((mig_server_routine)); // expected-warning{{'mig_server_routine' attribute only applies to routines that return a kern_return_t}}
13 @end
14
15 @implementation I
16 - (kern_return_t)foo {
17 kern_return_t (^block)(void) = ^ __attribute__((mig_server_routine)) { // no-warning
18 return KERN_SUCCESS;
19 };
20
21 // FIXME: Warn that this block doesn't return a kern_return_t.
22 void (^invalid_block)(void) = ^ __attribute__((mig_server_routine)) {};
23
24 return block();
25 }
26 - (void)bar_void {
27 }
28 - (int)bar_int {
29 return 0;
30 }
31 @end