[600] | 1 | #include <stdio.h>
|
---|
[594] | 2 | typedef struct some_struct_pointer * PTYPE;
|
---|
| 3 |
|
---|
| 4 | /*
|
---|
| 5 | * Function and method declarations.
|
---|
| 6 | * Checks mangling.
|
---|
| 7 | */
|
---|
| 8 |
|
---|
| 9 | /* No underscore, No mangling. */
|
---|
[599] | 10 | extern "C" void _System ExternCVoid(int a, int b, int c, int d);
|
---|
| 11 | extern "C" void * _System ExternCPVoid(int a, int b, int c, int d);
|
---|
| 12 | extern "C" int _System ExternCInt(int a, int b, int c, int d);
|
---|
| 13 | extern "C" PTYPE _System ExternCPType(int a, int b, int c, int d);
|
---|
[594] | 14 |
|
---|
| 15 | /* No underscore, No mangling. */
|
---|
[599] | 16 | void _System Void(int a, int b, int c, int d);
|
---|
| 17 | void * _System PVoid(int a, int b, int c, int d);
|
---|
| 18 | int _System Int(int a, int b, int c, int d);
|
---|
| 19 | PTYPE _System PType(int a, int b, int c, int d);
|
---|
[594] | 20 |
|
---|
| 21 |
|
---|
| 22 | /* Members are mangled. */
|
---|
| 23 | class foo
|
---|
| 24 | {
|
---|
| 25 | public:
|
---|
[599] | 26 | static void _System StaticMemberVoid(int a, int b, int c, int d);
|
---|
| 27 | static void * _System StaticMemberPVoid(int a, int b, int c, int d);
|
---|
| 28 | static int _System StaticMemberInt(int a, int b, int c, int d);
|
---|
| 29 | static PTYPE _System StaticMemberPType(int a, int b, int c, int d);
|
---|
[594] | 30 |
|
---|
| 31 | /* VAC365 allows this too, and actually mangles the
|
---|
| 32 | * calling convention into the name.
|
---|
| 33 | * _System: MemberVoid__3fooF__l2_v
|
---|
| 34 | * default: MemberVoid__3fooFv
|
---|
| 35 | * We don't need to support this, it's just a curiosity.
|
---|
| 36 | */
|
---|
[599] | 37 | void _System MemberVoid(int a, int b, int c, int d);
|
---|
| 38 | void * _System MemberPVoid(int a, int b, int c, int d);
|
---|
| 39 | int _System MemberInt(int a, int b, int c, int d);
|
---|
| 40 | PTYPE _System MemberPType(int a, int b, int c, int d);
|
---|
[594] | 41 | };
|
---|
| 42 |
|
---|
| 43 |
|
---|
| 44 | /*
|
---|
| 45 | * Typedefs.
|
---|
| 46 | * Checks that there is not warnings on these.
|
---|
| 47 | */
|
---|
[599] | 48 | typedef void _System Typedef1Void(int a, int b, int c, int d);
|
---|
| 49 | typedef void * _System Typedef1PVoid(int a, int b, int c, int d);
|
---|
| 50 | typedef int _System Typedef1Int(int a, int b, int c, int d);
|
---|
| 51 | typedef PTYPE _System Typedef1PType(int a, int b, int c, int d);
|
---|
[594] | 52 |
|
---|
[599] | 53 | typedef void (_System Typedef2Void)(int a, int b, int c, int d);
|
---|
| 54 | typedef void * (_System Typedef2PVoid)(int a, int b, int c, int d);
|
---|
| 55 | typedef int (_System Typedef2Int)(int a, int b, int c, int d);
|
---|
| 56 | typedef PTYPE (_System Typedef2PType)(int a, int b, int c, int d);
|
---|
[594] | 57 |
|
---|
[599] | 58 | typedef void (* _System PTypedef1Void)(int a, int b, int c, int d);
|
---|
| 59 | typedef void * (* _System PTypedef1PVoid)(int a, int b, int c, int d);
|
---|
| 60 | typedef int (* _System PTypedef1Int)(int a, int b, int c, int d);
|
---|
| 61 | typedef PTYPE (* _System PTypedef1PType)(int a, int b, int c, int d);
|
---|
[594] | 62 |
|
---|
[595] | 63 | /* Alternate writing which should have the same effect I think... */
|
---|
[599] | 64 | typedef void (_System * PTypedef2Void)(int a, int b, int c, int d);
|
---|
| 65 | typedef void * (_System * PTypedef2PVoid)(int a, int b, int c, int d);
|
---|
| 66 | typedef int (_System * PTypedef2Int)(int a, int b, int c, int d);
|
---|
| 67 | typedef PTYPE (_System * PTypedef2PType)(int a, int b, int c, int d);
|
---|
[594] | 68 |
|
---|
| 69 |
|
---|
| 70 | /*
|
---|
| 71 | * Structures.
|
---|
| 72 | * Should not cause warnings.
|
---|
| 73 | */
|
---|
| 74 | typedef struct VFT
|
---|
| 75 | {
|
---|
[599] | 76 | void (* _System PStructMemberVoid)(int a, int b, int c, int d);
|
---|
| 77 | void * (* _System PStructMemberPVoid)(int a, int b, int c, int d);
|
---|
| 78 | int (* _System PStructMemberInt)(int a, int b, int c, int d);
|
---|
| 79 | PTYPE (* _System PStructMemberPType)(int a, int b, int c, int d);
|
---|
[595] | 80 |
|
---|
| 81 | /* Alternate writing which should have the same effect I think... */
|
---|
[599] | 82 | void ( _System * PStructMember2Void)(int a, int b, int c, int d);
|
---|
| 83 | void * ( _System * PStructMember2PVoid)(int a, int b, int c, int d);
|
---|
| 84 | int ( _System * PStructMember2Int)(int a, int b, int c, int d);
|
---|
| 85 | PTYPE ( _System * PStructMember2PType)(int a, int b, int c, int d);
|
---|
[595] | 86 |
|
---|
[594] | 87 | } VFT, *PVFT;
|
---|
| 88 |
|
---|
| 89 |
|
---|
| 90 | extern "C" int DoC(void);
|
---|
| 91 | int main(void)
|
---|
| 92 | {
|
---|
[600] | 93 | static VFT vft = {Void, PVoid, Int, PType,
|
---|
| 94 | Void, PVoid, Int, PType};
|
---|
[594] | 95 |
|
---|
[600] | 96 | static Typedef1Void * pfnTypedef1Void = Void;
|
---|
| 97 | static Typedef1PVoid * pfnTypedef1PVoid = PVoid;
|
---|
| 98 | static Typedef1Int * pfnTypedef1Int = Int;
|
---|
| 99 | static Typedef1PType * pfnTypedef1PType = PType;
|
---|
[594] | 100 |
|
---|
[600] | 101 | static Typedef2Void * pfnTypedef2Void = Void;
|
---|
| 102 | static Typedef2PVoid * pfnTypedef2PVoid = PVoid;
|
---|
| 103 | static Typedef2Int * pfnTypedef2Int = Int;
|
---|
| 104 | static Typedef2PType * pfnTypedef2PType = PType;
|
---|
[594] | 105 |
|
---|
[600] | 106 | static PTypedef1Void pfnPTypedef1Void = Void;
|
---|
| 107 | static PTypedef1PVoid pfnPTypedef1PVoid = PVoid;
|
---|
| 108 | static PTypedef1Int pfnPTypedef1Int = Int;
|
---|
| 109 | static PTypedef1PType pfnPTypedef1PType = PType;
|
---|
[599] | 110 |
|
---|
[600] | 111 | static PTypedef2Void pfnPTypedef2Void = Void;
|
---|
| 112 | static PTypedef2PVoid pfnPTypedef2PVoid = PVoid;
|
---|
| 113 | static PTypedef2Int pfnPTypedef2Int = Int;
|
---|
| 114 | static PTypedef2PType pfnPTypedef2PType = PType;
|
---|
[599] | 115 |
|
---|
| 116 | /* extern functions */
|
---|
| 117 | ExternCVoid(1,2,3,4);
|
---|
| 118 | ExternCPVoid(1,2,3,4);
|
---|
| 119 | ExternCInt(1,2,3,4);
|
---|
| 120 | ExternCPType(1,2,3,4);
|
---|
| 121 |
|
---|
| 122 | Void(1,2,3,4);
|
---|
| 123 | PVoid(1,2,3,4);
|
---|
| 124 | Int(1,2,3,4);
|
---|
| 125 | PType(1,2,3,4);
|
---|
| 126 |
|
---|
| 127 | /* class */
|
---|
| 128 | foo::StaticMemberVoid(1,2,3,4);
|
---|
| 129 | foo::StaticMemberPVoid(1,2,3,4);
|
---|
| 130 | foo::StaticMemberInt(1,2,3,4);
|
---|
| 131 | foo::StaticMemberPType(1,2,3,4);
|
---|
| 132 |
|
---|
[594] | 133 | foo obj;
|
---|
[599] | 134 | obj.MemberVoid(1,2,3,4);
|
---|
| 135 | obj.MemberPVoid(1,2,3,4);
|
---|
| 136 | obj.MemberInt(1,2,3,4);
|
---|
| 137 | obj.MemberPType(1,2,3,4);
|
---|
[594] | 138 |
|
---|
[599] | 139 | /* typedefs */
|
---|
| 140 | pfnTypedef1Void(1,2,3,4);
|
---|
| 141 | pfnTypedef1PVoid(1,2,3,4);
|
---|
| 142 | pfnTypedef1Int(1,2,3,4);
|
---|
| 143 | pfnTypedef1PType(1,2,3,4);
|
---|
[594] | 144 |
|
---|
[599] | 145 | pfnTypedef2Void(1,2,3,4);
|
---|
| 146 | pfnTypedef2PVoid(1,2,3,4);
|
---|
| 147 | pfnTypedef2Int(1,2,3,4);
|
---|
| 148 | pfnTypedef2PType(1,2,3,4);
|
---|
| 149 |
|
---|
| 150 | pfnPTypedef1Void(1,2,3,4);
|
---|
| 151 | pfnPTypedef1PVoid(1,2,3,4);
|
---|
| 152 | pfnPTypedef1Int(1,2,3,4);
|
---|
| 153 | pfnPTypedef1PType(1,2,3,4);
|
---|
| 154 |
|
---|
| 155 | pfnPTypedef2Void(1,2,3,4);
|
---|
| 156 | pfnPTypedef2PVoid(1,2,3,4);
|
---|
| 157 | pfnPTypedef2Int(1,2,3,4);
|
---|
| 158 | pfnPTypedef2PType(1,2,3,4);
|
---|
| 159 |
|
---|
| 160 |
|
---|
| 161 | /* structs */
|
---|
| 162 | vft.PStructMemberVoid(1,2,3,4);
|
---|
| 163 | vft.PStructMemberPVoid(1,2,3,4);
|
---|
| 164 | vft.PStructMemberInt(1,2,3,4);
|
---|
| 165 | vft.PStructMemberPType(1,2,3,4);
|
---|
| 166 |
|
---|
| 167 | vft.PStructMember2Void(1,2,3,4);
|
---|
| 168 | vft.PStructMember2PVoid(1,2,3,4);
|
---|
| 169 | vft.PStructMember2Int(1,2,3,4);
|
---|
| 170 | vft.PStructMember2PType(1,2,3,4);
|
---|
| 171 |
|
---|
[595] | 172 | /* test C stuff */
|
---|
[594] | 173 | DoC();
|
---|
| 174 |
|
---|
[600] | 175 | printf("Successfully executed _System testcase (assumed).\n");
|
---|
[594] | 176 | return 0;
|
---|
| 177 | }
|
---|
| 178 |
|
---|