OSDN Git Service

PR target/57264
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / obj-c++.dg / threedotthree-abi-1.mm
1 /* This file tests that things are encoded using the gcc-3.3 ABI which is only
2    used by the NeXT runtime.  */
3 /* { dg-do run { target *-*-darwin* } } */
4 /* { dg-require-effective-target ilp32 } */
5 /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
6
7 #include <stdio.h>
8 #include <string.h>
9 #include "../objc-obj-c++-shared/runtime.h"
10
11 extern "C" void abort();
12
13 @protocol CommonProtocol
14
15 -(oneway void)methodCall_On:(in bycopy id)someValue_On;
16 -(oneway void)methodCall_nO:(bycopy in id)someValue_nO;
17
18 -(oneway void)methodCall_Oo:(out bycopy id)someValue_Oo;
19 -(oneway void)methodCall_oO:(bycopy out id)someValue_oO;
20
21 -(oneway void)methodCall_rn:(in const id)someValue_rn;
22
23 -(oneway void)methodCall_oOn:(in bycopy out id)someValue_oOn;
24
25 @end
26
27 @interface ObjCClass <CommonProtocol>
28 {
29
30 }
31
32 @end
33
34 @implementation ObjCClass
35 -(oneway void)methodCall_On:(in bycopy id)someValue_On { }
36 -(oneway void)methodCall_nO:(bycopy in id)someValue_nO { }
37
38 -(oneway void)methodCall_Oo:(out bycopy id)someValue_Oo { }
39 -(oneway void)methodCall_oO:(bycopy out id)someValue_oO { }
40
41 -(oneway void)methodCall_rn:(in const id)someValue_rn { }
42 -(oneway void)methodCall_oOn:(in bycopy out id)someValue_oOn { }
43 @end
44
45 Protocol *proto = @protocol(CommonProtocol);
46 struct objc_method_description *meth;
47 struct objc_method_description meth_object;
48
49 int main()
50 {
51         meth_object = protocol_getMethodDescription (proto, @selector(methodCall_On:), YES, YES);
52         meth = &meth_object;
53         if (strcmp (meth->types, "Vv12@0:4On@8"))
54           abort();
55         meth_object = protocol_getMethodDescription (proto, @selector(methodCall_nO:), YES, YES);
56         meth = &meth_object;
57         if (strcmp (meth->types, "Vv12@0:4nO@8"))
58           abort();
59         meth_object = protocol_getMethodDescription (proto, @selector(methodCall_Oo:), YES, YES);
60         meth = &meth_object;
61         if (strcmp (meth->types, "Vv12@0:4Oo@8"))
62           abort();
63         meth_object = protocol_getMethodDescription (proto, @selector(methodCall_oO:), YES, YES);
64         meth = &meth_object;
65         if (strcmp (meth->types, "Vv12@0:4oO@8"))
66           abort();
67         meth_object = protocol_getMethodDescription (proto, @selector(methodCall_rn:), YES, YES);
68         meth = &meth_object;
69         if (strcmp (meth->types, "Vv12@0:4rn@8"))
70           abort();
71         meth_object = protocol_getMethodDescription (proto, @selector(methodCall_oOn:), YES, YES);
72         meth = &meth_object;
73         if (strcmp (meth->types, "Vv12@0:4oOn@8"))
74           abort();
75         return 0;
76 }