[594] | 1 | typedef struct some_struct_pointer * PTYPE;
|
---|
| 2 |
|
---|
| 3 | /*
|
---|
| 4 | * Function and method declarations.
|
---|
| 5 | * Checks mangling.
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | /* No underscore, No mangling. */
|
---|
| 9 | extern "C" void _System ExternCVoid(void);
|
---|
| 10 | extern "C" void * _System ExternCPVoid(void);
|
---|
| 11 | extern "C" int _System ExternCInt(void);
|
---|
| 12 | extern "C" PTYPE _System ExternCPType(void);
|
---|
| 13 |
|
---|
| 14 | /* No underscore, No mangling. */
|
---|
| 15 | void _System Void(void);
|
---|
| 16 | void * _System PVoid(void);
|
---|
| 17 | int _System Int(void);
|
---|
| 18 | PTYPE _System PType(void);
|
---|
| 19 |
|
---|
| 20 |
|
---|
| 21 | /* Members are mangled. */
|
---|
| 22 | class foo
|
---|
| 23 | {
|
---|
| 24 | public:
|
---|
| 25 | static void _System StaticMemberVoid(void);
|
---|
| 26 | static void * _System StaticMemberPVoid(void);
|
---|
| 27 | static int _System StaticMemberInt(void);
|
---|
| 28 | static 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 | */
|
---|
| 36 | void _System MemberVoid(void);
|
---|
| 37 | void * _System MemberPVoid(void);
|
---|
| 38 | int _System MemberInt(void);
|
---|
| 39 | PTYPE _System MemberPType(void);
|
---|
| 40 | };
|
---|
| 41 |
|
---|
| 42 |
|
---|
| 43 | /*
|
---|
| 44 | * Typedefs.
|
---|
| 45 | * Checks that there is not warnings on these.
|
---|
| 46 | */
|
---|
| 47 | typedef void _System Typedef1Void(void);
|
---|
| 48 | typedef void * _System Typedef1PVoid(void);
|
---|
| 49 | typedef int _System Typedef1Int(void);
|
---|
| 50 | typedef PTYPE _System Typedef1PType(void);
|
---|
| 51 |
|
---|
| 52 | typedef void (_System Typedef2Void)(void);
|
---|
| 53 | typedef void * (_System Typedef2PVoid)(void);
|
---|
| 54 | typedef int (_System Typedef2Int)(void);
|
---|
| 55 | typedef PTYPE (_System Typedef2PType)(void);
|
---|
| 56 |
|
---|
| 57 | typedef void (* _System PTypedef1Void)(void);
|
---|
| 58 | typedef void * (* _System PTypedef1PVoid)(void);
|
---|
| 59 | typedef int (* _System PTypedef1Int)(void);
|
---|
| 60 | typedef PTYPE (* _System PTypedef1PType)(void);
|
---|
| 61 |
|
---|
| 62 | typedef void (_System * PTypedef2Void)(void);
|
---|
| 63 | typedef void * (_System * PTypedef2PVoid)(void);
|
---|
| 64 | typedef int (_System * PTypedef2Int)(void);
|
---|
| 65 | typedef PTYPE (_System * PTypedef2PType)(void);
|
---|
| 66 |
|
---|
| 67 |
|
---|
| 68 | /*
|
---|
| 69 | * Structures.
|
---|
| 70 | * Should not cause warnings.
|
---|
| 71 | */
|
---|
| 72 | typedef struct VFT
|
---|
| 73 | {
|
---|
| 74 | void (_System * PStructMemberVoid)(void* pvThis);
|
---|
| 75 | void * (_System * PStructMemberPVoid)(void* pvThis);
|
---|
| 76 | int (_System * PStructMemberInt)(void* pvThis);
|
---|
| 77 | PTYPE (_System * PStructMemberPType)(void* pvThis);
|
---|
| 78 | } VFT, *PVFT;
|
---|
| 79 |
|
---|
| 80 |
|
---|
| 81 | extern "C" int DoC(void);
|
---|
| 82 | int main(void)
|
---|
| 83 | {
|
---|
| 84 | ExternCVoid();
|
---|
| 85 | ExternCPVoid();
|
---|
| 86 | ExternCInt();
|
---|
| 87 | ExternCPType();
|
---|
| 88 |
|
---|
| 89 | Void();
|
---|
| 90 | PVoid();
|
---|
| 91 | Int();
|
---|
| 92 | PType();
|
---|
| 93 |
|
---|
| 94 | foo::StaticMemberVoid();
|
---|
| 95 | foo::StaticMemberPVoid();
|
---|
| 96 | foo::StaticMemberInt();
|
---|
| 97 | foo::StaticMemberPType();
|
---|
| 98 |
|
---|
| 99 | foo obj;
|
---|
| 100 | obj.MemberVoid();
|
---|
| 101 | obj.MemberPVoid();
|
---|
| 102 | obj.MemberInt();
|
---|
| 103 | obj.MemberPType();
|
---|
| 104 |
|
---|
| 105 | VFT vft = {0,0,0,0};
|
---|
| 106 | if (vft.PStructMemberVoid)
|
---|
| 107 | vft.PStructMemberVoid(&vft);
|
---|
| 108 | if (vft.PStructMemberPVoid)
|
---|
| 109 | vft.PStructMemberPVoid(&vft);
|
---|
| 110 | if (vft.PStructMemberInt)
|
---|
| 111 | vft.PStructMemberInt(&vft);
|
---|
| 112 | if (vft.PStructMemberPType)
|
---|
| 113 | vft.PStructMemberPType(&vft);
|
---|
| 114 |
|
---|
| 115 | DoC();
|
---|
| 116 |
|
---|
| 117 | return 0;
|
---|
| 118 | }
|
---|
| 119 |
|
---|