Less sloppy handling of IoErr().
[AROS.git] / rom / isapnp / CompilerSpecific.h
blob26b29d4c5eed2df2325d40b3f0e6fc7122ecdfb8
1 #include <exec/types.h>
3 #ifdef __AROS__
4 #include <aros/debug.h>
5 #include <aros/libcall.h>
6 #else
7 #define bug KPrintF
8 #endif
10 #ifndef COMPILERSPECIFIC_H
11 #define COMPILERSPECIFIC_H
13 ** $VER: CompilerSpecific.h 2.3 lcs (9.1.99)
15 ** Copyright (C) 1997 Bernardo Innocenti. All rights reserved.
16 ** Copyright (C) 2009-2013 The AROS Development Team
18 ** Compiler specific definitions is here. You can add support
19 ** for other compilers in this header. Please return any changes
20 ** you make to me, so I can add them to my personal copy of this file.
22 ** Here is a short description of the macros defined below:
24 ** LIBCALL
25 ** Shared library entry point, with register args
27 ** HOOKCALL
28 ** Hook or boopsi dispatcher entry point with arguments
29 ** passed in registers
31 ** INLINE
32 ** Please put function body inline to the calling code
34 ** STDARGS
35 ** Function uses standard C conventions for arguments
37 ** ASMCALL
38 ** Function takes arguments in the specified 68K registers
40 ** REGCALL
41 ** Function takes arguments in registers choosen by the compiler
43 ** CONSTCALL
44 ** Function does not modify any global variable
46 ** FORMATCALL(archetype,string_index,first_to_check)
47 ** Function uses printf or scanf-like formatting
49 ** SAVEDS
50 ** Function needs to reload context for small data model
52 ** INTERRUPT
53 ** Function will be called from within an interrupt
55 ** NORETURN
56 ** Function does never return
58 ** ALIGNED
59 ** Variable must be aligned to longword boundaries
61 ** CHIP
62 ** Variable must be stored in CHIP RAM
64 ** REG(reg,arg)
65 ** Put argument <arg> in 68K register <reg>
67 ** min(a,b)
68 ** Return the minimum between <a> and <b>
70 ** max(a,b)
71 ** Return the maximum between <a> and <b>
73 ** abs(a)
74 ** Return the absolute value of <a>
76 ** _COMPILED_WITH
77 ** A string containing the name of the compiler
80 #ifdef __SASC
81 /* SAS/C 6.58 or better */
83 #define INLINE static __inline
84 #define STDARGS __stdargs
85 #define ASMCALL __asm
86 #define REGCALL __regcall
87 #define CONSTCALL /* unsupported */
88 #define FORMATCALL /* unsupported */
89 #define SAVEDS __saveds
90 #define INTERRUPT __interrupt
91 #define NORETURN /* unsupported */
92 #define ALIGNED __aligned
93 #define CHIP __chip
94 #define REG(reg,arg) register __##reg arg
95 #define _COMPILED_WITH "SAS/C"
97 /* For min(), max() and abs() */
98 #define USE_BUILTIN_MATH
99 #include <string.h>
100 #else
101 #ifdef __GNUC__
102 /* GeekGadgets GCC 2.7.2.1 or better */
104 #define INLINE static inline
105 #define STDARGS __attribute__((stkparm))
106 #define ASMCALL /* nothing */
107 #define REGCALL /* nothing */
108 #define CONSTCALL __attribute__((const))
109 #define FORMATCALL(a,s,f) __attribute__((format(a,s,f)))
110 #define SAVEDS __attribute__((saveds))
111 #define INTERRUPT __attribute__((interrupt))
112 #define NORETURN __attribute__((noreturn))
113 #define ALIGNED __attribute__((aligned(4)))
114 #define CHIP __attribute__((chip))
115 #ifdef m68000
116 #define REG(reg,arg) arg __asm(#reg)
117 #else
118 #define REG(reg,arg) arg
119 #endif
120 #define _COMPILED_WITH "GCC"
122 #ifndef min
123 #define min(a,b) (((a)<(b))?(a):(b))
124 #endif
125 #ifndef max
126 #define max(a,b) (((a)>(b))?(a):(b))
127 #endif
128 #ifndef __AROS__
129 #ifndef abs
130 #define abs(a) (((a)>0)?(a):-(a))
131 #endif
132 #endif
134 #if 0
135 /* GCC produces code which calls these two functions
136 * to initialize and copy structures and arrays.
138 static inline void __attribute__((stkparm)) bzero (char *buf, int len)
139 { while (len--) *buf++ = 0; }
141 static inline void __attribute__((stkparm)) bcopy (char *src, char *dest, int len)
142 { while (len--) *dest++ = *src++; }
143 #endif
145 #else
146 #ifdef __STORM__
147 /* StormC 2.00.23 or better */
148 #define INLINE __inline
149 #define STDARGS /* nothing */
150 #define ASMCALL /* nothing */
151 #define REGCALL register
152 #define CONSTCALL /* unsupported */
153 #define FORMATCALL /* unsupported */
154 #define SAVEDS __saveds
155 #define INTERRUPT __interrupt
156 #define NORETURN /* unsupported */
157 #define ALIGNED /* unsupported */
158 #define CHIP __chip
159 #define REG(reg,arg) register __##reg arg
160 #define _COMPILED_WITH "StormC"
162 #define min(a,b) (((a)<(b))?(a):(b))
163 #define max(a,b) (((a)>(b))?(a):(b))
164 #define abs(a) (((a)>0)?(a):-(a))
166 #define _INLINE_INCLUDES
167 #include <string.h>
168 #else
169 #ifdef __MAXON__
170 /* Maxon C/C++ */
172 #define INLINE static inline
173 #define STDARGS /* ? */
174 #define ASMCALL /* ? */
175 #define REGCALL /* ? */
176 #define CONSTCALL /* unsupported */
177 #define FORMATCALL /* unsupported */
178 #define SAVEDS __saveds
179 #define INTERRUPT __interrupt
180 #define NORETURN /* unsupported */
181 #define ALIGNED __aligned
182 #define REG(reg,arg) register __##reg arg
183 #define _COMPILED_WITH "Maxon C"
185 /* For min(), max() and abs() */
186 #define USE_BUILTIN_MATH
187 #include <string.h>
189 #error Maxon C compiler support is untested. Please check all the above definitions
190 #else
191 #ifdef _DCC
192 /* DICE C */
194 #define INLINE static __inline
195 #define STDARGS __stdargs
196 #define ASMCALL /* nothing */
197 #define REGCALL /* ? */
198 #define CONSTCALL /* unsupported */
199 #define FORMATCALL /* unsupported */
200 #define SAVEDS __geta4
201 #define INTERRUPT /* unsupported */
202 #define NORETURN /* unsupported */
203 #define ALIGNED __aligned
204 #define REG(reg,arg) __##reg arg
205 #define _COMPILED_WITH "DICE"
207 #ifndef min
208 #define min(a,b) (((a)<(b))?(a):(b))
209 #endif
210 #ifndef max
211 #define max(a,b) (((a)>(b))?(a):(b))
212 #endif
213 #ifndef abs
214 #define abs(a) (((a)>0)?(a):-(a))
215 #endif
217 #error DICE compiler support is untested. Please check all the above definitions
218 #else
219 #ifdef AZTEC_C
220 /* Aztec/Manx C */
222 #define INLINE static
223 #define STDARGS /* ? */
224 #define ASMCALL /* ? */
225 #define REGCALL /* ? */
226 #define CONSTCALL /* unsupported */
227 #define FORMATCALL /* unsupported */
228 #define SAVEDS __geta4
229 #define INTERRUPT /* unsupported */
230 #define NORETURN /* unsupported */
231 #define ALIGNED __aligned
232 #define REG(reg,arg) __##reg arg
233 #define _COMPILED_WITH "Manx C"
235 #ifndef min
236 #define min(a,b) (((a)<(b))?(a):(b))
237 #endif
238 #ifndef max
239 #define max(a,b) (((a)>(b))?(a):(b))
240 #endif
241 #ifndef abs
242 #define abs(a) (((a)>0)?(a):-(a))
243 #endif
245 #error Aztec/Manx C compiler support is untested. Please check all the above definitions
246 #else
247 #error Please add compiler specific definitions for your compiler
248 #endif
249 #endif
250 #endif
251 #endif
252 #endif
253 #endif
256 /* Special function attributes */
258 #define LIBCALL ASMCALL SAVEDS
259 #define HOOKCALL ASMCALL SAVEDS
262 /* AROS Compatibility: IPTR is a type which can store a pointer
263 * as well as a long integer.
265 #ifndef AROS_INTPTR_TYPE
266 #define AROS_INTPTR_TYPE long
267 typedef unsigned AROS_INTPTR_TYPE IPTR;
268 typedef signed AROS_INTPTR_TYPE SIPTR;
269 #endif /* AROS_INTPTR_TYPE */
273 #endif /* !COMPILERSPECIFIC_H */