7 Versionstring: $VER: SDI_compiler.h 1.29 (25.03.2009)
8 Author: Dirk Stoecker & Jens Langner
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
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))
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.
58 ** This is PD (Public Domain). This means you can do with it whatever you want
59 ** without any restrictions. I only ask you to tell me improvements, so I may
60 ** fix the main line of this files as well.
62 ** To keep confusion level low: When changing this file, please note it in
63 ** above history list and indicate that the change was not made by myself
64 ** (e.g. add your name or nick name).
66 ** Find the latest version of this file at:
67 ** http://cvs.sourceforge.net/viewcvs.py/sditools/sditools/headers/
69 ** Jens Langner <Jens.Langner@light-speed.de> and
70 ** Dirk Stoecker <soft@dstoecker.de>
73 /* Some SDI internal header */
93 /* first "exceptions" */
95 #if defined(__MAXON__)
100 #define INLINE inline
101 /*************************************************************************/
102 #elif defined(__VBCC__)
106 #define INLINE static
107 #define OFFSET(p,m) __offsetof(struct p,m)
110 #define VARARGS68K __linearvarargs
111 #define REG(reg,arg) arg
113 #define REG(reg,arg) __reg(#reg) arg
115 /*************************************************************************/
116 #elif defined(__STORM__)
120 #define INLINE inline
121 /*************************************************************************/
122 #elif defined(__SASC)
124 /*************************************************************************/
125 #elif defined(__GNUC__)
126 #define UNUSED __attribute__((unused)) /* for functions, variables and types */
127 #define USED __attribute__((used)) /* for functions only! */
128 #define DEPRECATED __attribute__((deprecated))
129 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)
130 #define USED_VAR USED /* for variables only! */
131 #define INLINE static __inline __attribute__((always_inline))
133 /* we have to distinguish between AmigaOS4 and MorphOS */
134 #if defined(_M68000) || defined(__M68000) || defined(__mc68000)
135 #define REG(reg,arg) arg __asm(#reg)
136 #define LREG(reg,arg) register REG(reg,arg)
138 #define REG(reg,arg) arg
143 #if defined(__MORPHOS__)
144 #define VARARGS68K __attribute__((varargs68k))
152 #define REG(reg,arg) __##reg arg
153 #define STACKEXT __stkcheck
154 #define STDARGS __stkargs
155 #define INLINE static
158 /* then "common" ones */
164 #define REG(reg,arg) register __##reg arg
167 #define LREG(reg,arg) register arg
173 #define SAVEDS __saveds
176 #define INLINE static __inline
178 #if !defined(REGARGS)
179 #define REGARGS __regargs
181 #if !defined(STDARGS)
182 #define STDARGS __stdargs
184 #if !defined(STACKEXT)
185 #define STACKEXT __stackext
187 #if !defined(VARARGS68K)
191 #define OFFSET(structName, structEntry) \
192 ((char *)(&(((struct structName *)0)->structEntry))-(char *)0)
194 #if !defined(INTERRUPT)
195 #define INTERRUPT __interrupt
212 #if !defined(USED_VAR)
215 #if !defined(DEPRECATED)
218 #if defined(_M68000) || defined(__M68000) || defined(__mc68000)
222 /*************************************************************************/
224 #endif /* SDI_COMPILER_H */