| 1 | /* $Id: 570c.c 639 2003-08-19 00:11:21Z 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 | */ | 
|---|
| 14 | typedef struct some_struct_pointer * PTYPE; | 
|---|
| 15 |  | 
|---|
| 16 | /* | 
|---|
| 17 | * Function and method declarations. | 
|---|
| 18 | * Checks mangling. | 
|---|
| 19 | */ | 
|---|
| 20 | /* No underscore, No mangling. */ | 
|---|
| 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); | 
|---|
| 25 |  | 
|---|
| 26 | /* | 
|---|
| 27 | * Typedefs. | 
|---|
| 28 | * Checks that there is not warnings on these. | 
|---|
| 29 | */ | 
|---|
| 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); | 
|---|
| 34 |  | 
|---|
| 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); | 
|---|
| 39 |  | 
|---|
| 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); | 
|---|
| 44 |  | 
|---|
| 45 | /* Alternate writing which should have the same effect I think... */ | 
|---|
| 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); | 
|---|
| 50 |  | 
|---|
| 51 |  | 
|---|
| 52 | /* | 
|---|
| 53 | * Structures. | 
|---|
| 54 | */ | 
|---|
| 55 | typedef struct VFT | 
|---|
| 56 | { | 
|---|
| 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); | 
|---|
| 61 |  | 
|---|
| 62 | /* Alternate writing which should have the same effect I think... */ | 
|---|
| 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); | 
|---|
| 67 |  | 
|---|
| 68 | } VFT, *PVFT; | 
|---|
| 69 |  | 
|---|
| 70 |  | 
|---|
| 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 |  | 
|---|
| 86 |  | 
|---|
| 87 | int DoC(int a, int b, int c, int d) | 
|---|
| 88 | { | 
|---|
| 89 | static VFT vft = {Void, PVoid, Int, PType, | 
|---|
| 90 | Void, PVoid, Int, PType}; | 
|---|
| 91 |  | 
|---|
| 92 | static Typedef1Void       * pfnTypedef1Void   = Void; | 
|---|
| 93 | static Typedef1PVoid      * pfnTypedef1PVoid  = PVoid; | 
|---|
| 94 | static Typedef1Int        * pfnTypedef1Int    = Int; | 
|---|
| 95 | static Typedef1PType      * pfnTypedef1PType  = PType; | 
|---|
| 96 |  | 
|---|
| 97 | static Typedef2Void       * pfnTypedef2Void   = Void; | 
|---|
| 98 | static Typedef2PVoid      * pfnTypedef2PVoid  = PVoid; | 
|---|
| 99 | static Typedef2Int        * pfnTypedef2Int    = Int; | 
|---|
| 100 | static Typedef2PType      * pfnTypedef2PType  = PType; | 
|---|
| 101 |  | 
|---|
| 102 | static PTypedef1Void        pfnPTypedef1Void  = Void; | 
|---|
| 103 | static PTypedef1PVoid       pfnPTypedef1PVoid = PVoid; | 
|---|
| 104 | static PTypedef1Int         pfnPTypedef1Int   = Int; | 
|---|
| 105 | static PTypedef1PType       pfnPTypedef1PType = PType; | 
|---|
| 106 |  | 
|---|
| 107 | static PTypedef2Void        pfnPTypedef2Void  = Void; | 
|---|
| 108 | static PTypedef2PVoid       pfnPTypedef2PVoid = PVoid; | 
|---|
| 109 | static PTypedef2Int         pfnPTypedef2Int   = Int; | 
|---|
| 110 | static PTypedef2PType       pfnPTypedef2PType = PType; | 
|---|
| 111 |  | 
|---|
| 112 | PVar1Void   = Void; | 
|---|
| 113 | PVar1PVoid  = PVoid; | 
|---|
| 114 | PVar1Int    = Int; | 
|---|
| 115 | PVar1PType  = PType; | 
|---|
| 116 |  | 
|---|
| 117 | PVar2Void   = Void; | 
|---|
| 118 | PVar2PVoid  = PVoid; | 
|---|
| 119 | PVar2Int    = Int; | 
|---|
| 120 | PVar2PType  = PType; | 
|---|
| 121 |  | 
|---|
| 122 |  | 
|---|
| 123 | /* extern functions */ | 
|---|
| 124 | Void(1,2,3,4); | 
|---|
| 125 | PVoid(1,2,3,4); | 
|---|
| 126 | Int(1,2,3,4); | 
|---|
| 127 | PType(1,2,3,4); | 
|---|
| 128 |  | 
|---|
| 129 | /* typedefs */ | 
|---|
| 130 | pfnTypedef1Void(1,2,3,4); | 
|---|
| 131 | pfnTypedef1PVoid(1,2,3,4); | 
|---|
| 132 | pfnTypedef1Int(1,2,3,4); | 
|---|
| 133 | pfnTypedef1PType(1,2,3,4); | 
|---|
| 134 |  | 
|---|
| 135 | pfnTypedef2Void(1,2,3,4); | 
|---|
| 136 | pfnTypedef2PVoid(1,2,3,4); | 
|---|
| 137 | pfnTypedef2Int(1,2,3,4); | 
|---|
| 138 | pfnTypedef2PType(1,2,3,4); | 
|---|
| 139 |  | 
|---|
| 140 | pfnPTypedef1Void(1,2,3,4); | 
|---|
| 141 | pfnPTypedef1PVoid(1,2,3,4); | 
|---|
| 142 | pfnPTypedef1Int(1,2,3,4); | 
|---|
| 143 | pfnPTypedef1PType(1,2,3,4); | 
|---|
| 144 |  | 
|---|
| 145 | pfnPTypedef2Void(1,2,3,4); | 
|---|
| 146 | pfnPTypedef2PVoid(1,2,3,4); | 
|---|
| 147 | pfnPTypedef2Int(1,2,3,4); | 
|---|
| 148 | pfnPTypedef2PType(1,2,3,4); | 
|---|
| 149 |  | 
|---|
| 150 |  | 
|---|
| 151 | /* structs */ | 
|---|
| 152 | vft.PStructMemberVoid(1,2,3,4); | 
|---|
| 153 | vft.PStructMemberPVoid(1,2,3,4); | 
|---|
| 154 | vft.PStructMemberInt(1,2,3,4); | 
|---|
| 155 | vft.PStructMemberPType(1,2,3,4); | 
|---|
| 156 |  | 
|---|
| 157 | vft.PStructMember2Void(1,2,3,4); | 
|---|
| 158 | vft.PStructMember2PVoid(1,2,3,4); | 
|---|
| 159 | vft.PStructMember2Int(1,2,3,4); | 
|---|
| 160 | vft.PStructMember2PType(1,2,3,4); | 
|---|
| 161 |  | 
|---|
| 162 |  | 
|---|
| 163 | /* variables */ | 
|---|
| 164 | PVar1Void(1,2,3,4); | 
|---|
| 165 | PVar1PVoid(1,2,3,4); | 
|---|
| 166 | PVar1Int(1,2,3,4); | 
|---|
| 167 | PVar1PType(1,2,3,4); | 
|---|
| 168 |  | 
|---|
| 169 | PVar2Void(1,2,3,4); | 
|---|
| 170 | PVar2PVoid(1,2,3,4); | 
|---|
| 171 | PVar2Int(1,2,3,4); | 
|---|
| 172 | PVar2PType(1,2,3,4); | 
|---|
| 173 |  | 
|---|
| 174 | return 0; | 
|---|
| 175 | } | 
|---|
| 176 |  | 
|---|