7 Versionstring: $VER: SDI_compiler.h 1.21 (28.02.2005)
8 Author: SDI & Jens Langner
10 Description: defines to hide compiler stuff
12 1.1 25.06.98 : created from data made by Gunter Nikl
13 1.2 17.11.99 : added VBCC
14 1.3 29.02.00 : fixed VBCC REG define
15 1.4 30.03.00 : fixed SAVEDS for VBCC
16 1.5 29.07.00 : added #undef statements (needed e.g. for AmiTCP together
18 1.6 19.05.01 : added STACKEXT and Dice stuff
19 1.7 16.06.01 : added MorphOS specials and VARARGS68K
20 1.8 21.09.02 : added MorphOS register stuff
21 1.9 26.09.02 : added OFFSET macro. Thanks Frank Wille for suggestion
22 1.10 18.10.02 : reverted to old MorphOS-method for GCC
23 1.11 09.11.02 : added REGARGS define to MorphOS section
24 1.12 18.01.04 : some adaptions for AmigaOS4 compatibility
25 1.13 17.02.04 : changed ASM macros to be a simple define and added
26 INTERRUPT, CHIP and FAR
27 1.14 02.03.04 : added UNUSED which can be used to specify a function parameter
28 or variable as "unused" which will not cause any compiler warning.
29 1.15 02.03.04 : added special INLINE define for gcc > 3.0 version
30 1.17 07.03.04 : changed INLINE definition of gcc <= 2.95.3 to be static aswell.
31 1.18 21.06.04 : added USED and USED_VAR attribute to allow placing a
32 __attribute__((used)) to a function and a variable, taking care of
33 different compiler versions.
34 1.19 04.07.04 : register specification for variables is not supported on MorphOS,
35 so we modified the REG() macro accordingly.
36 1.20 28.02.05 : correct INLINE for VBCC.
37 1.21 28.02.05 : cleanup __GCC__ case.
41 ** This is PD (Public Domain). This means you can do with it whatever you want
42 ** without any restrictions. I only ask you to tell me improvements, so I may
43 ** fix the main line of this files as well.
45 ** To keep confusion level low: When changing this file, please note it in
46 ** above history list and indicate that the change was not made by myself
47 ** (e.g. add your name or nick name).
49 ** Jens Langner <Jens.Langner@light-speed.de> and
50 ** Dirk Stöcker <stoecker@epost.de>
69 /* first "exceptions" */
71 #if defined(__MAXON__)
77 #elif defined(__VBCC__)
81 #if (__STDC__ == 1L) && (__STDC_VERSION__ >= 199901L)
86 #define OFFSET(p,m) __offsetof(struct p,m)
87 #if defined(__MORPHOS__)
88 #define REG(reg,arg) __reg(MOS__##reg) arg
90 /* NOTE: This assumes "quick native mode" when compiling libraries. */
98 /* #define MOS__a7 "r31" */
100 #define MOS__d1 "r17"
101 #define MOS__d2 "r18"
102 #define MOS__d3 "r19"
103 #define MOS__d4 "r20"
104 #define MOS__d5 "r21"
105 #define MOS__d6 "r22"
106 #define MOS__d7 "r23"
109 #define REG(reg,arg) __reg(#reg) arg
111 #elif defined(__STORM__)
115 #define INLINE inline
116 #elif defined(__SASC)
118 #elif defined(__GNUC__)
119 #define UNUSED __attribute__((unused)) /* for functions, variables and types */
120 #define USED __attribute__((used)) /* for functions only! */
121 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)
122 #define USED_VAR USED /* for variables only! */
123 #define INLINE static __inline __attribute__((always_inline))
125 /* we have to distinguish between AmigaOS4 and MorphOS */
126 #if defined(__PPC__) || defined(__AROS__)
127 #define REG(reg,arg) arg
132 #if defined(__MORPHOS__)
133 #define VARARGS68K __attribute__((varargs68k))
138 #define REG(reg,arg) arg __asm(#reg)
139 #define LREG(reg,arg) register REG(reg,arg)
143 #define REG(reg,arg) __##reg arg
144 #define STACKEXT __stkcheck
145 #define STDARGS __stkargs
146 #define INLINE static
149 /* then "common" ones */
155 #define REG(reg,arg) register __##reg arg
158 #define LREG(reg,arg) register arg
164 #define SAVEDS __saveds
167 #define INLINE static __inline
169 #if !defined(REGARGS)
170 #define REGARGS __regargs
172 #if !defined(STDARGS)
173 #define STDARGS __stdargs
175 #if !defined(STACKEXT)
176 #define STACKEXT __stackext
178 #if !defined(VARARGS68K)
182 #define OFFSET(structName, structEntry) \
183 ((char *)(&(((struct structName *)0)->structEntry))-(char *)0)
185 #if !defined(INTERRUPT)
186 #define INTERRUPT __interrupt
200 #if !defined(USED_VAR)
203 #endif /* SDI_COMPILER_H */