diff options
author | Andrew Pinski <pinskia@gmail.com> | 2008-12-28 18:16:45 -0800 |
---|---|---|
committer | Andrew Pinski <pinskia@gcc.gnu.org> | 2008-12-28 18:16:45 -0800 |
commit | bbddfe5b6c53a0daad579fbc025b8f5d63c24687 (patch) | |
tree | c1f9dd32b22768f364547977033c7f379a55de4c /gcc/testsuite/objc | |
parent | 07d20642066a0cf73d23c1fcd9a3efea928064d1 (diff) | |
download | gcc-bbddfe5b6c53a0daad579fbc025b8f5d63c24687.zip gcc-bbddfe5b6c53a0daad579fbc025b8f5d63c24687.tar.gz gcc-bbddfe5b6c53a0daad579fbc025b8f5d63c24687.tar.bz2 |
re PR libobjc/36610 (objc_msg_sendv is broken for targets which pass argument via registers)
2008-12-28 Andrew Pinski <pinskia@gmail.com>
PR libobjc/36610
* objc/execute/forward-1.m: New test.
From-SVN: r142945
Diffstat (limited to 'gcc/testsuite/objc')
-rw-r--r-- | gcc/testsuite/objc/execute/forward-1.m | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/gcc/testsuite/objc/execute/forward-1.m b/gcc/testsuite/objc/execute/forward-1.m new file mode 100644 index 0000000..9306dea --- /dev/null +++ b/gcc/testsuite/objc/execute/forward-1.m @@ -0,0 +1,85 @@ +/* See if -forward::/-performv:: is able to work. */ + +#include <stdio.h> +#include <stdlib.h> +#include <objc/Object.h> +#include <objc/objc-api.h> + +#define VALUETOUSE 1234567890 + +#ifdef __NEXT_RUNTIME__ +/* Does not run with the next runtime. */ +int main(void) +{ + return 0; +} + +#else + +id forwarder, receiver; + +@interface Forwarder: Object +{ + id receiver; +} + +-initWithReceiver:theReceiver; + +@end + +@interface Receiver:Object +{ + int foo; +} +-display; +-initWithFoo:(int)theFoo; +@end +@implementation Receiver + +-initWithFoo: (int)theFoo +{ + foo = theFoo; + return self; +} + +-display +{ + /* Check to see if we are really the reciever. */ + if (self != receiver) + abort (); + /* And the value of foo is set correctly. */ + if (foo != VALUETOUSE) + abort (); + return self; +} + +@end + +@implementation Forwarder +-initWithReceiver: theReceiver +{ + [super init]; + receiver = theReceiver; + return self; +} +-(retval_t) forward: (SEL)theSel: (arglist_t)theArgFrame +{ + /* If we have a reciever try to perform on that object */ + if (receiver) + return [receiver performv: theSel: theArgFrame]; + return [self doesNotRecognize:theSel]; +} +@end +int main() +{ + /* Init the reciever. */ + receiver = [[Receiver alloc] initWithFoo: VALUETOUSE]; + /* Init the fowarder. */ + forwarder = [[Forwarder alloc] initWithReceiver: receiver]; + /* Call display on the forwarder which in turns calls display on + the reciever. */ + [forwarder display]; + exit(0); +} + +#endif |