source: branches/libc-0.6/testcase/570c.c

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

found a little problem.

  • Property cvs2svn:cvs-rev set to 1.8
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 6.5 KB
Line 
1/* $Id: 570c.c 1231 2004-02-12 15:00:11Z 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
86extern void _System glutDisplayFunc1(void (* _System)(void));
87extern void _System glutDisplayFunc2(void (_System *)(void));
88
89/*
90 * Parameters.
91 */
92int ParamArgs(
93 void (* _System pfn1Void)(int a, int b, int c, int d),
94 void * (* _System pfn1PVoid)(int a, int b, int c, int d),
95 int (* _System pfn1Int)(int a, int b, int c, int d),
96 PTYPE (* _System pfn1PType)(int a, int b, int c, int d),
97 void (_System * pfn2Void)(int a, int b, int c, int d),
98 void * (_System * pfn2PVoid)(int a, int b, int c, int d),
99 int (_System * pfn2Int)(int a, int b, int c, int d),
100 PTYPE (_System * pfn2PType)(int a, int b, int c, int d)
101 )
102{
103 pfn1Void(1,2,3,4);
104 pfn1PVoid(1,2,3,4);
105 pfn1Int(1,2,3,4);
106 pfn1PType(1,2,3,4);
107
108 pfn2Void(1,2,3,4);
109 pfn2PVoid(1,2,3,4);
110 pfn2Int(1,2,3,4);
111 pfn2PType(1,2,3,4);
112 return 0;
113}
114
115
116
117int DoC(int a, int b, int c, int d)
118{
119 static VFT vft = {Void, PVoid, Int, PType,
120 Void, PVoid, Int, PType};
121
122 static Typedef1Void * pfnTypedef1Void = Void;
123 static Typedef1PVoid * pfnTypedef1PVoid = PVoid;
124 static Typedef1Int * pfnTypedef1Int = Int;
125 static Typedef1PType * pfnTypedef1PType = PType;
126
127 static Typedef2Void * pfnTypedef2Void = Void;
128 static Typedef2PVoid * pfnTypedef2PVoid = PVoid;
129 static Typedef2Int * pfnTypedef2Int = Int;
130 static Typedef2PType * pfnTypedef2PType = PType;
131
132 static PTypedef1Void pfnPTypedef1Void = Void;
133 static PTypedef1PVoid pfnPTypedef1PVoid = PVoid;
134 static PTypedef1Int pfnPTypedef1Int = Int;
135 static PTypedef1PType pfnPTypedef1PType = PType;
136
137 static PTypedef2Void pfnPTypedef2Void = Void;
138 static PTypedef2PVoid pfnPTypedef2PVoid = PVoid;
139 static PTypedef2Int pfnPTypedef2Int = Int;
140 static PTypedef2PType pfnPTypedef2PType = PType;
141
142 PVar1Void = Void;
143 PVar1PVoid = PVoid;
144 PVar1Int = Int;
145 PVar1PType = PType;
146
147 PVar2Void = Void;
148 PVar2PVoid = PVoid;
149 PVar2Int = Int;
150 PVar2PType = PType;
151
152
153 /* extern functions */
154 Void(1,2,3,4);
155 PVoid(1,2,3,4);
156 Int(1,2,3,4);
157 PType(1,2,3,4);
158
159 /* typedefs */
160 pfnTypedef1Void(1,2,3,4);
161 pfnTypedef1PVoid(1,2,3,4);
162 pfnTypedef1Int(1,2,3,4);
163 pfnTypedef1PType(1,2,3,4);
164
165 pfnTypedef2Void(1,2,3,4);
166 pfnTypedef2PVoid(1,2,3,4);
167 pfnTypedef2Int(1,2,3,4);
168 pfnTypedef2PType(1,2,3,4);
169
170 pfnPTypedef1Void(1,2,3,4);
171 pfnPTypedef1PVoid(1,2,3,4);
172 pfnPTypedef1Int(1,2,3,4);
173 pfnPTypedef1PType(1,2,3,4);
174
175 pfnPTypedef2Void(1,2,3,4);
176 pfnPTypedef2PVoid(1,2,3,4);
177 pfnPTypedef2Int(1,2,3,4);
178 pfnPTypedef2PType(1,2,3,4);
179
180
181 /* structs */
182 vft.PStructMemberVoid(1,2,3,4);
183 vft.PStructMemberPVoid(1,2,3,4);
184 vft.PStructMemberInt(1,2,3,4);
185 vft.PStructMemberPType(1,2,3,4);
186
187 vft.PStructMember2Void(1,2,3,4);
188 vft.PStructMember2PVoid(1,2,3,4);
189 vft.PStructMember2Int(1,2,3,4);
190 vft.PStructMember2PType(1,2,3,4);
191
192
193 /* variables */
194 PVar1Void(1,2,3,4);
195 PVar1PVoid(1,2,3,4);
196 PVar1Int(1,2,3,4);
197 PVar1PType(1,2,3,4);
198
199 PVar2Void(1,2,3,4);
200 PVar2PVoid(1,2,3,4);
201 PVar2Int(1,2,3,4);
202 PVar2PType(1,2,3,4);
203
204 /* parameters */
205 ParamArgs(Void, PVoid, Int, PType,
206 Void, PVoid, Int, PType);
207
208
209 return 0;
210}
211
Note: See TracBrowser for help on using the repository browser.