1 | /* $Id: 570c.c 601 2003-08-15 23:50:34Z 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 | */
|
---|
14 | typedef struct some_struct_pointer * PTYPE;
|
---|
15 |
|
---|
16 | /*
|
---|
17 | * Function and method declarations.
|
---|
18 | * Checks mangling.
|
---|
19 | */
|
---|
20 | /* No underscore, No mangling. */
|
---|
21 | void _System Void(int a, int b, int c, int d);
|
---|
22 | void * _System PVoid(int a, int b, int c, int d);
|
---|
23 | int _System Int(int a, int b, int c, int d);
|
---|
24 | PTYPE _System PType(int a, int b, int c, int d);
|
---|
25 |
|
---|
26 | /*
|
---|
27 | * Typedefs.
|
---|
28 | * Checks that there is not warnings on these.
|
---|
29 | */
|
---|
30 | typedef void _System Typedef1Void(int a, int b, int c, int d);
|
---|
31 | typedef void * _System Typedef1PVoid(int a, int b, int c, int d);
|
---|
32 | typedef int _System Typedef1Int(int a, int b, int c, int d);
|
---|
33 | typedef PTYPE _System Typedef1PType(int a, int b, int c, int d);
|
---|
34 |
|
---|
35 | typedef void (_System Typedef2Void)(int a, int b, int c, int d);
|
---|
36 | typedef void * (_System Typedef2PVoid)(int a, int b, int c, int d);
|
---|
37 | typedef int (_System Typedef2Int)(int a, int b, int c, int d);
|
---|
38 | typedef PTYPE (_System Typedef2PType)(int a, int b, int c, int d);
|
---|
39 |
|
---|
40 | typedef void (* _System PTypedef1Void)(int a, int b, int c, int d);
|
---|
41 | typedef void * (* _System PTypedef1PVoid)(int a, int b, int c, int d);
|
---|
42 | typedef int (* _System PTypedef1Int)(int a, int b, int c, int d);
|
---|
43 | typedef PTYPE (* _System PTypedef1PType)(int a, int b, int c, int d);
|
---|
44 |
|
---|
45 | /* Alternate writing which should have the same effect I think... */
|
---|
46 | typedef void (_System * PTypedef2Void)(int a, int b, int c, int d);
|
---|
47 | typedef void * (_System * PTypedef2PVoid)(int a, int b, int c, int d);
|
---|
48 | typedef int (_System * PTypedef2Int)(int a, int b, int c, int d);
|
---|
49 | typedef PTYPE (_System * PTypedef2PType)(int a, int b, int c, int d);
|
---|
50 |
|
---|
51 |
|
---|
52 | /*
|
---|
53 | * Structures.
|
---|
54 | */
|
---|
55 | typedef 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 | int DoC(int a, int b, int c, int d)
|
---|
72 | {
|
---|
73 | static VFT vft = {Void, PVoid, Int, PType,
|
---|
74 | Void, PVoid, Int, PType};
|
---|
75 |
|
---|
76 | static Typedef1Void * pfnTypedef1Void = Void;
|
---|
77 | static Typedef1PVoid * pfnTypedef1PVoid = PVoid;
|
---|
78 | static Typedef1Int * pfnTypedef1Int = Int;
|
---|
79 | static Typedef1PType * pfnTypedef1PType = PType;
|
---|
80 |
|
---|
81 | static Typedef2Void * pfnTypedef2Void = Void;
|
---|
82 | static Typedef2PVoid * pfnTypedef2PVoid = PVoid;
|
---|
83 | static Typedef2Int * pfnTypedef2Int = Int;
|
---|
84 | static Typedef2PType * pfnTypedef2PType = PType;
|
---|
85 |
|
---|
86 | static PTypedef1Void pfnPTypedef1Void = Void;
|
---|
87 | static PTypedef1PVoid pfnPTypedef1PVoid = PVoid;
|
---|
88 | static PTypedef1Int pfnPTypedef1Int = Int;
|
---|
89 | static PTypedef1PType pfnPTypedef1PType = PType;
|
---|
90 |
|
---|
91 | static PTypedef2Void pfnPTypedef2Void = Void;
|
---|
92 | static PTypedef2PVoid pfnPTypedef2PVoid = PVoid;
|
---|
93 | static PTypedef2Int pfnPTypedef2Int = Int;
|
---|
94 | static PTypedef2PType pfnPTypedef2PType = PType;
|
---|
95 |
|
---|
96 |
|
---|
97 | /* extern functions */
|
---|
98 | Void(1,2,3,4);
|
---|
99 | PVoid(1,2,3,4);
|
---|
100 | Int(1,2,3,4);
|
---|
101 | PType(1,2,3,4);
|
---|
102 |
|
---|
103 | /* typedefs */
|
---|
104 | pfnTypedef1Void(1,2,3,4);
|
---|
105 | pfnTypedef1PVoid(1,2,3,4);
|
---|
106 | pfnTypedef1Int(1,2,3,4);
|
---|
107 | pfnTypedef1PType(1,2,3,4);
|
---|
108 |
|
---|
109 | pfnTypedef2Void(1,2,3,4);
|
---|
110 | pfnTypedef2PVoid(1,2,3,4);
|
---|
111 | pfnTypedef2Int(1,2,3,4);
|
---|
112 | pfnTypedef2PType(1,2,3,4);
|
---|
113 |
|
---|
114 | pfnPTypedef1Void(1,2,3,4);
|
---|
115 | pfnPTypedef1PVoid(1,2,3,4);
|
---|
116 | pfnPTypedef1Int(1,2,3,4);
|
---|
117 | pfnPTypedef1PType(1,2,3,4);
|
---|
118 |
|
---|
119 | pfnPTypedef2Void(1,2,3,4);
|
---|
120 | pfnPTypedef2PVoid(1,2,3,4);
|
---|
121 | pfnPTypedef2Int(1,2,3,4);
|
---|
122 | pfnPTypedef2PType(1,2,3,4);
|
---|
123 |
|
---|
124 |
|
---|
125 | /* structs */
|
---|
126 | vft.PStructMemberVoid(1,2,3,4);
|
---|
127 | vft.PStructMemberPVoid(1,2,3,4);
|
---|
128 | vft.PStructMemberInt(1,2,3,4);
|
---|
129 | vft.PStructMemberPType(1,2,3,4);
|
---|
130 |
|
---|
131 | vft.PStructMember2Void(1,2,3,4);
|
---|
132 | vft.PStructMember2PVoid(1,2,3,4);
|
---|
133 | vft.PStructMember2Int(1,2,3,4);
|
---|
134 | vft.PStructMember2PType(1,2,3,4);
|
---|
135 |
|
---|
136 | return 0;
|
---|
137 | }
|
---|
138 |
|
---|