Merge from mainline
[official-gcc.git] / gcc / testsuite / objc.dg / stubify-2.m
bloba77ab9f20610af11983cc9c8c5e31c499917f123
1 /* All calls must be properly stubified.  */
2 /* Testcase extracted from TextEdit:Document.m.  */
4 /* { dg-do compile { target *-*-darwin* } } */
5 /* { dg-options "-mdynamic-no-pic -fdump-rtl-jump" } */
7 typedef struct objc_object { } *id ;
8 int x = 41 ;
9 extern id objc_msgSend(id self, char * op, ...);
10 extern int bogonic (int, int, int) ;
11 @interface Document {}
12 - (Document *) window;
13 - (Document *) class;
14 - (Document *) close;
15 @end
16 @implementation Document
17 - (Document *) class { }
18 - (Document *) close { }
19 - (Document *) window { }
20 - (void)willEndCloseSheet:(void *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo {
21   [[self window] close];
22   ((void (*)(id, char *, int))objc_msgSend)([self class], (char *)contextInfo, 1);
23   ((void (*)(id, char *, int))bogonic)([self class], (char *)contextInfo, 1);
24   bogonic (3, 4, 5);
25   x++;
27 @end
29 /* Any symbol_ref of an un-stubified objc_msgSend is an error; look
30    for "objc_msgSend" in quotes, without the $stub suffix.  */
31 /* { dg-final { scan-rtl-dump-not "symbol_ref.*\"objc_msgSend\"" "jump" } } */