| 1 | /* $Id: 572main.cpp 1232 2004-02-12 15:21:45Z bird $ */
|
|---|
| 2 | /** @file
|
|---|
| 3 | *
|
|---|
| 4 | * _Optlink declaration and definition testcases.
|
|---|
| 5 | *
|
|---|
| 6 | * InnoTek Systemberatung GmbH confidential
|
|---|
| 7 | *
|
|---|
| 8 | * Copyright (c) 2003 InnoTek Systemberatung GmbH
|
|---|
| 9 | * Author: knut st. osmundsen <[email protected]>
|
|---|
| 10 | *
|
|---|
| 11 | * All Rights Reserved
|
|---|
| 12 | *
|
|---|
| 13 | */
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 | #include <stdio.h>
|
|---|
| 17 | typedef struct some_struct_pointer * PTYPE;
|
|---|
| 18 |
|
|---|
| 19 | /*
|
|---|
| 20 | * Function and method declarations.
|
|---|
| 21 | * Checks mangling.
|
|---|
| 22 | */
|
|---|
| 23 |
|
|---|
| 24 | /* No underscore, No mangling. */
|
|---|
| 25 | extern "C" void _Optlink ExternCVoid(int a, int b, int c, int d);
|
|---|
| 26 | extern "C" void * _Optlink ExternCPVoid(int a, int b, int c, int d);
|
|---|
| 27 | extern "C" int _Optlink ExternCInt(int a, int b, int c, int d);
|
|---|
| 28 | extern "C" PTYPE _Optlink ExternCPType(int a, int b, int c, int d);
|
|---|
| 29 |
|
|---|
| 30 | /* No underscore, No mangling. */
|
|---|
| 31 | void _Optlink Void(int a, int b, int c, int d);
|
|---|
| 32 | void * _Optlink PVoid(int a, int b, int c, int d);
|
|---|
| 33 | int _Optlink Int(int a, int b, int c, int d);
|
|---|
| 34 | PTYPE _Optlink PType(int a, int b, int c, int d);
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 | /* Members are mangled. */
|
|---|
| 38 | class foo
|
|---|
| 39 | {
|
|---|
| 40 | public:
|
|---|
| 41 | static void _Optlink StaticMemberVoid(int a, int b, int c, int d);
|
|---|
| 42 | static void * _Optlink StaticMemberPVoid(int a, int b, int c, int d);
|
|---|
| 43 | static int _Optlink StaticMemberInt(int a, int b, int c, int d);
|
|---|
| 44 | static PTYPE _Optlink StaticMemberPType(int a, int b, int c, int d);
|
|---|
| 45 |
|
|---|
| 46 | /* VAC365 allows this too, and actually mangles the
|
|---|
| 47 | * calling convention into the name.
|
|---|
| 48 | * _System: MemberVoid__3fooF__l2_v
|
|---|
| 49 | * default: MemberVoid__3fooFv
|
|---|
| 50 | * We don't need to support this, it's just a curiosity.
|
|---|
| 51 | */
|
|---|
| 52 | void _Optlink MemberVoid(int a, int b, int c, int d);
|
|---|
| 53 | void * _Optlink MemberPVoid(int a, int b, int c, int d);
|
|---|
| 54 | int _Optlink MemberInt(int a, int b, int c, int d);
|
|---|
| 55 | PTYPE _Optlink MemberPType(int a, int b, int c, int d);
|
|---|
| 56 | };
|
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 | /*
|
|---|
| 60 | * Typedefs.
|
|---|
| 61 | * Checks that there is not warnings on these.
|
|---|
| 62 | */
|
|---|
| 63 | typedef void _Optlink Typedef1Void(int a, int b, int c, int d);
|
|---|
| 64 | typedef void * _Optlink Typedef1PVoid(int a, int b, int c, int d);
|
|---|
| 65 | typedef int _Optlink Typedef1Int(int a, int b, int c, int d);
|
|---|
| 66 | typedef PTYPE _Optlink Typedef1PType(int a, int b, int c, int d);
|
|---|
| 67 |
|
|---|
| 68 | typedef void (_Optlink Typedef2Void)(int a, int b, int c, int d);
|
|---|
| 69 | typedef void * (_Optlink Typedef2PVoid)(int a, int b, int c, int d);
|
|---|
| 70 | typedef int (_Optlink Typedef2Int)(int a, int b, int c, int d);
|
|---|
| 71 | typedef PTYPE (_Optlink Typedef2PType)(int a, int b, int c, int d);
|
|---|
| 72 | #ifdef __EMX__
|
|---|
| 73 | typedef void _Optlink (Typedef3Void)(int a, int b, int c, int d);
|
|---|
| 74 | typedef void * _Optlink (Typedef3PVoid)(int a, int b, int c, int d);
|
|---|
| 75 | typedef int _Optlink (Typedef3Int)(int a, int b, int c, int d);
|
|---|
| 76 | typedef PTYPE _Optlink (Typedef3PType)(int a, int b, int c, int d);
|
|---|
| 77 | #endif
|
|---|
| 78 |
|
|---|
| 79 | typedef void (* _Optlink PTypedef1Void)(int a, int b, int c, int d);
|
|---|
| 80 | typedef void * (* _Optlink PTypedef1PVoid)(int a, int b, int c, int d);
|
|---|
| 81 | typedef int (* _Optlink PTypedef1Int)(int a, int b, int c, int d);
|
|---|
| 82 | typedef PTYPE (* _Optlink PTypedef1PType)(int a, int b, int c, int d);
|
|---|
| 83 |
|
|---|
| 84 | /* Alternate writing which should have the same effect I think... */
|
|---|
| 85 | typedef void (_Optlink * PTypedef2Void)(int a, int b, int c, int d);
|
|---|
| 86 | typedef void * (_Optlink * PTypedef2PVoid)(int a, int b, int c, int d);
|
|---|
| 87 | typedef int (_Optlink * PTypedef2Int)(int a, int b, int c, int d);
|
|---|
| 88 | typedef PTYPE (_Optlink * PTypedef2PType)(int a, int b, int c, int d);
|
|---|
| 89 | #ifdef __EMX__
|
|---|
| 90 | /* Alternate writing which should have the same effect I think... */
|
|---|
| 91 | typedef void _Optlink (* PTypedef3Void)(int a, int b, int c, int d);
|
|---|
| 92 | typedef void * _Optlink (* PTypedef3PVoid)(int a, int b, int c, int d);
|
|---|
| 93 | typedef int _Optlink (* PTypedef3Int)(int a, int b, int c, int d);
|
|---|
| 94 | typedef PTYPE _Optlink (* PTypedef3PType)(int a, int b, int c, int d);
|
|---|
| 95 | #endif
|
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 | /*
|
|---|
| 99 | * Structures.
|
|---|
| 100 | * Should not cause warnings.
|
|---|
| 101 | */
|
|---|
| 102 | typedef struct VFT
|
|---|
| 103 | {
|
|---|
| 104 | void (* _Optlink PStructMemberVoid)(int a, int b, int c, int d);
|
|---|
| 105 | void * (* _Optlink PStructMemberPVoid)(int a, int b, int c, int d);
|
|---|
| 106 | int (* _Optlink PStructMemberInt)(int a, int b, int c, int d);
|
|---|
| 107 | PTYPE (* _Optlink PStructMemberPType)(int a, int b, int c, int d);
|
|---|
| 108 |
|
|---|
| 109 | /* Alternate writing which should have the same effect I think... */
|
|---|
| 110 | void (_Optlink * PStructMember2Void)(int a, int b, int c, int d);
|
|---|
| 111 | void * (_Optlink * PStructMember2PVoid)(int a, int b, int c, int d);
|
|---|
| 112 | int (_Optlink * PStructMember2Int)(int a, int b, int c, int d);
|
|---|
| 113 | PTYPE (_Optlink * PStructMember2PType)(int a, int b, int c, int d);
|
|---|
| 114 | #ifdef __EMX__
|
|---|
| 115 | /* Alternate writing which should have the same effect I think... */
|
|---|
| 116 | void _Optlink (* PStructMember3Void)(int a, int b, int c, int d);
|
|---|
| 117 | void * _Optlink (* PStructMember3PVoid)(int a, int b, int c, int d);
|
|---|
| 118 | int _Optlink (* PStructMember3Int)(int a, int b, int c, int d);
|
|---|
| 119 | PTYPE _Optlink (* PStructMember3PType)(int a, int b, int c, int d);
|
|---|
| 120 | #endif
|
|---|
| 121 |
|
|---|
| 122 | } VFT, *PVFT;
|
|---|
| 123 |
|
|---|
| 124 |
|
|---|
| 125 | /*
|
|---|
| 126 | * Variables
|
|---|
| 127 | */
|
|---|
| 128 | void (* _Optlink PVar1Void)(int a, int b, int c, int d);
|
|---|
| 129 | void * (* _Optlink PVar1PVoid)(int a, int b, int c, int d);
|
|---|
| 130 | int (* _Optlink PVar1Int)(int a, int b, int c, int d);
|
|---|
| 131 | PTYPE (* _Optlink PVar1PType)(int a, int b, int c, int d);
|
|---|
| 132 |
|
|---|
| 133 | /* Alternate writing which should have the same effect I think... */
|
|---|
| 134 | void (_Optlink * PVar2Void)(int a, int b, int c, int d);
|
|---|
| 135 | void * (_Optlink * PVar2PVoid)(int a, int b, int c, int d);
|
|---|
| 136 | int (_Optlink * PVar2Int)(int a, int b, int c, int d);
|
|---|
| 137 | PTYPE (_Optlink * PVar2PType)(int a, int b, int c, int d);
|
|---|
| 138 | #ifdef __EMX__
|
|---|
| 139 | void _Optlink (* PVar3Void)(int a, int b, int c, int d);
|
|---|
| 140 | void * _Optlink (* PVar3PVoid)(int a, int b, int c, int d);
|
|---|
| 141 | int _Optlink (* PVar3Int)(int a, int b, int c, int d);
|
|---|
| 142 | PTYPE _Optlink (* PVar3PType)(int a, int b, int c, int d);
|
|---|
| 143 | #endif
|
|---|
| 144 |
|
|---|
|
|---|