source: trunk/testcase/570main.cpp@ 595

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

More, better.

  • Property cvs2svn:cvs-rev set to 1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1typedef struct some_struct_pointer * PTYPE;
2
3/*
4 * Function and method declarations.
5 * Checks mangling.
6 */
7
8/* No underscore, No mangling. */
9extern "C" void _System ExternCVoid(void);
10extern "C" void * _System ExternCPVoid(void);
11extern "C" int _System ExternCInt(void);
12extern "C" PTYPE _System ExternCPType(void);
13
14/* No underscore, No mangling. */
15void _System Void(void);
16void * _System PVoid(void);
17int _System Int(void);
18PTYPE _System PType(void);
19
20
21/* Members are mangled. */
22class foo
23{
24public:
25static void _System StaticMemberVoid(void);
26static void * _System StaticMemberPVoid(void);
27static int _System StaticMemberInt(void);
28static PTYPE _System StaticMemberPType(void);
29
30/* VAC365 allows this too, and actually mangles the
31 * calling convention into the name.
32 * _System: MemberVoid__3fooF__l2_v
33 * default: MemberVoid__3fooFv
34 * We don't need to support this, it's just a curiosity.
35 */
36void _System MemberVoid(void);
37void * _System MemberPVoid(void);
38int _System MemberInt(void);
39PTYPE _System MemberPType(void);
40};
41
42
43/*
44 * Typedefs.
45 * Checks that there is not warnings on these.
46 */
47typedef void _System Typedef1Void(void);
48typedef void * _System Typedef1PVoid(void);
49typedef int _System Typedef1Int(void);
50typedef PTYPE _System Typedef1PType(void);
51
52typedef void (_System Typedef2Void)(void);
53typedef void * (_System Typedef2PVoid)(void);
54typedef int (_System Typedef2Int)(void);
55typedef PTYPE (_System Typedef2PType)(void);
56
57typedef void (* _System PTypedef1Void)(void);
58typedef void * (* _System PTypedef1PVoid)(void);
59typedef int (* _System PTypedef1Int)(void);
60typedef PTYPE (* _System PTypedef1PType)(void);
61
62/* Alternate writing which should have the same effect I think... */
63typedef void (_System * PTypedef2Void)(void);
64typedef void * (_System * PTypedef2PVoid)(void);
65typedef int (_System * PTypedef2Int)(void);
66typedef PTYPE (_System * PTypedef2PType)(void);
67
68
69/*
70 * Structures.
71 * Should not cause warnings.
72 */
73typedef struct VFT
74{
75 void (* _System PStructMemberVoid)(void* pvThis);
76 void * (* _System PStructMemberPVoid)(void* pvThis);
77 int (* _System PStructMemberInt)(void* pvThis);
78 PTYPE (* _System PStructMemberPType)(void* pvThis);
79
80 /* Alternate writing which should have the same effect I think... */
81 void ( _System * PStructMember2Void)(void* pvThis);
82 void * ( _System * PStructMember2PVoid)(void* pvThis);
83 int ( _System * PStructMember2Int)(void* pvThis);
84 PTYPE ( _System * PStructMember2PType)(void* pvThis);
85
86} VFT, *PVFT;
87
88
89extern "C" int DoC(void);
90int main(void)
91{
92 ExternCVoid();
93 ExternCPVoid();
94 ExternCInt();
95 ExternCPType();
96
97 Void();
98 PVoid();
99 Int();
100 PType();
101
102 foo::StaticMemberVoid();
103 foo::StaticMemberPVoid();
104 foo::StaticMemberInt();
105 foo::StaticMemberPType();
106
107 foo obj;
108 obj.MemberVoid();
109 obj.MemberPVoid();
110 obj.MemberInt();
111 obj.MemberPType();
112
113 VFT vft = {0,0,0,0};
114 if (vft.PStructMemberVoid)
115 vft.PStructMemberVoid(&vft);
116 if (vft.PStructMemberPVoid)
117 vft.PStructMemberPVoid(&vft);
118 if (vft.PStructMemberInt)
119 vft.PStructMemberInt(&vft);
120 if (vft.PStructMemberPType)
121 vft.PStructMemberPType(&vft);
122
123 /* test C stuff */
124 DoC();
125
126 /** @todo test typedefs and structure field. */
127
128 return 0;
129}
130
Note: See TracBrowser for help on using the repository browser.