source: trunk/testcase/570c.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.7
  • 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: 570c.c 906 2003-12-15 20:33:09Z bird $ */
2/** @file
3 *
4 * _System 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 _System Void(int a, int b, int c, int d);
22void * _System PVoid(int a, int b, int c, int d);
23int _System Int(int a, int b, int c, int d);
24PTYPE _System PType(int a, int b, int c, int d);
25
26/*
27 * Typedefs.
28 * Checks that there is not warnings on these.
29 */
30typedef void _System Typedef1Void(int a, int b, int c, int d);
31typedef void * _System Typedef1PVoid(int a, int b, int c, int d);
32typedef int _System Typedef1Int(int a, int b, int c, int d);
33typedef PTYPE _System Typedef1PType(int a, int b, int c, int d);
34
35typedef void (_System Typedef2Void)(int a, int b, int c, int d);
36typedef void * (_System Typedef2PVoid)(int a, int b, int c, int d);
37typedef int (_System Typedef2Int)(int a, int b, int c, int d);
38typedef PTYPE (_System Typedef2PType)(int a, int b, int c, int d);
39
40typedef void (* _System PTypedef1Void)(int a, int b, int c, int d);
41typedef void * (* _System PTypedef1PVoid)(int a, int b, int c, int d);
42typedef int (* _System PTypedef1Int)(int a, int b, int c, int d);
43typedef PTYPE (* _System PTypedef1PType)(int a, int b, int c, int d);
44
45/* Alternate writing which should have the same effect I think... */
46typedef void (_System * PTypedef2Void)(int a, int b, int c, int d);
47typedef void * (_System * PTypedef2PVoid)(int a, int b, int c, int d);
48typedef int (_System * PTypedef2Int)(int a, int b, int c, int d);
49typedef PTYPE (_System * PTypedef2PType)(int a, int b, int c, int d);
50
51
52/*
53 * Structures.
54 */
55typedef struct VFT
56{
57 void (_System * PStructMemberVoid)(int a, int b, int c, int d);
58 void * (_System * PStructMemberPVoid)(int a, int b, int c, int d);
59 int (_System * PStructMemberInt)(int a, int b, int c, int d);
60 PTYPE (_System * PStructMemberPType)(int a, int b, int c, int d);
61
62 /* Alternate writing which should have the same effect I think... */
63 void ( _System * PStructMember2Void)(int a, int b, int c, int d);
64 void * ( _System * PStructMember2PVoid)(int a, int b, int c, int d);
65 int ( _System * PStructMember2Int)(int a, int b, int c, int d);
66 PTYPE ( _System * PStructMember2PType)(int a, int b, int c, int d);
67
68} VFT, *PVFT;
69
70
71/*
72 * Variables
73 */
74void (* _System PVar1Void)(int a, int b, int c, int d);
75void * (* _System PVar1PVoid)(int a, int b, int c, int d);
76int (* _System PVar1Int)(int a, int b, int c, int d);
77PTYPE (* _System PVar1PType)(int a, int b, int c, int d);
78
79/* Alternate writing which should have the same effect I think... */
80void (_System * PVar2Void)(int a, int b, int c, int d);
81void * (_System * PVar2PVoid)(int a, int b, int c, int d);
82int (_System * PVar2Int)(int a, int b, int c, int d);
83PTYPE (_System * PVar2PType)(int a, int b, int c, int d);
84
85
86/*
87 * Parameters.
88 */
89int ParamArgs(
90 void (* _System pfn1Void)(int a, int b, int c, int d),
91 void * (* _System pfn1PVoid)(int a, int b, int c, int d),
92 int (* _System pfn1Int)(int a, int b, int c, int d),
93 PTYPE (* _System pfn1PType)(int a, int b, int c, int d),
94 void (_System * pfn2Void)(int a, int b, int c, int d),
95 void * (_System * pfn2PVoid)(int a, int b, int c, int d),
96 int (_System * pfn2Int)(int a, int b, int c, int d),
97 PTYPE (_System * 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
113
114int DoC(int a, int b, int c, int d)
115{
116 static VFT vft = {Void, PVoid, Int, PType,
117 Void, PVoid, Int, PType};
118
119 static Typedef1Void * pfnTypedef1Void = Void;
120 static Typedef1PVoid * pfnTypedef1PVoid = PVoid;
121 static Typedef1Int * pfnTypedef1Int = Int;
122 static Typedef1PType * pfnTypedef1PType = PType;
123
124 static Typedef2Void * pfnTypedef2Void = Void;
125 static Typedef2PVoid * pfnTypedef2PVoid = PVoid;
126 static Typedef2Int * pfnTypedef2Int = Int;
127 static Typedef2PType * pfnTypedef2PType = PType;
128
129 static PTypedef1Void pfnPTypedef1Void = Void;
130 static PTypedef1PVoid pfnPTypedef1PVoid = PVoid;
131 static PTypedef1Int pfnPTypedef1Int = Int;
132 static PTypedef1PType pfnPTypedef1PType = PType;
133
134 static PTypedef2Void pfnPTypedef2Void = Void;
135 static PTypedef2PVoid pfnPTypedef2PVoid = PVoid;
136 static PTypedef2Int pfnPTypedef2Int = Int;
137 static PTypedef2PType pfnPTypedef2PType = PType;
138
139 PVar1Void = Void;
140 PVar1PVoid = PVoid;
141 PVar1Int = Int;
142 PVar1PType = PType;
143
144 PVar2Void = Void;
145 PVar2PVoid = PVoid;
146 PVar2Int = Int;
147 PVar2PType = PType;
148
149
150 /* extern functions */
151 Void(1,2,3,4);
152 PVoid(1,2,3,4);
153 Int(1,2,3,4);
154 PType(1,2,3,4);
155
156 /* typedefs */
157 pfnTypedef1Void(1,2,3,4);
158 pfnTypedef1PVoid(1,2,3,4);
159 pfnTypedef1Int(1,2,3,4);
160 pfnTypedef1PType(1,2,3,4);
161
162 pfnTypedef2Void(1,2,3,4);
163 pfnTypedef2PVoid(1,2,3,4);
164 pfnTypedef2Int(1,2,3,4);
165 pfnTypedef2PType(1,2,3,4);
166
167 pfnPTypedef1Void(1,2,3,4);
168 pfnPTypedef1PVoid(1,2,3,4);
169 pfnPTypedef1Int(1,2,3,4);
170 pfnPTypedef1PType(1,2,3,4);
171
172 pfnPTypedef2Void(1,2,3,4);
173 pfnPTypedef2PVoid(1,2,3,4);
174 pfnPTypedef2Int(1,2,3,4);
175 pfnPTypedef2PType(1,2,3,4);
176
177
178 /* structs */
179 vft.PStructMemberVoid(1,2,3,4);
180 vft.PStructMemberPVoid(1,2,3,4);
181 vft.PStructMemberInt(1,2,3,4);
182 vft.PStructMemberPType(1,2,3,4);
183
184 vft.PStructMember2Void(1,2,3,4);
185 vft.PStructMember2PVoid(1,2,3,4);
186 vft.PStructMember2Int(1,2,3,4);
187 vft.PStructMember2PType(1,2,3,4);
188
189
190 /* variables */
191 PVar1Void(1,2,3,4);
192 PVar1PVoid(1,2,3,4);
193 PVar1Int(1,2,3,4);
194 PVar1PType(1,2,3,4);
195
196 PVar2Void(1,2,3,4);
197 PVar2PVoid(1,2,3,4);
198 PVar2Int(1,2,3,4);
199 PVar2PType(1,2,3,4);
200
201 /* parameters */
202 ParamArgs(Void, PVoid, Int, PType,
203 Void, PVoid, Int, PType);
204
205
206 return 0;
207}
208
Note: See TracBrowser for help on using the repository browser.