1/* All calls must be properly stubified.  */
2/* Testcase extracted from TextEdit:Document.m.  */
3
4/* { dg-do compile { target *-*-darwin* } } */
5/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
6/* { dg-require-effective-target ilp32 } */
7/* { dg-options "-mdynamic-no-pic -mmacosx-version-min=10.4 -msymbol-stubs" } */
8
9typedef struct objc_object { } *id ;
10int x = 41 ;
11extern id objc_msgSend(id self, char * op, ...);
12extern int bogonic (int, int, int) ;
13@interface Document {}
14- (Document *) window;
15- (Document *) class;
16- (Document *) close;
17@end
18@implementation Document
19- (Document *) class { return (Document *)0; }
20- (Document *) close { return (Document *)0; }
21- (Document *) window { return (Document *)0; }
22- (void)willEndCloseSheet:(void *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo {
23  [[self window] close];
24  ((void (*)(id, char *, int))objc_msgSend)([self class], (char *)contextInfo, 1);
25  ((void (*)(id, char *, int))bogonic)([self class], (char *)contextInfo, 1);
26  bogonic (3, 4, 5);
27  x++;
28}
29@end
30
31/* Any symbol_ref of an un-stubified objc_msgSend is an error; look
32   for "objc_msgSend" in quotes, without the $stub suffix. */
33
34/* { dg-final { scan-assembler-not {(bl|call)[ \t]+_objc_msgSend\n} } } */
35/* { dg-final { scan-assembler     {(bl|call)[ \t]+L_objc_msgSend\$stub\n} } } */
36/* { dg-final { scan-assembler-not {(bl|call)[ \t]+_Z7bogoniciii\n} } } */
37/* { dg-final { scan-assembler     {(bl|call)[ \t]+L__Z7bogoniciii\$stub\n} } } */
38/* { dg-final { scan-assembler-not {\$non_lazy_ptr} } } */
39