1/* All calls must be properly stubified.  Complain about any "call
2   _objc_msgSend<end-of-line>" without the $stub suffix.  */
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 -fno-exceptions -mmacosx-version-min=10.4 -msymbol-stubs" } */
8
9typedef struct objc_object { } *id ;
10int x = 41 ;
11
12extern "C" {
13  extern id objc_msgSend(id self, objc_selector* op, ...);
14  extern int bogonic (int, int, int);
15}
16
17@interface Document {}
18- (Document *) window;
19- (Document *) class;
20- (Document *) close;
21@end
22@implementation Document
23- (Document *) class { return (Document *)0; }
24- (Document *) close { return (Document *)0; }
25- (Document *) window { return (Document *)0; }
26- (void)willEndCloseSheet:(void *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo {
27  [[self window] close];
28  ((void (*)(id, char *, int))objc_msgSend)([self class], (char *)contextInfo, 1);
29  ((void (*)(id, char *, int))bogonic)([self class], (char *)contextInfo, 1);
30  bogonic (3, 4, 5);
31  x++;
32}
33@end
34
35/* { dg-final { scan-assembler-not {(bl|call)[ \t]+_objc_msgSend\n} } } */
36/* { dg-final { scan-assembler     {(bl|call)[ \t]+L_objc_msgSend\$stub\n} } } */
37/* { dg-final { scan-assembler-not {(bl|call)[ \t]+_bogonic\n} } } */
38/* { dg-final { scan-assembler     {(bl|call)[ \t]+L_bogonic\$stub\n} } } */
39/* { dg-final { scan-assembler-not {\$non_lazy_ptr} } } */
40