let make recognise ports as a target
[AROS.git] / test / sdi / SDI_compiler.h
blob531c29737d34af2793e39a21678287484e7f27e1
1 #ifndef SDI_COMPILER_H
2 #define SDI_COMPILER_H
4 /* Includeheader
6 Name: SDI_compiler.h
7 Versionstring: $VER: SDI_compiler.h 1.35 (03.03.2011)
8 Authors: Dirk Stoecker, Jens Maus
9 Distribution: PD
10 Project page: http://sf.net/p/adtools/code/HEAD/tree/trunk/sdi/
11 Description: defines to hide compiler stuff
12 Id: $Id$
13 URL: $URL: svn://svn.code.sf.net/p/adtools/code/trunk/sdi/SDI_compiler.h $
15 1.1 25.06.98 : created from data made by Gunter Nikl
16 1.2 17.11.99 : added VBCC
17 1.3 29.02.00 : fixed VBCC REG define
18 1.4 30.03.00 : fixed SAVEDS for VBCC
19 1.5 29.07.00 : added #undef statements (needed e.g. for AmiTCP together
20 with vbcc)
21 1.6 19.05.01 : added STACKEXT and Dice stuff
22 1.7 16.06.01 : added MorphOS specials and VARARGS68K
23 1.8 21.09.02 : added MorphOS register stuff
24 1.9 26.09.02 : added OFFSET macro. Thanks Frank Wille for suggestion
25 1.10 18.10.02 : reverted to old MorphOS-method for GCC
26 1.11 09.11.02 : added REGARGS define to MorphOS section
27 1.12 18.01.04 : some adaptions for AmigaOS4 compatibility
28 1.13 17.02.04 : changed ASM macros to be a simple define and added
29 INTERRUPT, CHIP and FAR
30 1.14 02.03.04 : added UNUSED which can be used to specify a function parameter
31 or variable as "unused" which will not cause any compiler warning.
32 1.15 02.03.04 : added special INLINE define for gcc > 3.0 version
33 1.17 07.03.04 : changed INLINE definition of gcc <= 2.95.3 to be static aswell.
34 1.18 21.06.04 : added USED and USED_VAR attribute to allow placing a
35 __attribute__((used)) to a function and a variable, taking care of
36 different compiler versions.
37 1.19 04.07.04 : register specification for variables is not supported on MorphOS,
38 so we modified the REG() macro accordingly.
39 1.20 28.02.05 : correct INLINE for VBCC.
40 1.21 28.02.05 : cleanup __GCC__ case.
41 1.22 16.05.05 : changed the vbcc/REG() macro.
42 added missing vbcc/VARARGS68K define.
43 moved morphos SDI_EmulLib Stuff into compilers.h. I know it's not
44 compiler specific, (Guido Mersmann)
45 1.23 30.04.06 : modified to get it compatible to AROS. (Guido Mersmann)
46 1.24 06.05.06 : __linearvarargs is only valid for vbcc and PPC, so I moved VARARGS68K
47 to prevent problems with 68K and i86 targets. (Guido Mersmann)
48 1.25 21.06.07 : added NEAR to be usable for __near specification for SAS/C
49 1.26 14.10.07 : added DEPRECATED macro which defaults to __attribute__((deprecated))
50 for GCC compiles.
51 1.27 20.03.09 : applied some changes and fixes to get the header more usable
52 for an AROS compilation. (Pavel Fedin)
53 1.28 25.03.09 : added missing IPTR definition to make SDI_compiler.h more compatible
54 to AROS. (Pavel Fedin)
55 1.29 25.03.09 : fixed the IPTR definition and also the use of the __M68000__ define.
56 1.30 26.03.09 : fixed the IPTR definition by only defining it for non AROS targets.
57 1.31 29.03.09 : added VARARGS68K definition for AROS.
58 1.32 28.05.09 : added STACKED definition for non-AROS targets.
59 1.33 03.06.10 : added missing SIPTR definition to make SDI_compiler.h more compatible
60 to AROS.
61 1.34 26.07.10 : adapted IPTR and SIPTR definitions as the latest MorphOS SDK already
62 contains them. (tboeckel)
63 1.35 03.03.11 : fixed AROS macros for m68k (Jason McMullan)
68 ** This is PD (Public Domain). This means you can do with it whatever you want
69 ** without any restrictions. I only ask you to tell me improvements, so I may
70 ** fix the main line of this files as well.
72 ** To keep confusion level low: When changing this file, please note it in
73 ** above history list and indicate that the change was not made by myself
74 ** (e.g. add your name or nick name).
76 ** Find the latest version of this file at:
77 ** http://sf.net/p/adtools/code/HEAD/tree/trunk/sdi/
79 ** Jens Maus <mail@jens-maus.de>
80 ** Dirk Stoecker <soft@dstoecker.de>
83 /* Some SDI internal header */
85 #undef ASM
86 #undef REG
87 #undef LREG
88 #undef CONST
89 #undef SAVEDS
90 #undef INLINE
91 #undef REGARGS
92 #undef STDARGS
93 #undef OFFSET
94 #undef INTERRUPT
95 #undef CHIP
96 #undef FAR
97 #undef NEAR
98 #undef UNUSED
99 #undef USED
100 #undef USED_VAR
101 #undef DEPRECATED
103 /* first "exceptions" */
105 #if defined(__MAXON__)
106 #define STDARGS
107 #define STACKEXT
108 #define REGARGS
109 #define SAVEDS
110 #define INLINE inline
111 /*************************************************************************/
112 #elif defined(__VBCC__)
113 #define STDARGS
114 #define STACKEXT
115 #define REGARGS
116 #define INLINE static
117 #define OFFSET(p,m) __offsetof(struct p,m)
119 #if defined(__PPC__)
120 #define VARARGS68K __linearvarargs
121 #define REG(reg,arg) arg
122 #else
123 #define REG(reg,arg) __reg(#reg) arg
124 #endif
125 /*************************************************************************/
126 #elif defined(__STORM__)
127 #define STDARGS
128 #define STACKEXT
129 #define REGARGS
130 #define INLINE inline
131 /*************************************************************************/
132 #elif defined(__SASC)
133 #define ASM __asm
134 /*************************************************************************/
135 #elif defined(__GNUC__)
136 #define UNUSED __attribute__((unused)) /* for functions, variables and types */
137 #define USED __attribute__((used)) /* for functions only! */
138 #define DEPRECATED __attribute__((deprecated))
139 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)
140 #define USED_VAR USED /* for variables only! */
141 #define INLINE static __inline __attribute__((always_inline))
142 #endif
143 /* we have to distinguish between AmigaOS4 and MorphOS */
144 #if (defined(_M68000) || defined(__M68000) || defined(__mc68000)) && !defined(__AROS__)
145 #define REG(reg,arg) arg __asm(#reg)
146 #define LREG(reg,arg) register REG(reg,arg)
147 #else
148 #define REG(reg,arg) arg
149 #define SAVEDS
150 #define STDARGS
151 #define REGARGS
152 #define STACKEXT
153 #if defined(__MORPHOS__)
154 #define VARARGS68K __attribute__((varargs68k))
155 #endif
156 #if defined(__AROS__)
157 #define VARARGS68K __stackparm
158 #endif
159 #define INTERRUPT
160 #define CHIP
161 #endif
162 #define FAR
163 #define NEAR
164 #elif defined(_DCC)
165 #define REG(reg,arg) __##reg arg
166 #define STACKEXT __stkcheck
167 #define STDARGS __stkargs
168 #define INLINE static
169 #endif
171 /* then "common" ones */
173 #if !defined(ASM)
174 #define ASM
175 #endif
176 #if !defined(REG)
177 #define REG(reg,arg) register __##reg arg
178 #endif
179 #if !defined(LREG)
180 #define LREG(reg,arg) register arg
181 #endif
182 #if !defined(CONST)
183 #define CONST const
184 #endif
185 #if !defined(SAVEDS)
186 #define SAVEDS __saveds
187 #endif
188 #if !defined(INLINE)
189 #define INLINE static __inline
190 #endif
191 #if !defined(REGARGS)
192 #define REGARGS __regargs
193 #endif
194 #if !defined(STDARGS)
195 #define STDARGS __stdargs
196 #endif
197 #if !defined(STACKEXT)
198 #define STACKEXT __stackext
199 #endif
200 #if !defined(VARARGS68K)
201 #define VARARGS68K
202 #endif
203 #if !defined(OFFSET)
204 #define OFFSET(structName, structEntry) \
205 ((char *)(&(((struct structName *)0)->structEntry))-(char *)0)
206 #endif
207 #if !defined(INTERRUPT)
208 #define INTERRUPT __interrupt
209 #endif
210 #if !defined(CHIP)
211 #define CHIP __chip
212 #endif
213 #if !defined(FAR)
214 #define FAR __far
215 #endif
216 #if !defined(NEAR)
217 #define NEAR __near
218 #endif
219 #if !defined(UNUSED)
220 #define UNUSED
221 #endif
222 #if !defined(USED)
223 #define USED
224 #endif
225 #if !defined(USED_VAR)
226 #define USED_VAR
227 #endif
228 #if !defined(DEPRECATED)
229 #define DEPRECATED
230 #endif
231 #if !defined(__AROS__) && !defined(__MORPHOS__) && !defined(IPTR)
232 #define IPTR ULONG
233 #endif
234 #if !defined(__AROS__) && !defined(__MORPHOS__) && !defined(SIPTR)
235 #define SIPTR LONG
236 #endif
237 #if !defined(__AROS__) && !defined(STACKED)
238 #define STACKED
239 #endif
241 /*************************************************************************/
243 #endif /* SDI_COMPILER_H */