source: trunk/testcase/572c.c@ 906

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

As parameters

  • Property cvs2svn:cvs-rev set to 1.4
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 6.4 KB
Line 
1/* $Id: 572c.c 906 2003-12-15 20:33:09Z bird $ */
2/** @file
3 *
4 * _Optlink declaration and definition testcases.
5 *
6 * InnoTek Systemberatung GmbH confidential
7 *
8 * Copyright (c) 2003 InnoTek Systemberatung GmbH
9 * Author: knut st. osmundsen <bird-srcspam@anduin.net>
10 *
11 * All Rights Reserved
12 *
13 */
14typedef struct some_struct_pointer * PTYPE;
15
16/*
17 * Function and method declarations.
18 * Checks mangling.
19 */
20/* No underscore, No mangling. */
21void _Optlink CVoid(int a, int b, int c, int d);
22void * _Optlink CPVoid(int a, int b, int c, int d);
23int _Optlink CInt(int a, int b, int c, int d);
24PTYPE _Optlink CPType(int a, int b, int c, int d);
25
26/*
27 * Typedefs.
28 * Checks that there is not warnings on these.
29 */
30typedef void _Optlink Typedef1Void(int a, int b, int c, int d);
31typedef void * _Optlink Typedef1PVoid(int a, int b, int c, int d);
32typedef int _Optlink Typedef1Int(int a, int b, int c, int d);
33typedef PTYPE _Optlink Typedef1PType(int a, int b, int c, int d);
34
35typedef void (_Optlink Typedef2Void)(int a, int b, int c, int d);
36typedef void * (_Optlink Typedef2PVoid)(int a, int b, int c, int d);
37typedef int (_Optlink Typedef2Int)(int a, int b, int c, int d);
38typedef PTYPE (_Optlink Typedef2PType)(int a, int b, int c, int d);
39
40typedef void (* _Optlink PTypedef1Void)(int a, int b, int c, int d);
41typedef void * (* _Optlink PTypedef1PVoid)(int a, int b, int c, int d);
42typedef int (* _Optlink PTypedef1Int)(int a, int b, int c, int d);
43typedef PTYPE (* _Optlink PTypedef1PType)(int a, int b, int c, int d);
44
45/* Alternate writing which should have the same effect I think... */
46typedef void (_Optlink * PTypedef2Void)(int a, int b, int c, int d);
47typedef void * (_Optlink * PTypedef2PVoid)(int a, int b, int c, int d);
48typedef int (_Optlink * PTypedef2Int)(int a, int b, int c, int d);
49typedef PTYPE (_Optlink * PTypedef2PType)(int a, int b, int c, int d);
50
51
52/*
53 * Structures.
54 */
55typedef struct VFT
56{
57 void (_Optlink * PStructMemberVoid)(int a, int b, int c, int d);
58 void * (_Optlink * PStructMemberPVoid)(int a, int b, int c, int d);
59 int (_Optlink * PStructMemberInt)(int a, int b, int c, int d);
60 PTYPE (_Optlink * PStructMemberPType)(int a, int b, int c, int d);
61
62 /* Alternate writing which should have the same effect I think... */
63 void (_Optlink * PStructMember2Void)(int a, int b, int c, int d);
64 void * (_Optlink * PStructMember2PVoid)(int a, int b, int c, int d);
65 int (_Optlink * PStructMember2Int)(int a, int b, int c, int d);
66 PTYPE (_Optlink * PStructMember2PType)(int a, int b, int c, int d);
67
68} VFT, *PVFT;
69
70
71/*
72 * Variables
73 */
74void (* _Optlink PVar1Void)(int a, int b, int c, int d);
75void * (* _Optlink PVar1PVoid)(int a, int b, int c, int d);
76int (* _Optlink PVar1Int)(int a, int b, int c, int d);
77PTYPE (* _Optlink PVar1PType)(int a, int b, int c, int d);
78
79/* Alternate writing which should have the same effect I think... */
80void (_Optlink * PVar2Void)(int a, int b, int c, int d);
81void * (_Optlink * PVar2PVoid)(int a, int b, int c, int d);
82int (_Optlink * PVar2Int)(int a, int b, int c, int d);
83PTYPE (_Optlink * PVar2PType)(int a, int b, int c, int d);
84
85
86/*
87 * Parameters.
88 */
89int ParamArgs(
90 void (* _Optlink pfn1Void)(int a, int b, int c, int d),
91 void * (* _Optlink pfn1PVoid)(int a, int b, int c, int d),
92 int (* _Optlink pfn1Int)(int a, int b, int c, int d),
93 PTYPE (* _Optlink pfn1PType)(int a, int b, int c, int d),
94 void (_Optlink * pfn2Void)(int a, int b, int c, int d),
95 void * (_Optlink * pfn2PVoid)(int a, int b, int c, int d),
96 int (_Optlink * pfn2Int)(int a, int b, int c, int d),
97 PTYPE (_Optlink * pfn2PType)(int a, int b, int c, int d)
98 )
99{
100 pfn1Void(1,2,3,4);
101 pfn1PVoid(1,2,3,4);
102 pfn1Int(1,2,3,4);
103 pfn1PType(1,2,3,4);
104
105 pfn2Void(1,2,3,4);
106 pfn2PVoid(1,2,3,4);
107 pfn2Int(1,2,3,4);
108 pfn2PType(1,2,3,4);
109 return 0;
110}
111
112
113int DoC(int a, int b, int c, int d)
114{
115 static VFT vft = {CVoid, CPVoid, CInt, CPType,
116 CVoid, CPVoid, CInt, CPType};
117
118 static Typedef1Void * pfnTypedef1Void = CVoid;
119 static Typedef1PVoid * pfnTypedef1PVoid = CPVoid;
120 static Typedef1Int * pfnTypedef1Int = CInt;
121 static Typedef1PType * pfnTypedef1PType = CPType;
122
123 static Typedef2Void * pfnTypedef2Void = CVoid;
124 static Typedef2PVoid * pfnTypedef2PVoid = CPVoid;
125 static Typedef2Int * pfnTypedef2Int = CInt;
126 static Typedef2PType * pfnTypedef2PType = CPType;
127
128 static PTypedef1Void pfnPTypedef1Void = CVoid;
129 static PTypedef1PVoid pfnPTypedef1PVoid = CPVoid;
130 static PTypedef1Int pfnPTypedef1Int = CInt;
131 static PTypedef1PType pfnPTypedef1PType = CPType;
132
133 static PTypedef2Void pfnPTypedef2Void = CVoid;
134 static PTypedef2PVoid pfnPTypedef2PVoid = CPVoid;
135 static PTypedef2Int pfnPTypedef2Int = CInt;
136 static PTypedef2PType pfnPTypedef2PType = CPType;
137
138 PVar1Void = CVoid;
139 PVar1PVoid = CPVoid;
140 PVar1Int = CInt;
141 PVar1PType = CPType;
142
143 PVar2Void = CVoid;
144 PVar2PVoid = CPVoid;
145 PVar2Int = CInt;
146 PVar2PType = CPType;
147
148
149 /* extern functions */
150 CVoid(1,2,3,4);
151 CPVoid(1,2,3,4);
152 CInt(1,2,3,4);
153 CPType(1,2,3,4);
154
155 /* typedefs */
156 pfnTypedef1Void(1,2,3,4);
157 pfnTypedef1PVoid(1,2,3,4);
158 pfnTypedef1Int(1,2,3,4);
159 pfnTypedef1PType(1,2,3,4);
160
161 pfnTypedef2Void(1,2,3,4);
162 pfnTypedef2PVoid(1,2,3,4);
163 pfnTypedef2Int(1,2,3,4);
164 pfnTypedef2PType(1,2,3,4);
165
166 pfnPTypedef1Void(1,2,3,4);
167 pfnPTypedef1PVoid(1,2,3,4);
168 pfnPTypedef1Int(1,2,3,4);
169 pfnPTypedef1PType(1,2,3,4);
170
171 pfnPTypedef2Void(1,2,3,4);
172 pfnPTypedef2PVoid(1,2,3,4);
173 pfnPTypedef2Int(1,2,3,4);
174 pfnPTypedef2PType(1,2,3,4);
175
176
177 /* structs */
178 vft.PStructMemberVoid(1,2,3,4);
179 vft.PStructMemberPVoid(1,2,3,4);
180 vft.PStructMemberInt(1,2,3,4);
181 vft.PStructMemberPType(1,2,3,4);
182
183 vft.PStructMember2Void(1,2,3,4);
184 vft.PStructMember2PVoid(1,2,3,4);
185 vft.PStructMember2Int(1,2,3,4);
186 vft.PStructMember2PType(1,2,3,4);
187
188 /* variables */
189 PVar1Void(1,2,3,4);
190 PVar1PVoid(1,2,3,4);
191 PVar1Int(1,2,3,4);
192 PVar1PType(1,2,3,4);
193
194 PVar2Void(1,2,3,4);
195 PVar2PVoid(1,2,3,4);
196 PVar2Int(1,2,3,4);
197 PVar2PType(1,2,3,4);
198
199 /* parameters */
200 ParamArgs(CVoid, CPVoid, CInt, CPType,
201 CVoid, CPVoid, CInt, CPType);
202
203 return 0;
204}
205
Note: See TracBrowser for help on using the repository browser.