source: trunk/testcase/570main.cpp@ 599

Last change on this file since 599 was 599, checked in by bird, 22 years ago

'Completed' the testcase.

  • Property cvs2svn:cvs-rev set to 1.3
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 5.8 KB
RevLine 
[594]1typedef struct some_struct_pointer * PTYPE;
2
3/*
4 * Function and method declarations.
5 * Checks mangling.
6 */
7
8/* No underscore, No mangling. */
[599]9extern "C" void _System ExternCVoid(int a, int b, int c, int d);
10extern "C" void * _System ExternCPVoid(int a, int b, int c, int d);
11extern "C" int _System ExternCInt(int a, int b, int c, int d);
12extern "C" PTYPE _System ExternCPType(int a, int b, int c, int d);
[594]13
14/* No underscore, No mangling. */
[599]15void _System Void(int a, int b, int c, int d);
16void * _System PVoid(int a, int b, int c, int d);
17int _System Int(int a, int b, int c, int d);
18PTYPE _System PType(int a, int b, int c, int d);
[594]19
20
21/* Members are mangled. */
22class foo
23{
24public:
[599]25static void _System StaticMemberVoid(int a, int b, int c, int d);
26static void * _System StaticMemberPVoid(int a, int b, int c, int d);
27static int _System StaticMemberInt(int a, int b, int c, int d);
28static PTYPE _System StaticMemberPType(int a, int b, int c, int d);
[594]29
30/* VAC365 allows this too, and actually mangles the
31 * calling convention into the name.
32 * _System: MemberVoid__3fooF__l2_v
33 * default: MemberVoid__3fooFv
34 * We don't need to support this, it's just a curiosity.
35 */
[599]36void _System MemberVoid(int a, int b, int c, int d);
37void * _System MemberPVoid(int a, int b, int c, int d);
38int _System MemberInt(int a, int b, int c, int d);
39PTYPE _System MemberPType(int a, int b, int c, int d);
[594]40};
41
42
43/*
44 * Typedefs.
45 * Checks that there is not warnings on these.
46 */
[599]47typedef void _System Typedef1Void(int a, int b, int c, int d);
48typedef void * _System Typedef1PVoid(int a, int b, int c, int d);
49typedef int _System Typedef1Int(int a, int b, int c, int d);
50typedef PTYPE _System Typedef1PType(int a, int b, int c, int d);
[594]51
[599]52typedef void (_System Typedef2Void)(int a, int b, int c, int d);
53typedef void * (_System Typedef2PVoid)(int a, int b, int c, int d);
54typedef int (_System Typedef2Int)(int a, int b, int c, int d);
55typedef PTYPE (_System Typedef2PType)(int a, int b, int c, int d);
[594]56
[599]57typedef void (* _System PTypedef1Void)(int a, int b, int c, int d);
58typedef void * (* _System PTypedef1PVoid)(int a, int b, int c, int d);
59typedef int (* _System PTypedef1Int)(int a, int b, int c, int d);
60typedef PTYPE (* _System PTypedef1PType)(int a, int b, int c, int d);
[594]61
[595]62/* Alternate writing which should have the same effect I think... */
[599]63typedef void (_System * PTypedef2Void)(int a, int b, int c, int d);
64typedef void * (_System * PTypedef2PVoid)(int a, int b, int c, int d);
65typedef int (_System * PTypedef2Int)(int a, int b, int c, int d);
66typedef PTYPE (_System * PTypedef2PType)(int a, int b, int c, int d);
[594]67
68
69/*
70 * Structures.
71 * Should not cause warnings.
72 */
73typedef struct VFT
74{
[599]75 void (* _System PStructMemberVoid)(int a, int b, int c, int d);
76 void * (* _System PStructMemberPVoid)(int a, int b, int c, int d);
77 int (* _System PStructMemberInt)(int a, int b, int c, int d);
78 PTYPE (* _System PStructMemberPType)(int a, int b, int c, int d);
[595]79
80 /* Alternate writing which should have the same effect I think... */
[599]81 void ( _System * PStructMember2Void)(int a, int b, int c, int d);
82 void * ( _System * PStructMember2PVoid)(int a, int b, int c, int d);
83 int ( _System * PStructMember2Int)(int a, int b, int c, int d);
84 PTYPE ( _System * PStructMember2PType)(int a, int b, int c, int d);
[595]85
[594]86} VFT, *PVFT;
87
88
89extern "C" int DoC(void);
90int main(void)
91{
[599]92 VFT vft = {Void, PVoid, Int, PType,
93 Void, PVoid, Int, PType};
[594]94
[599]95 Typedef1Void * pfnTypedef1Void = Void;
96 Typedef1PVoid * pfnTypedef1PVoid = PVoid;
97 Typedef1Int * pfnTypedef1Int = Int;
98 Typedef1PType * pfnTypedef1PType = PType;
[594]99
[599]100 Typedef2Void * pfnTypedef2Void = Void;
101 Typedef2PVoid * pfnTypedef2PVoid = PVoid;
102 Typedef2Int * pfnTypedef2Int = Int;
103 Typedef2PType * pfnTypedef2PType = PType;
[594]104
[599]105 PTypedef1Void pfnPTypedef1Void = Void;
106 PTypedef1PVoid pfnPTypedef1PVoid = PVoid;
107 PTypedef1Int pfnPTypedef1Int = Int;
108 PTypedef1PType pfnPTypedef1PType = PType;
109
110 PTypedef2Void pfnPTypedef2Void = Void;
111 PTypedef2PVoid pfnPTypedef2PVoid = PVoid;
112 PTypedef2Int pfnPTypedef2Int = Int;
113 PTypedef2PType pfnPTypedef2PType = PType;
114
115 /* extern functions */
116 ExternCVoid(1,2,3,4);
117 ExternCPVoid(1,2,3,4);
118 ExternCInt(1,2,3,4);
119 ExternCPType(1,2,3,4);
120
121 Void(1,2,3,4);
122 PVoid(1,2,3,4);
123 Int(1,2,3,4);
124 PType(1,2,3,4);
125
126 /* class */
127 foo::StaticMemberVoid(1,2,3,4);
128 foo::StaticMemberPVoid(1,2,3,4);
129 foo::StaticMemberInt(1,2,3,4);
130 foo::StaticMemberPType(1,2,3,4);
131
[594]132 foo obj;
[599]133 obj.MemberVoid(1,2,3,4);
134 obj.MemberPVoid(1,2,3,4);
135 obj.MemberInt(1,2,3,4);
136 obj.MemberPType(1,2,3,4);
[594]137
[599]138 /* typedefs */
139 pfnTypedef1Void(1,2,3,4);
140 pfnTypedef1PVoid(1,2,3,4);
141 pfnTypedef1Int(1,2,3,4);
142 pfnTypedef1PType(1,2,3,4);
[594]143
[599]144 pfnTypedef2Void(1,2,3,4);
145 pfnTypedef2PVoid(1,2,3,4);
146 pfnTypedef2Int(1,2,3,4);
147 pfnTypedef2PType(1,2,3,4);
148
149 pfnPTypedef1Void(1,2,3,4);
150 pfnPTypedef1PVoid(1,2,3,4);
151 pfnPTypedef1Int(1,2,3,4);
152 pfnPTypedef1PType(1,2,3,4);
153
154 pfnPTypedef2Void(1,2,3,4);
155 pfnPTypedef2PVoid(1,2,3,4);
156 pfnPTypedef2Int(1,2,3,4);
157 pfnPTypedef2PType(1,2,3,4);
158
159
160 /* structs */
161 vft.PStructMemberVoid(1,2,3,4);
162 vft.PStructMemberPVoid(1,2,3,4);
163 vft.PStructMemberInt(1,2,3,4);
164 vft.PStructMemberPType(1,2,3,4);
165
166 vft.PStructMember2Void(1,2,3,4);
167 vft.PStructMember2PVoid(1,2,3,4);
168 vft.PStructMember2Int(1,2,3,4);
169 vft.PStructMember2PType(1,2,3,4);
170
[595]171 /* test C stuff */
[594]172 DoC();
173
[595]174 /** @todo test typedefs and structure field. */
175
[594]176 return 0;
177}
178
Note: See TracBrowser for help on using the repository browser.