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