| [601] | 1 | /* $Id: 570c.c 1231 2004-02-12 15:00:11Z bird $ */ | 
|---|
|  | 2 | /** @file | 
|---|
|  | 3 | * | 
|---|
|  | 4 | * _System declaration and definition testcases. | 
|---|
|  | 5 | * | 
|---|
|  | 6 | * InnoTek Systemberatung GmbH confidential | 
|---|
|  | 7 | * | 
|---|
|  | 8 | * Copyright (c) 2003 InnoTek Systemberatung GmbH | 
|---|
|  | 9 | * Author: knut st. osmundsen <bird-srcspam@anduin.net> | 
|---|
|  | 10 | * | 
|---|
|  | 11 | * All Rights Reserved | 
|---|
|  | 12 | * | 
|---|
|  | 13 | */ | 
|---|
| [594] | 14 | typedef struct some_struct_pointer * PTYPE; | 
|---|
|  | 15 |  | 
|---|
|  | 16 | /* | 
|---|
|  | 17 | * Function and method declarations. | 
|---|
|  | 18 | * Checks mangling. | 
|---|
|  | 19 | */ | 
|---|
|  | 20 | /* No underscore, No mangling. */ | 
|---|
| [599] | 21 | void    _System             Void(int a, int b, int c, int d); | 
|---|
|  | 22 | void *  _System             PVoid(int a, int b, int c, int d); | 
|---|
|  | 23 | int     _System             Int(int a, int b, int c, int d); | 
|---|
|  | 24 | PTYPE   _System             PType(int a, int b, int c, int d); | 
|---|
| [594] | 25 |  | 
|---|
|  | 26 | /* | 
|---|
|  | 27 | * Typedefs. | 
|---|
|  | 28 | * Checks that there is not warnings on these. | 
|---|
|  | 29 | */ | 
|---|
| [599] | 30 | typedef void    _System     Typedef1Void(int a, int b, int c, int d); | 
|---|
|  | 31 | typedef void *  _System     Typedef1PVoid(int a, int b, int c, int d); | 
|---|
|  | 32 | typedef int     _System     Typedef1Int(int a, int b, int c, int d); | 
|---|
|  | 33 | typedef PTYPE   _System     Typedef1PType(int a, int b, int c, int d); | 
|---|
| [594] | 34 |  | 
|---|
| [599] | 35 | typedef void    (_System    Typedef2Void)(int a, int b, int c, int d); | 
|---|
|  | 36 | typedef void *  (_System    Typedef2PVoid)(int a, int b, int c, int d); | 
|---|
|  | 37 | typedef int     (_System    Typedef2Int)(int a, int b, int c, int d); | 
|---|
|  | 38 | typedef PTYPE   (_System    Typedef2PType)(int a, int b, int c, int d); | 
|---|
| [594] | 39 |  | 
|---|
| [599] | 40 | typedef void    (* _System  PTypedef1Void)(int a, int b, int c, int d); | 
|---|
|  | 41 | typedef void *  (* _System  PTypedef1PVoid)(int a, int b, int c, int d); | 
|---|
|  | 42 | typedef int     (* _System  PTypedef1Int)(int a, int b, int c, int d); | 
|---|
|  | 43 | typedef PTYPE   (* _System  PTypedef1PType)(int a, int b, int c, int d); | 
|---|
| [594] | 44 |  | 
|---|
| [595] | 45 | /* Alternate writing which should have the same effect I think... */ | 
|---|
| [599] | 46 | typedef void    (_System *  PTypedef2Void)(int a, int b, int c, int d); | 
|---|
|  | 47 | typedef void *  (_System *  PTypedef2PVoid)(int a, int b, int c, int d); | 
|---|
|  | 48 | typedef int     (_System *  PTypedef2Int)(int a, int b, int c, int d); | 
|---|
|  | 49 | typedef PTYPE   (_System *  PTypedef2PType)(int a, int b, int c, int d); | 
|---|
| [594] | 50 |  | 
|---|
|  | 51 |  | 
|---|
|  | 52 | /* | 
|---|
|  | 53 | * Structures. | 
|---|
|  | 54 | */ | 
|---|
|  | 55 | typedef struct VFT | 
|---|
|  | 56 | { | 
|---|
| [599] | 57 | void    (_System *  PStructMemberVoid)(int a, int b, int c, int d); | 
|---|
|  | 58 | void *  (_System *  PStructMemberPVoid)(int a, int b, int c, int d); | 
|---|
|  | 59 | int     (_System *  PStructMemberInt)(int a, int b, int c, int d); | 
|---|
|  | 60 | PTYPE   (_System *  PStructMemberPType)(int a, int b, int c, int d); | 
|---|
| [595] | 61 |  | 
|---|
|  | 62 | /* Alternate writing which should have the same effect I think... */ | 
|---|
| [599] | 63 | void    ( _System * PStructMember2Void)(int a, int b, int c, int d); | 
|---|
|  | 64 | void *  ( _System * PStructMember2PVoid)(int a, int b, int c, int d); | 
|---|
|  | 65 | int     ( _System * PStructMember2Int)(int a, int b, int c, int d); | 
|---|
|  | 66 | PTYPE   ( _System * PStructMember2PType)(int a, int b, int c, int d); | 
|---|
| [595] | 67 |  | 
|---|
| [594] | 68 | } VFT, *PVFT; | 
|---|
|  | 69 |  | 
|---|
|  | 70 |  | 
|---|
| [639] | 71 | /* | 
|---|
|  | 72 | * Variables | 
|---|
|  | 73 | */ | 
|---|
|  | 74 | void    (* _System PVar1Void)(int a, int b, int c, int d); | 
|---|
|  | 75 | void *  (* _System PVar1PVoid)(int a, int b, int c, int d); | 
|---|
|  | 76 | int     (* _System PVar1Int)(int a, int b, int c, int d); | 
|---|
|  | 77 | PTYPE   (* _System PVar1PType)(int a, int b, int c, int d); | 
|---|
|  | 78 |  | 
|---|
|  | 79 | /* Alternate writing which should have the same effect I think... */ | 
|---|
|  | 80 | void    (_System * PVar2Void)(int a, int b, int c, int d); | 
|---|
|  | 81 | void *  (_System * PVar2PVoid)(int a, int b, int c, int d); | 
|---|
|  | 82 | int     (_System * PVar2Int)(int a, int b, int c, int d); | 
|---|
|  | 83 | PTYPE   (_System * PVar2PType)(int a, int b, int c, int d); | 
|---|
|  | 84 |  | 
|---|
|  | 85 |  | 
|---|
| [1231] | 86 | extern void _System glutDisplayFunc1(void (* _System)(void)); | 
|---|
|  | 87 | extern void _System glutDisplayFunc2(void (_System *)(void)); | 
|---|
|  | 88 |  | 
|---|
| [906] | 89 | /* | 
|---|
|  | 90 | * Parameters. | 
|---|
|  | 91 | */ | 
|---|
|  | 92 | int ParamArgs( | 
|---|
|  | 93 | void    (* _System pfn1Void)(int a, int b, int c, int d), | 
|---|
|  | 94 | void *  (* _System pfn1PVoid)(int a, int b, int c, int d), | 
|---|
|  | 95 | int     (* _System pfn1Int)(int a, int b, int c, int d), | 
|---|
|  | 96 | PTYPE   (* _System pfn1PType)(int a, int b, int c, int d), | 
|---|
|  | 97 | void    (_System * pfn2Void)(int a, int b, int c, int d), | 
|---|
|  | 98 | void *  (_System * pfn2PVoid)(int a, int b, int c, int d), | 
|---|
|  | 99 | int     (_System * pfn2Int)(int a, int b, int c, int d), | 
|---|
|  | 100 | PTYPE   (_System * pfn2PType)(int a, int b, int c, int d) | 
|---|
|  | 101 | ) | 
|---|
|  | 102 | { | 
|---|
|  | 103 | pfn1Void(1,2,3,4); | 
|---|
|  | 104 | pfn1PVoid(1,2,3,4); | 
|---|
|  | 105 | pfn1Int(1,2,3,4); | 
|---|
|  | 106 | pfn1PType(1,2,3,4); | 
|---|
| [639] | 107 |  | 
|---|
| [906] | 108 | pfn2Void(1,2,3,4); | 
|---|
|  | 109 | pfn2PVoid(1,2,3,4); | 
|---|
|  | 110 | pfn2Int(1,2,3,4); | 
|---|
|  | 111 | pfn2PType(1,2,3,4); | 
|---|
|  | 112 | return 0; | 
|---|
|  | 113 | } | 
|---|
|  | 114 |  | 
|---|
|  | 115 |  | 
|---|
|  | 116 |  | 
|---|
| [599] | 117 | int DoC(int a, int b, int c, int d) | 
|---|
| [594] | 118 | { | 
|---|
| [600] | 119 | static VFT vft = {Void, PVoid, Int, PType, | 
|---|
|  | 120 | Void, PVoid, Int, PType}; | 
|---|
| [594] | 121 |  | 
|---|
| [600] | 122 | static Typedef1Void       * pfnTypedef1Void   = Void; | 
|---|
|  | 123 | static Typedef1PVoid      * pfnTypedef1PVoid  = PVoid; | 
|---|
|  | 124 | static Typedef1Int        * pfnTypedef1Int    = Int; | 
|---|
|  | 125 | static Typedef1PType      * pfnTypedef1PType  = PType; | 
|---|
| [594] | 126 |  | 
|---|
| [600] | 127 | static Typedef2Void       * pfnTypedef2Void   = Void; | 
|---|
|  | 128 | static Typedef2PVoid      * pfnTypedef2PVoid  = PVoid; | 
|---|
|  | 129 | static Typedef2Int        * pfnTypedef2Int    = Int; | 
|---|
|  | 130 | static Typedef2PType      * pfnTypedef2PType  = PType; | 
|---|
| [594] | 131 |  | 
|---|
| [600] | 132 | static PTypedef1Void        pfnPTypedef1Void  = Void; | 
|---|
|  | 133 | static PTypedef1PVoid       pfnPTypedef1PVoid = PVoid; | 
|---|
|  | 134 | static PTypedef1Int         pfnPTypedef1Int   = Int; | 
|---|
|  | 135 | static PTypedef1PType       pfnPTypedef1PType = PType; | 
|---|
| [599] | 136 |  | 
|---|
| [600] | 137 | static PTypedef2Void        pfnPTypedef2Void  = Void; | 
|---|
|  | 138 | static PTypedef2PVoid       pfnPTypedef2PVoid = PVoid; | 
|---|
|  | 139 | static PTypedef2Int         pfnPTypedef2Int   = Int; | 
|---|
|  | 140 | static PTypedef2PType       pfnPTypedef2PType = PType; | 
|---|
| [599] | 141 |  | 
|---|
| [639] | 142 | PVar1Void   = Void; | 
|---|
|  | 143 | PVar1PVoid  = PVoid; | 
|---|
|  | 144 | PVar1Int    = Int; | 
|---|
|  | 145 | PVar1PType  = PType; | 
|---|
| [599] | 146 |  | 
|---|
| [639] | 147 | PVar2Void   = Void; | 
|---|
|  | 148 | PVar2PVoid  = PVoid; | 
|---|
|  | 149 | PVar2Int    = Int; | 
|---|
|  | 150 | PVar2PType  = PType; | 
|---|
|  | 151 |  | 
|---|
|  | 152 |  | 
|---|
| [599] | 153 | /* extern functions */ | 
|---|
|  | 154 | Void(1,2,3,4); | 
|---|
|  | 155 | PVoid(1,2,3,4); | 
|---|
|  | 156 | Int(1,2,3,4); | 
|---|
|  | 157 | PType(1,2,3,4); | 
|---|
|  | 158 |  | 
|---|
|  | 159 | /* typedefs */ | 
|---|
|  | 160 | pfnTypedef1Void(1,2,3,4); | 
|---|
|  | 161 | pfnTypedef1PVoid(1,2,3,4); | 
|---|
|  | 162 | pfnTypedef1Int(1,2,3,4); | 
|---|
|  | 163 | pfnTypedef1PType(1,2,3,4); | 
|---|
|  | 164 |  | 
|---|
|  | 165 | pfnTypedef2Void(1,2,3,4); | 
|---|
|  | 166 | pfnTypedef2PVoid(1,2,3,4); | 
|---|
|  | 167 | pfnTypedef2Int(1,2,3,4); | 
|---|
|  | 168 | pfnTypedef2PType(1,2,3,4); | 
|---|
|  | 169 |  | 
|---|
|  | 170 | pfnPTypedef1Void(1,2,3,4); | 
|---|
|  | 171 | pfnPTypedef1PVoid(1,2,3,4); | 
|---|
|  | 172 | pfnPTypedef1Int(1,2,3,4); | 
|---|
|  | 173 | pfnPTypedef1PType(1,2,3,4); | 
|---|
|  | 174 |  | 
|---|
|  | 175 | pfnPTypedef2Void(1,2,3,4); | 
|---|
|  | 176 | pfnPTypedef2PVoid(1,2,3,4); | 
|---|
|  | 177 | pfnPTypedef2Int(1,2,3,4); | 
|---|
|  | 178 | pfnPTypedef2PType(1,2,3,4); | 
|---|
|  | 179 |  | 
|---|
|  | 180 |  | 
|---|
|  | 181 | /* structs */ | 
|---|
|  | 182 | vft.PStructMemberVoid(1,2,3,4); | 
|---|
|  | 183 | vft.PStructMemberPVoid(1,2,3,4); | 
|---|
|  | 184 | vft.PStructMemberInt(1,2,3,4); | 
|---|
|  | 185 | vft.PStructMemberPType(1,2,3,4); | 
|---|
|  | 186 |  | 
|---|
|  | 187 | vft.PStructMember2Void(1,2,3,4); | 
|---|
|  | 188 | vft.PStructMember2PVoid(1,2,3,4); | 
|---|
|  | 189 | vft.PStructMember2Int(1,2,3,4); | 
|---|
|  | 190 | vft.PStructMember2PType(1,2,3,4); | 
|---|
|  | 191 |  | 
|---|
| [639] | 192 |  | 
|---|
|  | 193 | /* variables */ | 
|---|
|  | 194 | PVar1Void(1,2,3,4); | 
|---|
|  | 195 | PVar1PVoid(1,2,3,4); | 
|---|
|  | 196 | PVar1Int(1,2,3,4); | 
|---|
|  | 197 | PVar1PType(1,2,3,4); | 
|---|
|  | 198 |  | 
|---|
|  | 199 | PVar2Void(1,2,3,4); | 
|---|
|  | 200 | PVar2PVoid(1,2,3,4); | 
|---|
|  | 201 | PVar2Int(1,2,3,4); | 
|---|
|  | 202 | PVar2PType(1,2,3,4); | 
|---|
|  | 203 |  | 
|---|
| [906] | 204 | /* parameters */ | 
|---|
|  | 205 | ParamArgs(Void, PVoid, Int, PType, | 
|---|
|  | 206 | Void, PVoid, Int, PType); | 
|---|
|  | 207 |  | 
|---|
|  | 208 |  | 
|---|
| [594] | 209 | return 0; | 
|---|
|  | 210 | } | 
|---|
|  | 211 |  | 
|---|