- Give PCI controllers lower unit numbers than legacy controllers.
[cake.git] / compiler / clib / include / alloca.h
blobb738996d6321534893576ebfd2e08eef6d5c112d
1 /*
2 Copyright © 1995-2002, The AROS Development Team. All rights reserved.
3 $Id$
5 System header file <alloca.h>
6 */
8 #ifndef _ALLOCA_H
9 #define _ALLOCA_H
11 #include <sys/cdefs.h>
12 #include <stddef.h>
14 /* Discard any previous definition. */
15 #undef alloca
17 __BEGIN_DECLS
19 /* Allocate a block of memory which will be automatically freed upon function exiting. */
20 extern void *alloca(size_t size);
22 /* Private function to get the upper or lower bound (depending on the architecture)
23 of the stack. */
24 extern void *__alloca_get_stack_limit(void);
25 __END_DECLS
27 /* GNU C provides a builtin alloca function. */
28 #ifdef __GNUC__
29 # if AROS_STACK_GROWS_DOWNWARDS
30 # define alloca(size) \
31 ({ \
32 ((void *)(AROS_GET_SP - AROS_ALIGN(size)) <= __alloca_get_stack_limit()) ? \
33 NULL : \
34 __builtin_alloca(size); \
36 # else
37 # define alloca(size) \
38 ({ \
39 ((void *)(AROS_GET_SP + AROS_ALIGN(size)) >= __alloca_get_stack_limit()) ? \
40 NULL : \
41 __builtin_alloca(size); \
43 # endif /* AROS_STACK_GROWS_DOWNWARDS */
44 #endif /* GCC. */
47 #endif /* alloca.h */