1 /* Definitions for compiler-specific features. */
3 #ifndef _MINIX_COMPILER_H
4 #define _MINIX_COMPILER_H
6 /*===========================================================================*
8 *===========================================================================*/
11 #include <minix/compiler-ack.h>
14 /*===========================================================================*
16 *===========================================================================*/
18 * cdecl calling convention expects the callee to pop the hidden pointer on
19 * struct return. For example, GCC and LLVM comply with this (tested on IA32).
21 #ifndef BYTES_TO_POP_ON_STRUCT_RETURN
22 #define BYTES_TO_POP_ON_STRUCT_RETURN $4
26 * cdecl calling convention requires to push arguments on the stack in a
27 * reverse order to easily support variadic arguments. Thus, instead of
28 * using the proper stdarg.h macros (that nowadays are
29 * compiler-dependant), it may be tempting to directly take the address of
30 * the last argument and considering it as the start of an array. This is
31 * a shortcut that avoid looping to get all the arguments as the CPU
32 * already pushed them on the stack before the call to the function.
34 * Unfortunately, such an assumption is strictly compiler-dependant and
35 * compilers are free to move the last argument on the stack, as a local
36 * variable, and return the address of the location where the argument was
37 * stored, if asked for. This will break things as the rest of the array's
38 * argument are stored elsewhere (typically, a couple of words above the
39 * location where the argument was stored).
41 * Conclusion: if unsure on what the compiler may do, do not make any
42 * assumption and use the right (typically compiler-dependant) macros.
45 #ifndef FUNC_ARGS_ARRAY
46 #define FUNC_ARGS_ARRAY 0
49 #endif /* _MINIX_COMPILER_H */