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